Go to the documentation of this file.
28 CNTRIPEmitter::CNTRIPEmitter() : m_client(), m_com_port(
"") {}
44 std::vector<uint8_t> buf;
57 "[NTRIP %s] Rate: %.02f B/s\n",
66 "[NTRIP %s] RX (%u bytes)\n",
68 (
unsigned int)buf.size());
74 "[NTRIP %s] RX: %u bytes\n",
76 (
unsigned)buf.size());
83 reinterpret_cast<const char*
>(&buf[0]), buf.size());
91 const size_t nReadActual =
m_out_COM.
Read(rxbuf,
sizeof(rxbuf) - 1);
94 rxbuf[nReadActual] = 0;
97 "[NTRIP %s] TX (%u bytes)\n",
100 (
unsigned int)nReadActual);
104 std::this_thread::sleep_for(1ms);
139 "Error opening output raw file: `%s`", fil.c_str());
145 "ERROR trying to connect to NTRIP caster: %s", errstr.c_str());
164 "At least one of either raw file output or serial COM file must be "
165 "specified in configuration file!");
bool isOpen() const
Returns if port has been correctly open.
This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of du...
void close()
Close the port.
std::string dateTimeLocalToString(const mrpt::system::TTimeStamp t)
Convert a timestamp into this textual form (in local time): YEAR/MONTH/DAY,HH:MM:SS....
std::string m_raw_output_file_prefix
void doProcess() override
The main loop, which must be called in a timely fashion in order to process the incomming NTRIP data ...
mrpt::containers::MT_buffer stream_data
The buffer with all the bytes so-far read from the NTRIP server stream.
~CNTRIPEmitter() override
Destructor
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
Contains classes for various device interfaces.
mrpt::vision::TStereoCalibResults out
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
void readAndClear(std::vector< uint8_t > &d)
Read the whole buffer and empty it.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CNTRIPClient m_client
The NTRIP comms object.
void purgeBuffers()
Purge tx and rx buffers.
This namespace contains representation of robot actions and observations.
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 fro...
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
std::string fileNameStripInvalidChars(const std::string &filename, const char replacement_to_invalid_chars='_')
Replace invalid filename chars by underscores ('_') or any other user-given char.
double Tac() noexcept
Stops the stopwatch.
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
void setConfig(int baudRate, int parity=0, int bits=8, int nStopBits=1, bool enableFlowControl=false)
Changes the configuration of the port.
CNTRIPClient::NTRIPArgs m_ntrip_args
This class allows loading and storing values and vectors of different types from a configuration text...
std::ofstream m_raw_output_file_stream
std::string timeLocalToString(const mrpt::system::TTimeStamp t, unsigned int secondFractionDigits=6)
Convert a timestamp into this textual form (in local time): HH:MM:SS.MMMMMM.
mrpt::comms::CSerialPort m_out_COM
The output serial port.
void Tic() noexcept
Starts the stopwatch.
void close()
Closes the connection.
mrpt::system::CTicTac m_rate_timer
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
void open()
Open the port.
void setTimeouts(int ReadIntervalTimeout, int ReadTotalTimeoutMultiplier, int ReadTotalTimeoutConstant, int WriteTotalTimeoutMultiplier, int WriteTotalTimeoutConstant)
Changes the timeouts of the port, in milliseconds.
std::string trim(const std::string &str)
Removes leading and trailing spaces.
void initialize() override
Set up the NTRIP communications, raising an exception on fatal errors.
std::string m_com_port
If set to non-empty, the serial port will be attempted to be opened automatically when this class is ...
bool m_transmit_to_server
std::string std::string format(std::string_view fmt, ARGS &&... args)
size_t Read(void *Buffer, size_t Count) override
Implements the virtual method responsible for reading from the stream - Unlike CStream::ReadBuffer,...
Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Fri Jul 17 08:43:33 UTC 2020 | |