|
BAOS SDK v2
1.2.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
|
Represents a BAOS IP4 device with an underlying TCP connection (with BAOS unsecure connection-oriented) More...
#include <baos/ip/BaosIpv4Device.h>
Inheritance diagram for BaosConOrientedIp4Device:Public Member Functions | |
| BaosConOrientedIp4Device (const std::string &ip4Address, std::uint16_t port=12004) | |
| Construct a new Baos Ip 4 Device object from an ip address and a port. | |
| BaosConnection_UPtr | getConnection () override |
| Pure virtual function to get a BaosConnection to the device. | |
Public Member Functions inherited from BaosIp4Device | |
| BaosIp4Device (const std::string &ip4Address, std::uint16_t port=12004) | |
| Construct a new Baos Ip 4 Device object from an ip address and a port. | |
| void | setConnectionData (const std::string &ip4Address, std::uint16_t port=12004) |
| Explicitly sets the connection data for a Baos Ip 4 Device object from an ip address and a port. | |
| BaosConnection_UPtr | getConnection () override |
| Get a BaosConnection to the device. | |
| void | enableEnsureAutoConnect (bool enable) |
| Enables the option for ensure auto connect in legacy mode (e.g. 774.1 with auto connect mode). The default value is true (enabled). | |
| void | enableVerifyProtocolVersion (bool enable) |
| Enables the option for verify the BAOS binary protocol version. The default value is true (enabled). | |
Public Member Functions inherited from BaosDevice | |
| virtual void | close () |
| ServerItemReadStrategy | setServerItemReadStrategy (ServerItemReadStrategy strategy) |
| Set the strategy to use for reading the serveritems. | |
| bool | enableCaching (bool state) |
| Enable or Disable the internal caching for datapoint and parameter bytes. | |
| bool | isCachingEnabled () const |
| Return the current caching state. | |
| void | clearCaches () |
| Clear the internal caches for datapoints and parameter bytes. | |
| bool | wasCacheHit () |
| Returns if the last request could be statisfied by the cache or not. | |
| std::optional< DeviceMeta > | getMetaInfo () |
| Get the metadata set for this device if available. | |
| void | setMetaInfo (DeviceMeta &&meta) |
| Set the meta data for this device. | |
| void | registerServerItemCallback (ServerItemIndicationCb) |
| Register one or more functions ascallbacks, invoked on serveritem changes. | |
| void | registerDPValueCallback (DatapointValueCb) |
| Register one or more functions ascallbacks, invoked on datapoint value changes. | |
| void | registerConnectionEventCallback (ConnectionEventCb callback) |
| Register one or more functions as callbacks, invoked on connection lifecycle events. | |
| DeviceStaticInfo | getStaticInfo (bool reload=false) |
| Get the information about a connected BAOS device that is never changed. Like serial number. | |
| DeviceConfigInfo | getConfigInfo (bool reload=false) |
| Get the information about a connected BAOS device that is typically only changed during configuration. | |
| DeviceRuntimeInfo | getRuntimeInfo (bool reload=false) |
| Get the information about a connected BAOS device that may change during runtime. | |
| void | setBoolServerItem (protocol::ServerItemId id, bool value) |
| Set the a bool value to a server item. | |
| protocol::ParameterBytes | getParameterBytes (std::uint16_t byteIndex=1, std::uint16_t numberOfBytes=UINT16_MAX, bool reload=false) |
| Get the parameter bytes If caching is enabled, the result of this call will be stored in cache. | |
| protocol::ParameterBytes | getAllParameterBytes (bool reload=false) |
| Load all the parameter bytes and cache them. | |
| std::optional< DatapointConfig > | getDpConfiguration (std::uint16_t dpId=1, bool withDescStrings=true, bool reload=false) |
| Get the datapoint configuration of a single datapoint If caching is enabled, the result of this call will be stored in cache. | |
| DatapointConfigurations | getDpConfigurations (std::uint16_t startDpId=1, std::uint16_t endDpId=UINT16_MAX, bool withDescStrings=true, bool reload=false) |
| Get the datapoint configurations If caching is enabled, the result of this call will be stored in cache. | |
| DatapointConfigurations | getAllDpConfigurations (bool reload=false) |
| Load all the datapoint configurations and cache them. | |
| void | setDpValue (std::uint16_t dpId, Buffer dpData, protocol::DatapointSetCommand command=protocol::DatapointSetCommand::SetNewValueAndSendOnBus) |
| Set the value of a single datapoint. | |
| void | setDpValues (std::map< std::uint16_t, Buffer > &&values, protocol::DatapointSetCommand command=protocol::DatapointSetCommand::SetNewValueAndSendOnBus) |
| Set the value of multiple datapoints. | |
| void | readDpValueFromBus (std::uint16_t dpId) |
| Triggers a read request for the datapoint on the bus. | |
| void | readDpValuesFromBus (std::vector< std::uint16_t > &&dpIds) |
| Triggers read requests for a set of datapoints on the bus. | |
| void | readDpValuesFromBus (const std::vector< std::uint16_t > &dpIds) |
| Triggers read requests for a set of datapoints on the bus. | |
| std::optional< protocol::DatapointValue > | getDpValueRaw (std::uint16_t dpId, bool reload=false) |
| Get the value of a single datapoint as raw bytes. | |
| template<class T > | |
| std::optional< T > | getDatapointValue (std::uint16_t dpId, bool reload=false) |
| Get the value of a single datapoint as type T. | |
| protocol::DatapointValues | getDpValuesRaw (std::vector< std::uint16_t > dpIds, bool reload=false) |
| Get the values of multiple datapoints as raw bytes. | |
| protocol::DatapointValues | getDpValuesRaw (std::uint16_t startDpId, std::uint16_t endDpId, bool reload=false, protocol::DatapointValueFilter filter=protocol::DatapointValueFilter::VALID) |
| Get the values of multiple datapoints as raw bytes. | |
| protocol::DatapointValues | getAllDpValuesRaw (bool reload=false, protocol::DatapointValueFilter filter=protocol::DatapointValueFilter::VALID) |
| Load all the datapoint values and cache them. | |
Additional Inherited Members | |
Public Types inherited from BaosDevice | |
| using | ConnectionEventCb = std::function< void(ConnectionEvent &)> |
| Function signature for connection events callbacks. | |
| using | ServerItemIndicationCb = std::function< void(const protocol::ServerItems &)> |
| The function signature for the callback on changed server items. | |
| using | DatapointValueCb = std::function< void(const protocol::DatapointValues &)> |
| The function signature for the callback on changed datapoint values. | |
Protected Member Functions inherited from BaosDevice | |
| void | ensureConnection () |
| Make sure that a connection to the underlying device exists and is open or throw an exception if this is not possible. | |
| void | onServerItemsUpdate (const protocol::ServerItems &serverItems) |
| An update may occur as a response to a getServerItem request or via an indication. | |
| void | onDpValueUpdate (const protocol::DatapointValueStates &dpValueStates) |
| An update may occur as a response to a getDatapointValue request or via an indication. | |
| void | onConnectionEvent (ConnectionEvent event) |
| Forwarded callback from underlying connection for lifecycle events. | |
| void | clearDeviceConfigs () |
| Reset the device information, retrieved from serveritems and meta data to their default values. | |
| protocol::ServerItems | getAllServerItems () |
| Get all the serveritem values from the device. | |
| template<class TGetter > | |
| auto | getElements (std::uint16_t start, std::uint16_t count, std::uint16_t maxLengthElement, TGetter cb) |
| Helper function to retrieve the elements(datapoint descriptions, string and parameter bytes) from the device. | |
Protected Attributes inherited from BaosIp4Device | |
| std::string | ip4Address_ |
| std::uint16_t | port_ |
| bool | ensureAutoConnect_ {true} |
| bool | verifyProtocolVersion_ {true} |
Protected Attributes inherited from BaosDevice | |
| DeviceClassConfig | config_ |
| Configuration options for this class. | |
| std::optional< DeviceMeta > | metaInfo_ |
| Meta information set by the user. | |
| bool | cacheHit_ {false} |
| Flag to indicate that the last operation could be statisfied with the cache content. | |
| bool | deviceInfoLoaded_ {false} |
| Flag set of the device information is loaded from the device via serveritems. | |
| DeviceStaticInfo | staticInfo_ |
| Static information about the BAOS device. | |
| DeviceConfigInfo | configInfo_ |
| Config information about the BAOS device. | |
| DeviceRuntimeInfo | runtimeInfo_ |
| Runtime information about the BAOS device. | |
| std::map< std::uint16_t, Buffer > | dpCache_ |
| Cache to hold the last valid values for the datapoints. | |
| bool | dpCacheFilled_ {false} |
| Flag to indicate that the cache is valid. | |
| protocol::ParameterBytes | paramBytes_ |
| Cache to hold the parameter bytes. | |
| DatapointConfigurations | dpConfig_ |
| Configuration information about the BAOS datapoints. | |
| std::vector< ServerItemIndicationCb > | serverItemsCallbacks |
| List of registered callback functions. | |
| std::vector< DatapointValueCb > | dpValueCallbacks |
| List of registered callback functions. | |
| std::vector< ConnectionEventCb > | connectionEventCallbacks |
| List of registered connection lifecycle callbacks. | |
| BaosConnection_UPtr | baosCon_ |
| The internal connection used to coomunicate with the BAOS device. | |
Represents a BAOS IP4 device with an underlying TCP connection (with BAOS unsecure connection-oriented)
The connection information like ip address and the port can either be set in the constructor or later with setConnectionData. This has to be done before opening a the connection to the device.
This connection type is supported by BAOS 771 BAOS 772 BAOS 773 BAOS 774 BAOS 777 BAOS 774.1 when configured as auto-connect BAOS 777.1 when configured as auto-connect
| BaosConOrientedIp4Device | ( | const std::string & | ip4Address, |
| std::uint16_t | port = 12004 |
||
| ) |
Construct a new Baos Ip 4 Device object from an ip address and a port.
| ip4Address | The IPv4 Address as string in the form "xxx.xxx.xxx.xxx" |
| port | The tcp port of the remote device |
|
overridevirtual |
Pure virtual function to get a BaosConnection to the device.
Implements BaosDevice.