QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SerialGPSTransport Class Reference

#include <SerialGPSTransport.h>

+ Inheritance diagram for SerialGPSTransport:
+ Collaboration diagram for SerialGPSTransport:

Public Member Functions

 SerialGPSTransport (QString device, const std::atomic_bool &requestStop)
 
 ~SerialGPSTransport () override
 
bool open ()
 
bool fatalError () const
 True once the port hits an error the receive loop should stop retrying past.
 
int read (uint8_t *buffer, int length, int timeoutMs) override
 
int write (const uint8_t *buffer, int length) override
 Write length bytes. Returns bytes written, or -1 on error.
 
bool setBaudrate (unsigned baudrate) override
 Set the link baud rate. Returns true on success.
 
- Public Member Functions inherited from GPSTransport
virtual ~GPSTransport ()=default
 

Detailed Description

GPSTransport backed by a QSerialPort. Owns the port and must be constructed on the thread that pumps the driver — QSerialPort has thread affinity.

Definition at line 15 of file SerialGPSTransport.h.

Constructor & Destructor Documentation

◆ SerialGPSTransport()

SerialGPSTransport::SerialGPSTransport ( QString  device,
const std::atomic_bool &  requestStop 
)

Definition at line 17 of file SerialGPSTransport.cc.

◆ ~SerialGPSTransport()

SerialGPSTransport::~SerialGPSTransport ( )
overridedefault

Member Function Documentation

◆ fatalError()

bool SerialGPSTransport::fatalError ( ) const

True once the port hits an error the receive loop should stop retrying past.

Definition at line 56 of file SerialGPSTransport.cc.

References QSerialPort::NoError, and QSerialPort::TimeoutError.

◆ open()

bool SerialGPSTransport::open ( )

Open the device, retrying briefly while it settles after startup. Aborts the retry promptly if requestStop is set, so a disconnect can't be stalled by it.

Definition at line 25 of file SerialGPSTransport.cc.

References QSerialPort::Baud9600, QSerialPort::Data8, QSerialPort::NoError, QSerialPort::NoFlowControl, QSerialPort::NoParity, QSerialPort::OneStop, and QSerialPort::PermissionError.

◆ read()

int SerialGPSTransport::read ( uint8_t *  buffer,
int  length,
int  timeoutMs 
)
overridevirtual

Read up to length bytes into buffer, waiting up to timeoutMs. Returns bytes read, 0 on timeout, <0 on error.

Implements GPSTransport.

Definition at line 63 of file SerialGPSTransport.cc.

◆ setBaudrate()

bool SerialGPSTransport::setBaudrate ( unsigned  baudrate)
overridevirtual

Set the link baud rate. Returns true on success.

Implements GPSTransport.

Definition at line 95 of file SerialGPSTransport.cc.

◆ write()

int SerialGPSTransport::write ( const uint8_t *  buffer,
int  length 
)
overridevirtual

Write length bytes. Returns bytes written, or -1 on error.

Implements GPSTransport.

Definition at line 76 of file SerialGPSTransport.cc.


The documentation for this class was generated from the following files: