00001
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "GizmoEventPowermate.hpp"
00030 #include "GizmoLinuxInputDevice.hpp"
00031 #include "../libH/Debug.hpp"
00032 #include "../libH/Exception.hpp"
00033 #include "../libH/Util.hpp"
00034 #include <boost/bind.hpp>
00035
00036 using namespace std;
00037 using namespace boost;
00038 using namespace H;
00039 using namespace Gizmod;
00040
00042
00044
00046
00048
00052 GizmoEventPowermate::GizmoEventPowermate() : GizmoEvent(GIZMO_EVENTCLASS_POWERMATE, false) {
00053 ClickTime = 0.0f;
00054 }
00055
00059 GizmoEventPowermate::GizmoEventPowermate(struct input_event const & InputEvent, bool IsRemote) : GizmoEvent(GIZMO_EVENTCLASS_POWERMATE, IsRemote), GizmoLinuxInputEvent(InputEvent) {
00060 ClickTime = 0.0f;
00061 }
00062
00066 GizmoEventPowermate::~GizmoEventPowermate() {
00067 ClickTime = 0.0f;
00068 }
00069
00071
00073
00080 void GizmoEventPowermate::buildEventsVectorFromBuffer(std::vector< boost::shared_ptr<GizmoEventPowermate> > & EventVector, H::DynamicBuffer<char> const & Buffer, bool SendNullEvents) {
00081 std::vector<struct input_event> InputEvents;
00082 GizmoLinuxInputDevice::buildInputEventsVectorFromBuffer(InputEvents, Buffer);
00083 apply_static_func_args(InputEvents, GizmoEventPowermate::buildEventsVectorFromBufferFunctor, &EventVector, SendNullEvents);
00084 }
00085
00089 void GizmoEventPowermate::buildEventsVectorFromBufferFunctor(struct input_event & InputEvent, std::vector< boost::shared_ptr<GizmoEventPowermate> > * pEventVector, bool SendNullEvents) {
00090 if ( (!SendNullEvents) && (InputEvent.type == 0) && (InputEvent.code == 0) && (InputEvent.value == 0) )
00091 return;
00092 pEventVector->push_back(boost::shared_ptr<GizmoEventPowermate>(new GizmoEventPowermate(InputEvent)));
00093 }