libGizmod/GizmoStandard.cpp

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 #include "GizmoStandard.hpp"
00030 #include "GizmoEventStandard.hpp"
00031 #include "../libH/Debug.hpp"
00032 #include "../libH/Exception.hpp"
00033 #include <boost/shared_ptr.hpp>
00034 
00035 using namespace std;
00036 using namespace boost;
00037 using namespace H;
00038 using namespace Gizmod;
00039 
00041 // Type Defs
00043 
00048 #define GIZMO_STANDARD_TYPE     "Standard"
00049 
00051 // Construction
00053 
00057 GizmoStandard::GizmoStandard(const H::DeviceInfo & deviceInfo, int DeviceID, int DeviceClassID) : Gizmo(GIZMO_CLASS_STANDARD, deviceInfo, DeviceID, DeviceClassID), GizmoLinuxInputDevice(deviceInfo) {
00058 }
00059 
00063 GizmoStandard::GizmoStandard() {
00064 }
00065 
00069 GizmoStandard::~GizmoStandard() {
00070 }
00071 
00073 // Class Body
00075 
00080 std::string GizmoStandard::getType() {
00081         return GIZMO_STANDARD_TYPE;
00082 }
00083 
00089 bool GizmoStandard::processEvent(GizmoEvent * pEvent) {
00090         if (!GizmoLinuxInputDevice::processEvent())
00091                 return false;
00092         
00093         GizmoEventStandard * pStandardEvent = static_cast<GizmoEventStandard *>(pEvent);
00094         
00095         switch (pStandardEvent->Type) {
00096         case EV_KEY:
00097                 setKeyState(pStandardEvent->Code, pStandardEvent->Value);
00098                 break;
00099         default:
00100                 // do nothing
00101                 break;
00102         }
00103         
00104         return true;
00105 }

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