libGizmod/GizmoLinuxInputDevice.hpp

Go to the documentation of this file.
00001 
00012 /*
00013   
00014   Copyright (c) 2007, Tim Burrell
00015   Licensed under the Apache License, Version 2.0 (the "License");
00016   you may not use this file except in compliance with the License.
00017   You may obtain a copy of the License at 
00018 
00019         http://www.apache.org/licenses/LICENSE-2.0
00020 
00021   Unless required by applicable law or agreed to in writing, software
00022   distributed under the License is distributed on an "AS IS" BASIS,
00023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   See the License for the specific language governing permissions and 
00025   limitations under the License. 
00026   
00027 */
00028 
00029 #ifndef __GizmoLinuxInputDevice_h
00030 #define __GizmoLinuxInputDevice_h
00031 
00032 #if HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035 
00036 
00037 #include "../libH/DynamicBuffer.hpp"
00038 #include "../libH/FileEventWatcher.hpp"
00039 #include <linux/input.h>
00040 #include <vector>
00041 #include <boost/archive/text_oarchive.hpp>
00042 #include <boost/archive/text_iarchive.hpp>
00043 #include <boost/serialization/base_object.hpp>
00044 #include <boost/python/list.hpp>
00045 
00047 // Namespace
00049 
00050 namespace Gizmod {
00051 
00053 // Typedef, enum's
00055         
00057 // Class Definition
00059 
00064 class GizmoLinuxInputDevice {
00065 public:
00066         // public functions
00067         bool                            createEventPress(int Type, int Code); 
00068         bool                            createEventPressMod(int Type, int Code, boost::python::object Modifiers); 
00069         bool                            createEventRaw(int Type, int Code, int Value); 
00070         bool                            createEvents(int Type, int Code, int Value, int NumWrites); 
00071         bool                            getSendNullEvents() const;              
00072         bool                            grabExclusiveAccess(bool Grab); 
00073         bool                            processEvent();                 
00074         bool                            remapKey(int CurCode, int NewCode); 
00075         void                            setMinimumTimeBetweenEvents(float Seconds); 
00076         void                            setSendNullEvents(bool SendNull); 
00077 
00078         // construction / deconstruction
00079         GizmoLinuxInputDevice();                                        
00080         GizmoLinuxInputDevice(const H::DeviceInfo & DeviceInfo);        
00081         virtual ~GizmoLinuxInputDevice();                               
00082 
00083         // static public functions
00084         static void                     buildInputEventsVectorFromBuffer(std::vector<struct input_event> & EventVector, H::DynamicBuffer<char> const & Buffer); 
00085 
00086 protected:
00087         // protected functions
00088         
00089         // protected member variables
00090         H::DeviceInfo                   mDeviceInfo;                    
00091         unsigned long                   mLastEventTime;                 
00092         unsigned long                   mMinTimeBetweenEvents;          
00093         bool                            mSendNullEvents;                
00094         
00095 private:
00096         // private functions
00097         
00098         // private member variables
00099         
00100 private: 
00101         // serialization
00102         friend class boost::serialization::access;
00103         template<class Archive>
00104         void serialize(Archive & ar, const unsigned int version) {
00105                 ar & mDeviceInfo;
00106                 ar & mLastEventTime;
00107                 ar & mMinTimeBetweenEvents;
00108                 ar & mSendNullEvents;
00109         }                       
00110 };
00111 
00113 
00114 } // Gizmod namespace
00115 
00116 #endif // __GizmoLinuxInputDevice_h

Generated on Wed Nov 7 10:04:16 2007 for gizmod by  doxygen 1.5.3