FREEDM DGI
|
Physical adapter device interface that stores settings in itself. More...
#include <CFakeAdapter.hpp>
Public Types | |
typedef boost::shared_ptr< CFakeAdapter > | Pointer |
Type of a fake adapter pointer. More... | |
Public Member Functions | |
std::set< std::string > | GetDevices () const |
Get the list of registered device names. More... | |
SignalValue | GetState (const std::string device, const std::string key) const |
Retrieves a value from a device. More... | |
void | RegisterDevice (const std::string devid) |
Register a device name with the adapter. More... | |
void | SetCommand (const std::string device, const std::string key, const SignalValue value) |
Sets a value on a device. More... | |
void | Start () |
Start the fake adapter. More... | |
void | Stop () |
Stop the fake adapter. More... | |
Static Public Member Functions | |
static Pointer | Create () |
Creates a new fake adapter. More... | |
Protected Member Functions | |
void | RevealDevices () |
Reveals devices in the device manager. More... | |
Private Types | |
typedef std::map< std::string, KeyMap > | DeviceMap |
Map of devices of KeyMaps. More... | |
typedef std::map< std::string, SignalValue > | KeyMap |
Map of device setting keys to values. More... | |
Private Member Functions | |
CFakeAdapter () | |
Constructor. More... | |
Private Attributes | |
DeviceMap | m_registry |
Registry of device keys and values. More... | |
boost::mutex | m_stopMutex |
Protects m_stopped. More... | |
bool | m_stopped |
Is the adapter stopped? More... | |
Physical adapter device interface that stores device settings in itself and updates them immediately when receiving commands. This class is used when no "real" adapter is desired.
|
private |
|
private |
typedef boost::shared_ptr<CFakeAdapter> freedm::broker::device::CFakeAdapter::Pointer |
|
private |
|
static |
Creates a new fake device adapter adapter.
|
inherited |
Accessor function for the registered device set.
|
virtual |
Sets the value of a device's setting. If the device is not currently registered with the adapter, it is added. If the setting does not currently exist, it is added with a default value of 0.0
device | the unique identifier of the target device. |
key | the desired setting on the target device. |
Implements freedm::broker::device::IAdapter.
|
inherited |
Adds a device name to the registered device set.
devid | The name of the device to register. |
|
protectedinherited |
Reveals the associated devices in the device manager.
|
virtual |
Sets the value of a device's setting. The set occurs immediately. If the adapter has been stopped, nothing happens.
device | the unique identifier of the target device. |
key | the desired setting on the target device. |
value | the new value for the setting to take. |
Implements freedm::broker::device::IAdapter.
|
virtual |
Starts the fake adapter. Reveals the adapter's devices to the device manager.
Implements freedm::broker::device::IAdapter.
|
virtual |
Stops the fake adapter. (Makes sets fail.) Thread-safe.
Implements freedm::broker::device::IAdapter.
|
mutableprivate |
|
private |
|
private |