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

Committer:
bapowell
Date:
Wed Dec 21 22:29:59 2011 +0000
Revision:
0:a5d13af495af

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bapowell 0:a5d13af495af 1 #include "XPlaneIO.h"
bapowell 0:a5d13af495af 2 #include "TimeoutPrompt.h"
bapowell 0:a5d13af495af 3
bapowell 0:a5d13af495af 4 void XPlaneIO::diagnostics(Serial & serialInOut) {
bapowell 0:a5d13af495af 5
bapowell 0:a5d13af495af 6 TimeoutPrompt top(serialInOut, 2);
bapowell 0:a5d13af495af 7
bapowell 0:a5d13af495af 8 if (top.prompt("\nPress 'd' within 2 seconds for interactive diagnostics", "Dd") == NULL) {
bapowell 0:a5d13af495af 9 return;
bapowell 0:a5d13af495af 10 }
bapowell 0:a5d13af495af 11
bapowell 0:a5d13af495af 12 char c;
bapowell 0:a5d13af495af 13
bapowell 0:a5d13af495af 14 while ((c = top.prompt(30, "\n 1. Analog Input \n 2. \n 3. \n q. Quit \n Select within 30 seconds", "123Qq")) != NULL
bapowell 0:a5d13af495af 15 && c != 'q' && c != 'Q')
bapowell 0:a5d13af495af 16 {
bapowell 0:a5d13af495af 17 serialInOut.printf("%c was typed \n\n", c);
bapowell 0:a5d13af495af 18
bapowell 0:a5d13af495af 19 switch (c) {
bapowell 0:a5d13af495af 20 case '1':
bapowell 0:a5d13af495af 21 for (int i = 0; i < _xpAnalogInCount; i++) {
bapowell 0:a5d13af495af 22 pollAnalogIn();
bapowell 0:a5d13af495af 23 serialInOut.printf("Analog Input #%d: ", i + 1);
bapowell 0:a5d13af495af 24 _xpAnalogIn[i]->toString(serialInOut);
bapowell 0:a5d13af495af 25 serialInOut.printf("\n");
bapowell 0:a5d13af495af 26 }
bapowell 0:a5d13af495af 27 break;
bapowell 0:a5d13af495af 28 /*
bapowell 0:a5d13af495af 29 case '2':
bapowell 0:a5d13af495af 30 break;
bapowell 0:a5d13af495af 31 case '3':
bapowell 0:a5d13af495af 32 break;
bapowell 0:a5d13af495af 33 case 'a':
bapowell 0:a5d13af495af 34 case 'A':
bapowell 0:a5d13af495af 35 break;
bapowell 0:a5d13af495af 36 */
bapowell 0:a5d13af495af 37 default:
bapowell 0:a5d13af495af 38 serialInOut.printf("%c is not an option \n");
bapowell 0:a5d13af495af 39 }
bapowell 0:a5d13af495af 40 }
bapowell 0:a5d13af495af 41
bapowell 0:a5d13af495af 42 serialInOut.printf("Done \n");
bapowell 0:a5d13af495af 43 }