13 #ifndef __BAOSLIB_DEFINES_H__
14 #define __BAOSLIB_DEFINES_H__
35 std::map<std::uint16_t, DatapointValue>;
98 GetServerItemRequest = 0x01,
99 SetServerItemRequest = 0x02,
100 GetDatapointDescriptionRequest = 0x03,
101 GetDescriptionStringRequest = 0x04,
102 GetDatapointValueRequest = 0x05,
103 SetDatapointValueRequest = 0x06,
104 GetParameterByteRequest = 0x07,
108 GetServerItemResponse = 0x81,
109 SetServerItemResponse = 0x82,
110 GetDatapointDescriptionResponse = 0x83,
111 GetDescriptionStringResponse = 0x84,
112 GetDatapointValueResponse = 0x85,
113 SetDatapointValueResponse = 0x86,
114 GetParameterByteResponse = 0x87,
117 MinIndication = 0xC1,
118 DatapointValueIndication = 0xC1,
119 ServerItemIndication = 0xC2,
120 MaxIndication = 0xC2,
171 enum class DPT : std::uint8_t
268 assert(data.size() >= 2);
269 value_ = data[0] << 8 | data[1];
280 StatusFlags(
bool running,
bool loaded,
bool tl_connected,
bool secure)
340 assert(data.size() >= 2);
341 value_ = data[0] << 8 | data[1];
417 std::uint8_t length{0};
427 : transmitPriority{0},
440 updateResponse = value >> 7;
441 transmitToBus = value >> 6 & 0x01;
442 readOnInit = value >> 5 & 0x01;
443 writeFromBus = value >> 4 & 0x01;
444 readFromBus = value >> 3 & 0x01;
445 communication = value >> 2 & 0x01;
446 transmitPriority = value & 0x03;
452 updateResponse = value >> 7;
453 transmitToBus = value >> 6 & 0x01;
454 readOnInit = value >> 5 & 0x01;
455 writeFromBus = value >> 4 & 0x01;
456 readFromBus = value >> 3 & 0x01;
457 communication = value >> 2 & 0x01;
458 transmitPriority = value & 0x03;
463 operator std::uint8_t()
const
465 std::uint8_t value{0};
466 value = updateResponse << 7 | transmitToBus << 6 | readOnInit << 5 | writeFromBus << 4 | readFromBus << 3 |
467 communication << 2 | transmitPriority;
475 std::ostringstream oss;
476 std::string flags{
"______"};
477 if (communication) flags[0] =
'C';
478 if (readFromBus) flags[1] =
'R';
479 if (writeFromBus) flags[2] =
'W';
480 if (transmitToBus) flags[3] =
'T';
481 if (updateResponse) flags[4] =
'U';
482 if (readOnInit) flags[5] =
'I';
484 oss << transmitPriorityToString(static_cast<TransmitPriority>(transmitPriority)) <<
" " << flags;
515 reserved_3 = value >> 7;
516 reserved_2 = value >> 6 & 0x01;
517 reserved_1 = value >> 5 & 0x01;
518 valid = value >> 4 & 0x01;
519 updated = value >> 3 & 0x01;
520 readRequest = value >> 2 & 0x01;
521 transmitStatus = value & 0x03;
527 reserved_3 = value >> 7;
528 reserved_2 = value >> 6 & 0x01;
529 reserved_1 = value >> 5 & 0x01;
530 valid = value >> 4 & 0x01;
531 updated = value >> 3 & 0x01;
532 readRequest = value >> 2 & 0x01;
533 transmitStatus = value & 0x03;
538 operator std::uint8_t()
const
540 std::uint8_t value{0};
541 value = reserved_3 << 7 | reserved_2 << 6 | reserved_1 << 5 | valid << 4 | updated << 3 | readRequest << 2 |
556 std::ostringstream oss;
557 valid ? oss <<
"V" : oss <<
"_";
558 updated ? oss <<
"U" : oss <<
"_";
559 readRequest ? oss <<
"R" : oss <<
"W";
561 oss << transmissionStatusToString(static_cast<TransmissionStatus>(transmitStatus));
609 std::map<std::uint16_t, DatapointDescription>;
613 std::map<std::uint16_t, DatapointDescriptionString>;
Represents which status flags are supported by the device, serveritem 52.
Definition: Defines.h:332
bool hasRunning() const
Is the running flag supported.
Definition: Defines.h:367
StatusFlagsSupported(const Buffer &data)
Construct from an array of bytes.
Definition: Defines.h:338
bool hasSecure() const
Is the secure mode flag supported.
Definition: Defines.h:386
bool hasLoaded() const
Is the loaded flag supported.
Definition: Defines.h:373
bool hasTLConnected() const
Is the transport layer connected flag supported.
Definition: Defines.h:379
StatusFlagsSupported(bool running, bool loaded, bool tl_connected, bool secure)
Construct a new StatusFlagsSupported object from integral values.
Definition: Defines.h:352
StatusFlagsSupported(const ServerItem_StatusFlagType val)
< Construct from a existing ServerItem_StatusFlagType value
Definition: Defines.h:335
This structure represents the status flags provided by some BAOS devices server item ServerItemId::St...
Definition: Defines.h:261
StatusFlags(bool running, bool loaded, bool tl_connected, bool secure)
Construct a new Status Flags object.
Definition: Defines.h:280
bool isSecure() const
Returns if the device is on secure mode.
Definition: Defines.h:314
StatusFlags(const ServerItem_StatusFlagType val)
Construct from a existing ServerItem_StatusFlagType value.
Definition: Defines.h:264
bool isTLConnected() const
Returns if the transport layer is connected.
Definition: Defines.h:307
bool isRunning() const
Return the value of the running element as boolean.
Definition: Defines.h:295
StatusFlags(const Buffer &data)
Construct from an array of bytes.
Definition: Defines.h:266
bool isLoaded() const
Return if the ETS applicatiopn is loaded or not.
Definition: Defines.h:301
Global types and configuration for the whole SDK.
Groups BAOS binary protocol specific types , defines and classes for Indications, Responses etc.
Definition: Defines.h:32
constexpr std::size_t POS_ERRORCODE
The 0 bases position of the errorcode if available.
Definition: Defines.h:650
IpAssigmentMethod
An Ip device may have different methods for ip assigment.
Definition: Defines.h:632
@ manual
The ip address, subnet mask etc. are explicitly set manualy.
@ autoIp
Configure its own ip address automatically.
@ bootp
Boot mode with network boot vi bootp.
@ dhcp
The ip address is requested from a DHCP server.
BaosResponseCode
These are the BaosServerErrorCodes.
Definition: Defines.h:128
@ WrongDpId
Wrong datapoint ID.
@ ItemNotWriteable
Item is not writable.
@ BadDpValueLength
Bad length of datapoint value.
@ ServiceNotSupported
Service is not supported.
@ ObjectServerIsBusy
Object server is busy.
@ MessageInconsistent
Message inconsistent.
@ NoItemFound
No item found.
@ BadServiceParameter
Bad service parameter.
@ Internal
Internal error.
@ BufferTooSmall
Buffer is too small.
@ BadDpCmd
Bad datapoint command.
std::map< std::uint16_t, DatapointValue > DatapointValues
A map with datapoint ids as keys and DatapointValue as values.
Definition: Defines.h:35
ServerItem_StatusFlag
Enum class representing the flags inside the status flag serveritem.
Definition: Defines.h:41
@ RUNNING
The run state of the application.
@ LOADED
The load state of the applcation.
@ TL_CONNECTED
If the transport layer is connected or not.
@ SECURE
If the device has secure mode enabled.
constexpr std::uint8_t BAOS_MAIN_SERVICE
The main service to identify a BAOS telegram by.
Definition: Defines.h:644
std::string DatapointDescriptionString
Strong type for the description string.
Definition: Defines.h:611
BAOSLIB_EXPORT std::string serverItemIdToString(ServerItemId sid)
Convert the enum value to a human readable string.
std::map< std::uint16_t, DatapointChangeValue > DatapointChangeValues
Definition: Defines.h:598
ServerItemId
An enum class to provide conveniant names to the serveritem ids.
Definition: Defines.h:198
@ MaxTunnellingClients
(Read Only; 1 byte; from V2.1)
@ ProgrammingMode
(Read/Write; 1 bytes)
@ ConnectedBaosUdpClients
(Read Only; 1 byte; from V2.1)
@ BinaryProtocolVersion
Version of the ObjectServer binary protocol (Read Only; 1 byte; from V2.0)
@ MaxBaosUdpClients
(Read Only; 1 byte; from V2.1)
@ ConnectedTunnellingClients
(Read Only; 1 byte; from V2.1)
@ SearchRequestEnabled
(Read / Write; 1 byte; from V2.1)
@ MenuEnabled
(Read / Write; 1 byte; from V2.1)
@ DownloadCounter
(Read Only; 2 bytes; from V2.1)
@ ManufactureCodeDevice
(Read Only; 2 bytes)
@ FirmwareVersion
(Read Only; 1 byte)
@ LengthOfDescriptionString
(Read Only; 2 bytes)
@ RFDomainAddress
(Read / Write; 6 bytes;)
@ IsStructured
(Read Only; 1 byte; from V2.1)
@ SystemTimezoneOffset
(Read / Write; 1 byte (signed); from V2.1)
@ MaxBaosTcpClients
(Read Only; 1 byte; from V2.1)
@ SystemTime
(Read / Write; variable length; from V2.1)
@ Invalid
Mark item as invalid.
@ TunnellingEnabled
(Read / Write; 1 byte; from V2.1)
@ MaxManagementClients
(Read Only; 1 byte; from V2.1)
@ WebServicesProtocolVersion
Version of the ObjectServer web services protocol (Read Only; 1 byte; from V2.0)
@ ApplicationVersion
(Read Only; 1 bytes)
@ MaxParameterBytes
(Read Only; 2 bytes; from V2.1)
@ ConnectedBaosTcpClients
(Read Read / Write Only; 1 byte; from V2.1)
@ IndicationSetting
Indicates whether indications are sent (Read/Write; 1 byte; from V2.0)
@ MaxBufferSize
(Read/Write; 2 bytes)
@ RestServiceProtocolVersion
(Read Only; 1 byte; from V2.1)
@ IPAddress
(Read / Write; 4 bytes; from V2.1)
@ ConnectedManagementClients
(Read Only; 1 byte; from V2.1)
@ BaudrateItem
(Read/Write; 1 byte)
@ ManufactureCodeApp
(Read Only; 2 bytes)
@ DeviceFriendlyName
(Read / Write; 30 bytes; from V2.1)
@ BaosWebEnabled
(Read / Write; 1 byte; from V2.1)
@ TimeSinceReset
(Read Only; 4 bytes)
@ ConfiguredDatapoints
(Read Only; 2 bytes; from V2.1)
@ ApplicationId
(Read Only; 2 bytes)
@ SerialNumber
(Read Only; 6 bytes)
@ MacAddress
(Read Only; 6 byte; from V2.1)
@ SubnetMask
(Read / Write; 4 bytes; from V2.1)
@ DefaultGateway
(Read / Write; 4 bytes; from V2.1)
@ BaosRestEnabled
(Read / Write; 1 byte; from V2.1)
@ IndividualAddress
(Read / Write; 2 byte; from V2.1)
@ HardwareVersion
(Read Only; 1 byte)
@ BusConnected
(Read Only; 1 byte)
@ MaxDatapoints
(Read Only; 2 bytes; from V2.1)
@ SuspendEnabled
(Read / Write; 1 byte; from 2.1)
@ IPAssignment
(Read / Write; 1 byte; from V2.1)
@ HttpFileEnabled
(Read / Write; 1 byte; from V2.1)
@ HardwareType
(Read Only; 6 bytes)
@ CurrentBufferSize
(Read Only; 2 bytes)
@ BaosBinaryEnabled
(Read / Write; 1 byte; from V2.1)
constexpr std::size_t POS_MAIN_SERVICE
The 0 based position of the main service byte.
Definition: Defines.h:645
constexpr std::size_t POS_START
The 0 based position of the start element (startitem, start datapoint id etc.)
Definition: Defines.h:647
std::map< std::uint16_t, DatapointValueState > DatapointValueStates
Definition: Defines.h:588
DatapointSetCommand
Setting a datapoint value there are different modes supported. This enum class gives those modes name...
Definition: Defines.h:60
@ SetNewValue
Set the new value inside the baos device object server*/.
@ NoCommand
Do nothing, more or less a placeholder.
@ ClearTransmissionState
Clear the device internal transmission state of the datapoints.
@ SendValueOnBus
Send the new value to bus but does not set it internaly.
@ SetNewValueAndSendOnBus
The default: Set the new value in the object server and send it to the bus.
@ ReadNewValueViaBus
Issue an group value read on the bus to get the current value of the underlying group object.
BAOSLIB_EXPORT std::string dpSizeToString(DatapointSize dpSize)
Convert the enum value to a human readable string.
constexpr std::size_t POS_PAYLOAD_BEGIN
The 0 based position of the payload in the packet.
Definition: Defines.h:651
BAOSLIB_EXPORT std::string transmitPriorityToString(TransmitPriority transmitPrio)
Convert the enum value to a human readable string.
BAOSLIB_EXPORT std::string dptToString(DPT dpt)
Convert the enum value to a human readable string.
std::vector< std::uint8_t > ParameterBytes
Strong type for a list of parameter bytes.
Definition: Defines.h:616
DPT
Enumeration value for the supported datapoint types( DPTs )
Definition: Defines.h:172
@ DPT_16
(14 std::uint8_t, String)
@ DPT_18
(1 std::uint8_t, Scene Control)
@ DPT_11
(3 std::uint8_t, Date)
@ DPT_10
(3 std::uint8_t, Time)
@ DPT_8
(2 std::uint8_t, Signed Value)
@ DPT_5
(8 Bit, Unsigned Value)
@ DPT_6
(8 Bit, Signed Value)
@ DPT_14
(4 std::uint8_t, Float Value)
@ DPT_3
(4 Bit, Dimming, Blinds)
@ DPT_9
(2 std::uint8_t, Float Value)
@ DPT_12
(4 std::uint8_t, Unsigned Value)
@ DPT_7
(2 std::uint8_t, Unsigned Value)
@ DPT_15
(4 std::uint8_t, Access)
@ DPT_4
(8 Bit, Character Set)
@ DPT_17
(1 std::uint8_t, Scene Number)
@ DPT_13
(4 std::uint8_t, Signed Value)
BAOSLIB_EXPORT std::string getBaosSubServiceTypeDescription(BaosSubServiceTypes subServiceType)
Convert the enum value to a human readable string.
BAOSLIB_EXPORT std::string transmissionStatusToString(TransmissionStatus transmissionStatus)
Convert the enum value to a human readable string.
BAOSLIB_EXPORT std::string timeSinceResetUnitToString(TimeSinceResetUnit unit)
Convert the enum value to a human readable string.
TransmitPriority
The knx transmit priority.
Definition: Defines.h:72
DatapointValueFilter
Requested datapoint value can be filtered by this criteria.
Definition: Defines.h:50
@ ALL
No filter, all datapoints.
TransmissionStatus
Internal transmit state of the device.
Definition: Defines.h:84
constexpr std::size_t POS_NUMBER_OF_ELEMENTS
The 0 based position of the number of elements in the packet.
Definition: Defines.h:649
std::string baosResponseCodeToString(BaosResponseCode code)
Convert the enum value to a human readable string.
TimeSinceResetUnit
The ServerItemId::TimeSinceResetUnit current unit for TimeSinceReset. This type gives those units a n...
Definition: Defines.h:620
wz::baos::Buffer DatapointValue
An type for the DatapointValues.
Definition: Defines.h:33
std::map< std::uint16_t, DatapointDescription > DatapointDescriptions
Definition: Defines.h:610
BaosSubServiceTypes
The in the baos binary protocol specified sub services and some internal ranges in them.
Definition: Defines.h:96
std::map< std::uint16_t, DatapointDescriptionString > DatapointDescriptionStrings
Definition: Defines.h:614
BAOSLIB_EXPORT std::uint8_t dpSizeInBytes(DatapointSize dpSize)
Convert the enum value to a intergral size in bytes.
std::vector< ServerItem > ServerItems
Type for a list of ServerItems.
Definition: Defines.h:421
std::uint16_t ServerItem_StatusFlagType
Serveritem status flag type.
Definition: Defines.h:37
DatapointSize
Enum class representing the different datapoint lengths.
Definition: Defines.h:147
constexpr std::size_t POS_SUB_SERVICE
The 0 based position of the sub service byte.
Definition: Defines.h:646
std::vector< std::uint8_t > Buffer
An alias type for a byte buffer.
Definition: config.h:64
A pair of the DatapointSetCommand and the Datapoint value for changing datapoint values.
Definition: Defines.h:592
DatapointSetCommand command
The command for the value change.
Definition: Defines.h:594
DatapointValue value
The actual value of the datapoint.
Definition: Defines.h:593
Struct for the communication flags of a datapoint. See KNX spec for more details.
Definition: Defines.h:425
std::uint8_t transmitPriority
The KNX transmit priority.
Definition: Defines.h:488
std::uint8_t writeFromBus
The writable from bus flag.
Definition: Defines.h:492
std::string toString() const
Definition: Defines.h:473
DatapointConfigFlags(std::uint8_t &&value)
Construct from a byte value.
Definition: Defines.h:438
std::uint8_t readOnInit
The perform read request in onit flag.
Definition: Defines.h:493
std::uint8_t updateResponse
Define the bitfield for the flags and transmitPriority.
Definition: Defines.h:495
std::uint8_t communication
Definition: Defines.h:490
std::uint8_t transmitToBus
The devices send changes on the group object to the KNX bus.
Definition: Defines.h:494
DatapointConfigFlags & operator=(std::uint8_t &value)
Assign a byte to this object.
Definition: Defines.h:450
std::uint8_t readFromBus
The readable from bus flag.
Definition: Defines.h:491
Represents the information about a datapoint in the BAOS device.
Definition: Defines.h:602
DatapointSize size
The size as an enum value.
Definition: Defines.h:603
DPT dpt
The datapoint type (e.G. DPT1 for boolean, see KNX Spec datapoint types for more details)
Definition: Defines.h:605
DatapointConfigFlags flags
The communication flags.
Definition: Defines.h:604
Internal state for each datapoint in the object server.
Definition: Defines.h:500
std::uint8_t reserved_1
Reserved bit 1.
Definition: Defines.h:574
std::uint8_t updated
Definition: Defines.h:572
std::string toString() const
Represent the flags in a human readable form.
Definition: Defines.h:554
std::uint8_t valid
0 Object value is invalid or 1 the device has seen at least one value for the group object.
Definition: Defines.h:573
std::uint8_t readRequest
0 Write request should be sent, 1 Read request should be sent
Definition: Defines.h:570
std::uint8_t reserved_2
Reserved bit 2.
Definition: Defines.h:575
std::uint8_t transmitStatus
See BAOS binary protocol spec GetDatapointValue.Res state byte for details.
Definition: Defines.h:569
DatapointStatus(std::uint8_t &&value)
Construct from byte value.
Definition: Defines.h:513
DatapointStatus & operator=(std::uint8_t &value)
Assign value from byte.
Definition: Defines.h:525
std::uint8_t reserved_3
Reserved bit 3.
Definition: Defines.h:576
A combination of the status of a datapoint and its actual value.
Definition: Defines.h:582
DatapointValue value
The actual value of the datapoint.
Definition: Defines.h:583
DatapointStatus status
The status of the datapoint object.
Definition: Defines.h:584
Structure to hold information about a serveritem.
Definition: Defines.h:403
ServerItem(ServerItemId id_, std::uint8_t length_, Buffer &&data_)
Construct a new Server Item object.
Definition: Defines.h:413
Buffer data
the data
Definition: Defines.h:418