BAOS SDK v2  1.2.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
Loading...
Searching...
No Matches
wz::baos Namespace Reference

Global BAOS sdk namespace. More...

Namespaces

namespace  protocol
 Groups BAOS binary protocol specific types , defines and classes for Indications, Responses etc.
 

Classes

class  BaosConnection
 Represents a connection to a BAOS device. More...
 
class  BaosDevice
 This class represents a BAOS device. More...
 
struct  ConnectionEvent
 
struct  DatapointConfig
 Information about a datapoint object. More...
 
struct  DeviceClassConfig
 Configuration options for the cpp device class behaviour. More...
 
struct  DeviceConfigInfo
 A collection of fields representing those serveritems which may change if the configuration of the device is changed. More...
 
struct  DeviceGroupIdentifier
 Unique identifier for a device. More...
 
struct  DeviceMeta
 Meta information about a device group, which is required be the device class. More...
 
struct  DeviceRuntimeInfo
 A collection of fields representing those serveritems which may change during "normal" operation of the device. More...
 
struct  DeviceStaticInfo
 A collection of fields representing those serveritems which won't ever change in a device. More...
 
class  IOEvent
 Represents an IOEvent. More...
 

Typedefs

using Buffer = std::vector< std::uint8_t >
 An alias type for a byte buffer.
 
using BaosMsgQueue = wzcpp::ConcurrentDeque< IOEvent >
 Alias for a concurrent queue with IOEvents.
 
using TransportMsgQueue = wzcpp::ConcurrentDeque< IOEvent >
 Alias for a concurrent queue with IOEvents used by the transport layer.
 
using BaosConnection_UPtr = std::unique_ptr< BaosConnection >
 Alias for a std::unique pointer of a BaosConnection.
 
using DatapointConfigurations = std::map< std::uint16_t, DatapointConfig >
 
using DevicesMeta = std::map< DeviceGroupIdentifier, DeviceMeta >
 Maps the unqiue device identifier to an metainformation entry.
 
using LOGLEVEL = unsigned int
 

Enumerations

enum class  BaosParseStatus {
  Success ,
  SizeMismatch ,
  InvalidKnxHeader ,
  InvalidConnectionHeader ,
  InvalidMsgData ,
  InvalidMainService ,
  InvalidSubService ,
  UnknownIndicationType ,
  MalformedResponse
}
 The different result type of the BAOS binary parsing operation.
 
enum class  ServerItemReadStrategy : std::uint8_t {
  METADATAREAD ,
  METADATAREADWITHFALLBACK ,
  ALLATONCE
}
 Strategy type on how to handle reading the serveritems. More...
 
enum class  ErrorCodes {
  BaosError = 2 ,
  SocketError = 3 ,
  AddressResolveError = 4 ,
  TCPConnectionError = 5 ,
  TCPConnectionClosed = 6 ,
  SocketRecvError = 7 ,
  SocketSendError = 8 ,
  SocketInitError = 9 ,
  SocketRxBufferToSmall = 10 ,
  ResponseError = 20 ,
  ResponseTimeoutError = 21 ,
  MaleformedTelegram = 22 ,
  ConnectResponseTimeoutError = 23 ,
  GenericSecurityError = 30 ,
  AuthenticationFailedError = 31 ,
  DeviceAuthenticationCodeInvalidError = 32 ,
  UnauthenticatedError = 33 ,
  ReceivedSessionKeepAliveError = 34 ,
  ClosedSecuritySessionError = 35 ,
  ClosedConnection = 51 ,
  StoppedConnection = 52
}
 Custom error codes for each exception. More...
 

Functions

std::string BAOSLIB_EXPORT parseStatusToString (BaosParseStatus parseStatus)
 Human readable string of the parse status.
 
BAOSLIB_EXPORT std::string toString (ConnectionEvent::Type type)
 
BAOSLIB_EXPORT std::string toString (IOEvent::Type typ)
 Provides a human readable string for an IOEvent type.
 
BAOSLIB_EXPORT std::uint16_t getAvailableBufferSize (const DeviceStaticInfo &staticInfo, const DeviceConfigInfo &configInfo)
 
