2016-02-17 21:25:26 -04:00
|
|
|
#pragma once
|
2015-06-10 19:46:53 -03:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2016-07-07 12:46:12 -03:00
|
|
|
#include "AP_HAL_Linux.h"
|
|
|
|
|
2015-06-10 19:46:53 -03:00
|
|
|
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;
|
2016-07-07 12:46:12 -03:00
|
|
|
virtual AP_HAL::UARTDriver::flow_control get_flow_control(void) { return AP_HAL::UARTDriver::FLOW_CONTROL_ENABLE; }
|
|
|
|
virtual void set_flow_control(AP_HAL::UARTDriver::flow_control flow_control_setting)
|
|
|
|
{
|
|
|
|
/* most devices simply igmore this setting */
|
|
|
|
};
|
2015-06-10 19:46:53 -03:00
|
|
|
};
|