forked from DonLakeFlyer/MavlinkTagController
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandHandler.h
43 lines (34 loc) · 1.51 KB
/
CommandHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include "TunnelProtocol.h"
#include "TagDatabase.h"
#include "MavlinkOutgoingMessageQueue.h"
#include <mavsdk/mavsdk.h>
#include <boost/process.hpp>
namespace bp = boost::process;
class MonitoredProcess;
class CommandHandler {
public:
CommandHandler(mavsdk::System& system, MavlinkOutgoingMessageQueue& outgoingMessageQueue);
private:
void _sendCommandAck (uint32_t command, uint32_t result);
bool _handleStartTags (void);
bool _handleEndTags (void);
bool _handleTag (const mavlink_tunnel_t& tunnel);
bool _handleStartDetection (const mavlink_tunnel_t& tunnel);
bool _handleStopDetection (void);
bool _handleAirspyMini (void);
void _handleTunnelMessage (const mavlink_message_t& message);
void _startDetector (const TunnelProtocol::TagInfo_t& tagInfo, bool secondaryChannel);
std::string _tunnelCommandIdToString (uint32_t command);
std::string _tunnelCommandResultToString(uint32_t result);
private:
mavsdk::System& _system;
MavlinkOutgoingMessageQueue& _outgoingMessageQueue;
TagDatabase _tagDatabase;
bool _receivingTags = false;
bool _detectorsRunning = false;
char* _homePath = NULL;
std::vector<MonitoredProcess*> _processes;
uint _startCount = 0;
bp::pipe* _airspyPipe = NULL;
};