BAOSLIB_EXPORT std::uint16_t getAvailablePayloadSize (const DeviceStaticInfo &staticInfo, const DeviceConfigInfo &configInfo)
 
std::string BAOSLIB_EXPORT toString (const DatapointConfig &config)
 Convert to human readable string.
 
BAOSLIB_EXPORT std::optional< std::uint16_t > getAvailableBufferSizeFromMeta (const wzcpp::SixByteArray &hardwareType)
 
 DECLARE_WZ_EXCEPTION (WzBaosException, ErrorCodes::BaosError, wzcpp::error::WzBaseException)
 Generic exception from this SDK.
 
 DECLARE_WZ_EXCEPTION (WzSocketException, ErrorCodes::SocketError, WzBaosException)
 Thrown if errors occur in the underlying sockets.
 
 DECLARE_WZ_EXCEPTION (WzIpAddressResolveException, ErrorCodes::AddressResolveError, WzSocketException)
 Thrown if the ip address could not be resolved.
 
 DECLARE_WZ_EXCEPTION (WzTCPConnectionException, ErrorCodes::TCPConnectionError, WzSocketException)
 Thrown for error during establishing of the TCP connection.
 
 DECLARE_WZ_EXCEPTION (WzTCPConnectionClosedException, ErrorCodes::TCPConnectionClosed, WzSocketException)
 Thrown if the TCP connection is unexpectely closed.
 
 DECLARE_WZ_EXCEPTION (WzRecvException, ErrorCodes::SocketRecvError, WzSocketException)
 Thrown on error during a read on a socket.
 
 DECLARE_WZ_EXCEPTION (WzSendException, ErrorCodes::SocketSendError, WzSocketException)
 Thrown on error during a send to a socket.
 
 DECLARE_WZ_EXCEPTION (WzSocketInitException, ErrorCodes::SocketInitError, WzSocketException)
 Thrown if creation or initialization of the socket failed.
 
 DECLARE_WZ_EXCEPTION (WzRxBufferOverflowException, ErrorCodes::SocketRxBufferToSmall, WzSocketException)
 
 DECLARE_WZ_EXCEPTION (WzMaleformedTelegramException, ErrorCodes::MaleformedTelegram, WzBaosException)
 Thrown if incoming telegrams are not wellformed.
 
 DECLARE_WZ_EXCEPTION (WzResponseException, ErrorCodes::ResponseError, WzBaosException)
 Thrown if the response contains an errorcode other then success.
 
 DECLARE_WZ_EXCEPTION (WzResponseTimeoutException, ErrorCodes::ResponseTimeoutError, WzBaosException)
 Thrown if an expected response was not received in time.
 
 DECLARE_WZ_EXCEPTION (WzConnectResponseTimeoutException, ErrorCodes::ConnectResponseTimeoutError, WzBaosException)
 Thrown if a layer connect response (e.g. Connect.res) was not received in time.
 
 DECLARE_WZ_EXCEPTION (WzClosedConnectionException, ErrorCodes::ClosedConnection, WzBaosException)
 Thrown if the connection was not open for some task.
 
 DECLARE_WZ_EXCEPTION (WzStoppedConnectionException, ErrorCodes::StoppedConnection, WzBaosException)
 Thrown if attempted to open a connection which underlying system is not running.
 
 DECLARE_WZ_EXCEPTION (WzGenericSecurityException, ErrorCodes::GenericSecurityError, WzBaosException)
 Thrown if a generic security error occurs.
 
 DECLARE_WZ_EXCEPTION (WzAuthenticationFailedException, ErrorCodes::AuthenticationFailedError, WzGenericSecurityException)
 Thrown if the authentication failed.
 
 DECLARE_WZ_EXCEPTION (DeviceAuthenticationCodeInvalidException, ErrorCodes::DeviceAuthenticationCodeInvalidError, WzGenericSecurityException)
 Thrown if the d evice authentication code is invalid.
 
 DECLARE_WZ_EXCEPTION (WzUnauthenticatedException, ErrorCodes::UnauthenticatedError, WzGenericSecurityException)
 Thrown if the security session is unauthenticated.
 
 DECLARE_WZ_EXCEPTION (WzReceivedSessionKeepAliveException, ErrorCodes::ReceivedSessionKeepAliveError, WzGenericSecurityException)
 Thrown if a session keep alive was received.
 
 DECLARE_WZ_EXCEPTION (WzClosedSecuritySessionException, ErrorCodes::ClosedSecuritySessionError, WzGenericSecurityException)
 Thrown if the security session is closed.
 
