PLCnext API Documentation 25.0.2.69
|
This class is used to store and to manage fieldbus frame buffer objects. More...
#include <DataManager.hpp>
Public Types | |
using | BufferInfo = Arp::Io::Commons::Data::BufferInfo |
using | DataType = Arp::Plc::Meta::Commons::DataType |
using | ArrayDimensions = Arp::Plc::Meta::Commons::Io::PortDefinition::ArrayDimensions |
Public Member Functions | |
DataManager (const DataManager &arg)=delete | |
DataManager (DataManager &&arg) noexcept | |
Default move constructor. | |
DataManager & | operator= (const DataManager &arg)=delete |
DataManager & | operator= (DataManager &&arg) noexcept |
Default move-assignment operator. | |
~DataManager (void) | |
Default destructor. | |
DataManager (const String &componentName, Endianness defaultEndianness) | |
Constructs an DataManager instance. More... | |
Endianness | GetDefaultEndianness (void) const |
Gets the default endianness of the IoComponent. More... | |
bool | IsPlcRunning (void) const |
Checks the current 'PlcState' is 'PlcState::Running'. The method returns at once to false after the real-time tasks are stopped, even before IoComponentBase::StopPlc. More... | |
IoBuffer::Ptr | GetSystemIoBuffer (const String &bufferName) |
Returns a 'SystemIoBuffer' buffer object by given name. Throws exception, if buffer with 'bufferName' could not found. More... | |
bool | TryGetSystemIoBuffer (const String &bufferName, IoBuffer::Ptr &result) |
Tries to return a 'SystemIoBuffer' buffer object by given name. More... | |
IoBuffer::Ptr | GetPlcIoBuffer (const String &bufferName, bool isChanging=false) |
Returns a 'PlcIoBuffer' buffer object by given name. Throws exception, if buffer with 'bufferName' could not found. More... | |
bool | TryGetPlcIoBuffer (const String &bufferName, IoBuffer::Ptr &result, bool isChanging=false) |
Tries to return a 'PlcIoBuffer' buffer object by given name. More... | |
IoBuffer::Ptr | CreateSystemIoBuffer (const BufferInfo &bufferInfo) |
Creates a 'SystemIoBuffer' buffer object. Throws exception, if buffer with 'bufferName' is already added. More... | |
IoBuffer::Ptr | CreatePlcIoBuffer (const BufferInfo &bufferInfo, bool isChanging=false) |
Creates a 'PlcIoBuffer' buffer object. Throws exception, if buffer with 'bufferName' is already added. More... | |
void | RegisterStatusVariable (const String &name, DataType dataType) |
Registers a new status variable. More... | |
void | RegisterStatusVariable (const String &name, DataType dataType, const ArrayDimensions &dimensions) |
Registers a new array status variable. More... | |
void | RegisterBitStatusVariable (const String &name, uint32 bitOffset) |
Registers a new bit status variable. Bit variables always references a specific bit in the last registered (non-bit) status variable. More... | |
byte * | GetStatusVariableAddress (const String &name) const |
Returns a pointer to a status variable. This is only possible after the status variable have been created in SetupConfig. Throws if the variable is unknown os is still not been created. More... | |
Impl & | GetImpl (void) |
For internal use only. | |
const Impl & | GetImpl (void) const |
This class is used to store and to manage fieldbus frame buffer objects.
The DataManager handles different kinds of data buffer objects:
type | description |
---|---|
System buffer | System Io buffers are created during the start up of the firmware. They are created in SetupConfig and are destroyed in ResetConfig. They should be used for all data elements, that are independent of the project. |
Plc frame | Plc Io buffers are created during the setup up of the project. They are created in SetupPlc and are destroyed in ResetPlc. They should be used for all data elements, that are part of the project. |
Status variables | Status variables are used to store global status values of the fieldbus. They are stored in an unsynced internal buffer. They can be accessed without real-time side effects but cannot guarantee data consistency. Status variables should be registered in IoComponentBase::InitializeInternal. They are created in SetupConfig. |
The method IsPlcRunning provides information about the running state of the plc. This method should be polled in the update thread of the IO component. If the method returns false, the IO component should use substitute values and/or stop the communication. After this method returns false it's recommended to send the output data one time more marked as valid and after that mark the output data as invalid. This should ensure, that output data of a stop task / power down task is still sent.
Arp::Io::Commons::DataManager::DataManager | ( | const String & | componentName, |
Endianness | defaultEndianness | ||
) |
Constructs an DataManager instance.
componentName | Name of the component providing the data manager |
defaultEndianness | Default data endianness of the IoComponent |
The DataManager is provided by IoComponentBase and should not be created directly by the IO component
IoBuffer::Ptr Arp::Io::Commons::DataManager::CreatePlcIoBuffer | ( | const BufferInfo & | bufferInfo, |
bool | isChanging = false |
||
) |
Creates a 'PlcIoBuffer' buffer object. Throws exception, if buffer with 'bufferName' is already added.
bufferInfo | Buffer parameter values. |
isChanging | true if the buffer should added in the backgroundDomain, otherwise false . |
IoBuffer::Ptr Arp::Io::Commons::DataManager::CreateSystemIoBuffer | ( | const BufferInfo & | bufferInfo | ) |
Creates a 'SystemIoBuffer' buffer object. Throws exception, if buffer with 'bufferName' is already added.
bufferInfo | Buffer parameter values. |
Endianness Arp::Io::Commons::DataManager::GetDefaultEndianness | ( | void | ) | const |
Gets the default endianness of the IoComponent.
IoBuffer::Ptr Arp::Io::Commons::DataManager::GetPlcIoBuffer | ( | const String & | bufferName, |
bool | isChanging = false |
||
) |
Returns a 'PlcIoBuffer' buffer object by given name. Throws exception, if buffer with 'bufferName' could not found.
bufferName | Name of the buffer object. |
isChanging | true if the buffer of the background domain should be returned, otherwise false . |
byte * Arp::Io::Commons::DataManager::GetStatusVariableAddress | ( | const String & | name | ) | const |
Returns a pointer to a status variable. This is only possible after the status variable have been created in SetupConfig. Throws if the variable is unknown os is still not been created.
name | Name of the status variable |
IoBuffer::Ptr Arp::Io::Commons::DataManager::GetSystemIoBuffer | ( | const String & | bufferName | ) |
Returns a 'SystemIoBuffer' buffer object by given name. Throws exception, if buffer with 'bufferName' could not found.
bufferName | Name of the buffer object. |
bool Arp::Io::Commons::DataManager::IsPlcRunning | ( | void | ) | const |
Checks the current 'PlcState' is 'PlcState::Running'. The method returns at once to false after the real-time tasks are stopped, even before IoComponentBase::StopPlc.
true
if the PLC is in 'PlcState::Running', otherwise false
.void Arp::Io::Commons::DataManager::RegisterBitStatusVariable | ( | const String & | name, |
uint32 | bitOffset | ||
) |
Registers a new bit status variable. Bit variables always references a specific bit in the last registered (non-bit) status variable.
name | Name of the status variable |
bitOffset | Relative bit offset to the last full status variable. |
void Arp::Io::Commons::DataManager::RegisterStatusVariable | ( | const String & | name, |
DataType | dataType | ||
) |
Registers a new status variable.
name | Name of the status variable |
dataTypeInfo | Description of the status variable. |
void Arp::Io::Commons::DataManager::RegisterStatusVariable | ( | const String & | name, |
DataType | dataType, | ||
const ArrayDimensions & | dimensions | ||
) |
Registers a new array status variable.
name | Name of the status variable |
dataTypeInfo | Description of the status variable base type. |
dimensions | Array dimensions |
bool Arp::Io::Commons::DataManager::TryGetPlcIoBuffer | ( | const String & | bufferName, |
IoBuffer::Ptr & | result, | ||
bool | isChanging = false |
||
) |
Tries to return a 'PlcIoBuffer' buffer object by given name.
bufferName | Name of the buffer object. |
result | Returns initialized IoBuffer::Ptr. |
isChanging | true if the buffer of the background domain should be returned, otherwise false . |
true
if buffer was found, otherwise false
.bool Arp::Io::Commons::DataManager::TryGetSystemIoBuffer | ( | const String & | bufferName, |
IoBuffer::Ptr & | result | ||
) |
Tries to return a 'SystemIoBuffer' buffer object by given name.
bufferName | Name of the buffer object. |
result | Returns initialized IoBuffer::Ptr. |
true
if buffer was found, otherwise false
.