Gizmod::GizmoLinuxInputDevice Class Reference

Wrapper for functions dealing with Linux Input Event Interface Devices. More...

#include <GizmoLinuxInputDevice.hpp>

Inheritance diagram for Gizmod::GizmoLinuxInputDevice:

Inheritance graph
[legend]
Collaboration diagram for Gizmod::GizmoLinuxInputDevice:

Collaboration graph
[legend]

List of all members.

Public Member Functions

bool createEventPress (int Type, int Code)
 Write a "press" event to the device (two events, with value 1, then 0).
bool createEventPressMod (int Type, int Code, boost::python::object Modifiers)
 Write event to the device with modifiers.
bool createEventRaw (int Type, int Code, int Value)
 Write event to the device.
bool createEvents (int Type, int Code, int Value, int NumWrites)
 Write multiple similar events to the device.
bool getSendNullEvents () const
 Get whether or not the Gizmo sends NULL events.
bool grabExclusiveAccess (bool Grab)
 Grab a device for exlusive access (or ungrab).
bool processEvent ()
 Should we process the event based on the minimum time between events?
bool remapKey (int CurCode, int NewCode)
 Remap a key on the input device.
void setMinimumTimeBetweenEvents (float Seconds)
 Remap a key on the device.
void setSendNullEvents (bool SendNull)
 Set whether or not the Gizmo sends NULL events.
 GizmoLinuxInputDevice ()
 Serialize Constructor.
 GizmoLinuxInputDevice (const H::DeviceInfo &DeviceInfo)
 Default Constructor.
virtual ~GizmoLinuxInputDevice ()
 Destructor.

Static Public Member Functions

static void buildInputEventsVectorFromBuffer (std::vector< struct input_event > &EventVector, H::DynamicBuffer< char > const &Buffer)
 Build an event list from a read buffer.

Protected Attributes

H::DeviceInfo mDeviceInfo
 Info about the device.
unsigned long mLastEventTime
 Time of last event.
unsigned long mMinTimeBetweenEvents
 Minimum time between events (smooth out trigger happy controllers).
bool mSendNullEvents
 Send NULL events if the device creates them?

Friends

class boost::serialization::access


Detailed Description

Wrapper for functions dealing with Linux Input Event Interface Devices.

Definition at line 64 of file GizmoLinuxInputDevice.hpp.


Constructor & Destructor Documentation

GizmoLinuxInputDevice::GizmoLinuxInputDevice (  ) 

Serialize Constructor.

GizmoLinuxInputDevice Serialize Constructor.

Definition at line 69 of file GizmoLinuxInputDevice.cpp.

References mLastEventTime, mMinTimeBetweenEvents, and mSendNullEvents.

GizmoLinuxInputDevice::GizmoLinuxInputDevice ( const H::DeviceInfo DeviceInfo  ) 

Default Constructor.

GizmoLinuxInputDevice Default Constructor.

Definition at line 59 of file GizmoLinuxInputDevice.cpp.

References mDeviceInfo, mLastEventTime, mMinTimeBetweenEvents, and mSendNullEvents.

GizmoLinuxInputDevice::~GizmoLinuxInputDevice (  )  [virtual]

Destructor.

GizmoLinuxInputDevice Destructor.

Definition at line 78 of file GizmoLinuxInputDevice.cpp.


Member Function Documentation

bool GizmoLinuxInputDevice::createEventPress ( int  Type,
int  Code 
)

Write a "press" event to the device (two events, with value 1, then 0).

Create a key press event on the device.

Parameters:
Type GizmoEventType of the event
Code GizmoKey (or other code) of the event
Returns:
True on success
See GizmoKeyDefs.hpp for a list of the available Types, and Codes

This creates two events, to simulate a key press First send event with value 1, then value 0

Note: This is available in Python as createEvent as well as createEventPress

Definition at line 133 of file GizmoLinuxInputDevice.cpp.

References createEventRaw().

bool GizmoLinuxInputDevice::createEventPressMod ( int  Type,
int  Code,
boost::python::object  Modifiers 
)

Write event to the device with modifiers.

Create a key press event on the device plus modifiers.

Parameters:
Type GizmoEventType of the event
Code GizmoKey (or other code) of the event
Modifiers List of modifiers
Returns:
True on success
See GizmoKeyDefs.hpp for a list of the available Types, and Codes

Send modifiers with value 1, then send event with value 1, then value 0, then send modifiers with value 0

Note: This is available in Python as createEvent as well as createEventPress, and createEventPressMod

Definition at line 157 of file GizmoLinuxInputDevice.cpp.

References createEventRaw().

bool GizmoLinuxInputDevice::createEventRaw ( int  Type,
int  Code,
int  Value 
)

Write event to the device.

Create an event on the device.

