00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CNTRIPEmitter_H 00029 #define CNTRIPEmitter_H 00030 00031 #include <mrpt/hwdrivers/CNTRIPClient.h> 00032 #include <mrpt/hwdrivers/CSerialPort.h> 00033 #include <mrpt/hwdrivers/CGenericSensor.h> 00034 00035 namespace mrpt 00036 { 00037 namespace hwdrivers 00038 { 00039 /** This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of dumping the received datastream to a given serial port. 00040 * Used within rawlog-grabber, along CGPSInterface, this class allows to build a powerful & simple RTK-capable GPS receiver system. 00041 * 00042 * Therefore, this sensor will never "collect" any observation via the CGenericSensor interface. 00043 * 00044 * See also the example configuration file for rawlog-grabber in "share/mrpt/config_files/rawlog-grabber". 00045 * 00046 * \code 00047 * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS: 00048 * ------------------------------------------------------- 00049 * [supplied_section_name] 00050 * COM_port_WIN = COM1 // Serial port where the NTRIP stream will be dumped to. 00051 * COM_port_LIN = ttyUSB0 00052 * baudRate = 38400 00053 * 00054 * server = 143.123.9.129 // NTRIP caster IP 00055 * port = 2101 00056 * mountpoint = MYPOINT23 00057 * //user = pepe // User & password optional. 00058 * //password = loco 00059 * 00060 * \endcode 00061 * 00062 * \ingroup mrpt_hwdrivers_grp 00063 * \sa CGPSInterface, CNTRIPClient 00064 */ 00065 class HWDRIVERS_IMPEXP CNTRIPEmitter : public CGenericSensor 00066 { 00067 DEFINE_GENERIC_SENSOR(CNTRIPEmitter) 00068 00069 private: 00070 CNTRIPClient::NTRIPArgs m_ntrip_args; 00071 00072 CNTRIPClient m_client; //!< The NTRIP comms object. 00073 CSerialPort m_out_COM; //!< The output serial port. 00074 00075 std::string m_com_port; //!< If set to non-empty, the serial port will be attempted to be opened automatically when this class is first used to request data from the laser. 00076 int m_com_bauds; 00077 00078 protected: 00079 /** Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) 00080 * See hwdrivers::CNTRIPEmitter for the possible parameters 00081 */ 00082 void loadConfig_sensorSpecific( 00083 const mrpt::utils::CConfigFileBase &configSource, 00084 const std::string &iniSection ); 00085 00086 public: 00087 /** Constructor */ 00088 CNTRIPEmitter(); 00089 00090 /** Destructor */ 00091 virtual ~CNTRIPEmitter(); 00092 00093 /** Changes the serial port to connect to (call prior to 'doProcess'), for example "COM1" or "ttyS0". 00094 * This is not needed if the configuration is loaded with "loadConfig". 00095 */ 00096 void setOutputSerialPort(const std::string &port) { m_com_port = port; } 00097 00098 /** Set up the NTRIP communications, raising an exception on fatal errors. 00099 * Called automatically by rawlog-grabber. 00100 * If used manually, call after "loadConfig" and before "doProcess". 00101 */ 00102 void initialize(); 00103 00104 /** The main loop, which must be called in a timely fashion in order to process the incomming NTRIP data stream and dump it to the serial port. 00105 * This method is called automatically when used within rawlog-grabber. 00106 */ 00107 void doProcess(); 00108 00109 }; // End of class 00110 00111 } // End of namespace 00112 } // End of namespace 00113 00114 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |