00001
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00049
00050 namespace Gizmod {
00051
00053
00055
00057
00059
00064 class GizmoLinuxInputDevice {
00065 public:
00066
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
00079 GizmoLinuxInputDevice();
00080 GizmoLinuxInputDevice(const H::DeviceInfo & DeviceInfo);
00081 virtual ~GizmoLinuxInputDevice();
00082
00083
00084 static void buildInputEventsVectorFromBuffer(std::vector<struct input_event> & EventVector, H::DynamicBuffer<char> const & Buffer);
00085
00086 protected:
00087
00088
00089
00090 H::DeviceInfo mDeviceInfo;
00091 unsigned long mLastEventTime;
00092 unsigned long mMinTimeBetweenEvents;
00093 bool mSendNullEvents;
00094
00095 private:
00096
00097
00098
00099
00100 private:
00101
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 }
00115
00116 #endif // __GizmoLinuxInputDevice_h