Parameters:
Type GizmoEventType of the event
Code GizmoKey (or other code) of the event
Value Value of the event
Returns:
True on success
See GizmoKeyDefs.hpp for a list of the available Types, and Codes

The Value field can mean many things, however for key press events a Value of 1 means turn the key "on", and 0 means turn the key "off"

Note: Writes the event, and a NULL event to signal a refresh

Definition at line 108 of file GizmoLinuxInputDevice.cpp.

References H::DeviceInfo::FileDescriptor, and mDeviceInfo.

Referenced by createEventPress(), and createEventPressMod().

bool GizmoLinuxInputDevice::createEvents ( int  Type,
int  Code,
int  Value,
int  NumWrites 
)

Write multiple similar events to the device.

Create multiple events on the device.

Parameters:
Type GizmoEventType of the event
Code GizmoKey (or other code) of the event
Value Value of the event
NumWrites Number of time to write the event (default == 1)
Returns:
True on success
See GizmoKeyDefs.hpp for a list of the available Types, and Codes

The Value field can mean many things, however for key press events a Value of 1 means turn the key "on", and 0 means turn the key "off"

Note: Writes the events, then a NULL event to signal a refresh

Definition at line 189 of file GizmoLinuxInputDevice.cpp.

References H::DeviceInfo::FileDescriptor, and mDeviceInfo.

bool GizmoLinuxInputDevice::getSendNullEvents (  )  const

Get whether or not the Gizmo sends NULL events.

Returns:
True if sends null events

Definition at line 208 of file GizmoLinuxInputDevice.cpp.

References mSendNullEvents.

bool GizmoLinuxInputDevice::grabExclusiveAccess ( bool  Grab  ) 

Grab a device for exlusive access (or ungrab).

Set a device's exlusive access property.

Parameters:
Grab Enable exlusive access if Grab is true
Returns:
True on success
When a device is in exlusive access mode only gizmod will receive events from it. This allows intercepting the events without the rest of the system knowing about them, and they can then be translated into other events by issuing createEvent calls

Definition at line 222 of file GizmoLinuxInputDevice.cpp.

References cdbg, H::DeviceInfo::DeviceName, H::DeviceInfo::FileDescriptor, and mDeviceInfo.

bool GizmoLinuxInputDevice::processEvent (  ) 

Should we process the event based on the minimum time between events?

Returns:
True if we should, false if not

Definition at line 236 of file GizmoLinuxInputDevice.cpp.

References mLastEventTime, and mMinTimeBetweenEvents.

Referenced by Gizmod::GizmoStandard::processEvent(), Gizmod::GizmoPowermate::processEvent(), and Gizmod::GizmoATIX10::processEvent().

bool GizmoLinuxInputDevice::remapKey ( int  CurCode,
int  NewCode 
)

Remap a key on the input device.

Parameters:
CurCode Key to change the mapping of
NewCode New code of the key
Returns:
True on success

Definition at line 249 of file GizmoLinuxInputDevice.cpp.

References cdbg, H::DeviceInfo::DeviceName, H::DeviceInfo::FileDescriptor, and mDeviceInfo.

void GizmoLinuxInputDevice::setMinimumTimeBetweenEvents ( float  Seconds  ) 

Remap a key on the device.

Set the minimum time between events.

Set the minimum time between events

Parameters:
Seconds The time in seconds
This is for remotes that are a bit jittery, or trigger happy. Set this to an appropriate value (issue -V 5 to see the timings)

Definition at line 269 of file GizmoLinuxInputDevice.cpp.

References mMinTimeBetweenEvents.

Referenced by Gizmod::GizmoATIX10::GizmoATIX10().

void GizmoLinuxInputDevice::setSendNullEvents ( bool  SendNull  ) 

Set whether or not the Gizmo sends NULL events.

Parameters:
SendNull Set to true if the device should send NULL events

Definition at line 277 of file GizmoLinuxInputDevice.cpp.

References mSendNullEvents.

void GizmoLinuxInputDevice::buildInputEventsVectorFromBuffer ( std::vector< struct input_event > &  EventVector,
H::DynamicBuffer< char > const &  Buffer 
) [static]

Build an event list from a read buffer.

Build an event vector from a read buffer.

Parameters:
EventVector Reference to a vector which will contain the results
Buffer The bufer to convert into events

Definition at line 90 of file GizmoLinuxInputDevice.cpp.

Referenced by Gizmod::GizmoEventStandard::buildEventsVectorFromBuffer(), Gizmod::GizmoEventPowermate::buildEventsVectorFromBuffer(), and Gizmod::GizmoEventATIX10::buildEventsVectorFromBuffer().


The documentation for this class was generated from the following files:
Generated on Wed Nov 7 10:07:06 2007 for gizmod by  doxygen 1.5.3