#include <DeviceInterface.h>
Inheritance diagram for gadget::BaseDeviceInterface:


Public Methods | |
| BaseDeviceInterface (const BaseDeviceInterface &other) | |
| BaseDeviceInterface () | |
| virtual | ~BaseDeviceInterface () |
| void | init (const std::string proxyName) |
| Initializes the object. More... | |
| virtual void | refresh () |
| NOTE: If the interface does not have an initialized mProxyName, then don't try to refresh it. More... | |
| std::string | getProxyName () |
| Returns the name of the proxy. More... | |
| bool | isConnected () |
Static Public Methods | |
| void | refreshAllDevices () |
Protected Attributes | |
| Proxy * | mProxyPtr |
| Ptr to the proxy. More... | |
| std::string | mProxyName |
| The name of the proxy (or alias) we are looking at. More... | |
| bool | mNameSet |
| Has the user set a name?? More... | |
Wrapper to provide an easier way to access proxy objects from within user applications.
Users can simply declare a local interface variable and use it as a smart_ptr for the proxy.
Definition at line 65 of file DeviceInterface.h.
|
|
Definition at line 68 of file DeviceInterface.h. Referenced by gadget::DeviceInterface< DigitalProxy >::DeviceInterface, and refreshAllDevices.
00069 : mProxyName(other.mProxyName), 00070 mNameSet(other.mNameSet) 00071 { 00072 BaseDeviceInterface::addDevInterface(this); // Keep reference to the interface 00073 } |
|
|
Definition at line 43 of file DeviceInterface.cpp.
00044 : mProxyPtr(NULL), mProxyName("UnInitialized"), mNameSet(false) 00045 { 00046 BaseDeviceInterface::addDevInterface(this); // Keep reference to the interface 00047 } |
|
|
Definition at line 49 of file DeviceInterface.cpp.
00050 {
00051 BaseDeviceInterface::removeDevInterface(this); // Remove it from the list of active interfaces;
00052 }
|
|
|
Initializes the object.
Definition at line 55 of file DeviceInterface.cpp. References mNameSet, mProxyName, and refresh. Referenced by gadget::InputLogger::config.
00056 {
00057 mProxyName = proxyName; // Set the name
00058 mNameSet = true;
00059 refresh(); // Refresh the name
00060 }
|
|
|
NOTE: If the interface does not have an initialized mProxyName, then don't try to refresh it.
Reimplemented in gadget::DeviceInterface. Definition at line 64 of file DeviceInterface.cpp. References mNameSet, mProxyName, and mProxyPtr. Referenced by init.
00065 {
00066 Proxy* prev_proxy_ptr = mProxyPtr; // Keep track of previous value
00067
00068 // If it is not initialized, then don't try
00069 if(!mNameSet)
00070 { return; }
00071
00072 mProxyPtr = InputManager::instance()->getProxy(mProxyName);
00073
00074 if (NULL == mProxyPtr)
00075 {
00076 vprDEBUG(vprDBG_ALL,vprDBG_CONFIG_LVL)
00077 << "WARNING: DeviceInterface::refresh: could not find proxy: "
00078 << mProxyName.c_str() << std::endl << vprDEBUG_FLUSH;
00079 vprDEBUG(vprDBG_ALL,vprDBG_CONFIG_LVL)
00080 << " Make sure the proxy exists in the current configuration."
00081 << std::endl << vprDEBUG_FLUSH;
00082 vprDEBUG(vprDBG_ALL,vprDBG_CONFIG_LVL)
00083 << " referencing device interface will be stupified to point at dummy device."
00084 << std::endl << vprDEBUG_FLUSH;
00085 }
00086 else if((NULL != mProxyPtr) && (NULL == prev_proxy_ptr)) // ASSERT: We have just gotten a valid proxy to point to
00087 {
00088 const int item_width(25+12);
00089 //const int type_width(20);
00090
00091 //vprDEBUG(vprDBG_ALL,vprDBG_CONFIG_STATUS_LVL)
00092 // << "DeviceInterface now able to find proxy: "
00093 // << mProxyName.c_str() << " [ "
00094 // << clrSetNORM(clrGREEN) << "OK" << clrRESET << " ]" << std::endl << vprDEBUG_FLUSH;
00095
00096 //std::string device_name("");
00097 //Input* deviceptr = mProxyPtr->getProxiedInputDevice();
00098 //if (NULL != deviceptr)
00099 //{
00100 // device_name = deviceptr->getInstanceName();
00101 //}
00102
00103 vprDEBUG(vprDBG_ALL,vprDBG_CONFIG_STATUS_LVL)
00104 << "DeviceInterface found proxy: " << std::setiosflags(std::ios::right)
00105 << std::setfill(' ') << std::setw(item_width) << mProxyName
00106 << std::resetiosflags(std::ios::right) << " ";
00107 vprDEBUG_CONTnl(vprDBG_ALL,vprDBG_CONFIG_STATUS_LVL) << "[ " << clrSetNORM(clrGREEN) << "OK" << clrRESET << " ]";
00108 vprDEBUG_CONTnl(vprDBG_ALL,vprDBG_CONFIG_STATUS_LVL) << std::endl << vprDEBUG_FLUSH;
00109 }
00110 }
|
|
|
Returns the name of the proxy.
Definition at line 94 of file DeviceInterface.h.
00095 {
00096 return mProxyName;
00097 }
|
|
|
Definition at line 99 of file DeviceInterface.h.
00100 {
00101 return (NULL != mProxyPtr);
00102 }
|
|
|
Definition at line 127 of file DeviceInterface.cpp. References BaseDeviceInterface.
00128 {
00129 for(unsigned int i=0;i<mAllocatedDevices.size();i++)
00130 {
00131 BaseDeviceInterface* dev = mAllocatedDevices[i];
00132 dev->refresh();
00133 }
00134 }
|
|
|
Ptr to the proxy.
Definition at line 105 of file DeviceInterface.h. Referenced by gadget::DeviceInterface< DigitalProxy >::refresh, and refresh. |
|
|
The name of the proxy (or alias) we are looking at.
Definition at line 106 of file DeviceInterface.h. Referenced by init, gadget::DeviceInterface< DigitalProxy >::refresh, refresh, and gadget::DeviceInterface< DigitalProxy >::setProxy. |
|
|
Has the user set a name??
Definition at line 107 of file DeviceInterface.h. Referenced by init, refresh, and gadget::DeviceInterface< DigitalProxy >::setProxy. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002