From 1d75ec0639026c3fca621d6f1c28694c932b6af7 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sat, 29 Apr 2006 11:14:36 +0000 Subject: [PATCH] Add support for a binary output mode. --- Protocol/README.Protocol | 16 +++++++++++-- Protocol/bintest.xml | 51 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 Protocol/bintest.xml diff --git a/Protocol/README.Protocol b/Protocol/README.Protocol index 32a4e189e..cd2159f44 100644 --- a/Protocol/README.Protocol +++ b/Protocol/README.Protocol @@ -1,5 +1,5 @@ The generic communication protocol for FlightGear provides a powerfull way -of adding a simple ASCII based output only protocol, just by defining an +of adding a simple ASCII based or binary protocol, just by defining an XML encoded configuration file. The definition of the protocol consists of variable separators, line separators, @@ -16,8 +16,9 @@ Each chunck defines: %s string %i integer (default) %f float + (not used or needed in binary mode) - an optionale multiplication factor which can be used for + an optional multiplication factor which can be used for unit conversion. (for example, radians to degrees). an optional offset which can be used for unit conversion. (for example, degrees Celsius to degrees Fahrenheit). @@ -44,6 +45,16 @@ any other charachters just need to be added to "Network/generic.cxx" The var_separator is placed between each variable, while the line_separator is placed at the end of each lot of variables. +To enable binary mode, simply include a true tag in +your XML file. The format of the binary output is tightly packed, with 1 byte +for bool, 4 bytes for int, and 8 bytes for double. At this time, strings are not +supported. A configurable footer at the end of each "line" or packet of binary +output can be added using the tag. Options include the length +of the packet, a magic number to simplify decoding. Examples: + + magic,0x12345678 + length + none A simple protocol configuration file then could look something like the following: @@ -57,6 +68,7 @@ following: newline newline + false speed diff --git a/Protocol/bintest.xml b/Protocol/bintest.xml new file mode 100644 index 000000000..8dfaf5588 --- /dev/null +++ b/Protocol/bintest.xml @@ -0,0 +1,51 @@ + + + + + + + + true + magic,0x12345678 + + + indicated speed (kt) + int + /velocities/airspeed-kt + + + + pitch att (deg) + float + /orientation/pitch-deg + + + + magnetic heading (deg) + float + /orientation/heading-deg + + + + outside air temperarure (degF) + int + /environment/temperature-degf + + + + autocoord + boolean + /sim/auto-coordination + + + + clock + string + /instrumentation/clock/indicated-string + + + + + + +