It's typo time
[fg:toms-fgdata.git] / Protocol / README.Protocol
1 The generic communication protocol for FlightGear provides a powerfull way
2 of adding a simple ASCII based output only protocol, just by defining an
3 XML encoded configuration file.
4
5 The definition of the protocol consists of variable separators, line separators,
6 and chuncks of text.
7
8 Each chunck defines:
9
10 <name>          for ease of use
11 <node>          the property tree node which provides the data
12 <type>          the value type (needed for formatting)
13 <format>        defines the actual piece of text which should be sent.
14                 it can include formatting options like:
15                                 <type>
16                         %s      string
17                         %i      integer (default)
18                         %f      float
19
20 <factor>        an optionale multiplication factor which can be used for
21                 unit conversion. (for example, radians to degrees).
22 <offset>        an optional offset which can be used for unit conversion.
23                 (for example, degrees Celsius to degrees Fahrenheit).
24
25
26 The output section also could define the variable separator and line separator.
27
28 The separators can be either a control character such as a tab or newline, or a
29 user specified string or other single charachter. The currently supported
30 control charachters are:
31
32 <var_separator>:
33 <line_separator>:
34 Name            Charachter
35
36 newline         '\n'
37 tab             '\t'
38 formfeed        '\f'
39 carriagereturn  '\r'
40 verticaltab     '\v'
41
42 any other charachters just need to be added to "Network/generic.cxx"
43
44 The var_separator is placed between each variable, while the line_separator is
45 placed at the end of each lot of variables.
46
47
48 A simple protocol configuration file then could look something like the
49 following:
50
51 <?xml version="1.0"?>
52
53 <PropertyList>
54
55  <generic>
56
57   <output>
58    <line_separator>newline</line_separator>
59    <var_separator>newline</var_separator>
60
61    <chunk>
62     <name>speed</name>
63     <format>V=%d</format>
64     <node>/velocities/airspeed-kt</node>
65    </chunk>
66
67    <chunk>
68     <name>heading</name>
69     <format>H=%02d</format>
70     <node>/orientation/heading-deg</node>
71     <factor>57.29578</factor>  <!-- radians to degrees -->
72    </chunk>
73
74    <chunk>
75     <name>pitch angle</name>
76     <format>P=%05.1f</format>
77     <type>float</type>
78     <node>/orientation/pitch-deg</node>
79    </chunk>
80
81  </generic>
82
83 </PropertyList>