BAOS .net SDK
18.2.0
|
The BAOS device holds the datapoint as a byte array (between 1 and 14 bytes) and the BaosDatapoint class provides conversion routines from this raw byte stream to typed values, such as Boolean, 8 Bit Signed, 2 Octet Unsigned etc. More...
#include <BaosDatapoint.h>
Public Types | |
enum | TransmissionStatus { TransmissionStatus::TransmissionIdleOk = unmanaged::BaosDatapoint::TransmissionIdleOk, TransmissionStatus::TransmissionIdleError = unmanaged::BaosDatapoint::TransmissionIdleError, TransmissionStatus::TransmissionInProgress = unmanaged::BaosDatapoint::TransmissionInProgress, TransmissionStatus::TransmissionRequest = unmanaged::BaosDatapoint::TransmissionRequest } |
Transmission status values More... | |
Public Member Functions | |
BaosDatapoint (Connector^connector, unsigned short id) | |
Constructor. More... | |
BaosDatapoint (Connector^connector, unsigned short id, unsigned char serviceData, array< unsigned char >^data) | |
Constructor. More... | |
~BaosDatapoint () | |
Destructor cleans up unmanaged and managed resources. More... | |
void | setId (unsigned char id) |
Sets the Data point id. More... | |
unsigned short | getId () |
Gets the datapoint id. More... | |
void | setCommand (unsigned char command) |
Sets the command. More... | |
unsigned char | getCommand () |
Gets the command. More... | |
void | readNewValueViaBus () |
Requests a read value from the bus for this data point. More... | |
void | clearTransmissionState () |
Requests that the transmission state is cleared. More... | |
void | setData (array< unsigned char >^data) |
Sets the value of the data point on the remote BAOS device associated with the current id. More... | |
array< unsigned char > | getData () |
Reads the value of the data point on the remote BAOS device associated with the current id. More... | |
void | clearData () |
Clears the internal data. More... | |
bool | isValidFlag () |
Returns true: Object has already been received Returns false: Object value is unknown More... | |
bool | isUpdate () |
Returns true: Value is updated from the bus Returns false: Value was not updated More... | |
bool | isDataRequest () |
Returns true: Data request Returns false: Idle/response More... | |
int | getTransmissionStatus () |
Returns one of the following transmission status values: TransmissionIdleOk TransmissionIdleError TransmissionInProgress TransmissionRequest More... | |
System::String | getDescription () |
Get the Description String associated with the data point More... | |
void | enableCache (bool cacheEnabled) |
Enable the data cache More... | |
void | disableCache () |
Disable the cache More... | |
void | setBoolean (bool value) |
Set Datapoint DPT-1 More... | |
bool | getBoolean () |
Gets Datapoint DPT-1 More... | |
void | set1BitControl (bool control, bool value) |
Sets Datapoint DPT-2 More... | |
bool | get1BitControl () |
Gets Datapoint DPT-2 (control) More... | |
bool | get1BitControlValue () |
Gets Datapoint DPT-2 (value) More... | |
void | set3BitControl (bool control, unsigned char value) |
Sets Datapoint DPT-3 More... | |
bool | get3BitControl () |
Gets Datapoint DPT-3 (control) More... | |
unsigned char | get3BitControlValue () |
Gets Datapoint DPT-3 (value) More... | |
void | setCharacterSet (unsigned char value) |
Sets Datapoint DPT-4 More... | |
unsigned char | getCharacterSet () |
Gets Datapoint DPT-4 More... | |
void | set8BitUnsigned (unsigned char value) |
Sets Datapoint DPT-5 More... | |
unsigned char | get8BitUnsigned () |
Gets Datapoint DPT-5 More... | |
void | set8BitSigned (char value) |
Sets Datapoint DPT-6 More... | |
char | get8BitSigned () |
Gets Datapoint DPT-6 More... | |
void | set2OctetUnsigned (unsigned short value) |
Sets Datapoint DPT-7 More... | |
unsigned short | get2OctetUnsigned () |
Gets Datapoint DPT-7 More... | |
void | set2OctetSigned (short value) |
Sets Datapoint DPT-8 More... | |
short | get2OctetSigned () |
Gets Datapoint DPT-8 More... | |
void | set2OctetFloat (unsigned char msb, unsigned char lsb) |
Sets Datapoint DPT-9 More... | |
unsigned char | get2OctetFloatMsb () |
Gets Datapoint DPT-9 (msb) More... | |
unsigned char | get2OctetFloatLsb () |
Gets Datapoint DPT-9 (lsb) More... | |
void | set2OctetFloat (float f) |
Sets Datapoint DPT-9, converts a standard IEEE float to a KNX 2 byte float More... | |
float | get2OctetFloat () |
Gets Datapoint DPT-9, converts a KNX 2 byte float to a standard IEEE float More... | |
void | setTimeLocal () |
Sets Datapoint DPT-10 (local time) More... | |
void | setTimeUTC () |
Sets Datapoint DPT-10 (utc time) More... | |
void | setTime (int day, int hour, int minute, int second) |
Sets Datapoint DPT-10 More... | |
int | getTimeDay () |
Gets Datapoint DPT-10 (day) More... | |
int | getTimeHour () |
Gets Datapoint DPT-10 (hour) More... | |
int | getTimeMinute () |
Gets Datapoint DPT-10 (minute) More... | |
int | getTimeSecond () |
Gets Datapoint DPT-10 (second) More... | |
void | setDateLocal () |
Sets Datapoint DPT-11 (local) More... | |
void | setDateUTC () |
Sets Datapoint DPT-11 (utc) More... | |
void | setDate (int year, int month, int day) |
Sets Datapoint DPT-11 More... | |
int | getDateYear () |
Gets Datapoint DPT-11 (year) More... | |
int | getDateMonth () |
Gets Datapoint DPT-11 (month) More... | |
int | getDateDay () |
Gets Datapoint DPT-11 (day) More... | |
void | set4OctetUnsigned (unsigned int value) |
Sets Datapoint DPT-12 More... | |
unsigned int | get4OctetUnsigned () |
Gets Datapoint DPT-12 More... | |
void | set4OctetSigned (int value) |
Sets Datapoint DPT-13 More... | |
int | get4OctetSigned () |
Gets Datapoint DPT-13 More... | |
void | set4OctetFloat (float value) |
Sets Datapoint DPT-14 More... | |
float | get4OctetFloat () |
Gets Datapoint DPT-14 More... | |
void | setAccess (unsigned int accessCode, bool error, bool permission, bool direction, bool encrypted, unsigned char index) |
Sets Datapoint DPT-15 More... | |
unsigned int | getAccessCode () |
Gets Datapoint DPT-15 (code) More... | |
bool | getAccessError () |
Gets Datapoint DPT-15 (error) More... | |
bool | getAccessPermission () |
Gets Datapoint DPT-15 (permission) More... | |
bool | getAccessDirection () |
Gets Datapoint DPT-15 (direction) More... | |
bool | getAccessEncrypted () |
Gets Datapoint DPT-15 (encrypted) More... | |
unsigned char | getAccessIndex () |
Gets Datapoint DPT-15 (index) More... | |
void | setString (System::String^str) |
Sets Datapoint DPT-16 More... | |
System::String | getString () |
Gets Datapoint DPT-16 More... | |
Protected Member Functions | |
!BaosDatapoint () | |
Finalizer (non-deterministic destructor) cleans up unmanaged resources. More... | |
The BAOS device holds the datapoint as a byte array (between 1 and 14 bytes) and the BaosDatapoint class provides conversion routines from this raw byte stream to typed values, such as Boolean, 8 Bit Signed, 2 Octet Unsigned etc.
Internally it uses the BaosDatapointDescription to ensure that the conversion is type safe, that is, it compares the length of the datapoint value in the description with the length of the requested type and if these lengths do not match an exception will be raised. Note: it is possible to convert to/from types of the same length. i.e. if the datapoint value length is 2 bytes all the 2 octet conversion functions will be valid. We've included standard basic datapoint types from the specification however this is still a subset of the C++ API, which includes the datapoint types like Status With Mode, Date, Time and Access for example. The Datapoint is associated with a specific id, which should be configured in the ETS project. Currently the BAOS protocol supports an id range from 1 to 255.
kdrive::baos::bindings::BaosDatapoint::BaosDatapoint | ( | Connector^ | connector, |
unsigned short | id | ||
) |
Constructor.
This is the standard constructor you will use to create a BaosDatapoint class.
You pass in the Connector class and the associated Data point Value id. This id should correspond to the id configured in the ETS project and is associated with a specific Group Value Address.
connector | The connector. |
id | The data point id. |
kdrive::baos::bindings::BaosDatapoint::BaosDatapoint | ( | Connector^ | connector, |
unsigned short | id, | ||
unsigned char | serviceData, | ||
array< unsigned char >^ | data | ||
) |
Constructor.
This constructor is called from within the library when a Data point Value Indication is received.
It contains the data point value data. You won’t need to use this and can safely ignore it.
connector | The connector. |
id | The data point id. |
serviceData | The service data. |
data | The data. |
kdrive::baos::bindings::BaosDatapoint::~BaosDatapoint | ( | ) |
Destructor cleans up unmanaged and managed resources.
|
protected |
Finalizer (non-deterministic destructor) cleans up unmanaged resources.
void kdrive::baos::bindings::BaosDatapoint::clearData | ( | ) |
Clears the internal data.
If the cache is enabled this will empty the data cache, so the next read will read from the BAOS device, and not from the cache.
void kdrive::baos::bindings::BaosDatapoint::clearTransmissionState | ( | ) |
Requests that the transmission state is cleared.
Like readNewValueViaBus it has no lasting effect on the command
void kdrive::baos::bindings::BaosDatapoint::disableCache | ( | ) |
Disable the cache
void kdrive::baos::bindings::BaosDatapoint::enableCache | ( | bool | cacheEnabled | ) |
Enable the data cache
bool kdrive::baos::bindings::BaosDatapoint::get1BitControl | ( | ) |
Gets Datapoint DPT-2 (control)
bool kdrive::baos::bindings::BaosDatapoint::get1BitControlValue | ( | ) |
Gets Datapoint DPT-2 (value)
float kdrive::baos::bindings::BaosDatapoint::get2OctetFloat | ( | ) |
Gets Datapoint DPT-9, converts a KNX 2 byte float to a standard IEEE float
unsigned char kdrive::baos::bindings::BaosDatapoint::get2OctetFloatLsb | ( | ) |
Gets Datapoint DPT-9 (lsb)
unsigned char kdrive::baos::bindings::BaosDatapoint::get2OctetFloatMsb | ( | ) |
Gets Datapoint DPT-9 (msb)
short kdrive::baos::bindings::BaosDatapoint::get2OctetSigned | ( | ) |
Gets Datapoint DPT-8
unsigned short kdrive::baos::bindings::BaosDatapoint::get2OctetUnsigned | ( | ) |
Gets Datapoint DPT-7
bool kdrive::baos::bindings::BaosDatapoint::get3BitControl | ( | ) |
Gets Datapoint DPT-3 (control)
unsigned char kdrive::baos::bindings::BaosDatapoint::get3BitControlValue | ( | ) |
Gets Datapoint DPT-3 (value)
float kdrive::baos::bindings::BaosDatapoint::get4OctetFloat | ( | ) |
Gets Datapoint DPT-14
int kdrive::baos::bindings::BaosDatapoint::get4OctetSigned | ( | ) |
Gets Datapoint DPT-13
unsigned int kdrive::baos::bindings::BaosDatapoint::get4OctetUnsigned | ( | ) |
Gets Datapoint DPT-12
char kdrive::baos::bindings::BaosDatapoint::get8BitSigned | ( | ) |
Gets Datapoint DPT-6
unsigned char kdrive::baos::bindings::BaosDatapoint::get8BitUnsigned | ( | ) |
Gets Datapoint DPT-5
unsigned int kdrive::baos::bindings::BaosDatapoint::getAccessCode | ( | ) |
Gets Datapoint DPT-15 (code)
bool kdrive::baos::bindings::BaosDatapoint::getAccessDirection | ( | ) |
Gets Datapoint DPT-15 (direction)
bool kdrive::baos::bindings::BaosDatapoint::getAccessEncrypted | ( | ) |
Gets Datapoint DPT-15 (encrypted)
bool kdrive::baos::bindings::BaosDatapoint::getAccessError | ( | ) |
Gets Datapoint DPT-15 (error)
unsigned char kdrive::baos::bindings::BaosDatapoint::getAccessIndex | ( | ) |
Gets Datapoint DPT-15 (index)
bool kdrive::baos::bindings::BaosDatapoint::getAccessPermission | ( | ) |
Gets Datapoint DPT-15 (permission)
bool kdrive::baos::bindings::BaosDatapoint::getBoolean | ( | ) |
Gets Datapoint DPT-1
unsigned char kdrive::baos::bindings::BaosDatapoint::getCharacterSet | ( | ) |
Gets Datapoint DPT-4
unsigned char kdrive::baos::bindings::BaosDatapoint::getCommand | ( | ) |
Gets the command.
array<unsigned char> kdrive::baos::bindings::BaosDatapoint::getData | ( | ) |
Reads the value of the data point on the remote BAOS device associated with the current id.
It returns the raw Big Endian encoded byte stream. The data point values which are less than 1 byte (Boolean etc) are encoded as outlined in the BAOS protocol specification. It is preferable to use the specific type conversion functions to get the data.
int kdrive::baos::bindings::BaosDatapoint::getDateDay | ( | ) |
Gets Datapoint DPT-11 (day)
int kdrive::baos::bindings::BaosDatapoint::getDateMonth | ( | ) |
Gets Datapoint DPT-11 (month)
int kdrive::baos::bindings::BaosDatapoint::getDateYear | ( | ) |
Gets Datapoint DPT-11 (year)
System::String kdrive::baos::bindings::BaosDatapoint::getDescription | ( | ) |
Get the Description String associated with the data point
unsigned short kdrive::baos::bindings::BaosDatapoint::getId | ( | ) |
Gets the datapoint id.
System::String kdrive::baos::bindings::BaosDatapoint::getString | ( | ) |
Gets Datapoint DPT-16
int kdrive::baos::bindings::BaosDatapoint::getTimeDay | ( | ) |
Gets Datapoint DPT-10 (day)
int kdrive::baos::bindings::BaosDatapoint::getTimeHour | ( | ) |
Gets Datapoint DPT-10 (hour)
int kdrive::baos::bindings::BaosDatapoint::getTimeMinute | ( | ) |
Gets Datapoint DPT-10 (minute)
int kdrive::baos::bindings::BaosDatapoint::getTimeSecond | ( | ) |
Gets Datapoint DPT-10 (second)
int kdrive::baos::bindings::BaosDatapoint::getTransmissionStatus | ( | ) |
Returns one of the following transmission status values: TransmissionIdleOk TransmissionIdleError TransmissionInProgress TransmissionRequest
bool kdrive::baos::bindings::BaosDatapoint::isDataRequest | ( | ) |
Returns true: Data request Returns false: Idle/response
bool kdrive::baos::bindings::BaosDatapoint::isUpdate | ( | ) |
Returns true: Value is updated from the bus Returns false: Value was not updated
bool kdrive::baos::bindings::BaosDatapoint::isValidFlag | ( | ) |
Returns true: Object has already been received Returns false: Object value is unknown
void kdrive::baos::bindings::BaosDatapoint::readNewValueViaBus | ( | ) |
Requests a read value from the bus for this data point.
This uses the set data point value service with command set to ReadNewValueViaBus (just for this call) and this function has no lasting effect on the value of the command.
void kdrive::baos::bindings::BaosDatapoint::set1BitControl | ( | bool | control, |
bool | value | ||
) |
Sets Datapoint DPT-2
void kdrive::baos::bindings::BaosDatapoint::set2OctetFloat | ( | unsigned char | msb, |
unsigned char | lsb | ||
) |
Sets Datapoint DPT-9
void kdrive::baos::bindings::BaosDatapoint::set2OctetFloat | ( | float | f | ) |
Sets Datapoint DPT-9, converts a standard IEEE float to a KNX 2 byte float
void kdrive::baos::bindings::BaosDatapoint::set2OctetSigned | ( | short | value | ) |
Sets Datapoint DPT-8
void kdrive::baos::bindings::BaosDatapoint::set2OctetUnsigned | ( | unsigned short | value | ) |
Sets Datapoint DPT-7
void kdrive::baos::bindings::BaosDatapoint::set3BitControl | ( | bool | control, |
unsigned char | value | ||
) |
Sets Datapoint DPT-3
void kdrive::baos::bindings::BaosDatapoint::set4OctetFloat | ( | float | value | ) |
Sets Datapoint DPT-14
void kdrive::baos::bindings::BaosDatapoint::set4OctetSigned | ( | int | value | ) |
Sets Datapoint DPT-13
void kdrive::baos::bindings::BaosDatapoint::set4OctetUnsigned | ( | unsigned int | value | ) |
Sets Datapoint DPT-12
void kdrive::baos::bindings::BaosDatapoint::set8BitSigned | ( | char | value | ) |
Sets Datapoint DPT-6
void kdrive::baos::bindings::BaosDatapoint::set8BitUnsigned | ( | unsigned char | value | ) |
Sets Datapoint DPT-5
void kdrive::baos::bindings::BaosDatapoint::setAccess | ( | unsigned int | accessCode, |
bool | error, | ||
bool | permission, | ||
bool | direction, | ||
bool | encrypted, | ||
unsigned char | index | ||
) |
Sets Datapoint DPT-15
void kdrive::baos::bindings::BaosDatapoint::setBoolean | ( | bool | value | ) |
Set Datapoint DPT-1
value | The bool value. |
void kdrive::baos::bindings::BaosDatapoint::setCharacterSet | ( | unsigned char | value | ) |
Sets Datapoint DPT-4
void kdrive::baos::bindings::BaosDatapoint::setCommand | ( | unsigned char | command | ) |
Sets the command.
When a data point value is set on the remote device it is accompanied by a command. This command defaults to: Sets new value and send on bus. If you need to change the command you can do so with this function. The list of commands can be found in the protocol specification on page 19. Otherwise you can safely ignore these functions.
command | The command. |
void kdrive::baos::bindings::BaosDatapoint::setData | ( | array< unsigned char >^ | data | ) |
Sets the value of the data point on the remote BAOS device associated with the current id.
This function also sends the command byte, which can be configured with setCommand (see setCommand for more information). Note: the length of data should correspond to the data point value length configured in the ETS project. Although you can use the command directly it is preferable to use the specific type conversion functions such as setBoolean, set8BitUnsigned etc. You should only really ever need to use this function if a conversion function is not available. Note: the data should be encoded as Big Endian.
data | The data. |
void kdrive::baos::bindings::BaosDatapoint::setDate | ( | int | year, |
int | month, | ||
int | day | ||
) |
Sets Datapoint DPT-11
year | The year. |
month | The month. |
day | The day. |
void kdrive::baos::bindings::BaosDatapoint::setDateLocal | ( | ) |
Sets Datapoint DPT-11 (local)
void kdrive::baos::bindings::BaosDatapoint::setDateUTC | ( | ) |
Sets Datapoint DPT-11 (utc)
void kdrive::baos::bindings::BaosDatapoint::setId | ( | unsigned char | id | ) |
Sets the Data point id.
You can use this when you need to dynamically change the id that this Datapoint object refers to in the remote BAOS device. For example, if you have several data points all of the same type (a Boolean type for example) with contiguous ids you can iterate over the ids and set their corresponding values on the remove device using the one BaosDatapoint object.
id | The data point id. |
void kdrive::baos::bindings::BaosDatapoint::setString | ( | System::String^ | str | ) |
Sets Datapoint DPT-16
void kdrive::baos::bindings::BaosDatapoint::setTime | ( | int | day, |
int | hour, | ||
int | minute, | ||
int | second | ||
) |
Sets Datapoint DPT-10
void kdrive::baos::bindings::BaosDatapoint::setTimeLocal | ( | ) |
Sets Datapoint DPT-10 (local time)
void kdrive::baos::bindings::BaosDatapoint::setTimeUTC | ( | ) |
Sets Datapoint DPT-10 (utc time)