2022-01-15 07:48:01 +00:00
|
|
|
#pragma once
|
2008-03-30 05:34:40 +00:00
|
|
|
|
|
|
|
#include <simgear/compiler.h>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
#include <simgear/misc/stdint.hxx>
|
|
|
|
#include <simgear/io/iochannel.hxx>
|
|
|
|
#include <simgear/serial/serial.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
// Manage UGear Command Channel
|
|
|
|
class UGCommand {
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
int cmd_send_index;
|
|
|
|
int cmd_recv_index;
|
|
|
|
bool prime_state;
|
2022-01-15 07:48:01 +00:00
|
|
|
std::queue <std::string> cmd_queue;
|
2008-03-30 05:34:40 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
UGCommand();
|
|
|
|
~UGCommand();
|
|
|
|
|
|
|
|
// send current command until acknowledged
|
|
|
|
int update( SGSerialPort *serial );
|
|
|
|
|
2022-01-15 07:48:01 +00:00
|
|
|
void add( const std::string command );
|
2008-03-30 05:34:40 +00:00
|
|
|
inline int cmd_queue_size() {
|
|
|
|
return cmd_queue.size();
|
|
|
|
}
|
|
|
|
inline void update_cmd_sequence( int sequence ) {
|
|
|
|
cmd_recv_index = sequence;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-04-04 22:34:19 +00:00
|
|
|
extern UGCommand command_mgr;
|