2016-02-17 21:25:26 -04:00
|
|
|
#pragma once
|
2015-06-15 18:20:29 -03:00
|
|
|
|
|
|
|
#include "SerialDevice.h"
|
2023-12-25 22:21:11 -04:00
|
|
|
#include <AP_HAL/utility/Socket_native.h>
|
2015-06-15 18:20:29 -03:00
|
|
|
|
|
|
|
class UARTDevice: public SerialDevice {
|
|
|
|
public:
|
|
|
|
UARTDevice(const char *device_path);
|
|
|
|
virtual ~UARTDevice();
|
|
|
|
|
|
|
|
virtual bool open() override;
|
|
|
|
virtual bool close() override;
|
|
|
|
virtual ssize_t write(const uint8_t *buf, uint16_t n) override;
|
|
|
|
virtual ssize_t read(uint8_t *buf, uint16_t n) override;
|
|
|
|
virtual void set_blocking(bool blocking) override;
|
|
|
|
virtual void set_speed(uint32_t speed) override;
|
2016-07-07 12:46:12 -03:00
|
|
|
virtual void set_flow_control(enum AP_HAL::UARTDriver::flow_control flow_control_setting) override;
|
|
|
|
virtual AP_HAL::UARTDriver::flow_control get_flow_control(void) override
|
|
|
|
{
|
|
|
|
return _flow_control;
|
|
|
|
}
|
2019-04-11 11:26:35 -03:00
|
|
|
virtual void set_parity(int v) override;
|
2015-06-15 18:20:29 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
void _disable_crlf();
|
2016-07-07 12:46:12 -03:00
|
|
|
AP_HAL::UARTDriver::flow_control _flow_control = AP_HAL::UARTDriver::flow_control::FLOW_CONTROL_DISABLE;
|
2015-06-15 18:20:29 -03:00
|
|
|
|
|
|
|
int _fd = -1;
|
|
|
|
const char *_device_path;
|
|
|
|
};
|