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 __GizmoLinuxInputEvent_h 00030 #define __GizmoLinuxInputEvent_h 00031 00032 #if HAVE_CONFIG_H 00033 #include "config.h" 00034 #endif 00035 00036 #include "GizmoKeyDefs.hpp" 00037 #include "../libH/DynamicBuffer.hpp" 00038 #include <linux/input.h> 00039 #include <vector> 00040 #include <boost/archive/text_oarchive.hpp> 00041 #include <boost/archive/text_iarchive.hpp> 00042 00044 // Namespace 00046 00047 namespace Gizmod { 00048 00050 // Typedef, enum's 00052 00057 typedef struct GizmoTimeVal { 00058 unsigned int Seconds; 00059 unsigned int MicroSeconds; 00060 00061 // serialization 00062 friend class boost::serialization::access; 00063 template<class Archive> 00064 void serialize(Archive & ar, const unsigned int version) { 00065 ar & Seconds; 00066 ar & MicroSeconds; 00067 } 00068 }; 00069 00071 // Class Definition 00073 00078 class GizmoLinuxInputEvent { 00079 public: 00080 // public member variables 00081 unsigned short RawType; 00082 unsigned short RawCode; 00083 GizmoTimeVal TimeStamp; 00084 GizmoKey Code; 00085 GizmoEventType Type; 00086 int Value; 00087 00088 // public functions 00089 00090 // construction / deconstruction 00091 GizmoLinuxInputEvent(); 00092 GizmoLinuxInputEvent(struct input_event const & InputEvent); 00093 virtual ~GizmoLinuxInputEvent(); 00094 00095 protected: 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 & RawType; 00106 ar & RawCode; 00107 ar & TimeStamp; 00108 ar & Code; 00109 ar & Type; 00110 ar & Value; 00111 } 00112 }; 00113 00115 00116 } // Gizmod namespace 00117 00118 #endif // __GizmoLinuxInputEvent_h