00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 University of Malaga | 00007 | | 00008 | This software was written by the Perception and Robotics | 00009 | research group, 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 00029 #ifndef CInterfaceFTDIMessages_H 00030 #define CInterfaceFTDIMessages_H 00031 00032 #include <mrpt/hwdrivers/CInterfaceFTDI.h> 00033 #include <mrpt/utils/CMessage.h> 00034 00035 namespace mrpt 00036 { 00037 namespace hwdrivers 00038 { 00039 00040 /** An implementation of message passing over a FTDI USB link. 00041 * The limit for the body size is 255 bytes. The frame format is an array of bytes, in this order: 00042 \code 00043 <START_FLAG> <HEADER> <LENGTH> <BODY> <END_FLAG> 00044 00045 <START_FLAG> = 0x69 00046 <HEADER> = A header byte 00047 <LENGHT> = Number of bytes of BODY 00048 <BODY> = N x bytes 00049 <END_FLAG> = 0X96 00050 Total length = <LENGTH> + 4 00051 \endcode 00052 * \sa CInterfaceFTDI 00053 */ 00054 class HWDLLIMPEXP CInterfaceFTDIMessages : public hwdrivers::CInterfaceFTDI 00055 { 00056 public: 00057 /** Constructor 00058 */ 00059 CInterfaceFTDIMessages(); 00060 00061 /** Destructor 00062 */ 00063 virtual ~CInterfaceFTDIMessages(); 00064 00065 /** Send a message to the device. 00066 * Note that only the low byte from the "type" field will be used. 00067 * \exception std::exception On communication errors 00068 */ 00069 void sendMessage( const utils::CMessage &msg); 00070 00071 /** Tries to receive a message from the device. 00072 * \exception std::exception On communication errors 00073 * \returns True if successful, false if there is no new data from the device (but communications seem to work fine) 00074 */ 00075 bool receiveMessage( utils::CMessage &msg ); 00076 }; // end of class 00077 00078 } // end of namespace 00079 } // end of namespace 00080 00081 #endif 00082 00083
Page generated by Doxygen 1.6.1 for MRPT 0.7.1 SVN: at Tue Dec 22 08:29:35 CET 2009 |