From 6b94fd7603aaf8bc4fc15dd3d735845392a0eefd Mon Sep 17 00:00:00 2001 From: Staroselskii Georgii Date: Thu, 11 Jun 2015 01:46:53 +0300 Subject: [PATCH] AP_HAL_Linux: added SerialDevice interface Adds the interface that will be used for encapsulating various mediums that can be used in the Linux port. --- libraries/AP_HAL_Linux/SerialDevice.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 libraries/AP_HAL_Linux/SerialDevice.h diff --git a/libraries/AP_HAL_Linux/SerialDevice.h b/libraries/AP_HAL_Linux/SerialDevice.h new file mode 100644 index 0000000000..8e65edcfcd --- /dev/null +++ b/libraries/AP_HAL_Linux/SerialDevice.h @@ -0,0 +1,19 @@ +#ifndef __AP_HAL_LINUX_SERIALDEVICE_H__ +#define __AP_HAL_LINUX_SERIALDEVICE_H__ + +#include +#include + +class SerialDevice { +public: + virtual ~SerialDevice() {} + + virtual bool open() = 0; + virtual bool close() = 0; + virtual ssize_t write(const uint8_t *buf, uint16_t n) = 0; + virtual ssize_t read(uint8_t *buf, uint16_t n) = 0; + virtual void set_blocking(bool blocking) = 0; + virtual void set_speed(uint32_t speed) = 0; +}; + +#endif