The xplane_io (X-Plane I/O) program is used to establish network communications, via UDP, with the X-Plane flight simulator running on a computer. The code consists of class libraries that abstract the lower-level UDP packet encoding and decoding details, according to the UDP protocol specifications in X-Plane version 9. Any X-Plane DATA packets can be sent and received, and any X-Plane DataRefs can be set by sending DREF packets to X-Plane.
Dependencies: EthernetNetIf mbed ConfigFile
Diff: XPlaneUdp/XPlaneUdpDATAMap.h
- Revision:
- 0:a5d13af495af
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/XPlaneUdp/XPlaneUdpDATAMap.h Wed Dec 21 22:29:59 2011 +0000 @@ -0,0 +1,35 @@ +#ifndef XPLANEUDPDATAMAP_H_INCLUDED +#define XPLANEUDPDATAMAP_H_INCLUDED + +#include <map> +#include "XPlaneUdpDATA.h" + +/** + * Map of XPlaneUdpDATA pointers, keyed by int (e.g. keyed by the DATA message index). + */ +typedef std::map<int, XPlaneUdpDATA *> XPlaneUdpDATAMap; + +/** + * Function to return the XPlaneUdpDATA pointer in the given map, keyed by the given int index. + * If no map entry exists for the given key index, then returns NULL. + */ +XPlaneUdpDATA * getXPlaneUdpDATA(const XPlaneUdpDATAMap & DATAMap, int index); + +/** + * Function to include a DATA message, of the given index, in the given map. + * If a message of the given index already exists in the map, then do nothing. + * Returns true if a new DATA message was created and added to the map. + */ +bool addXPlaneUdpDATAToMap(XPlaneUdpDATAMap & DATAMap, int index, bool reverseByteOrder); + +/** + * Function to reset the dataChanged flag in all DATA messages in the given map. + */ +void resetDataChangedInMap(XPlaneUdpDATAMap & DATAMap); + +/** + * Utility function to print the DATA messages in the given map. + */ +void printXPlaneUdpDATAMap(FILE * outputStream, XPlaneUdpDATAMap & DATAMap); + +#endif // XPLANEUDPDATAMAP_H_INCLUDED