Main Page | Modules | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

omSerialDriver.h

Go to the documentation of this file.
00001 
00002 // This code is part of the MaiaProject free software
00003 //
00004 // Keyboard and Mouse Emulator - Virtual keyboard Engine
00005 //
00006 // Copyright (c) 2002-2003 Luca Clivio <luca.clivio@maiaproject.org>
00007 // Tel. +39-347-2538040
00008 // via B.Croce 2, 20037 Paderno Dugnano (Milano) - Italy
00009 //
00010 // Developers:
00011 //    Simone Mangano <simone.mangano@maiaproject.org>
00012 //    Andrea Tosato  <andrea.tosato@maiaproject.org>
00013 //
00014 //  -----------------------------------------------------------------------------
00015 //  This program is free software; This program is free software; 
00016 //  you can redistribute it and/or modify it under the terms of the 
00017 //  GNU General Public License as published by the Free Software Foundation; 
00018 //  either version 2 of the License, or (at your option) any later version.
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of                              
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                                
00021 //  GNU General Public License for more details.                                                
00022 //  You should have received a copy of the GNU General Public License                           
00023 //  along with this program; if not, write to the Free Software                                 
00024 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                                   
00026 
00027 #ifndef _omSerialDriver_
00028 #define _omSerialDriver_
00029 
00030 #include <openmaia/omObject.h>
00031 
00032 #include <wx/wx.h>
00033 
00034 #include <sys/ioctl.h>
00035 #include <sys/types.h>
00036 #include <sys/stat.h>
00037 #include <sys/termios.h>
00038 #include <fcntl.h>
00039 
00040 #define OMSERIALBUTTONNUMBER 4
00041 
00059 class omSerialDriver: public omObject, wxTimer
00060 {
00061  private:
00062 
00063   long actionKey, upKey, downKey, leftKey, rightKey;
00064   bool actionOnPress;
00065   omObject *toInform ;             
00066   int serialFd;  
00067   wxString serialPort;
00068 
00069   void (omObject::*fptr[OMSERIALBUTTONNUMBER])() ;  
00070   bool enableButton[OMSERIALBUTTONNUMBER] ;   
00071 
00072   bool errorStatus;   
00073 
00074   // port channel flags
00075   bool RIActivated; 
00076   bool CTSActivated; 
00077   bool DSRActivated; 
00078   bool CDActivated; 
00079 
00080 
00081   int tickTime ;  
00082 
00083   void Notify() ;   
00084   void OpenSerialPort();
00085 
00086  public:
00087   omSerialDriver(omObject *, int, wxString, bool) ;
00088 
00089   void Start() ;   // start the event catching
00090   void Stop() ;   // stop the event catching
00091 
00092   void SetOnPress(bool) ;
00093   bool GetError() ;
00094 
00095   void AssignActionEvent(int);
00096   void AssignUpEvent(int) ;
00097   void AssignDownEvent(int);
00098   void AssignLeftEvent(int);
00099   void AssignRightEvent(int);
00100   void DisableButtonEvent(int) ;
00101 
00102 };
00103 
00104 
00105 #endif // _omKeyboardDriver_