APM:Libraries
SerialDevice.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdlib.h>
5 
6 #include "AP_HAL_Linux.h"
7 
8 class SerialDevice {
9 public:
10  virtual ~SerialDevice() {}
11 
12  virtual bool open() = 0;
13  virtual bool close() = 0;
14  virtual ssize_t write(const uint8_t *buf, uint16_t n) = 0;
15  virtual ssize_t read(uint8_t *buf, uint16_t n) = 0;
16  virtual void set_blocking(bool blocking) = 0;
17  virtual void set_speed(uint32_t speed) = 0;
19  virtual void set_flow_control(AP_HAL::UARTDriver::flow_control flow_control_setting)
20  {
21  /* most devices simply ignore this setting */
22  };
23 };
virtual ~SerialDevice()
Definition: SerialDevice.h:10
virtual void set_blocking(bool blocking)=0
virtual bool close()=0
virtual bool open()=0
virtual ssize_t read(uint8_t *buf, uint16_t n)=0
virtual ssize_t write(const uint8_t *buf, uint16_t n)=0
virtual AP_HAL::UARTDriver::flow_control get_flow_control(void)
Definition: SerialDevice.h:18
virtual void set_flow_control(AP_HAL::UARTDriver::flow_control flow_control_setting)
Definition: SerialDevice.h:19
virtual void set_speed(uint32_t speed)=0