Class CNTRIPClient

Nested Relationships

Nested Types

Class Documentation

class CNTRIPClient

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 necessary to call “close”, the connection is ended at destruction.

Public Types

using TListMountPoints = std::list<TMountPoint>

Used in CNTRIPClient::retrieveListOfMountpoints

Public Functions

CNTRIPClient()

Default constructor

virtual ~CNTRIPClient()

Default destructor

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.

See also

close, stream_data

Returns:

false On any kind of error, with a description of the error in errmsg, if provided.

void close()

Closes the connection.

See also

open

void sendBackToServer(const std::string &data)

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

Public Members

mrpt::containers::MT_buffer 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

Public Static 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. 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:

     CNTRIPClient::TListMountPoints lst;
     std::string errMsg;
     bool ret =
*CNTRIPClient::retrieveListOfMountpoints(lst,errMsg,"www.euref-ip.net",
 2101);

Returns:

False on any error, then “errmsg” holds the reason.

Protected Types

enum TConnResult

Values:

enumerator connOk
enumerator connError
enumerator connUnauthorized

Protected Functions

void private_ntrip_thread()

The working thread

Protected Attributes

std::thread m_thread
std::promise<void> m_sem_sock_closed
std::promise<void> m_sem_first_connect_done
mutable bool m_thread_exit = {false}
mutable bool m_thread_do_process = {false}

Will be “true” between “open” and “close”

mutable bool m_waiting_answer_connection = {false}
mutable TConnResult m_answer_connection = {connError}
mutable NTRIPArgs m_args

All the parameters for the NTRIP connection

mrpt::containers::MT_buffer m_upload_data

Buffer for data to be sent back to the server

struct NTRIPArgs

The arguments for connecting to a NTRIP stream, used in CNTRIPClient::open

Public Functions

NTRIPArgs() = default

Default params

Public Members

std::string server = {"www.euref-ip.net"}
int port = {2101}
std::string user
std::string password
std::string mountpoint
struct TMountPoint

A descriptor of one stream in an NTRIP Caster - See CNTRIPClient::retrieveListOfMountpoints

Public Functions

TMountPoint() = default

Public Members

std::string mountpoint_name
std::string id

City name

std::string format

RTCM 2.3, RTCM 3, CMR+, etc…

std::string format_details
int carrier = {0}

0: No carrier phase, 1: L1, 2: L1+L2

std::string nav_system

GPS, …

std::string network

IGS, …

std::string country_code

ITA, ESP, DEU,…

double latitude = {0}
double longitude = {0}
bool needs_nmea = {false}
bool net_ref_stations = {false}
std::string generator_model
std::string compr_encryp

“none”

char authentication = {'B'}

“N”: none, “B”: basic, “D”: digest

bool pay_service = {false}
int stream_bitspersec = {0}
std::string extra_info