Main MRPT website > C++ reference
MRPT logo
CNTRIPEmitter.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CNTRIPEmitter_H
29 #define CNTRIPEmitter_H
30 
34 
35 namespace mrpt
36 {
37  namespace hwdrivers
38  {
39  /** This "virtual driver" encapsulates a NTRIP client (see CNTRIPClient) but adds the functionality of dumping the received datastream to a given serial port.
40  * Used within rawlog-grabber, along CGPSInterface, this class allows to build a powerful & simple RTK-capable GPS receiver system.
41  *
42  * Therefore, this sensor will never "collect" any observation via the CGenericSensor interface.
43  *
44  * See also the example configuration file for rawlog-grabber in "share/mrpt/config_files/rawlog-grabber".
45  *
46  * \code
47  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
48  * -------------------------------------------------------
49  * [supplied_section_name]
50  * COM_port_WIN = COM1 // Serial port where the NTRIP stream will be dumped to.
51  * COM_port_LIN = ttyUSB0
52  * baudRate = 38400
53  *
54  * server = 143.123.9.129 // NTRIP caster IP
55  * port = 2101
56  * mountpoint = MYPOINT23
57  * //user = pepe // User & password optional.
58  * //password = loco
59  *
60  * \endcode
61  *
62  * \ingroup mrpt_hwdrivers_grp
63  * \sa CGPSInterface, CNTRIPClient
64  */
66  {
68 
69  private:
71 
72  CNTRIPClient m_client; //!< The NTRIP comms object.
73  CSerialPort m_out_COM; //!< The output serial port.
74 
75  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.
77 
78  protected:
79  /** 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)
80  * See hwdrivers::CNTRIPEmitter for the possible parameters
81  */
82  void loadConfig_sensorSpecific(
83  const mrpt::utils::CConfigFileBase &configSource,
84  const std::string &iniSection );
85 
86  public:
87  /** Constructor */
88  CNTRIPEmitter();
89 
90  /** Destructor */
91  virtual ~CNTRIPEmitter();
92 
93  /** Changes the serial port to connect to (call prior to 'doProcess'), for example "COM1" or "ttyS0".
94  * This is not needed if the configuration is loaded with "loadConfig".
95  */
96  void setOutputSerialPort(const std::string &port) { m_com_port = port; }
97 
98  /** Set up the NTRIP communications, raising an exception on fatal errors.
99  * Called automatically by rawlog-grabber.
100  * If used manually, call after "loadConfig" and before "doProcess".
101  */
102  void initialize();
103 
104  /** 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.
105  * This method is called automatically when used within rawlog-grabber.
106  */
107  void doProcess();
108 
109  }; // End of class
110 
111  } // End of namespace
112 } // End of namespace
113 
114 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013