Buffer adapter device interface.
More...
#include <IBufferAdapter.hpp>
Defines the interface used by adapters that need send and receive buffers to communicate with an external host.
- Limitations:
- None.
freedm::broker::device::IBufferAdapter::~IBufferAdapter |
( |
| ) |
|
|
virtual |
Virtual destructor made available for derived classes.
- Precondition:
- None.
- Postcondition:
- Destructs the object.
- Limitations:
- None.
freedm::broker::device::IBufferAdapter::IBufferAdapter |
( |
| ) |
|
|
protected |
std::set< std::string > freedm::broker::device::IAdapter::GetDevices |
( |
| ) |
const |
|
inherited |
Accessor function for the registered device set.
- Precondition:
- None.
- Postcondition:
- Returns m_devices.
- Returns
- A set of device identifiers.
- Limitations:
- None.
SignalValue freedm::broker::device::IBufferAdapter::GetState |
( |
const std::string |
device, |
|
|
const std::string |
signal |
|
) |
| const |
|
virtual |
Read the specified value from the rxBuffer.
- Error Handling:
- Throws std::exception if the value cannot be found.
- Precondition:
- The passed signal must be recognized by the adapter.
- Postcondition:
- Returns the value of the signal stored in m_rxBuffer.
- Parameters
-
device | The unique identifier of a physical device. |
signal | A power electronic reading related to the device. |
- Returns
- SignalValue from the rxBuffer.
- Limitations:
- None.
Implements freedm::broker::device::IAdapter.
void freedm::broker::device::IBufferAdapter::RegisterCommandInfo |
( |
const std::string |
device, |
|
|
const std::string |
signal, |
|
|
const std::size_t |
index |
|
) |
| |
Registers a new device signal as command information with the adapter.
- Error Handling:
- Throws a std::runtime_error if the device signal is invalid or already registered with the adapter.
- Precondition:
- The parameters must not be empty.
- Precondition:
- The device signal must not already be registered.
- Precondition:
- The index must not be registered with another signal.
- Postcondition:
- m_commandInfo is updated to store the new device signal.
- Parameters
-
device | The unique identifier of the device to register. |
signal | The signal of the device that will be registered. |
index | The numeric index associated with the device signal. |
- Limitations:
- None.
void freedm::broker::device::IAdapter::RegisterDevice |
( |
const std::string |
devid | ) |
|
|
inherited |
Adds a device name to the registered device set.
- Precondition:
- None.
- Postcondition:
- Inserts the device name into m_devices.
- Parameters
-
devid | The name of the device to register. |
- Limitations:
- None.
void freedm::broker::device::IBufferAdapter::RegisterStateInfo |
( |
const std::string |
device, |
|
|
const std::string |
signal, |
|
|
const std::size_t |
index |
|
) |
| |
Registers a new device signal as state information with the adapter.
- Error Handling:
- Throws a std::runtime_error if the device signal is invalid or already registered with the adapter.
- Precondition:
- The parameters must not be empty.
- Precondition:
- The device signal must not already be registered.
- Precondition:
- The index must not be registered with another signal.
- Postcondition:
- m_stateInfo is updated to store the new device signal.
- Parameters
-
device | The unique identifier of the device to register. |
signal | The signal of the device that will be registered. |
index | The numeric index associated with the device signal. |
- Limitations:
- None.
void freedm::broker::device::IAdapter::RevealDevices |
( |
| ) |
|
|
protectedinherited |
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.
void freedm::broker::device::IBufferAdapter::SetCommand |
( |
const std::string |
device, |
|
|
const std::string |
signal, |
|
|
const SignalValue |
value |
|
) |
| |
|
virtual |
Update the specified value in the txBuffer.
- Error Handling:
- Throws std::exception if the value cannot be found.
- Precondition:
- The passed signal must be recognized by the adapter.
- Postcondition:
- Updates the value of the signal in m_txBuffer.
- Parameters
-
device | The unique identifier of a physical device. |
signal | A power electronic reading related to the device. |
value | The desired new value for the device signal. |
- Limitations:
- None.
Implements freedm::broker::device::IAdapter.
void freedm::broker::device::IBufferAdapter::Start |
( |
| ) |
|
|
virtual |
Called when "starting" the adapter, after all devices have been added. Allocates send and receive buffers and performs error-checking on the device specification.
- Precondition:
- The adapter has not yet been started, and buffers have no size.
- Postcondition:
- The adapter has now been started, and buffers have been allocated.
- Error Handling:
- Throws std::runtime_error if the entry indices of the adapter's devices are malformed.
- Limitations:
- All devices must be added to the adapter before Start is invoked.
Implements freedm::broker::device::IAdapter.
virtual void freedm::broker::device::IAdapter::Stop |
( |
| ) |
|
|
pure virtualinherited |
bool freedm::broker::device::IBufferAdapter::m_buffer_initialized |
|
protected |
std::map<const DeviceSignal, const std::size_t> freedm::broker::device::IBufferAdapter::m_commandInfo |
|
protected |
std::vector<SignalValue> freedm::broker::device::IBufferAdapter::m_rxBuffer |
|
protected |
boost::shared_mutex freedm::broker::device::IBufferAdapter::m_rxMutex |
|
mutableprotected |
std::map<const DeviceSignal, const std::size_t> freedm::broker::device::IBufferAdapter::m_stateInfo |
|
protected |
std::vector<SignalValue> freedm::broker::device::IBufferAdapter::m_txBuffer |
|
protected |
boost::shared_mutex freedm::broker::device::IBufferAdapter::m_txMutex |
|
mutableprotected |
The documentation for this class was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/freedm/checkouts/latest/Broker/src/device/IBufferAdapter.hpp
- /home/docs/checkouts/readthedocs.org/user_builds/freedm/checkouts/latest/Broker/src/device/IBufferAdapter.cpp