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

#include <NTRIPHttpSession.h>

+ Inheritance diagram for NTRIPHttpSession:
+ Collaboration diagram for NTRIPHttpSession:

Signals

void certificatePinned (const QString &pin)
 A newly trusted self-signed certificate, as NTRIPConnectionConfig::pinnedCertificate; precedes the request.
 
void responseStarted ()
 The caster accepted the request; its body follows.
 
void bodyReceived (const QByteArray &body, qint64 receivedAtMs)
 Body bytes, with the scheduler time at which the bytes carrying them arrived.
 
void failed (const NTRIPFailure &failure)
 A socket, TLS or HTTP failure, including an error status with the caster's explanation.
 
void finished ()
 The response ended where its HTTP framing allows.
 

Public Member Functions

 NTRIPHttpSession (QObject *parent=nullptr, RuntimeScheduler *scheduler=nullptr, NTRIPHttpPurpose purpose=NTRIPHttpPurpose::Corrections)
 
QString open (const NTRIPConnectionConfig &config)
 
bool write (const QByteArray &bytes)
 False unless the socket accepted every byte; the owner decides how to report it.
 
bool isConnected () const
 
bool awaitingErrorBody () const
 An error status arrived and its body is still being read.
 
void abort ()
 Ends the connection without further signals.
 
void retire ()
 

Static Public Attributes

static constexpr qint64 READ_BUFFER_BYTES = 64 * 1024
 
static constexpr qint64 READ_CHUNK_BYTES = 16 * 1024
 
static constexpr std::chrono::milliseconds ERROR_BODY_TIMEOUT {250}
 

Friends

class NTRIPHttpSessionTest
 
class NTRIPHttpTransportTest
 

Detailed Description

One HTTP exchange with a caster over TCP or TLS, shared by the correction stream and source-table fetches: it sends the request once connected and decodes the response. responseStarted() precedes the body, which arrives through bodyReceived(); the exchange ends with at most one failed() or finished(), and abort() and retire() end it silently. An error status waits up to ERROR_BODY_TIMEOUT for the caster's explanation in its body. Observers may abort or retire the session from any of its signals, but must not delete it there: the signal is delivered from inside the session's socket, which deleting the session would destroy mid-emission.

With the self-signed opt-in, the first self-signed certificate accepted from a host:port is pinned; later connections accept a self-signed certificate only if it matches the configured pin.

Definition at line 31 of file NTRIPHttpSession.h.

Constructor & Destructor Documentation

◆ NTRIPHttpSession()

NTRIPHttpSession::NTRIPHttpSession ( QObject *  parent = nullptr,
RuntimeScheduler *  scheduler = nullptr,
NTRIPHttpPurpose  purpose = NTRIPHttpPurpose::Corrections 
)
explicit

Definition at line 18 of file NTRIPHttpSession.cc.

Member Function Documentation

◆ abort()

void NTRIPHttpSession::abort ( )

Ends the connection without further signals.

Definition at line 252 of file NTRIPHttpSession.cc.

Referenced by retire().

◆ awaitingErrorBody()

bool NTRIPHttpSession::awaitingErrorBody ( ) const
inline

An error status arrived and its body is still being read.

Definition at line 53 of file NTRIPHttpSession.h.

References NTRIPHttpDecoder::awaitingErrorBody().

◆ bodyReceived

void NTRIPHttpSession::bodyReceived ( const QByteArray &  body,
qint64  receivedAtMs 
)
signal

Body bytes, with the scheduler time at which the bytes carrying them arrived.

◆ certificatePinned

void NTRIPHttpSession::certificatePinned ( const QString &  pin)
signal

A newly trusted self-signed certificate, as NTRIPConnectionConfig::pinnedCertificate; precedes the request.

◆ failed

void NTRIPHttpSession::failed ( const NTRIPFailure &  failure)
signal

A socket, TLS or HTTP failure, including an error status with the caster's explanation.

◆ finished

void NTRIPHttpSession::finished ( )
signal

The response ended where its HTTP framing allows.

◆ isConnected()

bool NTRIPHttpSession::isConnected ( ) const

Definition at line 158 of file NTRIPHttpSession.cc.

◆ open()

QString NTRIPHttpSession::open ( const NTRIPConnectionConfig &  config)

Connects once and sends the request of the session's purpose when connected; later calls are ignored. Returns why config cannot build a request, without connecting, or empty.

Definition at line 26 of file NTRIPHttpSession.cc.

References NTRIPHttpRequest::build(), NTRIPHttpRequest::bytes, config, QGCNetworkHelper::createSslConfig(), and NTRIPHttpRequest::error.

Referenced by NTRIPHttpTransport::start().

◆ responseStarted

void NTRIPHttpSession::responseStarted ( )
signal

The caster accepted the request; its body follows.

◆ retire()

void NTRIPHttpSession::retire ( )

Detaches from its owning parent, aborts, and deletes the session later, so abort observers cannot reach the owner.

Definition at line 260 of file NTRIPHttpSession.cc.

References abort().

◆ write()

bool NTRIPHttpSession::write ( const QByteArray &  bytes)

False unless the socket accepted every byte; the owner decides how to report it.

Definition at line 149 of file NTRIPHttpSession.cc.

Friends And Related Symbol Documentation

◆ NTRIPHttpSessionTest

friend class NTRIPHttpSessionTest
friend

Definition at line 34 of file NTRIPHttpSession.h.

◆ NTRIPHttpTransportTest

friend class NTRIPHttpTransportTest
friend

Definition at line 35 of file NTRIPHttpSession.h.

Member Data Documentation

◆ ERROR_BODY_TIMEOUT

constexpr std::chrono::milliseconds NTRIPHttpSession::ERROR_BODY_TIMEOUT {250}
staticconstexpr

Definition at line 40 of file NTRIPHttpSession.h.

◆ READ_BUFFER_BYTES

constexpr qint64 NTRIPHttpSession::READ_BUFFER_BYTES = 64 * 1024
staticconstexpr

Definition at line 38 of file NTRIPHttpSession.h.

◆ READ_CHUNK_BYTES

constexpr qint64 NTRIPHttpSession::READ_CHUNK_BYTES = 16 * 1024
staticconstexpr

Definition at line 39 of file NTRIPHttpSession.h.


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