BAOSLIB_EXPORT void setBaosLogLevel (wz::baos::LogLevel level)
 

Variables

constexpr std::uint16_t MAX_TELEGRAM_LENGTH {4096}
 The maximum supported length for one BAOS telegram.
 
enum BAOSLIB_EXPORT LogLevel
 
enum BAOSLIB_EXPORT debug = 1
 
enum BAOSLIB_EXPORT info = 2
 
enum BAOSLIB_EXPORT notice = 3
 
enum BAOSLIB_EXPORT warn = 4
 
enum BAOSLIB_EXPORT error = 5
 
enum BAOSLIB_EXPORT critical = 6
 
enum BAOSLIB_EXPORT fatal = 7
 
enum BAOSLIB_EXPORT off
 

Detailed Description

Global BAOS sdk namespace.

Append it to the wz::baos root namespace e.g. wz::baos::format("Hello, world!\n");

Typedef Documentation

◆ DatapointConfigurations

using DatapointConfigurations = std::map<std::uint16_t, DatapointConfig>

A map with the datapoint ids as keys and the DatapointConfig struct as values

Enumeration Type Documentation

◆ ServerItemReadStrategy

enum class ServerItemReadStrategy : std::uint8_t
strong

Strategy type on how to handle reading the serveritems.

Enumerator
METADATAREAD 

Read the information for DeviceGroupIdentifier first an then rely on the metadata provided in DevicesMeta.h to read the remaining serveritems

METADATAREADWITHFALLBACK 

The same as METADATAREAD but instead of throwing an exception if no meta data is available a fallback to read ALLATONCE is executed

ALLATONCE 

Read from first to std::uint16_t Max serveritems.

◆ ErrorCodes

enum class ErrorCodes
strong

Custom error codes for each exception.

Each custom exception has it's own error code. The reasoning behind this is that when creating wrapper around this code for other languages like C, that do not support exceptions its easy to catch the SDK exceptions extract the errorcode and forward it.

Function Documentation

◆ toString()

BAOSLIB_EXPORT std::string toString ( IOEvent::Type  typ)

Provides a human readable string for an IOEvent type.

Parameters
typThe IOEvent type
Returns
std::string

◆ getAvailableBufferSize()

BAOSLIB_EXPORT std::uint16_t getAvailableBufferSize ( const DeviceStaticInfo &  staticInfo,
const DeviceConfigInfo &  configInfo 
)

The current available length for a whole BAOS telegram with header for transport

◆ getAvailablePayloadSize()

BAOSLIB_EXPORT std::uint16_t getAvailablePayloadSize ( const DeviceStaticInfo &  staticInfo,
const DeviceConfigInfo &  configInfo 
)

The current available length for a BAOS telegram

◆ getAvailableBufferSizeFromMeta()

BAOSLIB_EXPORT std::optional< std::uint16_t > getAvailableBufferSizeFromMeta ( const wzcpp::SixByteArray &  hardwareType)

The current available length for a whole BAOS telegram with header for transport

◆ DECLARE_WZ_EXCEPTION()

DECLARE_WZ_EXCEPTION ( WzRxBufferOverflowException  ,
ErrorCodes::SocketRxBufferToSmall  ,
WzSocketException   
)

Thrown if the incoming telegram is to big for the buffer. The buffer size is defined in MAX_TELEGRAM_LENGTH

◆ setBaosLogLevel()

Variable Documentation

◆ off

enum BAOSLIB_EXPORT off
Initial value:
= 8
}