FREEDM DGI
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
freedm::broker::device::IAdapter Class Referenceabstract

Physical adapter device interface. More...

#include <IAdapter.hpp>

Inheritance diagram for freedm::broker::device::IAdapter:
freedm::broker::device::CFakeAdapter freedm::broker::device::CMqttAdapter freedm::broker::device::IBufferAdapter freedm::broker::device::COpenDssAdapter freedm::broker::device::CPnpAdapter freedm::broker::device::CRtdsAdapter

Public Types

typedef boost::shared_ptr< IAdapterPointer
 Pointer to a physical adapter. More...
 

Public Member Functions

virtual ~IAdapter ()
 Virtual destructor for derived classes. More...
 
std::set< std::string > GetDevices () const
 Get the list of registered device names. More...
 
virtual SignalValue GetState (const std::string device, const std::string signal) const =0
 Retrieves a value from a device. More...
 
void RegisterDevice (const std::string devid)
 Register a device name with the adapter. More...
 
virtual void SetCommand (const std::string device, const std::string signal, const SignalValue value)=0
 Sets a value on a device. More...
 
virtual void Start ()=0
 Starts the adapter. More...
 
virtual void Stop ()=0
 Stops the adapter. Guaranteed to be thread-safe. More...
 

Protected Member Functions

 IAdapter ()
 Constructor. More...
 
void RevealDevices ()
 Reveals devices in the device manager. More...
 

Private Attributes

std::set< std::string > m_devices
 Set of registered device names. More...
 

Detailed Description

Defines the interface each device uses to perform its operations. The concrete adapter is responsible for implementation of both Get and Set functions.

The adapter class is intended to be private to the device subsystem. If you want to access it from outside devices, you are doing something wrong.

Limitations:
Adapters must be shut down via IAdapter::Stop() exactly once before they are destructed in order to ensure correct behavior. An adapter that has been shut down while references to it still exist is basically an empty shell: IAdapter::Get() is guaranteed to return the same value that it did before the adapter was stopped, and IAdapter::Set() is guaranteed to silently fail.

Member Typedef Documentation

Constructor & Destructor Documentation

freedm::broker::device::IAdapter::~IAdapter ( )
virtual

Virtual destructor for derived classes.

Precondition:
None.
Postcondition:
Destructs the object.
Limitations:
None.
freedm::broker::device::IAdapter::IAdapter ( )
protected

Member Function Documentation

std::set< std::string > freedm::broker::device::IAdapter::GetDevices ( ) const

Accessor function for the registered device set.

Precondition:
None.
Postcondition:
Returns m_devices.
Returns
A set of device identifiers.
Limitations:
None.
virtual SignalValue freedm::broker::device::IAdapter::GetState ( const std::string  device,
const std::string  signal 
) const
pure virtual
void freedm::broker::device::IAdapter::RegisterDevice ( const std::string  devid)

Adds a device name to the registered device set.

Precondition:
None.
Postcondition:
Inserts the device name into m_devices.
Parameters
devidThe name of the device to register.
Limitations:
None.
void freedm::broker::device::IAdapter::RevealDevices ( )
protected

Reveals the associated devices in the device manager.

Precondition:
No prior call has been made to this function.
Postcondition:
Calls CDeviceManger::RevealDevice for each known device.
Limitations:
This function can be called at most once.
virtual void freedm::broker::device::IAdapter::SetCommand ( const std::string  device,
const std::string  signal,
const SignalValue  value 
)
pure virtual
virtual void freedm::broker::device::IAdapter::Start ( )
pure virtual
virtual void freedm::broker::device::IAdapter::Stop ( )
pure virtual

Member Data Documentation

std::set<std::string> freedm::broker::device::IAdapter::m_devices
private

The documentation for this class was generated from the following files: