forked from DonLakeFlyer/MavlinkTagController
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMonitoredProcess.h
46 lines (37 loc) · 945 Bytes
/
MonitoredProcess.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
44
45
46
#pragma once
#include "MavlinkOutgoingMessageQueue.h"
#include <string>
#include <thread>
#include <chrono>
#include <memory>
#include <boost/process.hpp>
namespace bp = boost::process;
class MonitoredProcess
{
public:
enum IntermediatePipeType {
NoPipe,
InputPipe,
OutputPipe,
};
MonitoredProcess(
MavlinkOutgoingMessageQueue& outgoingMessageQueue,
const char* name,
const char* command,
const char* logPath,
IntermediatePipeType intermediatePipeType,
bp::pipe* intermediatePipe);
void start (void);
void stop (void);
private:
void _run(void);
MavlinkOutgoingMessageQueue& _outgoingMessageQueue;
std::string _name;
std::string _command;
std::string _logPath;
std::thread* _thread = NULL;
boost::process::child* _childProcess = NULL;
bool _terminated = false;
IntermediatePipeType _intermediatePipeType;
bp::pipe* _intermediatePipe;
};