QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SerialGPSTransport.h
Go to the documentation of this file.
1#pragma once
2
3#include "GPSTransport.h"
4
5#include <QtCore/QString>
6
7#include <atomic>
8#include <cstdint>
9#include <memory>
10
11class QSerialPort;
12
16{
17public:
18 SerialGPSTransport(QString device, const std::atomic_bool &requestStop);
20
23 bool open();
24
26 bool fatalError() const;
27
28 int read(uint8_t *buffer, int length, int timeoutMs) override;
29 int write(const uint8_t *buffer, int length) override;
30 bool setBaudrate(unsigned baudrate) override;
31
32private:
33 static constexpr int kWriteTimeoutMs = 500;
34
35 QString _device;
36 const std::atomic_bool &_requestStop;
37 std::unique_ptr<QSerialPort> _serial;
38};
Provides functions to access serial ports.
Definition qserialport.h:17
bool setBaudrate(unsigned baudrate) override
Set the link baud rate. Returns true on success.
bool fatalError() const
True once the port hits an error the receive loop should stop retrying past.
int write(const uint8_t *buffer, int length) override
Write length bytes. Returns bytes written, or -1 on error.
~SerialGPSTransport() override
int read(uint8_t *buffer, int length, int timeoutMs) override