epuckDriver.hpp
Go to the documentation of this file.
00001 /* Copyright 2008 Renato Florentino Garcia <fgar.renato@gmail.com>
00002  *
00003  * This program is free software: you can redistribute it and/or modify
00004  * it under the terms of the GNU General Public License version 2, as
00005  * published by the Free Software Foundation.
00006  *
00007  * This program is distributed in the hope that it will be useful,
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  * GNU General Public License for more details.
00011  *
00012  * You should have received a copy of the GNU General Public License
00013  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00014  */
00015 
00016 #ifndef EPUCK_DRIVER2_1_HPP
00017 #define EPUCK_DRIVER2_1_HPP
00018 
00019 #include <libplayercore/playercore.h>
00020 #include <string>
00021 #include <memory>
00022 #include "serialPort.hpp"
00023 #include "epuckPosition2d.hpp"
00024 #include "epuckIR.hpp"
00025 #include "epuckCamera.hpp"
00026 #include "epuckLEDs.hpp"
00027 
00041 class EpuckDriver : public ThreadedDriver
00042 {
00043 public:
00044 
00045   EpuckDriver(ConfigFile* cf, int section);
00046 
00047   ~EpuckDriver();
00048 
00049   virtual int MainSetup();
00050 
00051   virtual void MainQuit();
00052 
00053   virtual int ProcessMessage(QueuePointer &resp_queue,
00054                              player_msghdr* hdr, void* data);
00055 
00056   virtual int Subscribe(player_devaddr_t addr);
00057 
00058   virtual int Unsubscribe(player_devaddr_t addr);
00059 
00060   static Driver* EpuckDriver_Init(ConfigFile* cf, int section);
00061 
00062 private:
00063 
00064   const unsigned EXPECTED_EPUCK_SIDE_VERSION;
00065 
00066   virtual void Main();
00067 
00068   player_devaddr_t position2dAddr;
00069   player_position2d_data_t posData;
00070   std::auto_ptr<EpuckPosition2d> epuckPosition2d;
00071 
00072   player_devaddr_t irAddr;
00073   player_ir_data_t irData;
00074   std::auto_ptr<EpuckIR> epuckIR;
00075 
00076   player_devaddr_t cameraAddr;
00077   player_camera_data_t cameraData;
00078   std::auto_ptr<EpuckCamera> epuckCamera;
00079 
00080   player_devaddr_t ringLEDAddr[EpuckLEDs::RING_LEDS_NUM];
00081   player_blinkenlight_data_t ringLEDsData[EpuckLEDs::RING_LEDS_NUM];
00082   player_devaddr_t frontLEDAddr;
00083   player_blinkenlight_data_t frontLEDData;
00084   player_devaddr_t bodyLEDAddr;
00085   player_blinkenlight_data_t bodyLEDData;
00086   std::auto_ptr<EpuckLEDs> epuckLEDs;
00087 
00088   SerialPort* serialPort;
00089 };
00090 
00091 #endif