MRPT  1.9.9
mrpt::hwdrivers::CNTRIPClient Class Reference

Detailed Description

A client for NTRIP (HTTP) sources of differential GPS corrections from internet servers, or Global navigation satellite system (GNSS) internet radio.

Usage:

  • To open the server, invoke "open" with the proper parameters. Then use "stream_data" to read the read data.
  • To obtain a list of all the mountpoints available at a given NTRIP Caster, call "retrieveListOfMountpoints" (it's a static method).

It is not neccesary to call "close", the connection is ended at destruction.

Note
For a good reference of the NTRIP protocol, see http://gnss.itacyl.es/opencms/opencms/system/modules/es.jcyl.ita.site.gnss/resources/documentos_gnss/NtripDocumentation.pdf

Definition at line 37 of file CNTRIPClient.h.

#include <mrpt/hwdrivers/CNTRIPClient.h>

Classes

struct  NTRIPArgs
 The arguments for connecting to a NTRIP stream, used in CNTRIPClient::open. More...
 
struct  TMountPoint
 A descriptor of one stream in an NTRIP Caster - See CNTRIPClient::retrieveListOfMountpoints. More...
 

Public Types

using TListMountPoints = std::list< TMountPoint >
 Used in CNTRIPClient::retrieveListOfMountpoints. More...
 

Public Member Functions

 CNTRIPClient ()
 Default constructor. More...
 
virtual ~CNTRIPClient ()
 Default destructor. More...
 
bool open (const NTRIPArgs &params, std::string &out_errmsg)
 Tries to open a given NTRIP stream and, if successful, launches a thread for continuously reading from it. More...
 
void close ()
 Closes the connection. More...
 
void sendBackToServer (const std::string &data)
 Enqueues a string to be sent back to the NTRIP server (e.g. More...
 

Static Public Member Functions

static bool retrieveListOfMountpoints (TListMountPoints &out_list, std::string &out_errmsg, const std::string &server, int port=2101, const std::string &auth_user=std::string(), const std::string &auth_pass=std::string())
 Connect to a given NTRIP caster and get the list of all available mountpoints and their parameters. More...
 

Public Attributes

mrpt::containers::MT_buffer stream_data
 The buffer with all the bytes so-far read from the NTRIP server stream. More...
 

Protected Types

enum  TConnResult { connOk = 0, connError, connUnauthorized }
 

Protected Member Functions

void private_ntrip_thread ()
 The working thread. More...
 

Protected Attributes

std::thread m_thread
 
std::promise< voidm_sem_sock_closed
 
std::promise< voidm_sem_first_connect_done
 
bool m_thread_exit
 
bool m_thread_do_process
 Will be "true" between "open" and "close". More...
 
bool m_waiting_answer_connection
 
TConnResult m_answer_connection
 
NTRIPArgs m_args
 All the parameters for the NTRIP connection. More...
 
mrpt::containers::MT_buffer m_upload_data
 Buffer for data to be sent back to the server. More...
 

Member Typedef Documentation

◆ TListMountPoints

Member Enumeration Documentation

◆ TConnResult

Enumerator
connOk 
connError 
connUnauthorized 

Definition at line 122 of file CNTRIPClient.h.

Constructor & Destructor Documentation

◆ CNTRIPClient()

CNTRIPClient::CNTRIPClient ( )

Default constructor.

Definition at line 31 of file CNTRIPClient.cpp.

References m_thread, and private_ntrip_thread().

◆ ~CNTRIPClient()

CNTRIPClient::~CNTRIPClient ( )
virtual

Default destructor.

Definition at line 45 of file CNTRIPClient.cpp.

References close(), m_thread, and m_thread_exit.

Member Function Documentation

◆ close()

void CNTRIPClient::close ( )

◆ open()

bool CNTRIPClient::open ( const NTRIPArgs params,
std::string out_errmsg 
)

Tries to open a given NTRIP stream and, if successful, launches a thread for continuously reading from it.

See also
close, stream_data
Returns
false On any kind of error, with a description of the error in errmsg, if provided.

Definition at line 69 of file CNTRIPClient.cpp.

References close(), connError, connOk, connUnauthorized, mrpt::format(), m_answer_connection, m_args, m_sem_first_connect_done, m_thread_do_process, m_waiting_answer_connection, and mrpt::hwdrivers::CNTRIPClient::NTRIPArgs::mountpoint.

Referenced by mrpt::hwdrivers::CNTRIPEmitter::initialize().

◆ private_ntrip_thread()

◆ retrieveListOfMountpoints()

bool CNTRIPClient::retrieveListOfMountpoints ( TListMountPoints out_list,
std::string out_errmsg,
const std::string server,
int  port = 2101,
const std::string auth_user = std::string(),
const std::string auth_pass = std::string() 
)
static

◆ sendBackToServer()

void CNTRIPClient::sendBackToServer ( const std::string data)

Enqueues a string to be sent back to the NTRIP server (e.g.

GGA frames)

Definition at line 385 of file CNTRIPClient.cpp.

References mrpt::containers::MT_buffer::appendData(), m_upload_data, and mrpt::system::os::memcpy().

Member Data Documentation

◆ m_answer_connection

TConnResult mrpt::hwdrivers::CNTRIPClient::m_answer_connection
mutableprotected

Definition at line 129 of file CNTRIPClient.h.

Referenced by open(), and private_ntrip_thread().

◆ m_args

NTRIPArgs mrpt::hwdrivers::CNTRIPClient::m_args
mutableprotected

All the parameters for the NTRIP connection.

Definition at line 131 of file CNTRIPClient.h.

Referenced by open(), and private_ntrip_thread().

◆ m_sem_first_connect_done

std::promise<void> mrpt::hwdrivers::CNTRIPClient::m_sem_first_connect_done
protected

Definition at line 115 of file CNTRIPClient.h.

Referenced by open(), and private_ntrip_thread().

◆ m_sem_sock_closed

std::promise<void> mrpt::hwdrivers::CNTRIPClient::m_sem_sock_closed
protected

Definition at line 114 of file CNTRIPClient.h.

Referenced by close(), and private_ntrip_thread().

◆ m_thread

std::thread mrpt::hwdrivers::CNTRIPClient::m_thread
protected

Definition at line 113 of file CNTRIPClient.h.

Referenced by CNTRIPClient(), and ~CNTRIPClient().

◆ m_thread_do_process

bool mrpt::hwdrivers::CNTRIPClient::m_thread_do_process
mutableprotected

Will be "true" between "open" and "close".

Definition at line 119 of file CNTRIPClient.h.

Referenced by close(), open(), and private_ntrip_thread().

◆ m_thread_exit

bool mrpt::hwdrivers::CNTRIPClient::m_thread_exit
mutableprotected

Definition at line 117 of file CNTRIPClient.h.

Referenced by private_ntrip_thread(), and ~CNTRIPClient().

◆ m_upload_data

mrpt::containers::MT_buffer mrpt::hwdrivers::CNTRIPClient::m_upload_data
protected

Buffer for data to be sent back to the server.

Definition at line 134 of file CNTRIPClient.h.

Referenced by close(), private_ntrip_thread(), and sendBackToServer().

◆ m_waiting_answer_connection

bool mrpt::hwdrivers::CNTRIPClient::m_waiting_answer_connection
mutableprotected

Definition at line 120 of file CNTRIPClient.h.

Referenced by open(), and private_ntrip_thread().

◆ stream_data

mrpt::containers::MT_buffer mrpt::hwdrivers::CNTRIPClient::stream_data

The buffer with all the bytes so-far read from the NTRIP server stream.

Call its "readAndClear" method in a timely fashion to get the stream contents.

See also
open, close

Definition at line 161 of file CNTRIPClient.h.

Referenced by mrpt::hwdrivers::CNTRIPEmitter::doProcess(), and private_ntrip_thread().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020