#include <AnalogProxy.h>
Inheritance diagram for gadget::AnalogProxy:


Public Methods | |
| AnalogProxy () | |
| Constructor. More... | |
| virtual | ~AnalogProxy () |
| virtual void | updateData () |
| Updates the cached data copy from the device. More... | |
| virtual vpr::Interval | getTimeStamp () const |
| Returns time of last update. More... | |
| float | getData () const |
| Gets the current analog data value. More... | |
| Analog * | getAnalogPtr () |
| int | getUnit () const |
| bool | config (jccl::ConfigElementPtr element) |
| Configures the proxy. More... | |
| virtual Input * | getProxiedInputDevice () |
| Returns a pointer to the base class of the devices being proxied. More... | |
Static Public Methods | |
| std::string | getElementType () |
| Returns the string rep of the element type used to config this device. More... | |
An AnalogProxy always points to an analog device and subUnit number. The inputgroup can therefore keep an array of these around and treat them as analog devices which only return a single subDevice's amount of data. (one float)
Definition at line 60 of file AnalogProxy.h.
|
|
Constructor.
Definition at line 65 of file AnalogProxy.h.
00066 : mUnitNum(-1)
00067 , mData(-1.0f)
00068 {;}
|
|
|
Definition at line 70 of file AnalogProxy.h.
00071 {;}
|
|
|
Updates the cached data copy from the device.
Reimplemented from gadget::Proxy. Definition at line 74 of file AnalogProxy.h.
00075 {
00076 if(!isStupified())
00077 {
00078 mData = mTypedDevice->getAnalogData(mUnitNum);
00079 }
00080 }
|
|
|
Returns time of last update.
Implements gadget::Proxy. Definition at line 83 of file AnalogProxy.h.
00084 {
00085 return mData.getTime();
00086 }
|
|
|
Gets the current analog data value.
Definition at line 92 of file AnalogProxy.h.
00093 {
00094 const float analogDefault(0.0f);
00095 if(isStupified())
00096 {
00097 return analogDefault;
00098 }
00099 else
00100 {
00101 return mData.getAnalog();
00102 }
00103 }
|
|
|
Definition at line 105 of file AnalogProxy.h.
00106 {
00107 if(isStupified())
00108 {
00109 return NULL;
00110 }
00111 else
00112 {
00113 return mTypedDevice;
00114 }
00115 }
|
|
|
Definition at line 117 of file AnalogProxy.h.
00118 {
00119 return mUnitNum;
00120 }
|
|
|
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 AnalogProxy.cpp. Referenced by config.
00042 {
00043 return "analog_proxy";
00044 }
|
|
|
Configures the proxy.
Reimplemented from gadget::Proxy. Definition at line 46 of file AnalogProxy.cpp. References gadgetDBG_INPUT_MGR, getElementType, gadget::TypedProxy< Analog >::mDeviceName, and gadget::TypedProxy< Analog >::refresh.
00047 {
00048 vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL,
00049 std::string("----------- configuring ANALOG PROXY -----------------\n"),
00050 std::string("----------- exit: configuring analog proxy -----------\n"));
00051 vprASSERT(element->getID() == getElementType());
00052
00053 if ( ! Proxy::config(element) )
00054 {
00055 return false;
00056 }
00057
00058 mUnitNum = element->getProperty<int>("unit");
00059 mDeviceName = element->getProperty<std::string>("device");
00060
00061 refresh(); // Refresh the device now that we have something to point at
00062
00063 return true;
00064 }
|
|
|
Returns a pointer to the base class of the devices being proxied.
Implements gadget::Proxy. Definition at line 126 of file AnalogProxy.h.
00127 {
00128 if((NULL == mTypedDevice) || (mStupified))
00129 {
00130 return NULL;
00131 }
00132
00133 Input* ret_val = dynamic_cast<Input*>(mTypedDevice);
00134 vprASSERT((ret_val != NULL) && "Cross-cast in AnalogProxy failed");
00135 return ret_val;
00136 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002