Digi XBee(R) ANSI C Host Library
|
Files | |
file | zcl_types.h |
Macros and structures related to the ZCL datatypes. | |
file | zcl_types.c |
Information on each ZCL datatype; see zcl_type_info[] for additional documentation. | |
Data Structures | |
struct | zcl_timeofday_t |
Time of Day (for ZCL_TYPE_TIME_TIMEOFDAY Data Type) More... | |
struct | zcl_date_t |
Date (for ZCL_TYPE_TIME_DATE Data Type) More... | |
union | zcl40_t |
40-bit unsigned in host-byte-order More... | |
union | zcl48_t |
48-bit unsigned in host-byte-order More... | |
Macros | |
#define | ZCL_UTCTIME_INVALID 0xFFFFFFFF |
#define | ZCL_TYPE_IS_ANALOG(t) (zcl_type_info[t] & ZCL_T_ANALOG) |
ZCL data type t is an analog type. | |
#define | ZCL_TYPE_IS_DISCRETE(t) (zcl_type_info[t] & ZCL_T_DISCRETE) |
ZCL data type t is a discrete type. | |
#define | ZCL_TYPE_IS_SIGNED(t) (zcl_type_info[t] & ZCL_T_SIGNED) |
ZCL data type t is a signed type. | |
#define | ZCL_TYPE_IS_REPORTABLE(t) (zcl_type_info[t] & ZCL_T_REPORTABLE) |
ZCL data type t is a reportable type. | |
#define | ZCL_TYPE_IS_INVALID(t) (zcl_type_info[t] == ZCL_T_INVALID) |
ZCL data type t is an invalid (unsupported/unrecognized) type. | |
#define | ZCL_SIZE_SHORT -1 |
#define | ZCL_SIZE_LONG -2 |
#define | ZCL_SIZE_VARIABLE -3 |
#define | ZCL_SIZE_INVALID -127 |
#define | zcl_types_debug |
Typedefs | |
typedef uint32_t | zcl_utctime_t |
Functions | |
int | zcl_sizeof_type (uint8_t type) |
Return the number of octets used by a given ZCL datatype. More... | |
const char * | zcl_type_name (uint8_t type) |
Return a descriptive string for a given ZCL attribute type. More... | |
Variables | |
const uint8_t | zcl_type_info [256] |
Table to store information on each ZCL datatype. More... | |
const uint8_t | zcl_type_info [256] |
Table to store information on each ZCL datatype. More... | |
ZCL Null Types | |
#define | ZCL_TYPE_NO_DATA 0x00 |
ZCL Logical (discrete) Types | |
#define | ZCL_TYPE_LOGICAL_BOOLEAN 0x10 |
Values for #ZCL_TYPE_LOGICAL_BOOLEAN | |
#define | ZCL_BOOL_FALSE 0x00 |
#define | ZCL_BOOL_TRUE 0x01 |
#define | ZCL_BOOL_INVALID 0xff |
ZCL Enumeration (discrete) Types | |
#define | ZCL_TYPE_ENUM_8BIT 0x30 |
#define | ZCL_TYPE_ENUM_16BIT 0x31 |
ZCL Floating point (analog) Types | |
#define | ZCL_TYPE_FLOAT_SEMI 0x38 |
semi-precision (16-bit) floating point (unsupported) | |
#define | ZCL_TYPE_FLOAT_SINGLE 0x39 |
single-precision (32-bit) IEEE 754 floating point | |
#define | ZCL_TYPE_FLOAT_DOUBLE 0x3a |
double-precision (64-bit) IEEE 754 floating point | |
ZCL String (discrete) Types | |
#define | ZCL_TYPE_STRING_OCTET 0x41 |
First octet is number of bytes in string or 0xff for invalid. | |
#define | ZCL_TYPE_STRING_CHAR 0x42 |
First octet is number of characters in string or 0xff for invalid. More... | |
#define | ZCL_TYPE_STRING_LONG_OCTET 0x43 |
First two octets are number of bytes in string or 0xffff for invalid. More... | |
#define | ZCL_TYPE_STRING_LONG_CHAR 0x44 |
First two octets are number of characters in string or 0xffff for invalid. More... | |
ZCL Ordered Sequence (discrete) Types | |
#define | ZCL_TYPE_ARRAY 0x48 |
ZCL Array (unsupported) | |
#define | ZCL_TYPE_STRUCT 0x4C |
ZCL Struct (unsupported) | |
ZCL Collection (discrete) Types | |
#define | ZCL_TYPE_SET 0x50 |
ZCL Set (unsupported) | |
#define | ZCL_TYPE_BAG 0x51 |
ZCL Bag (unsupported) | |
ZCL Time (analog) Types | |
#define | ZCL_TYPE_TIME_TIMEOFDAY 0xE0 |
see zcl_timeofday_t | |
#define | ZCL_TYPE_TIME_DATE 0xE1 |
see zcl_date_t | |
#define | ZCL_TYPE_TIME_UTCTIME 0xE2 |
number of seconds (stored in uint32_t) since Midnight on 1/1/2000 UTC | |
ZCL Identifier (discrete) Types | |
#define | ZCL_TYPE_ID_CLUSTER 0xE8 |
16-bit cluster ID | |
#define | ZCL_TYPE_ID_ATTRIB 0xE9 |
16-bit attribute ID | |
#define | ZCL_TYPE_ID_BACNET_OID 0xEA |
32-bit BACnet OID | |
ZCL Miscellaneous Types | |
#define | ZCL_TYPE_IEEE_ADDR 0xF0 |
64-bit IEEE address | |
#define | ZCL_TYPE_SECURITY_KEY 0xF1 |
128-bit security key | |
ZCL Unknown Type | |
#define | ZCL_TYPE_UNKNOWN 0xFF |
Unknown ZCL Type. | |
Settings for zcl_type_info[] | |
These bitfields should only be used internally by the library, and should be exposed to user code via public APIs. | |
#define | ZCL_T_INVALID 0x0F |
Not a valid ZCL type. | |
#define | ZCL_T_DISCRETE 0x80 |
Discrete values (bitmap, enum, etc.) that can't be added/subtracted or (if reportable) have a reportable change. More... | |
#define | ZCL_T_ANALOG 0x20 |
If an attribute isn't discrete, it's analog (signed, unsigned, float, etc.) | |
#define | ZCL_T_SIGNED 0x40 |
Type is signed (default is unsigned). Only analog types can be signed. | |
#define | ZCL_T_FLOAT 0x10 |
Type is floating point (single, double or semi-precision). | |
#define | ZCL_T_REPORTABLE (ZCL_T_ANALOG | ZCL_T_DISCRETE) |
Type is reportable. More... | |
#define | ZCL_T_SIZE_MASK 0x0F |
0x00 to 0x08 represent 0 to 8 bytes; 0x0C is 16 bytes; 0x0D is two-octet size prefix, 0x0E is one-octet size prefix; 0x0F is invalid; 0x09, 0x0A and 0x0B are still available to encode special size information. More... | |
#define | ZCL_T_SIZE_INVALID (ZCL_T_INVALID & ZCL_T_SIZE_MASK) |
Macro used when type is invalid or doesn't have a known size. | |
#define | ZCL_T_SIZE_SHORT 0x0E |
First octet of attribute's value is its size. | |
#define | ZCL_T_SIZE_LONG 0x0D |
First two octets of attribute's value are its size. | |
#define | ZCL_T_SIZE_128BIT 0x0C |
128-bit (16-byte) value | |
#define | ZCL_T_SIZE_VARIABLE 0x0B |
variable-length value (array, set, bag, struct) | |
#define ZCL_T_DISCRETE 0x80 |
Discrete values (bitmap, enum, etc.) that can't be added/subtracted or (if reportable) have a reportable change.
Default is analog.
#define ZCL_T_REPORTABLE (ZCL_T_ANALOG | ZCL_T_DISCRETE) |
Type is reportable.
Both the type AND attribute must have reportable flags set if they are reportable.
#define ZCL_T_SIZE_MASK 0x0F |
0x00 to 0x08 represent 0 to 8 bytes; 0x0C is 16 bytes; 0x0D is two-octet size prefix, 0x0E is one-octet size prefix; 0x0F is invalid; 0x09, 0x0A and 0x0B are still available to encode special size information.
Be sure to update zcl_sizeof_type when adding to or changing these macros. Low nibble of each zcl_type_info byte stores the type's size.
Referenced by zcl_sizeof_type().
#define ZCL_TYPE_STRING_CHAR 0x42 |
First octet is number of characters in string or 0xff for invalid.
Note that each character may be more than one byte depending on the "language and character set field of the complex descriptor contained in the character data [following the first octet]". See ZCL for details.
Referenced by zcl_decode_attribute(), zcl_encode_attribute_value(), and zcl_print_attribute_value().
#define ZCL_TYPE_STRING_LONG_CHAR 0x44 |
First two octets are number of characters in string or 0xffff for invalid.
Note that each character may be more than one byte depending on the "language and character set field of the complex descriptor contained in the character data [following the first octet]". See ZCL for details.
#define ZCL_TYPE_STRING_LONG_OCTET 0x43 |
First two octets are number of bytes in string or 0xffff for invalid.
This will come in so handy for a protcol with frames of 256 bytes max (he said sarcastically).
int zcl_sizeof_type | ( | uint8_t | type | ) |
Return the number of octets used by a given ZCL datatype.
[in] | type | Type to look up. Typically one of the ZCL_TYPE_* macros, or the type element of an attribute record. |
ZCL_SIZE_INVALID | unknown or invalid type |
ZCL_SIZE_SHORT | 1-octet size prefix |
ZCL_SIZE_LONG | 2-octet size prefix |
ZCL_SIZE_VARIABLE | variable-length type (array, struct, set, bag) |
>=0 | number of octets used by type (0 to 8, 16) |
References ZCL_T_SIZE_128BIT, ZCL_T_SIZE_INVALID, ZCL_T_SIZE_LONG, ZCL_T_SIZE_MASK, ZCL_T_SIZE_SHORT, ZCL_T_SIZE_VARIABLE, and zcl_type_info.
Referenced by zcl_check_minmax(), zcl_decode_attribute(), zcl_encode_attribute_value(), zcl_parse_attribute_record(), and zcl_print_attribute_value().
const char * zcl_type_name | ( | uint8_t | type | ) |
Return a descriptive string for a given ZCL attribute type.
[in] | type | ZCL attribute type |
Referenced by zcl_print_array_value(), and zcl_print_struct_value().
const uint8_t zcl_type_info[256] |
Table to store information on each ZCL datatype.
Lower 4 bits encode size (0 to 8 octets, 16 octets, one-byte size prefix, two-byte size prefix), upper 4 bits encode additional information.
Need to represent 0 to 8 octets, 16 octets, size in first octet, size in first two octets. 12 possible values.
Using this table, it may be possible to simplify the encode/decode functions greatly – just use memcpy or swapcpy to copy the given number of bytes.
Special case for floating point values if the platform doesn't use IEEE floats, and to convert from 2-byte semi-precision float to 4-byte float.
Referenced by zcl_check_minmax(), zcl_print_attribute_value(), and zcl_sizeof_type().
const uint8_t zcl_type_info[256] |
Table to store information on each ZCL datatype.
Lower 4 bits encode size (0 to 8 octets, 16 octets, one-byte size prefix, two-byte size prefix), upper 4 bits encode additional information.
Need to represent 0 to 8 octets, 16 octets, size in first octet, size in first two octets. 12 possible values.
Using this table, it may be possible to simplify the encode/decode functions greatly – just use memcpy or swapcpy to copy the given number of bytes.
Special case for floating point values if the platform doesn't use IEEE floats, and to convert from 2-byte semi-precision float to 4-byte float.
Referenced by zcl_check_minmax(), zcl_print_attribute_value(), and zcl_sizeof_type().