MRPT
2.0.1
|
A client for NTRIP (HTTP) sources of differential GPS corrections from internet servers, or Global navigation satellite system (GNSS) internet radio.
Usage:
It is not neccesary to call "close", the connection is ended at destruction.
Definition at line 36 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 ¶ms, 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< void > | m_sem_sock_closed |
std::promise< void > | m_sem_first_connect_done |
bool | m_thread_exit {false} |
bool | m_thread_do_process {false} |
Will be "true" between "open" and "close". More... | |
bool | m_waiting_answer_connection {false} |
TConnResult | m_answer_connection {connError} |
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... | |
using mrpt::hwdrivers::CNTRIPClient::TListMountPoints = std::list<TMountPoint> |
Used in CNTRIPClient::retrieveListOfMountpoints.
Definition at line 74 of file CNTRIPClient.h.
|
protected |
Enumerator | |
---|---|
connOk | |
connError | |
connUnauthorized |
Definition at line 104 of file CNTRIPClient.h.
CNTRIPClient::CNTRIPClient | ( | ) |
Default constructor.
Definition at line 32 of file CNTRIPClient.cpp.
References m_thread, and private_ntrip_thread().
|
virtual |
Default destructor.
Definition at line 40 of file CNTRIPClient.cpp.
References close(), m_thread, and m_thread_exit.
void CNTRIPClient::close | ( | ) |
Closes the connection.
Definition at line 53 of file CNTRIPClient.cpp.
References mrpt::containers::MT_buffer::clear(), m_sem_sock_closed, m_thread_do_process, and m_upload_data.
Referenced by open(), ~CNTRIPClient(), and mrpt::hwdrivers::CNTRIPEmitter::~CNTRIPEmitter().
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.
Definition at line 64 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, mrpt::hwdrivers::CNTRIPClient::NTRIPArgs::mountpoint, and params.
Referenced by mrpt::hwdrivers::CNTRIPEmitter::initialize().
|
protected |
The working thread.
Definition at line 118 of file CNTRIPClient.cpp.
References mrpt::containers::MT_buffer::appendData(), mrpt::containers::MT_buffer::clear(), mrpt::comms::CClientTCPSocket::close(), mrpt::comms::CClientTCPSocket::connect(), connError, connOk, connUnauthorized, mrpt::system::encodeBase64(), mrpt::format(), mrpt::comms::CClientTCPSocket::isConnected(), m_answer_connection, m_args, m_sem_first_connect_done, m_sem_sock_closed, m_thread_do_process, m_thread_exit, m_upload_data, m_waiting_answer_connection, mrpt::system::os::memcpy(), mrpt::hwdrivers::CNTRIPClient::NTRIPArgs::mountpoint, mrpt::hwdrivers::CNTRIPClient::NTRIPArgs::password, mrpt::hwdrivers::CNTRIPClient::NTRIPArgs::port, mrpt::containers::MT_buffer::readAndClear(), mrpt::comms::CClientTCPSocket::readAsync(), mrpt::comms::CClientTCPSocket::sendString(), mrpt::hwdrivers::CNTRIPClient::NTRIPArgs::server, mrpt::containers::MT_buffer::size(), stream_data, mrpt::hwdrivers::CNTRIPClient::NTRIPArgs::user, and mrpt::comms::CClientTCPSocket::writeAsync().
Referenced by CNTRIPClient().
|
static |
Connect to a given NTRIP caster and get the list of all available mountpoints and their parameters.
Note that the authentication parameters "auth_user" and "auth_pass" will be left empty in most situations, since LISTING the Caster normally doesn't require special rights.
Example:
Definition at line 322 of file CNTRIPClient.cpp.
References mrpt::hwdrivers::CNTRIPClient::TMountPoint::carrier, mrpt::system::TParameters< T >::clear(), mrpt::hwdrivers::CNTRIPClient::TMountPoint::country_code, mrpt::DEG2RAD(), mrpt::comms::net::erOk, mrpt::hwdrivers::CNTRIPClient::TMountPoint::extra_info, mrpt::hwdrivers::CNTRIPClient::TMountPoint::format, mrpt::hwdrivers::CNTRIPClient::TMountPoint::format_details, mrpt::comms::net::http_get(), mrpt::hwdrivers::CNTRIPClient::TMountPoint::id, mrpt::hwdrivers::CNTRIPClient::TMountPoint::latitude, mrpt::hwdrivers::CNTRIPClient::TMountPoint::longitude, mrpt::hwdrivers::CNTRIPClient::TMountPoint::mountpoint_name, mrpt::hwdrivers::CNTRIPClient::TMountPoint::nav_system, mrpt::hwdrivers::CNTRIPClient::TMountPoint::needs_nmea, mrpt::hwdrivers::CNTRIPClient::TMountPoint::net_ref_stations, mrpt::hwdrivers::CNTRIPClient::TMountPoint::network, mrpt::RAD2DEG(), mrpt::system::tokenize(), and mrpt::math::wrapToPi().
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 380 of file CNTRIPClient.cpp.
References mrpt::containers::MT_buffer::appendData(), mrpt::opengl::internal::data, m_upload_data, and mrpt::system::os::memcpy().
|
mutableprotected |
Definition at line 111 of file CNTRIPClient.h.
Referenced by open(), and private_ntrip_thread().
|
mutableprotected |
All the parameters for the NTRIP connection.
Definition at line 113 of file CNTRIPClient.h.
Referenced by open(), and private_ntrip_thread().
|
protected |
Definition at line 97 of file CNTRIPClient.h.
Referenced by open(), and private_ntrip_thread().
|
protected |
Definition at line 96 of file CNTRIPClient.h.
Referenced by close(), and private_ntrip_thread().
|
protected |
Definition at line 95 of file CNTRIPClient.h.
Referenced by CNTRIPClient(), and ~CNTRIPClient().
|
mutableprotected |
Will be "true" between "open" and "close".
Definition at line 101 of file CNTRIPClient.h.
Referenced by close(), open(), and private_ntrip_thread().
|
mutableprotected |
Definition at line 99 of file CNTRIPClient.h.
Referenced by private_ntrip_thread(), and ~CNTRIPClient().
|
protected |
Buffer for data to be sent back to the server.
Definition at line 116 of file CNTRIPClient.h.
Referenced by close(), private_ntrip_thread(), and sendBackToServer().
|
mutableprotected |
Definition at line 102 of file CNTRIPClient.h.
Referenced by open(), and private_ntrip_thread().
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.
Definition at line 143 of file CNTRIPClient.h.
Referenced by mrpt::hwdrivers::CNTRIPEmitter::doProcess(), and private_ntrip_thread().
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |