308
edits
Line 320: | Line 320: | ||
The fields of the second part are '''property values''' encoded in the form '''ID'''|'''Value'''. | The fields of the second part are '''property values''' encoded in the form '''ID'''|'''Value'''. | ||
A subset of the following properties are transmitted in the order below. Properties marked as | A subset of the following properties are transmitted in the order below. Properties marked as V1_1_2_PROP_ID will only be sent when the 2017.2 protocol (or later) is selected. '''Transmit As''' is also only relevant for 2017.2 or later. | ||
Although the MP protocol can transmit many different packets mostly a '''T_PositionMsg''' identified by MsgId of '''POS_DATA_ID (7)''' in the header. Refer to src/MultiPlayer/mpmessages.hxx for the PROTO_VER that is in use, currently this is ''0x00010001'' which is '''1.1''' | |||
The '''T_PositionMsg''' contains the standard MsgHdr, with position and motion information next and then a set of properties. Within the protocol ''1.1'' there is a secondary version that applies to the way that the properties are encoded, and this secondary version is either 1 or 2 (2017.2) | |||
Version 1 of the properties can be read by all versions of FlightGear; however version 2 properties can only be read by FlightGear 2017.2 (or later). Version 1 of the property encoding is not covered here as it is obsolete and deprecated. | |||
Version 2 (2017.2) includes new ways of encoding and decoding properties which are designed to save space in the transmitted buffer. | |||
# ID Property ID (v1) | |||
# Property String (v1) | |||
# Type Property Type (v1) | |||
# TransmitAs (v2) - this causes the property to be transmitted on the wire using the specified format on the wire but decoded back into the original format (sometimes with data loss). | |||
# Protocol Ident - the minimum version of the protocol that is required to transmit a property. Does not apply to incoming properties - as these will be decoded correctly when received | |||
# encode_for_transmit - method that will convert from and to the packet for the value. This Allows specific conversion rules to be applied; such as conversion of a string to an integer for transmission. | |||
# decode_received - decodes received data. | |||
* NOTE: when using the encode/decode methods there should be both specified, however if the result of the encode is to transmit in a different property index the encode/decode will be on different elements in the property id list. | |||
* You can see an example of the encode and decode methods with property ID 108 ''gear/launchbar/state'' which although it is a string in FlightGear it will be transmitted as a SHORT_INT based on the known values. When received the property 120 will act as an intermediary an set the decoded value into ''gear/launchbar/state'' as though it had been transmitted as a string. | |||
{| class="wikitable" | {| class="wikitable" |
edits