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
TimeoutPrompt/TimeoutPrompt.cpp
- Committer:
- bapowell
- Date:
- 2011-12-21
- Revision:
- 0:a5d13af495af
File content as of revision 0:a5d13af495af:
#include "TimeoutPrompt.h" TimeoutPrompt::TimeoutPrompt(Serial & serialInOut, int defaultTimeoutSeconds) : _serialInOut(serialInOut), _defaultTimeoutSeconds(defaultTimeoutSeconds) { _timer.reset(); } char TimeoutPrompt::prompt(int timeoutSeconds, char *promptString, char* validChars) { _serialInOut.printf("%s\n", promptString); _timer.reset(); _timer.start(); while (_timer.read() < timeoutSeconds) { if (_serialInOut.readable()) { char c = _serialInOut.getc(); if (strchr(validChars, c) != NULL) { _timer.stop(); return c; } } } _timer.stop(); return NULL; } char TimeoutPrompt::prompt(char *promptString, char* validChars) { return prompt(_defaultTimeoutSeconds, promptString, validChars); }