#include <gadget/Type/CommandProxy.h>
Inheritance diagram for gadget::CommandProxy:


Public Member Functions | |
| virtual void | updateData () |
| virtual vpr::Interval | getTimeStamp () const |
| Returns the time of the last update. | |
| int | getData () const |
| Gets the command data. | |
| CommandData * | getCommandData () |
| Command * | getCommandPtr () |
| Returns a pointer to the gadget::Command object that we are proxying. | |
| int | getUnit () const |
| Returns the unit index into the string speech recognition device from which this proxy is reading data. | |
| bool | config (jccl::ConfigElementPtr element) |
| Configures the proxy. | |
| virtual Input * | getProxiedInputDevice () |
| Returns a pointer to the base class of the devices being proxied. | |
Static Public Member Functions | |
| static std::string | getElementType () |
| Returns the string rep of the element type used to config this device. | |
A command proxy always points to a command-oriented device and unit number within that device. The Input Manager can therefore keep an array of these around and treat them as command devices that only return a single sub-device's amount of data (one int).
Definition at line 55 of file CommandProxy.h.
| gadget::CommandProxy::CommandProxy | ( | ) | [inline] |
| virtual gadget::CommandProxy::~CommandProxy | ( | ) | [inline, virtual] |
| gadget::CommandProxy::CommandProxy | ( | ) | [inline] |
| virtual gadget::CommandProxy::~CommandProxy | ( | ) | [inline, virtual] |
| void gadget::CommandProxy::updateData | ( | ) | [virtual] |
Reimplemented from gadget::Proxy.
Definition at line 66 of file CommandProxy.cpp.
References getProxiedInputDevice(), gadget::Proxy::isStupefied(), gadget::TypedProxy< DEV_TYPE >::mTypedDevice, and gadget::Input::updateDataIfNeeded().
00067 { 00068 if (!isStupefied()) 00069 { 00070 // Make sure dependencies are updated. 00071 getProxiedInputDevice()->updateDataIfNeeded(); 00072 mData = mTypedDevice->getCommandData(mUnitNum); 00073 } 00074 }
| virtual vpr::Interval gadget::CommandProxy::getTimeStamp | ( | ) | const [inline, virtual] |
Returns the time of the last update.
Implements gadget::Proxy.
Definition at line 72 of file CommandProxy.h.
| int gadget::CommandProxy::getData | ( | ) | const [inline] |
Gets the command data.
Definition at line 80 of file CommandProxy.h.
00081 { 00082 // If we're stupefied, return 0, return the current command value. 00083 return (isStupefied() ? 0 : mData.getDigital()); 00084 }
| CommandData* gadget::CommandProxy::getCommandData | ( | ) | [inline] |
| Command* gadget::CommandProxy::getCommandPtr | ( | ) | [inline] |
Returns a pointer to the gadget::Command object that we are proxying.
Definition at line 94 of file CommandProxy.h.
00095 { 00096 // If we're stupefied, return NULL. Otherwise, return mTypedDevice. 00097 return (isStupefied() ? NULL : mTypedDevice); 00098 }
| int gadget::CommandProxy::getUnit | ( | ) | const [inline] |
Returns the unit index into the string speech recognition device from which this proxy is reading data.
Definition at line 104 of file CommandProxy.h.
| std::string gadget::CommandProxy::getElementType | ( | ) | [static] |
Returns the string rep of the element type used to config this device.
Used by the Input Manager to find elements that construct devices.
Reimplemented from gadget::Proxy.
Definition at line 41 of file CommandProxy.cpp.
Referenced by config().
| bool gadget::CommandProxy::config | ( | jccl::ConfigElementPtr | element | ) | [virtual] |
Configures the proxy.
Reimplemented from gadget::Proxy.
Definition at line 46 of file CommandProxy.cpp.
References gadget::Proxy::config(), gadgetDBG_INPUT_MGR(), getElementType(), gadget::TypedProxy< DEV_TYPE >::mDeviceName, and gadget::TypedProxy< DEV_TYPE >::refresh().
00047 { 00048 vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL, 00049 std::string("----------- configuring COMMAND PROXY -----------------\n"), 00050 std::string("----------- exit: configuring command proxy -----------\n")); 00051 00052 vprASSERT(element->getID() == getElementType()); 00053 00054 if( ! Proxy::config(element) ) 00055 { 00056 return false; 00057 } 00058 00059 mUnitNum = element->getProperty<int>("unit"); 00060 mDeviceName = element->getProperty<std::string>("device"); 00061 00062 refresh(); 00063 return true; 00064 }
| virtual Input* gadget::CommandProxy::getProxiedInputDevice | ( | ) | [inline, virtual] |
Returns a pointer to the base class of the devices being proxied.
Implements gadget::Proxy.
Definition at line 113 of file CommandProxy.h.
Referenced by updateData().
00114 { 00115 if((NULL == mTypedDevice) || (mStupefied)) 00116 { 00117 return NULL; 00118 } 00119 00120 Input* ret_val = dynamic_cast<Input*>(mTypedDevice); 00121 vprASSERT((ret_val != NULL) && "Cross-cast in Command failed"); 00122 return ret_val; 00123 }
1.5.1