QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
TCPGPSTransport.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <memory>
5
6#include <QtCore/QDeadlineTimer>
7#include <QtCore/QString>
8
10
11class QTcpSocket;
12
16{
17public:
18 TCPGPSTransport(QString host, quint16 port, GPSCancelToken cancelToken);
19 ~TCPGPSTransport() override;
20
21 GPSOpenResult open() override;
22 bool fatalError() const override;
23
24 unsigned fixedBaudrate() const override { return BRIDGE_BAUDRATE; }
25
26 std::chrono::milliseconds configurationWriteTimeout() const override;
27
28protected:
29 QIODevice* device() const override;
30 void retire() override;
31
32private:
33 QString _host;
34 quint16 _port;
35 std::unique_ptr<QTcpSocket> _socket;
36
37 static constexpr std::chrono::milliseconds CONNECT_TIMEOUT{5000};
38 static constexpr std::chrono::milliseconds WRITE_TIMEOUT{5000};
39};
static constexpr unsigned BRIDGE_BAUDRATE
const GPSCancelToken & cancelToken() const
void retire() override
Retires the connection after a failed write that accepted bytes; by default closes the device.
GPSOpenResult open() override
QIODevice * device() const override
The open device, or null before open().
unsigned fixedBaudrate() const override
Nonzero when the link cannot follow baud-rate changes (for example, a serial bridge).
std::chrono::milliseconds configurationWriteTimeout() const override
~TCPGPSTransport() override
bool fatalError() const override