-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobo_Server.h
46 lines (35 loc) · 1.19 KB
/
Robo_Server.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 "server.h"
#include "cvui.h"
#include <chrono>
#include <vector>
#include <thread>
class Robo_Server :
protected Server
{
public:
Robo_Server();
~Robo_Server();
void start(int port, cv::Mat& im);
void start_cmd(int port);
std::vector<std::string> get_cmds();
std::string get_latest_cmd();
void lock() {_lock.lock(); };
void unlock() {_lock.unlock(); };
void set_status(std::string status) {_status = status; };
protected:
void start(int port) override { Server::start(port); };
void stop() override { Server::stop(); };
void set_txim (cv::Mat &im) override { Server::set_txim(im); };
void get_cmd (std::vector<std::string> &cmds) override { Server::get_cmd(cmds); };
void send_string (std::string send_str) override { Server::send_string(send_str); };
private:
std::mutex _lock;
std::vector<std::string> _cmds;
std::string _status;
bool _thread_exit;
static void start_server(int port, Robo_Server* ptr);
static void run_server(cv::Mat& im, Robo_Server* ptr);
};
#define PC_PORT 4001
#define IM_PORT 6001