![]() |
peripherals
1.4.2
RoadNarrows Robotics Hardware Peripherals Package
|
Input Human Interface Device Abstract Base Class. More...
#include <HID.h>
Public Types | |
| typedef std::map< int, int > | FeatMap_T |
| device feature id - mnemonic map More... | |
Public Member Functions | |
| HIDInput (HIDClass eHIDClass=HIDClassUnknown) | |
| Default initialization constructor. More... | |
| virtual | ~HIDInput () |
| Destructor. More... | |
| virtual int | open ()=0 |
| Open connection to HID. More... | |
| virtual int | close ()=0 |
| Close connection to HID. More... | |
| virtual int | update (uint_t uMSec=T_UPDATE_DFT)=0 |
| Read device and update HID state. More... | |
| virtual HIDClass | getHIDClass () |
| Get the HID class. More... | |
| virtual bool | isConnected () |
| Query if HID is connected. More... | |
| virtual bool | isLinked () |
| Query if HID is linked. More... | |
| virtual int | assocFeature (int iFeatId, int iMnem) |
| Associate user mnemonic to the device feature (e.g. button) id. More... | |
| virtual int | getFeatureVal (int iMnem)=0 |
| Get the value associated with the mapped user mnemonic. More... | |
| virtual int | setFeatureVal (int iMnem, int nVal)=0 |
| Set the value associated with the mapped user mnemonic. More... | |
| virtual int | getFeatureProp (int iMnem, HIDFeatType &eFeatType, int &nDir, int &nMin, int &nMax, int &nStep)=0 |
| Get the feature properties. More... | |
| virtual void * | getCurrentState () |
| Get the current full state of the device. More... | |
| virtual bool | ping () |
| Ping device if it is connected and is responding. More... | |
| virtual bool | isFatal () const |
| Test to see if HID is in a fatal errored state. More... | |
| virtual int | getError () const |
| Get the last HID-specific error number. More... | |
| virtual const char * | getStrError (int nError) const |
| Get the string associated with the error number. More... | |
| virtual std::string | getProdName () |
| Get HID product name. More... | |
Static Public Attributes | |
| static const int | MNEM_START = 1024 |
| user mapped mnemonic starting index More... | |
| static const int | T_UPDATE_DFT = 33 |
| default update timeout (msec) More... | |
Protected Member Functions | |
| virtual void | setConnectionState (bool bNewState) |
| Set connection state. More... | |
| virtual void | setLinkState (bool bNewState) |
| Set new link state. More... | |
Protected Attributes | |
| HIDClass | m_eHIDClass |
| actual HID class More... | |
| std::string | m_strProdName |
| product name More... | |
| bool | m_bIsConnected |
| HID is [not] physically connected. More... | |
| bool | m_bIsLinked |
| HID is [not] linked and communicating. More... | |
| int | m_nError |
| last error number (HID specific) More... | |
| bool | m_bFatal |
| HID is [not] in a fatal condition. More... | |
| FeatMap_T | m_featMap |
| feature-userid association map More... | |
| typedef std::map<int, int> rnr::HIDInput::FeatMap_T |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Associate user mnemonic to the device feature (e.g. button) id.
| iFeatId | Device-specific feature id (or previous mnemonic). |
| iMnem | User-specific mnemonic. |
Definition at line 184 of file HID.h.
References getFeatureProp(), getFeatureVal(), m_featMap, and setFeatureVal().
Referenced by testXboxInput(), testXboxLED(), and testXboxRumble().
|
pure virtual |
Close connection to HID.
Implemented in rnr::HIDXbox360.
Referenced by ~HIDInput().
|
inlinevirtual |
Get the current full state of the device.
Reimplemented in rnr::HIDXbox360.
|
inlinevirtual |
|
pure virtual |
Get the feature properties.
| iMnem | User-specific mnemonic. | |
| [out] | eFeatType | Feature property type. |
| [out] | nDir | Feature is an input (HID_FEAT_INPUT) to host and/or an output (HID_FEAT_OUTPUT) to device. |
| [out] | nMin | Feature minimum value. |
| [out] | nMax | Feature maximum value. |
| [out] | nStep | Feature step size between [min,max] |
Implemented in rnr::HIDXbox360.
Referenced by assocFeature().
|
pure virtual |
Get the value associated with the mapped user mnemonic.
| iMnem | User-specific mnemonic. |
Implemented in rnr::HIDXbox360.
Referenced by assocFeature().
|
inlinevirtual |
Get the HID class.
Definition at line 160 of file HID.h.
References m_eHIDClass.
|
inlinevirtual |
Get HID product name.
Definition at line 289 of file HID.h.
References m_strProdName.
|
inlinevirtual |
Get the string associated with the error number.
| nError | HID-specific error number. |
Reimplemented in rnr::HIDXbox360.
|
inlinevirtual |
Query if HID is connected.
Definition at line 167 of file HID.h.
References m_bIsConnected.
Referenced by main(), testXboxSanity(), and rnr::HIDXbox360::updateThread().
|
inlinevirtual |
|
inlinevirtual |
Query if HID is linked.
Definition at line 174 of file HID.h.
References m_bIsLinked.
|
pure virtual |
Open connection to HID.
Implemented in rnr::HIDXbox360.
Referenced by ~HIDInput().
|
inlinevirtual |
Ping device if it is connected and is responding.
Reimplemented in rnr::HIDXbox360.
|
inlineprotectedvirtual |
Set connection state.
| bNewState | New connection state. |
Definition at line 308 of file HID.h.
References setLinkState().
Referenced by rnr::HIDXbox360::close(), rnr::HIDXbox360::open(), rnr::HIDXbox360::transferCallbackInput(), rnr::HIDXbox360::transferCallbackLED(), and rnr::HIDXbox360::transferCallbackRumble().
|
pure virtual |
Set the value associated with the mapped user mnemonic.
| iMnem | User-specific mnemonic. | |
| [in] | nVal | New input HID output value (e.g.LED). Meaning is specific to input. |
Implemented in rnr::HIDXbox360.
Referenced by assocFeature().
|
inlineprotectedvirtual |
Set new link state.
| bNewState | New link state. |
Reimplemented in rnr::HIDXbox360.
Definition at line 326 of file HID.h.
Referenced by setConnectionState(), and rnr::HIDXbox360::setLinkState().
|
pure virtual |
Read device and update HID state.
| uMSec | Block wait at most the given milliseconds for events. If zero, then update() will handle any already-pending events and then immediately return (non-blocking). Otherwise, if no events are currently pending, update() will block waiting for events for up specified timeout. If an event arrives update() will return early. |
Implemented in rnr::HIDXbox360.
Referenced by ~HIDInput().
|
protected |
HID is [not] in a fatal condition.
Definition at line 300 of file HID.h.
Referenced by rnr::HIDXbox360::close(), rnr::HIDXbox360::HIDXbox360(), isFatal(), and rnr::HIDXbox360::open().
|
protected |
HID is [not] physically connected.
Definition at line 297 of file HID.h.
Referenced by isConnected(), rnr::HIDXbox360::update(), and rnr::HIDXbox360::~HIDXbox360().
|
protected |
HID is [not] linked and communicating.
Definition at line 298 of file HID.h.
Referenced by rnr::HIDXbox360::checkErrorThresholds(), rnr::HIDXbox360::debugPrintState(), isLinked(), rnr::HIDXbox360::parseWireless(), rnr::HIDXbox360::ping(), rnr::HIDXbox360::setLED(), rnr::HIDXbox360::setLinkState(), rnr::HIDXbox360::setRumble(), and rnr::HIDXbox360::transferCallbackInput().
|
protected |
|
protected |
feature-userid association map
Definition at line 301 of file HID.h.
Referenced by assocFeature(), rnr::HIDXbox360::getFeatureProp(), rnr::HIDXbox360::getFeatureVal(), rnr::HIDXbox360::HIDXbox360(), and rnr::HIDXbox360::setFeatureVal().
|
protected |
last error number (HID specific)
Definition at line 299 of file HID.h.
Referenced by rnr::HIDXbox360::claimXboxInterfaces(), rnr::HIDXbox360::close(), getError(), rnr::HIDXbox360::HIDXbox360(), rnr::HIDXbox360::initTransferPkts(), rnr::HIDXbox360::open(), rnr::HIDXbox360::openXbox(), rnr::HIDXbox360::setLED(), rnr::HIDXbox360::setRumble(), rnr::HIDXbox360::submitReadTransfer(), and rnr::HIDXbox360::update().
|
protected |
|
static |
user mapped mnemonic starting index
Definition at line 103 of file HID.h.
Referenced by testXboxInput(), testXboxLED(), and testXboxRumble().
|
static |
default update timeout (msec)
Definition at line 104 of file HID.h.
Referenced by rnr::HIDXbox360::getStrError().