00001 /* 00002 Object Oriented Mobile Robot Model (OOMRM) C++ Library Copyright (C) 2007 Derek Jones 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 * $Id: commdevice.h,v 1.1 2007/06/10 23:15:00 derek Exp $ 00020 */ 00021 00022 #ifndef OOMRM_COMMDEVICE_H 00023 #define OOMRM_COMMDEVICE_H 00024 #include <types.h> 00026 enum OOMRM_COMMUNICATION_TYPE { OOMRM_NULL_DEVICE, OOMRM_RS232_DEVICE, OOMRM_EB500_DEVICE }; 00028 00036 class CommunicationDevice 00037 { 00038 public: 00039 CommunicationDevice(OOMRM_COMMUNICATION_TYPE cd) { _type = cd; } 00040 void outbyte(char c) { (_outbyte_callback)(c); } 00041 char inbyte(void) { return (_inbyte_callback)(); } 00042 bool havebyte(void) { return (_havebyte_callback)(); } 00043 OOMRM_COMMUNICATION_TYPE type(void) { return _type; } 00044 protected: 00045 void outbyte_callback(foochar); 00046 void inbyte_callback(charfoo); 00047 void havebyte_callback(boolfoo); 00048 //protected: 00049 CommunicationDevice(void); 00050 foochar _outbyte_callback; // message_send_callback; 00051 charfoo _inbyte_callback; 00052 boolfoo _havebyte_callback; 00053 enum OOMRM_COMMUNICATION_TYPE _type; 00054 }; 00055 00056 #endif
1.3