]> git.mxchange.org Git - flightgear.git/blob - utils/GPSsmooth/UGear_command.hxx
Complete X11 clipboard support.
[flightgear.git] / utils / GPSsmooth / UGear_command.hxx
1 #ifndef _FG_UGEAR_COMMAND_HXX
2 #define _FG_UGEAR_COMMAND_HXX
3
4
5 #ifdef HAVE_CONFIG_H
6 #  include <config.h>
7 #endif
8
9 #include <simgear/compiler.h>
10
11 #include <iostream>
12 #include <string>
13 #include <queue>
14
15 #include <simgear/misc/stdint.hxx>
16 #include <simgear/io/iochannel.hxx>
17 #include <simgear/serial/serial.hxx>
18
19 using std::cout;
20 using std::endl;
21 using std::string;
22 using std::queue;
23
24
25 // Manage UGear Command Channel
26 class UGCommand {
27
28 private:
29
30     int cmd_send_index;
31     int cmd_recv_index;
32     bool prime_state;
33     queue <string> cmd_queue;
34
35 public:
36
37     UGCommand();
38     ~UGCommand();
39
40     // send current command until acknowledged
41     int update( SGSerialPort *serial );
42
43     void add( const string command );
44     inline int cmd_queue_size() {
45         return cmd_queue.size();
46     }
47     inline void update_cmd_sequence( int sequence ) {
48         cmd_recv_index = sequence;
49     }
50 };
51
52
53 extern UGCommand command_mgr;
54
55
56 #endif // _FG_UGEAR_COMMAND_HXX