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

omConnector.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 _omConnector_
00028 #define _omConnector_
00029 
00030 #include <wx/wx.h>
00031 #include <wx/socket.h>
00032 #include <wx/config.h>
00033 
00034 #include <stdio.h>
00035 
00036 #include <openmaia/omObject.h>
00037 #include <openmaia/omTCPMessage.h>
00038 #include <openmaia/omTCPParser.h>
00039 #include <openmaia/omFunctions.h>
00040 
00055 class omConnector: public omObject, public wxEvtHandler
00056 {
00057  private:
00058   wxSocketClient *sock ;         
00059   omObject *toNotify;          
00060   wxString hostname;             
00061   unsigned short service;        
00062   bool connected;                
00063   wxString currentIP;            
00064   wxString currentHost;          
00065   int currentPort;               
00066   bool notifyMessages;           
00067   
00068   omTCPParser tcpParser;
00069 
00070   //  bool endOfLine;
00071   wxString incomingMessage;   
00072 
00073   void OnSocketEvent(wxSocketEvent) ;   
00074   void OnSocketConnection(wxSocketEvent);
00075 
00076   DECLARE_EVENT_TABLE()
00077 
00078  public:
00079   omConnector();
00080   omConnector(wxString, unsigned short) ;
00081   omConnector(omObject *);
00082   omConnector(omObject *, wxString, unsigned short);
00083 
00084   bool Connect() ;             // make a connection with openmaia server
00085   void SendMessage(omTCPMessage ) ;   // send a message to the server
00086   void SendClick();          // send the click event to the server
00087   
00088   
00089   
00090 };
00091 
00092 #endif  // _omConnector_