class mrpt::hwdrivers::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 neccesary to call “close”, the connection is ended at destruction.

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

#include <mrpt/hwdrivers/CNTRIPClient.h>

class CNTRIPClient
{
public:
    // typedefs

    typedef std::list<TMountPoint> TListMountPoints;

    // structs

    struct NTRIPArgs;
    struct TMountPoint;

    //
fields

    mrpt::containers::MT_buffer stream_data;

    // construction

    CNTRIPClient();

    //
methods

    bool open(const NTRIPArgs& params, std::string& out_errmsg);
    void close();
    void sendBackToServer(const std::string& data);

    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()
        );
};

Typedefs

typedef std::list<TMountPoint> TListMountPoints

Used in CNTRIPClient::retrieveListOfMountpoints.

Fields

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

Construction

CNTRIPClient()

Default constructor.

Methods

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.

Returns:

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

See also:

close, stream_data

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)

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.