kdriveExpress SDK 22.1.1
kdrive_express_dpt.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2002-2022 WEINZIERL ENGINEERING GmbH
3 // All rights reserved.
4 //
5 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7 // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
8 // SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY,
9 // WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
10 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
11 //
12 
13 #ifndef __KDRIVE_EXPRESS_DPT_H__
14 #define __KDRIVE_EXPRESS_DPT_H__
15 
16 #include "kdrive_express_config.h"
17 #include "kdrive_express_defs.h"
18 
79 #define KDRIVE_MAX_DP_TYPE_ID_LEN (13)
80 #define KDRIVE_MAX_DP_TYPE_NAME_LEN (30)
82 #define KDRIVE_DPT1_SIZE_IN_BITS (1)
83 #define KDRIVE_DPT2_SIZE_IN_BITS (2)
84 #define KDRIVE_DPT3_SIZE_IN_BITS (4)
85 #define KDRIVE_DPT4_SIZE_IN_BITS (8)
86 #define KDRIVE_DPT5_SIZE_IN_BITS (8)
87 #define KDRIVE_DPT6_SIZE_IN_BITS (8)
88 #define KDRIVE_DPT7_SIZE_IN_BITS (16)
89 #define KDRIVE_DPT8_SIZE_IN_BITS (16)
90 #define KDRIVE_DPT9_SIZE_IN_BITS (16)
91 #define KDRIVE_DPT10_SIZE_IN_BITS (24)
92 #define KDRIVE_DPT11_SIZE_IN_BITS (24)
93 #define KDRIVE_DPT12_SIZE_IN_BITS (32)
94 #define KDRIVE_DPT13_SIZE_IN_BITS (32)
95 #define KDRIVE_DPT14_SIZE_IN_BITS (32)
96 #define KDRIVE_DPT15_SIZE_IN_BITS (32)
97 #define KDRIVE_DPT16_SIZE_IN_BITS (112)
99 #ifdef __cplusplus
100 extern "C" {
101 #endif
102 
103 /**************************************************************
104 ** Datapoint
105 ***************************************************************/
106 
111 typedef struct datapoint_type_t
112 {
113  char id[KDRIVE_MAX_DP_TYPE_ID_LEN];
118 
126 
127 /**************************************************************
128 ** Encode and Decode
129 ***************************************************************/
130 
141  uint32_t* length, bool_t value);
142 
152  uint32_t length, bool_t* value);
153 
165  uint32_t* length, bool_t control, bool_t value);
166 
177  uint32_t length, bool_t* control, bool_t* value);
178 
190  uint32_t* length, bool_t control, uint8_t value);
191 
202  uint32_t length, bool_t* control, uint8_t* value);
203 
214  uint32_t* length, uint8_t character);
215 
225  uint32_t length, uint8_t* character);
226 
237  uint32_t* length, uint8_t value);
238 
248  uint32_t length, uint8_t* value);
249 
260  uint32_t* length, int8_t value);
261 
271  uint32_t length, int8_t* value);
272 
283  uint32_t* length, uint16_t value);
284 
294  uint32_t length, uint16_t* value);
295 
306  uint32_t* length, int16_t value);
307 
317  uint32_t length, int16_t* value);
318 
329  uint32_t* length, float32_t value);
330 
340  uint32_t length, float32_t* value);
341 
351 
361 
375  int32_t day, int32_t hour, int32_t minute, int32_t second);
376 
390  int32_t* day, int32_t* hour, int32_t* minute, int32_t* second);
391 
401 
411 
427  int32_t year, int32_t month, int32_t day);
428 
444  int32_t year, int32_t month, int32_t day);
445 
458  int32_t year, int32_t month, int32_t day);
459 
474  int32_t* year, int32_t* month, int32_t* day);
475 
490  int32_t* year, int32_t* month, int32_t* day);
491 
503  int32_t* year, int32_t* month, int32_t* day);
504 
515  uint32_t* length, uint32_t value);
516 
526  uint32_t length, uint32_t* value);
527 
538  uint32_t* length, int32_t value);
539 
549  uint32_t length, int32_t* value);
550 
561  uint32_t* length, float32_t value);
562 
572  uint32_t length, float32_t* value);
573 
589  int32_t accessCode, bool_t error, bool_t permission,
590  bool_t direction, bool_t encrypted, int32_t index);
591 
606  int32_t* accessCode, bool_t* error, bool_t* permission,
607  bool_t* direction, bool_t* encrypted, int32_t* index);
608 
623  uint32_t* length, const char value[KDRIVE_DPT16_LENGTH + 1]);
624 
639  uint32_t length, char value[KDRIVE_DPT16_LENGTH + 1]);
640 
641 #ifdef __cplusplus
642 }
643 #endif
644 
645 #endif /* __KDRIVE_EXPRESS_DPT_H__ */
kdrive_dpt_encode_dpt8
kdriveExpress_API error_t kdrive_dpt_encode_dpt8(uint8_t *data, uint32_t *length, int16_t value)
Sets DPT-8: 2 byte signed value.
kdrive_dpt_decode_dpt1
kdriveExpress_API error_t kdrive_dpt_decode_dpt1(const uint8_t *data, uint32_t length, bool_t *value)
Gets DPT-1 (1 bit)
kdrive_dpt_decode_dpt12
kdriveExpress_API error_t kdrive_dpt_decode_dpt12(const uint8_t *data, uint32_t length, uint32_t *value)
Gets DPT-12: 4 byte unsigned value.
kdrive_dpt_encode_dpt14
kdriveExpress_API error_t kdrive_dpt_encode_dpt14(uint8_t *data, uint32_t *length, float32_t value)
Sets DPT-14: 4 byte float value.
kdrive_dpt_decode_dpt13
kdriveExpress_API error_t kdrive_dpt_decode_dpt13(const uint8_t *data, uint32_t length, int32_t *value)
Gets DPT-13: 4 byte signed value.
kdrive_dpt_decode_dpt11_knx
kdriveExpress_API error_t kdrive_dpt_decode_dpt11_knx(const uint8_t *data, uint32_t length, int32_t *year, int32_t *month, int32_t *day)
Gets DPT-11: date in KNX format NOTE: The year is in KNX DPT11 format: 0..99; >=90 : 20th century; <9...
kdrive_dpt_encode_dpt11_knx
kdriveExpress_API error_t kdrive_dpt_encode_dpt11_knx(uint8_t *data, uint32_t *length, int32_t year, int32_t month, int32_t day)
Sets DPT-11: date in KNX format NOTE: The year is in KNX DPT11 format: 0..99; >=90 : 20th century; <9...
kdrive_dpt_decode_dpt16
kdriveExpress_API error_t kdrive_dpt_decode_dpt16(const uint8_t *data, uint32_t length, char value[KDRIVE_DPT16_LENGTH+1])
Gets DPT-16: Character string The out value string is null terminated.
datapoint_type_t::name
char name[KDRIVE_MAX_DP_TYPE_NAME_LEN]
datapoint type id e.g.
Definition: kdrive_express_dpt.h:116
kdrive_dpt_encode_dpt5
kdriveExpress_API error_t kdrive_dpt_encode_dpt5(uint8_t *data, uint32_t *length, uint8_t value)
Sets DPT-5: 8 bit unsigned value.
kdrive_dpt_get_dpt_descriptor
kdriveExpress_API error_t kdrive_dpt_get_dpt_descriptor(char *dpt_id, datapoint_type_t *dpt_desc)
Returns the datapoint type information associated with a datapoint type id.
uint16_t
unsigned short uint16_t
16 bit unsigned char
Definition: kdrive_express_config.h:30
kdrive_dpt_encode_dpt3
kdriveExpress_API error_t kdrive_dpt_encode_dpt3(uint8_t *data, uint32_t *length, bool_t control, uint8_t value)
Sets DPT-3: 3 bit controlled.
float32_t
float float32_t
32 bit single precision float
Definition: kdrive_express_config.h:35
datapoint_type_t
Represents a single datapoint type.
Definition: kdrive_express_dpt.h:111
uint32_t
unsigned int uint32_t
32 bit unsigned char
Definition: kdrive_express_config.h:31
kdrive_dpt_decode_dpt15
kdriveExpress_API error_t kdrive_dpt_decode_dpt15(const uint8_t *data, uint32_t length, int32_t *accessCode, bool_t *error, bool_t *permission, bool_t *direction, bool_t *encrypted, int32_t *index)
Gets DPT-15: Entrance access.
kdrive_dpt_encode_dpt11_local
kdriveExpress_API error_t kdrive_dpt_encode_dpt11_local(uint8_t *data, uint32_t *length)
Sets DPT-11: current local date.
kdrive_dpt_encode_dpt10
kdriveExpress_API error_t kdrive_dpt_encode_dpt10(uint8_t *data, uint32_t *length, int32_t day, int32_t hour, int32_t minute, int32_t second)
Sets DPT-10: time.
kdrive_dpt_decode_dpt4
kdriveExpress_API error_t kdrive_dpt_decode_dpt4(const uint8_t *data, uint32_t length, uint8_t *character)
Gets DPT-4: Character.
kdrive_dpt_encode_dpt1
kdriveExpress_API error_t kdrive_dpt_encode_dpt1(uint8_t *data, uint32_t *length, bool_t value)
Sets DPT-1 (1 bit)
int32_t
int int32_t
32 bit signed int
Definition: kdrive_express_config.h:34
kdrive_dpt_decode_dpt14
kdriveExpress_API error_t kdrive_dpt_decode_dpt14(const uint8_t *data, uint32_t length, float32_t *value)
Gets DPT-14: 4 byte float value.
kdrive_dpt_encode_dpt10_utc
kdriveExpress_API error_t kdrive_dpt_encode_dpt10_utc(uint8_t *data, uint32_t *length)
Sets DPT-10: UTC time.
kdrive_dpt_encode_dpt2
kdriveExpress_API error_t kdrive_dpt_encode_dpt2(uint8_t *data, uint32_t *length, bool_t control, bool_t value)
Sets DPT-2: 1 bit controlled.
kdrive_dpt_encode_dpt15
kdriveExpress_API error_t kdrive_dpt_encode_dpt15(uint8_t *data, uint32_t *length, int32_t accessCode, bool_t error, bool_t permission, bool_t direction, bool_t encrypted, int32_t index)
Sets DPT-15: Entrance access.
kdrive_dpt_decode_dpt2
kdriveExpress_API error_t kdrive_dpt_decode_dpt2(const uint8_t *data, uint32_t length, bool_t *control, bool_t *value)
Gets DPT-2: 1 bit controlled.
KDRIVE_DPT16_LENGTH
#define KDRIVE_DPT16_LENGTH
The length of a KNX character string for DPT-16 is 112 bits or 14 bytes.
Definition: kdrive_express_defs.h:40
kdrive_dpt_decode_dpt5
kdriveExpress_API error_t kdrive_dpt_decode_dpt5(const uint8_t *data, uint32_t length, uint8_t *value)
Gets DPT-5: 8 bit unsigned value.
kdrive_dpt_encode_dpt6
kdriveExpress_API error_t kdrive_dpt_encode_dpt6(uint8_t *data, uint32_t *length, int8_t value)
Sets DPT-6: 8 bit signed value.
int8_t
signed char int8_t
8 bit signed char
Definition: kdrive_express_config.h:32
kdrive_dpt_decode_dpt11_yyyy
kdriveExpress_API error_t kdrive_dpt_decode_dpt11_yyyy(const uint8_t *data, uint32_t length, int32_t *year, int32_t *month, int32_t *day)
Gets DPT-11: date in "normal" format.
KDRIVE_MAX_DP_TYPE_NAME_LEN
#define KDRIVE_MAX_DP_TYPE_NAME_LEN
The max length of a datapoint type name.
Definition: kdrive_express_dpt.h:80
kdrive_dpt_decode_dpt9
kdriveExpress_API error_t kdrive_dpt_decode_dpt9(const uint8_t *data, uint32_t length, float32_t *value)
Gets DPT-9: 2 byte float value.
kdrive_dpt_encode_dpt9
kdriveExpress_API error_t kdrive_dpt_encode_dpt9(uint8_t *data, uint32_t *length, float32_t value)
Sets DPT-9: 2 byte float value.
kdrive_express_defs.h
kdriveExpress Defines
int16_t
short int16_t
16 bit signed int
Definition: kdrive_express_config.h:33
kdrive_dpt_encode_dpt11_yyyy
kdriveExpress_API error_t kdrive_dpt_encode_dpt11_yyyy(uint8_t *data, uint32_t *length, int32_t year, int32_t month, int32_t day)
Sets DPT-11: date in "normal" format.
KDRIVE_MAX_DP_TYPE_ID_LEN
#define KDRIVE_MAX_DP_TYPE_ID_LEN
The max length of a datapoint type id.
Definition: kdrive_express_dpt.h:79
error_t
int32_t error_t
Definition: kdrive_express_config.h:46
kdrive_dpt_encode_dpt13
kdriveExpress_API error_t kdrive_dpt_encode_dpt13(uint8_t *data, uint32_t *length, int32_t value)
Sets DPT-13: 4 byte signed value.
bool_t
int32_t bool_t
Definition: kdrive_express_config.h:57
kdrive_dpt_encode_dpt11
kdriveExpress_API error_t kdrive_dpt_encode_dpt11(uint8_t *data, uint32_t *length, int32_t year, int32_t month, int32_t day)
Sets DPT-11: date in KNX format NOTE: The year is in KNX DPT11 format: 0..99; >=90 : 20th century; <9...
kdrive_dpt_decode_dpt10
kdriveExpress_API error_t kdrive_dpt_decode_dpt10(const uint8_t *data, uint32_t length, int32_t *day, int32_t *hour, int32_t *minute, int32_t *second)
Gets DPT-10: time.
datapoint_type_t::size_in_bit
int32_t size_in_bit
the data size in bits
Definition: kdrive_express_dpt.h:117
kdrive_dpt_encode_dpt4
kdriveExpress_API error_t kdrive_dpt_encode_dpt4(uint8_t *data, uint32_t *length, uint8_t character)
Sets DPT-4: Character.
uint8_t
unsigned char uint8_t
8 bit unsigned char
Definition: kdrive_express_config.h:29
kdrive_dpt_decode_dpt7
kdriveExpress_API error_t kdrive_dpt_decode_dpt7(const uint8_t *data, uint32_t length, uint16_t *value)
Gets DPT-7: 2 byte unsigned value.
datapoint_type_t
struct datapoint_type_t datapoint_type_t
Represents a single datapoint type.
kdrive_dpt_decode_dpt8
kdriveExpress_API error_t kdrive_dpt_decode_dpt8(const uint8_t *data, uint32_t length, int16_t *value)
Gets DPT-8: 2 byte signed value.
kdrive_dpt_encode_dpt11_utc
kdriveExpress_API error_t kdrive_dpt_encode_dpt11_utc(uint8_t *data, uint32_t *length)
Sets DPT-11: current UTC date.
kdrive_dpt_encode_dpt12
kdriveExpress_API error_t kdrive_dpt_encode_dpt12(uint8_t *data, uint32_t *length, uint32_t value)
Sets DPT-12: 4 byte unsigned value.
kdriveExpress_API
#define kdriveExpress_API
Definition: kdrive_express_config.h:88
kdrive_dpt_encode_dpt7
kdriveExpress_API error_t kdrive_dpt_encode_dpt7(uint8_t *data, uint32_t *length, uint16_t value)
Sets DPT-7: 2 byte unsigned value.
kdrive_express_config.h
kdrive_dpt_decode_dpt3
kdriveExpress_API error_t kdrive_dpt_decode_dpt3(const uint8_t *data, uint32_t length, bool_t *control, uint8_t *value)
Gets DPT-3: 3 bit controlled.
kdrive_dpt_decode_dpt6
kdriveExpress_API error_t kdrive_dpt_decode_dpt6(const uint8_t *data, uint32_t length, int8_t *value)
Gets DPT-6: 8 bit signed value.
kdrive_dpt_encode_dpt10_local
kdriveExpress_API error_t kdrive_dpt_encode_dpt10_local(uint8_t *data, uint32_t *length)
Sets DPT-10: local time.
kdrive_dpt_decode_dpt11
kdriveExpress_API error_t kdrive_dpt_decode_dpt11(const uint8_t *data, uint32_t length, int32_t *year, int32_t *month, int32_t *day)
Gets DPT-11: date in KNX format NOTE: The year is in KNX DPT11 format: 0..99; >=90 : 20th century; <9...
kdrive_dpt_encode_dpt16
kdriveExpress_API error_t kdrive_dpt_encode_dpt16(uint8_t *data, uint32_t *length, const char value[KDRIVE_DPT16_LENGTH+1])
Sets DPT-16: Character string.