forked from dronekit/dronekit-la
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtelem_serial.h
43 lines (30 loc) · 1 KB
/
telem_serial.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
#include "INIReader.h"
#include "telem_client.h"
class Telem_Serial : public Telem_Client {
public:
Telem_Serial() :
Telem_Client()
{ }
uint32_t handle_read();
void configure(INIReader *config) override;
void set_serial(std::string path, uint32_t baud, bool flow);
void pack_select_fds(fd_set &fds_read, fd_set &fds_write, fd_set &fds_err, uint8_t &nfds) override;
void handle_select_fds(fd_set &fds_read, fd_set &fds_write, fd_set &fds_err, uint8_t &nfds) override;
bool send_message(const mavlink_message_t &message) override;
void open_serial_port();
void do_writer_sends() override;
bool any_data_to_send() override {
return _send_buf_start != _send_buf_stop;
}
void init() override;
private:
int fd;
/* send buffer stuff: */
uint8_t _send_buf[65536]; /* way too big */
uint32_t send_buf_size() const override {
return 65536;
}
std::string serialPortName;
uint32_t serialBaud;
bool serialFlow;
};