Digi XBee(R) ANSI C Host Library
zcl_bacnet.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2012 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
10  * =======================================================================
11  */
12 
21 #ifndef ZCL_BACNET_H
22 #define ZCL_BACNET_H
23 
24 #include "wpan/aps.h"
25 #include "zigbee/zcl.h"
26 
28 
29 #define ZCL_BACNET_PROFILE 0x0105
30 
31 // Devices from the CBA (Commercial Building Automation) Profile
32 #define ZCL_BACNET_DEV_CONSTRUCTED 0x000A
33 #define ZCL_BACNET_DEV_TUNNELED 0x000B
34 
35 #define ZCL_BACNET_ATTR_ACKED_TRANSITIONS 0x0000 // BITMAP8
36 #define ZCL_BACNET_ATTR_ACTIVE_TEXT 0x0004 // CHAR STRING
37 #define ZCL_BACNET_ATTR_ALARM_VALUE 0x0006 // BOOLEAN
38 #define ZCL_BACNET_ATTR_STATE_TEXT 0x000E // ARRAY of STRING
39 #define ZCL_BACNET_ATTR_CHANGE_OF_STATE_COUNT 0x000F // UINT32
40 #define ZCL_BACNET_ATTR_CHANGE_OF_STATE_TIME 0x0010 // STRUCT
41 #define ZCL_BACNET_ATTR_NOTIFICATION_CLASS 0x0011 // UINT16
42 #define ZCL_BACNET_ATTR_COV_INCREMENT 0x0016 // FLOAT32
43 #define ZCL_BACNET_ATTR_DEADBAND 0x0019 // FLOAT32
44 #define ZCL_BACNET_ATTR_DESCRIPTION 0x001C // CHAR STRING
45 #define ZCL_BACNET_ATTR_DEVICE_TYPE 0x001F // CHAR STRING
46 #define ZCL_BACNET_ATTR_ELAPSED_ACTIVE_TIME 0x0021 // UINT32
47 #define ZCL_BACNET_ATTR_EVENT_ENABLE 0x0023 // BITMAP8
48 #define ZCL_BACNET_ATTR_EVENT_STATE 0x0024 // ENUM8
49 #define ZCL_BACNET_ATTR_FAULT_VALUES 0x0025 // SET of UINT16
50 #define ZCL_BACNET_ATTR_FEEDBACK_VALUE 0x0028 // ENUM8
51 #define ZCL_BACNET_ATTR_HIGH_LIMIT 0x002D // FLOAT32
52 #define ZCL_BACNET_ATTR_INACTIVE_TEXT 0x002E // CHAR STRING
53 #define ZCL_BACNET_ATTR_LIMIT_ENABLE 0x0034 // BITMAP8
54 #define ZCL_BACNET_ATTR_LOW_LIMIT 0x003B // FLOAT32
55 #define ZCL_BACNET_ATTR_MAX_PRESENT_VALUE 0x0041 // FLOAT32
56 #define ZCL_BACNET_ATTR_MINIMUM_OFF_TIME 0x0042 // UINT32
57 #define ZCL_BACNET_ATTR_MINIMUM_ON_TIME 0x0043 // UINT32
58 #define ZCL_BACNET_ATTR_MIN_PRESENT_VALUE 0x0045 // FLOAT32
59 #define ZCL_BACNET_ATTR_NOTIFY_TYPE 0x0048 // ENUM8
60 #define ZCL_BACNET_ATTR_NUMBER_OF_STATES 0x004A // UINT16
61 #define ZCL_BACNET_ATTR_OBJECT_IDENTIFIER 0x004B // BACnet OID
62 #define ZCL_BACNET_ATTR_OBJECT_NAME 0x004D // CHAR STRING
63 #define ZCL_BACNET_ATTR_OBJECT_TYPE 0x004F // ENUM16
64 #define ZCL_BACNET_ATTR_OUT_OF_SERVICE 0x0051 // BOOLEAN
65 #define ZCL_BACNET_ATTR_POLARITY 0x0054 // ENUM8
66 #define ZCL_BACNET_ATTR_PRESENT_VALUE 0x0055 // FLOAT32
67 #define ZCL_BACNET_ATTR_PRIORITY_ARRAY 0x0057 // ARRAY of STRUCT
68 #define ZCL_BACNET_ATTR_RELIABILITY 0x0067 // ENUM8
69 #define ZCL_BACNET_ATTR_RELINQUISH_DEFAULT 0x0068 // FLOAT32
70 #define ZCL_BACNET_ATTR_RESOLUTION 0x006A // FLOAT32
71 #define ZCL_BACNET_ATTR_STATUS_FLAGS 0x006F // BITMAP8
72 #define ZCL_BACNET_ATTR_TIME_DELAY 0x0071 // UINT8
73 #define ZCL_BACNET_ATTR_TIME_OF_AT_RESET 0x0072 // STRUCT
74 #define ZCL_BACNET_ATTR_TIME_OF_SC_RESET 0x0073 // STRUCT
75 #define ZCL_BACNET_ATTR_ENGINEERING_UNITS 0x0075 // ENUM16
76 #define ZCL_BACNET_ATTR_UPDATE_INTERVAL 0x0076 // UINT8
77 #define ZCL_BACNET_ATTR_EVENT_TIME_STAMPS 0x0082 // ARRAY
78 #define ZCL_BACNET_ATTR_PROFILE_NAME 0x00A8 // CHAR STRING
79 #define ZCL_BACNET_ATTR_APPLICATION_TYPE 0x0100 // UINT32
80 
81 // Values less than 0x0400 are reserved; 0x0400 to 0xFFFF are reserved for
82 // vendor-specific attributes.
83 
84 // bits of the ZCL_BACNET_ATTR_STATUS_FLAGS attribute
85 #define ZCL_BACNET_STATUS_FLAG_IN_ALARM (1<<0)
86 #define ZCL_BACNET_STATUS_FLAG_FAULT (1<<1)
87 #define ZCL_BACNET_STATUS_FLAG_OVERRIDDEN (1<<2)
88 #define ZCL_BACNET_STATUS_FLAG_OUT_OF_SERVICE (1<<3)
89 
90 // values for ZCL_BACNET_ATTR_POLARITY
91 #define ZCL_BACNET_POLARITY_NORMAL 0
92 #define ZCL_BACNET_POLARITY_REVERSE 1
93 
94 // Attributes structure for ZCL_CLUST_BINARY_OUT
95 typedef struct zcl_binary_output_attr_t {
96  zcl_attribute_base_t active_text;
97  zcl_attribute_base_t description;
98  zcl_attribute_base_t inactive_text;
99  zcl_attribute_base_t out_of_service;
100  zcl_attribute_full_t present_value;
101  zcl_attribute_full_t status_flags;
102  uint16_t end_of_list;
104 
105 // Variable data for ZCL_CLUST_BINARY_OUT
106 typedef struct zcl_binary_output_t {
107  bool_t present_value;
108  bool_t out_of_service;
109  uint8_t status_flags;
111 
112 // macro to create attributes for binary output cluster (ZCL_CLUST_BINARY_OUT)
113 // TODO need to pass in function pointers for value_write and status_read
114 // maybe split cluster table and ep state out, since there could be a need
115 // to create an endpoint with both an output and an input?
116 #define ZCL_BINARY_OUTPUT_VARS( var, desc, zbot, value_write, status_read) \
117  const zcl_binary_output_attr_t var ## _attr = { \
118  { ZCL_BACNET_ATTR_ACTIVE_TEXT, ZCL_ATTRIB_FLAG_READONLY, \
119  ZCL_TYPE_STRING_CHAR, desc " ON" }, \
120  { ZCL_BACNET_ATTR_DESCRIPTION, ZCL_ATTRIB_FLAG_READONLY, \
121  ZCL_TYPE_STRING_CHAR, desc }, \
122  { ZCL_BACNET_ATTR_INACTIVE_TEXT, ZCL_ATTRIB_FLAG_READONLY, \
123  ZCL_TYPE_STRING_CHAR, desc " OFF" }, \
124  { ZCL_BACNET_ATTR_OUT_OF_SERVICE, ZCL_ATTRIB_FLAG_READONLY, \
125  ZCL_TYPE_LOGICAL_BOOLEAN, &zbot.out_of_service }, \
126  { { ZCL_BACNET_ATTR_PRESENT_VALUE, ZCL_ATTRIB_FLAG_FULL, \
127  ZCL_TYPE_LOGICAL_BOOLEAN, &zbot.present_value \
128  }, 0, 0, NULL, value_write }, \
129  { { ZCL_BACNET_ATTR_STATUS_FLAGS, \
130  ZCL_ATTRIB_FLAG_FULL | ZCL_ATTRIB_FLAG_READONLY, \
131  ZCL_TYPE_BITMAP_8BIT, &zbot.status_flags \
132  }, 0, 0, status_read, NULL }, \
133  ZCL_ATTRIBUTE_END_OF_LIST }; \
134  const zcl_attribute_tree_t var ## _tree[] = \
135  { { ZCL_MFG_NONE, &var ## _attr.active_text, NULL } }; \
136  const wpan_cluster_table_entry_t var ## _cluster_table[] = \
137  { ZCL_CLUST_ENTRY_BASIC_SERVER, \
138  ZCL_CLUST_ENTRY_IDENTIFY_SERVER, \
139  { ZCL_CLUST_BINARY_OUT, \
140  &zcl_general_command, \
141  var ## _tree, \
142  WPAN_CLUST_FLAG_SERVER \
143  }, \
144  { WPAN_CLUST_ENTRY_LIST_END } \
145  }; \
146  wpan_ep_state_t var ## _ep_state;
147 
148 // extern declarations
149 // @sa ZCL_BINARY_OUTPUT_VARS, ZCL_BACNET_ENDPOINT
150 #define ZCL_BINARY_OUTPUT_EXTERN( var) \
151  extern wpan_ep_state_t var ## _ep_state; \
152  extern const wpan_cluster_table_entry_t var ## _cluster_table[]
153 
154 
155 
162 #define ZCL_BACNET_ENDPOINT( id, profile, name) \
163  { id, profile, zcl_invalid_cluster, &name ## _ep_state, \
164  ZCL_BACNET_DEV_CONSTRUCTED, 0x00, name ## _cluster_table }
165 
167 
168 #endif
169 
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
Definition: zcl_bacnet.h:106
Header for implementation of ZigBee Cluster Library.
Basic structure for storing a list of attributes in a cluster.
Definition: zcl.h:735
Definition: zcl_bacnet.h:95
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
Use this structure for attributes with min/max values or the need to have a read/write function...
Definition: zcl.h:779
Cluster/Endpoint layer for WPAN networks (ZigBee and DigiMesh).
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
int bool_t
Variable that can hold 0 or 1, may be an int for speed purporses or uint8_t for size optimization...
Definition: platform_config.h:51