Filter results by

Older Versions

Older API versions are available as a download. To view, extract the file and open the index.html file in a web browser.

artik_zigbee.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  */
18 
19 #ifndef __ARTIK_ZIGBEE_H__
20 #define __ARTIK_ZIGBEE_H__
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include <stdint.h>
27 #include "artik_error.h"
28 #include "artik_types.h"
29 #include "artik_zigbee_clusters.h"
30 
44 typedef unsigned short ARTIK_ZIGBEE_PROFILE;
45 #define ARTIK_ZIGBEE_PROFILE_HA 0x0104
46 #define ARTIK_ZIGBEE_PROFILE_ZLL 0xC05E
47 #define ARTIK_ZIGBEE_PROFILE_GP 0xA1E0
48 
49 typedef unsigned short ARTIK_ZIGBEE_DEVICEID;
50 #define ARTIK_ZIGBEE_DEVICE_ON_OFF_SWITCH 0x0000
51 #define ARTIK_ZIGBEE_DEVICE_LEVEL_CONTROL_SWITCH 0x0001
52 #define ARTIK_ZIGBEE_DEVICE_REMOTE_CONTROL 0x0006
53 #define ARTIK_ZIGBEE_DEVICE_ON_OFF_LIGHT 0x0100
54 #define ARTIK_ZIGBEE_DEVICE_DIMMABLE_LIGHT 0x0101
55 #define ARTIK_ZIGBEE_DEVICE_COLOR_DIMMABLE_LIGHT 0x0102
56 #define ARTIK_ZIGBEE_DEVICE_ON_OFF_LIGHT_SWITCH 0x0103
57 #define ARTIK_ZIGBEE_DEVICE_DIMMER_SWITCH 0x0104
58 #define ARTIK_ZIGBEE_DEVICE_COLOR_DIMMER_SWITCH 0x0105
59 #define ARTIK_ZIGBEE_DEVICE_LIGHT_SENSOR 0x0106
60 #define ARTIK_ZIGBEE_DEVICE_OCCUPANCY_SENSOR 0x0107
61 #define ARTIK_ZIGBEE_DEVICE_HEATING_COOLING_UNIT 0x0300
62 #define ARTIK_ZIGBEE_DEVICE_THERMOSTAT 0x0301
63 #define ARTIK_ZIGBEE_DEVICE_TEMPERATURE_SENSOR 0x0302
64 #define ARTIK_ZIGBEE_DEVICE_INVALIDATE 0x7FFF
65 
66 #define ARTIK_ZCL_BASIC_CLUSTER_ID 0x0000
67 #define ARTIK_ZCL_POWER_CONFIG_CLUSTER_ID 0x0001
68 #define ARTIK_ZCL_DEVICE_TEMP_CLUSTER_ID 0x0002
69 #define ARTIK_ZCL_IDENTIFY_CLUSTER_ID 0x0003
70 #define ARTIK_ZCL_GROUPS_CLUSTER_ID 0x0004
71 #define ARTIK_ZCL_SCENES_CLUSTER_ID 0x0005
72 #define ARTIK_ZCL_ON_OFF_CLUSTER_ID 0x0006
73 #define ARTIK_ZCL_ON_OFF_SWITCH_CONFIG_CLUSTER_ID 0x0007
74 #define ARTIK_ZCL_LEVEL_CONTROL_CLUSTER_ID 0x0008
75 #define ARTIK_ZCL_ALARM_CLUSTER_ID 0x0009
76 #define ARTIK_ZCL_TIME_CLUSTER_ID 0x000A
77 #define ARTIK_ZCL_RSSI_LOCATION_CLUSTER_ID 0x000B
78 #define ARTIK_ZCL_BINARY_INPUT_BASIC_CLUSTER_ID 0x000F
79 #define ARTIK_ZCL_COMMISSIONING_CLUSTER_ID 0x0015
80 #define ARTIK_ZCL_PARTITION_CLUSTER_ID 0x0016
81 #define ARTIK_ZCL_OTA_BOOTLOAD_CLUSTER_ID 0x0019
82 #define ARTIK_ZCL_POWER_PROFILE_CLUSTER_ID 0x001A
83 #define ARTIK_ZCL_APPLIANCE_CONTROL_CLUSTER_ID 0x001B
84 #define ARTIK_ZCL_POLL_CONTROL_CLUSTER_ID 0x0020
85 #define ARTIK_ZCL_SHADE_CONFIG_CLUSTER_ID 0x0100
86 #define ARTIK_ZCL_DOOR_LOCK_CLUSTER_ID 0x0101
87 #define ARTIK_ZCL_WINDOW_COVERING_CLUSTER_ID 0x0102
88 #define ARTIK_ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID 0x0200
89 #define ARTIK_ZCL_THERMOSTAT_CLUSTER_ID 0x0201
90 #define ARTIK_ZCL_FAN_CONTROL_CLUSTER_ID 0x0202
91 #define ARTIK_ZCL_DEHUMID_CONTROL_CLUSTER_ID 0x0203
92 #define ARTIK_ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID 0x0204
93 #define ARTIK_ZCL_COLOR_CONTROL_CLUSTER_ID 0x0300
94 #define ARTIK_ZCL_BALLAST_CONFIGURATION_CLUSTER_ID 0x0301
95 #define ARTIK_ZCL_ILLUM_MEASUREMENT_CLUSTER_ID 0x0400
96 #define ARTIK_ZCL_ILLUM_LEVEL_SENSING_CLUSTER_ID 0x0401
97 #define ARTIK_ZCL_TEMP_MEASUREMENT_CLUSTER_ID 0x0402
98 #define ARTIK_ZCL_PRESSURE_MEASUREMENT_CLUSTER_ID 0x0403
99 #define ARTIK_ZCL_FLOW_MEASUREMENT_CLUSTER_ID 0x0404
100 #define ARTIK_ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID 0x0405
101 #define ARTIK_ZCL_OCCUPANCY_SENSING_CLUSTER_ID 0x0406
102 #define ARTIK_ZCL_IAS_ZONE_CLUSTER_ID 0x0500
103 #define ARTIK_ZCL_IAS_ACE_CLUSTER_ID 0x0501
104 #define ARTIK_ZCL_IAS_WD_CLUSTER_ID 0x0502
105 #define ARTIK_ZCL_GENERIC_TUNNEL_CLUSTER_ID 0x0600
106 #define ARTIK_ZCL_BACNET_PROTOCOL_TUNNEL_CLUSTER_ID 0x0601
107 #define ARTIK_ZCL_11073_PROTOCOL_TUNNEL_CLUSTER_ID 0x0614
108 #define ARTIK_ZCL_ISO7816_PROTOCOL_TUNNEL_CLUSTER_ID 0x0615
109 #define ARTIK_ZCL_PRICE_CLUSTER_ID 0x0700
110 #define ARTIK_ZCL_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_ID 0x0701
111 #define ARTIK_ZCL_SIMPLE_METERING_CLUSTER_ID 0x0702
112 #define ARTIK_ZCL_MESSAGING_CLUSTER_ID 0x0703
113 #define ARTIK_ZCL_TUNNELING_CLUSTER_ID 0x0704
114 #define ARTIK_ZCL_PREPAYMENT_CLUSTER_ID 0x0705
115 #define ARTIK_ZCL_ENERGY_MANAGEMENT_CLUSTER_ID 0x0706
116 #define ARTIK_ZCL_CALENDAR_CLUSTER_ID 0x0707
117 #define ARTIK_ZCL_DEVICE_MANAGEMENT_CLUSTER_ID 0x0708
118 #define ARTIK_ZCL_EVENTS_CLUSTER_ID 0x0709
119 #define ARTIK_ZCL_MDU_PAIRING_CLUSTER_ID 0x070A
120 #define ARTIK_ZCL_KEY_ESTABLISHMENT_CLUSTER_ID 0x0800
121 #define ARTIK_ZCL_INFORMATION_CLUSTER_ID 0x0900
122 #define ARTIK_ZCL_DATA_SHARING_CLUSTER_ID 0x0901
123 #define ARTIK_ZCL_GAMING_CLUSTER_ID 0x0902
124 #define ARTIK_ZCL_DATA_RATE_CONTROL_CLUSTER_ID 0x0903
125 #define ARTIK_ZCL_VOICE_OVER_ZIGBEE_CLUSTER_ID 0x0904
126 #define ARTIK_ZCL_CHATTING_CLUSTER_ID 0x0905
127 #define ARTIK_ZCL_PAYMENT_CLUSTER_ID 0x0A01
128 #define ARTIK_ZCL_BILLING_CLUSTER_ID 0x0A02
129 #define ARTIK_ZCL_APPLIANCE_IDENTIFICATION_CLUSTER_ID 0x0B00
130 #define ARTIK_ZCL_METER_IDENTIFICATION_CLUSTER_ID 0x0B01
131 #define ARTIK_ZCL_APPLIANCE_EVENTS_AND_ALERT_CLUSTER_ID 0x0B02
132 #define ARTIK_ZCL_APPLIANCE_STATISTICS_CLUSTER_ID 0x0B03
133 #define ARTIK_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID 0x0B04
134 #define ARTIK_ZCL_DIAGNOSTICS_CLUSTER_ID 0x0B05
135 #define ARTIK_ZCL_ZLL_COMMISSIONING_CLUSTER_ID 0x1000
136 #define ARTIK_ZCL_SAMPLE_MFG_SPECIFIC_CLUSTER_ID 0xFC00
137 
138 #define ARTIK_ZIGBEE_MAX_COMMAND_BUFFER_SIZE 5000
139 #define ARTIK_ZIGBEE_MAX_RESPONSE_SIZE 10000
140 #define ARTIK_ZIGBEE_MAX_RECEIVED_COMMAND_PLAYLOAD_LENGTH 1024
141 #define ARTIK_ZIGBEE_MAX_DEVICE_INFO_SIZE 20
142 #define ARTIK_ZIGBEE_MAX_ENDPOINT_SIZE 5
143 #define ARTIK_ZIGBEE_MAX_CLUSTER_SIZE 9
144 #define ARTIK_ZIGBEE_EUI64_SIZE 8
145 #define ARTIK_ZIGBEE_COORDINATOR_NODEID 0x0000
146 #define ARTIK_ZIGBEE_BROADCAST_ENDPOINT 0xFF
147 
152 typedef enum {
153  ARTIK_ZIGBEE_CMD_SUCCESS = 0,
154  ARTIK_ZIGBEE_CMD_ERR_PORT_PROBLEM = -3001,
155  ARTIK_ZIGBEE_CMD_ERR_NO_SUCH_COMMAND = -3002,
156  ARTIK_ZIGBEE_CMD_ERR_WRONG_NUMBER_OF_ARGUMENTS = -3003,
157  ARTIK_ZIGBEE_CMD_ERR_ARGUMENT_OUT_OF_RANGE = -3004,
158  ARTIK_ZIGBEE_CMD_ERR_ARGUMENT_SYNTAX_ERROR = -3005,
159  ARTIK_ZIGBEE_CMD_ERR_STRING_TOO_LONG = -3006,
160  ARTIK_ZIGBEE_CMD_ERR_INVALID_ARGUMENT_TYPE = -3007,
161  ARTIK_ZIGBEE_CMD_ERR = -3008
167 typedef enum {
168  /* It is notified in coordinator side when router joins
169  * current network
170  */
171  ARTIK_ZIGBEE_NETWORK_JOIN = 3100,
172  /* It is notified in coordinator side when router leaves current network
173  */
174  ARTIK_ZIGBEE_NETWORK_LEAVE,
175  ARTIK_ZIGBEE_NETWORK_FIND_FORM_SUCCESS,
176  ARTIK_ZIGBEE_NETWORK_FIND_FORM_FAILED,
177  ARTIK_ZIGBEE_NETWORK_FIND_JOIN_SUCCESS,
178  ARTIK_ZIGBEE_NETWORK_FIND_JOIN_FAILED,
179  /* If it is in a network currently and form/join is re-called, this type
180  * notification will be used
181  */
182  ARTIK_ZIGBEE_NETWORK_EXIST,
183  /* It is used when network_form_manually */
184  ARTIK_ZIGBEE_NETWORK_FORM_SUCCESS,
185  ARTIK_ZIGBEE_NETWORK_FORM_FAILED,
186  /* It is used when network_join_manually */
187  ARTIK_ZIGBEE_NETWORK_JOIN_SUCCESS,
188  ARTIK_ZIGBEE_NETWORK_JOIN_FAILED
194 typedef enum {
195  ARTIK_ZIGBEE_UNKNOWN_DEVICE = 3200,
196  ARTIK_ZIGBEE_COORDINATOR = 3201,
197  ARTIK_ZIGBEE_ROUTER = 3202,
198  ARTIK_ZIGBEE_END_DEVICE = 3203,
199  ARTIK_ZIGBEE_SLEEPY_END_DEVICE = 3204
205 typedef enum {
206  ARTIK_ZIGBEE_NO_NETWORK = 3210,
207  ARTIK_ZIGBEE_JOINING_NETWORK,
208  ARTIK_ZIGBEE_JOINED_NETWORK,
209  ARTIK_ZIGBEE_JOINED_NETWORK_NO_PARENT,
210  ARTIK_ZIGBEE_LEAVING_NETWORK
215 typedef enum {
216  ARTIK_ZIGBEE_DEVICE_DISCOVERY_NO_DEVICE = 3220,
217  ARTIK_ZIGBEE_DEVICE_DISCOVERY_FOUND,
218  ARTIK_ZIGBEE_DEVICE_DISCOVERY_DONE,
219  ARTIK_ZIGBEE_DEVICE_DISCOVERY_START,
220  ARTIK_ZIGBEE_DEVICE_DISCOVERY_ERROR,
221  /* Cyclic discovery is in progress or last calling is not finished */
222  ARTIK_ZIGBEE_DEVICE_DISCOVERY_IN_PROGRESS,
223  /* In cycle discovery, device is changed */
224  ARTIK_ZIGBEE_DEVICE_DISCOVERY_CHANGED,
225  /* In cycle discovery, device is lost */
226  ARTIK_ZIGBEE_DEVICE_DISCOVERY_LOST
231 typedef enum {
232  ARTIK_ZIGBEE_NETWORK_FOUND = 3230,
233  ARTIK_ZIGBEE_NETWORK_FIND_FINISHED,
234  ARTIK_ZIGBEE_NETWORK_FIND_ERR
236 
237 typedef enum {
238  ARTIK_ZIGBEE_SERVICE_DISCOVERY_RECEIVED = 3240,
239  ARTIK_ZIGBEE_SERVICE_DISCOVERY_DONE,
240  ARTIK_ZIGBEE_SERVICE_DISCOVERY_ERROR
241 } artik_zigbee_service_discovery_result;
245 typedef enum {
246  /* Common response */
247  ARTIK_ZIGBEE_RESPONSE_NOTIFICATION = 3300,
248  ARTIK_ZIGBEE_RESPONSE_CLIENT_TO_SERVER_COMMAND_RECEIVED,
249  ARTIK_ZIGBEE_RESPONSE_ATTRIBUTE_CHANGE,
250  ARTIK_ZIGBEE_RESPONSE_REPORTING_CONFIGURE,
251  ARTIK_ZIGBEE_RESPONSE_REPORT_ATTRIBUTE,
252  ARTIK_ZIGBEE_RESPONSE_IDENTIFY_FEEDBACK_START,
253  ARTIK_ZIGBEE_RESPONSE_IDENTIFY_FEEDBACK_STOP,
254  /* Network response */
255  ARTIK_ZIGBEE_RESPONSE_NETWORK_NOTIFICATION,
256  ARTIK_ZIGBEE_RESPONSE_NETWORK_FIND,
257  /* Device response */
258  ARTIK_ZIGBEE_RESPONSE_DEVICE_DISCOVER,
259  /* Cluster response */
260  ARTIK_ZIGBEE_RESPONSE_BROADCAST_IDENTIFY_QUERY,
261  ARTIK_ZIGBEE_RESPONSE_GROUPS_INFO,
262  ARTIK_ZIGBEE_RESPONSE_COMMISSIONING_STATUS,
263  ARTIK_ZIGBEE_RESPONSE_COMMISSIONING_TARGET_INFO,
264  ARTIK_ZIGBEE_RESPONSE_COMMISSIONING_BOUND_INFO,
265  ARTIK_ZIGBEE_RESPONSE_IEEE_ADDR_RESP,
266  ARTIK_ZIGBEE_RESPONSE_SIMPLE_DESC_RESP,
267  ARTIK_ZIGBEE_RESPONSE_MATCH_DESC_RESP,
268  ARTIK_ZIGBEE_RESPONSE_END_DEVICE_BIND,
269  /* < Received basic reset to factory defaults requesting */
270  ARTIK_ZIGBEE_RESPONSE_BASIC_RESET_TO_FACTORY,
271  ARTIK_ZIGBEE_RESPONSE_LEVEL_CONTROL,
272  /* Common response none */
273  ARTIK_ZIGBEE_RESPONSE_NONE = 3399
278 typedef enum {
279  ARTIK_ZIGBEE_ATTR_ONOFF_STATUS,
280  ARTIK_ZIGBEE_ATTR_LEVELCONTROL_LEVEL,
281  ARTIK_ZIGBEE_ATTR_COLOR_HUE,
282  ARTIK_ZIGBEE_ATTR_COLOR_SATURATION,
283  ARTIK_ZIGBEE_ATTR_COLOR_CURRENT_X,
284  ARTIK_ZIGBEE_ATTR_COLOR_CURRENT_Y,
285  ARTIK_ZIGBEE_ATTR_COLOR_TEMP,
286  ARTIK_ZIGBEE_ATTR_FAN_MODE,
287  ARTIK_ZIGBEE_ATTR_FAN_MODE_SEQUENCE,
288  ARTIK_ZIGBEE_ATTR_OCCUPIED_HEATING_SETPOINT,
289  ARTIK_ZIGBEE_ATTR_OCCUPIED_COOLING_SETPOINT,
290  ARTIK_ZIGBEE_ATTR_SYSTEM_MODE,
291  ARTIK_ZIGBEE_ATTR_CONTROL_SEQUENCE,
292  /* cls:0x0400, attr:0x0000 */
293  ARTIK_ZIGBEE_ATTR_ILLUMINANCE,
294  /* cls:0x0402, attr:0x0000 */
295  ARTIK_ZIGBEE_ATTR_TEMPERATURE,
296  /* cls:0x0406, attr:0x0000 */
297  ARTIK_ZIGBEE_ATTR_OCCUPANCY,
298  /* cls:0x0201, attr:0x0000 */
299  ARTIK_ZIGBEE_ATTR_THERMOSTAT_TEMPERATURE,
300  ARTIK_ZIGBEE_ATTR_NONE
305 typedef enum {
306  ARTIK_ZIGBEE_TX_POWER_8 = 8,
307  ARTIK_ZIGBEE_TX_POWER_7 = 7,
308  ARTIK_ZIGBEE_TX_POWER_6 = 6,
309  ARTIK_ZIGBEE_TX_POWER_5 = 5,
310  ARTIK_ZIGBEE_TX_POWER_4 = 4,
311  ARTIK_ZIGBEE_TX_POWER_3 = 3,
312  ARTIK_ZIGBEE_TX_POWER_2 = 2,
313  ARTIK_ZIGBEE_TX_POWER_1 = 1,
314  ARTIK_ZIGBEE_TX_POWER_0 = 0,
315  ARTIK_ZIGBEE_TX_POWER_MINUS1 = -1,
316  ARTIK_ZIGBEE_TX_POWER_MINUS2 = -2,
317  ARTIK_ZIGBEE_TX_POWER_MINUS3 = -3,
318  ARTIK_ZIGBEE_TX_POWER_MINUS4 = -4,
319  ARTIK_ZIGBEE_TX_POWER_MINUS5 = -5,
320  ARTIK_ZIGBEE_TX_POWER_MINUS6 = -6,
321  ARTIK_ZIGBEE_TX_POWER_MINUS7 = -7,
322  ARTIK_ZIGBEE_TX_POWER_MINUS8 = -8,
323  ARTIK_ZIGBEE_TX_POWER_MINUS9 = -9,
324  ARTIK_ZIGBEE_TX_POWER_MINUS11 = -11,
325  ARTIK_ZIGBEE_TX_POWER_MINUS12 = -12,
326  ARTIK_ZIGBEE_TX_POWER_MINUS14 = -14,
327  ARTIK_ZIGBEE_TX_POWER_MINUS17 = -17,
328  ARTIK_ZIGBEE_TX_POWER_MINUS20 = -20,
329  ARTIK_ZIGBEE_TX_POWER_MINUS26 = -26,
330  ARTIK_ZIGBEE_TX_POWER_MINUS43 = -43
335 typedef enum {
336  /*
337  * The change_threshold should be in the range 0 ~ 60082
338  *
339  */
340  ARTIK_ZIGBEE_REPORTING_THERMOSTAT_TEMPERATURE = 0,
341  /*
342  * ARTIK_ZIGBEE_REPORTING_OCCUPANCY_SENSING for change_threshold
343  * parameter has no meaning, set change_threshold value to 0
344  *
345  */
346  ARTIK_ZIGBEE_REPORTING_OCCUPANCY_SENSING,
347  /*
348  * The change_threshold should be in the range 0 ~ 65533
349  *
350  */
351  ARTIK_ZIGBEE_REPORTING_MEASURED_ILLUMINANCE,
352  /*
353  * The change_threshold should be in the range 0 ~ 60082
354  *
355  */
356  ARTIK_ZIGBEE_REPORTING_MEASURED_TEMPERATURE
361 typedef struct {
362  ARTIK_ZIGBEE_PROFILE profile;
363  int endpoint_id;
364  ARTIK_ZIGBEE_DEVICEID device_id;
369 typedef struct {
370  int count;
371  artik_zigbee_local_endpoint endpoints[ARTIK_ZIGBEE_MAX_ENDPOINT_SIZE];
376 typedef struct {
377  int endpoint_id;
378  int node_id;
379  ARTIK_ZIGBEE_DEVICEID device_id;
380  int server_cluster[ARTIK_ZIGBEE_MAX_CLUSTER_SIZE];
381  int client_cluster[ARTIK_ZIGBEE_MAX_CLUSTER_SIZE];
386 typedef struct {
387  int num;
388  artik_zigbee_endpoint endpoint[ARTIK_ZIGBEE_MAX_ENDPOINT_SIZE *
389  ARTIK_ZIGBEE_MAX_DEVICE_INFO_SIZE];
395 typedef struct {
396  char eui64[ARTIK_ZIGBEE_EUI64_SIZE];
397  int node_id;
398  int endpoint_count;
399  artik_zigbee_endpoint endpoint[ARTIK_ZIGBEE_MAX_ENDPOINT_SIZE];
404 typedef struct {
405  int num;
406  artik_zigbee_device device[ARTIK_ZIGBEE_MAX_DEVICE_INFO_SIZE];
411 typedef struct {
412  artik_zigbee_device_discovery_status status;
413  artik_zigbee_device device;
418 typedef struct {
419  int channel;
420  artik_zigbee_tx_power tx_power;
421  int pan_id;
426 typedef struct {
427  artik_zigbee_network_find_status find_status;
428  artik_zigbee_network_info network_info;
433 typedef struct {
434  bool is_global_command;
435  int dest_endpoint_id;
436  int cluster_id;
437  int command_id;
438  char payload[ARTIK_ZIGBEE_MAX_RECEIVED_COMMAND_PLAYLOAD_LENGTH];
439  /* -1 if buffer size isn't enough */
440  int payload_length;
441  int source_node_id;
442  int source_endpoint_id;
447 typedef struct {
448  artik_zigbee_attribute_type type;
449  int endpoint_id;
451 
457 typedef struct {
458  bool used;
459  int endpoint_id;
460  int cluster_id;
461  int attribute_id;
462  bool is_server;
463 
464  struct {
466  uint16_t min_interval;
468  uint16_t max_interval;
473  } reported;
475 
479 typedef struct {
480  artik_zigbee_attribute_type attribute_type;
481  union {
482  int value;
484  } data;
486 
490 typedef struct {
491  int endpoint_id;
492  int duration; /* in seconds */
494 
499 typedef struct {
500  int node_id;
501  int endpoint_id;
503 
508 typedef struct {
509  int node_id;
510  int cluster_id;
511  int endpoint_id;
513 
518 typedef enum {
519  /* < Commissioning error */
520  ARTIK_ZIGBEE_COMMISSIONING_ERROR = 0x00,
521  /* < Commissioning in progress error */
522  ARTIK_ZIGBEE_COMMISSIONING_ERR_IN_PROGRESS,
523  /* < Try to form a new network if network join failed */
524  ARTIK_ZIGBEE_COMMISSIONING_NETWORK_STEERING_FORM,
525  /* < Network steering successfully */
526  ARTIK_ZIGBEE_COMMISSIONING_NETWORK_STEERING_SUCCESS,
527  /* < Network steering failed */
528  ARTIK_ZIGBEE_COMMISSIONING_NETWORK_STEERING_FAILED,
529  /* < Network steering is in progress, wait */
530  ARTIK_ZIGBEE_COMMISSIONING_WAIT_NETWORK_STEERING,
531  /* < Commissioning target successfully */
532  ARTIK_ZIGBEE_COMMISSIONING_TARGET_SUCCESS,
533  /* < Commissioning target stopped */
534  ARTIK_ZIGBEE_COMMISSIONING_TARGET_STOP,
535  /* < Commissioning target failed */
536  ARTIK_ZIGBEE_COMMISSIONING_TARGET_FAILED,
537  /* < Commissioning initiator successfully */
538  ARTIK_ZIGBEE_COMMISSIONING_INITIATOR_SUCCESS,
539  /* < Commissioning initiator stopped */
540  ARTIK_ZIGBEE_COMMISSIONING_INITIATOR_STOP,
541  /* < Commissioning initiator failed */
542  ARTIK_ZIGBEE_COMMISSIONING_INITIATOR_FAILED
544 
549 typedef struct {
550  artik_zigbee_service_discovery_result result;
551  int target_node_id;
552  int target_endpoint;
553  int server_cluster_count;
554  int server_cluster[ARTIK_ZIGBEE_MAX_CLUSTER_SIZE];
555  int client_cluster_count;
556  int client_cluster[ARTIK_ZIGBEE_MAX_CLUSTER_SIZE];
558 
563 typedef struct {
564  int node_id;
565  int endpoint_id;
566  int timeout;
568 
573 typedef struct {
574  artik_zigbee_service_discovery_result result;
575  int node_id;
576  char eui64[ARTIK_ZIGBEE_EUI64_SIZE];
578 
583 typedef struct {
584  artik_zigbee_service_discovery_result result;
585  int node_id;
586  int endpoint_list[ARTIK_ZIGBEE_MAX_ENDPOINT_SIZE];
587  int count;
589 
593 typedef enum {
594  /* A binding that is currently not in use. */
595  ARTIK_UNUSED_BINDING = 0,
596  /* A unicast binding whose 64-bit identifier is
597  * the destination EUI64.
598  */
599  ARTIK_UNICAST_BINDING = 1,
600  /* A unicast binding whose 64-bit identifier is the many-to-one
601  * destination EUI64. Route discovery should be disabled when sending
602  * unicasts via many-to-one bindings.
603  */
604  ARTIK_MANY_TO_ONE_BINDING = 2,
605  /* A multicast binding whose 64-bit identifier is the group address. A
606  * multicast binding can be used to send messages to the group and to
607  * receive messages sent to the group.
608  */
609  ARTIK_MULTICAST_BINDING = 3
611 
615 typedef struct {
616  /* The type of binding. */
618  /*The endpoint on the local node.*/
619  int local;
620  /* A cluster ID that matches one from the local endpoint's
621  * simple descriptor. This cluster ID is set by the provisioning
622  * application to indicate which part an endpoint's functionality is
623  * bound to this particular remote node and is used to distinguish
624  * between unicast and multicast bindings. Note that a binding can be
625  * used to to send messages with any cluster ID, not
626  * just that listed in the binding.
627  */
628  int cluster_id;
629  /* The endpoint on the remote node (specified by \c identifier).*/
630  int remote;
631  /* A 64-bit identifier. This is either:
632  * - The destination EUI64, for unicasts
633  * - A 16-bit multicast group address, for multicasts
634  */
635  char identifier[ARTIK_ZIGBEE_EUI64_SIZE];
636  /* The index of the network the binding belongs to.*/
637  int network_index;
639 
644 
649 typedef struct {
650  /* identify */
659  artik_error(*identify_request)(artik_zigbee_endpoint_handle handle,
660  const artik_zigbee_endpoint * endpoint,
661  int duration);
670  artik_error(*identify_get_remaining_time)(
671  artik_zigbee_endpoint_handle handle,
672  const artik_zigbee_endpoint * endpoint,
673  int *time);
674  /* onoff client */
684  artik_error(*onoff_command)(artik_zigbee_endpoint_handle handle,
685  const artik_zigbee_endpoint * endpoint,
686  artik_zigbee_onoff_status target_status);
687  /* ezmode commissioning */
711  artik_error(*ezmode_commissioning_initiator_start)
712  (
713  artik_zigbee_endpoint_handle handle
714  );
715 
735  artik_error(*ezmode_commissioning_initiator_stop)
736  (
737  artik_zigbee_endpoint_handle handle
738  );
740 
741 extern const artik_zigbee_device_on_off_switch device_on_off_switch_func;
742 
747 typedef struct {
748  /* identify */
757  artik_error(*identify_request)(artik_zigbee_endpoint_handle handle,
758  const artik_zigbee_endpoint * endpoint,
759  int duration);
768  artik_error(*identify_get_remaining_time)(
769  artik_zigbee_endpoint_handle handle,
770  const artik_zigbee_endpoint * endpoint,
771  int *time);
772  /* onoff client */
782  artik_error(*onoff_command)(artik_zigbee_endpoint_handle handle,
783  const artik_zigbee_endpoint * endpoint,
784  artik_zigbee_onoff_status target_status);
785  /* level control client */
795  artik_error(*level_control_request)(artik_zigbee_endpoint_handle handle,
796  const artik_zigbee_endpoint * endpoint,
797  const artik_zigbee_level_control_command * command);
798  /* ezmode commissioning */
822  artik_error(*ezmode_commissioning_initiator_start)
823  (
824  artik_zigbee_endpoint_handle handle
825  );
826 
846  artik_error(*ezmode_commissioning_initiator_stop)
847  (
848  artik_zigbee_endpoint_handle handle
849  );
851 
853  device_level_control_switch_func;
854 
859 typedef struct {
860  /* group server */
870  artik_error(*groups_get_local_name_support)(
871  artik_zigbee_endpoint_handle handle,
872  int endpoint);
880  artik_error(*groups_set_local_name_support)(
881  artik_zigbee_endpoint_handle handle,
882  bool support);
883  /* onoff server */
892  artik_error(*onoff_get_value)(artik_zigbee_endpoint_handle handle,
893  artik_zigbee_onoff_status * status);
894  /* ezmode commissioning */
915  artik_error(*ezmode_commissioning_target_start)
916  (
917  artik_zigbee_endpoint_handle handle
918  );
919 
938  artik_error(*ezmode_commissioning_target_stop)
939  (
940  artik_zigbee_endpoint_handle handle
941  );
943 
944 extern const artik_zigbee_device_on_off_light device_on_off_light_func;
945 
950 typedef struct {
951  /* group server */
961  artik_error(*groups_get_local_name_support)(
962  artik_zigbee_endpoint_handle handle,
963  int endpoint);
971  artik_error(*groups_set_local_name_support)(
972  artik_zigbee_endpoint_handle handle, bool support);
973  /* onoff server */
982  artik_error(*onoff_get_value)(artik_zigbee_endpoint_handle handle,
983  artik_zigbee_onoff_status * status);
984  /* level control server */
993  artik_error(*level_control_get_value)(
994  artik_zigbee_endpoint_handle handle,
995  int *value);
996  /* ezmode commissioning */
1017  artik_error(*ezmode_commissioning_target_start)
1018  (
1019  artik_zigbee_endpoint_handle handle
1020  );
1021 
1040  artik_error(*ezmode_commissioning_target_stop)
1041  (
1042  artik_zigbee_endpoint_handle handle
1043  );
1045 
1046 extern const artik_zigbee_device_dimmable_light device_dimmable_light_func;
1047 
1052 typedef struct {
1053  /* identify */
1062  artik_error(*identify_request)(artik_zigbee_endpoint_handle handle,
1063  const artik_zigbee_endpoint * endpoint,
1064  int duration);
1073  artik_error(*identify_get_remaining_time)(
1074  artik_zigbee_endpoint_handle handle,
1075  const artik_zigbee_endpoint * endpoint,
1076  int *time);
1077  /* Illuminance measurement server */
1092  artik_error(*illum_set_measured_value_range)(
1093  artik_zigbee_endpoint_handle handle,
1094  int min, int max);
1110  artik_error(*illum_set_measured_value)(
1111  artik_zigbee_endpoint_handle handle,
1112  int value);
1113 
1127  artik_error(*illum_get_measured_value)(
1128  artik_zigbee_endpoint_handle handle,
1129  int *value);
1130 
1131  /* ezmode commissioning */
1156  artik_error(*ezmode_commissioning_initiator_start)
1157  (
1158  artik_zigbee_endpoint_handle handle
1159  );
1160 
1181  artik_error(*ezmode_commissioning_initiator_stop)
1182  (
1183  artik_zigbee_endpoint_handle handle
1184  );
1186 
1187 extern const artik_zigbee_device_light_sensor device_light_sensor_func;
1188 
1193 typedef struct {
1194  /* basic client */
1202  artik_error(*reset_to_factory_default)(
1203  artik_zigbee_endpoint_handle handle,
1204  const artik_zigbee_endpoint * endpoint);
1205 
1206  /* identify */
1215  artik_error(*identify_request)(
1216  artik_zigbee_endpoint_handle handle,
1217  const artik_zigbee_endpoint * endpoint,
1218  int duration);
1219 
1228  artik_error(*identify_get_remaining_time)(
1229  artik_zigbee_endpoint_handle handle,
1230  const artik_zigbee_endpoint * endpoint,
1231  int *time);
1232 
1233  /* onoff client */
1243  artik_error(*onoff_command)(artik_zigbee_endpoint_handle handle,
1244  const artik_zigbee_endpoint * endpoint,
1245  artik_zigbee_onoff_status target_status);
1246 
1247  /* level control client */
1257  artik_error(*level_control_request)(artik_zigbee_endpoint_handle handle,
1258  const artik_zigbee_endpoint * endpoint,
1259  const artik_zigbee_level_control_command * command);
1260 
1261  /* cluster client */
1279  artik_error(*request_reporting)(artik_zigbee_endpoint_handle handle,
1280  const artik_zigbee_endpoint * endpoint,
1281  artik_zigbee_reporting_type report_type,
1282  int min_interval,
1283  int max_interval,
1284  int change_threshold);
1285 
1286  /* cluster client */
1300  artik_error(*stop_reporting)(artik_zigbee_endpoint_handle handle,
1301  const artik_zigbee_endpoint * endpoint,
1302  artik_zigbee_reporting_type report_type);
1303  /* ezmode commissioning */
1325  artik_error(*ezmode_commissioning_target_start)
1326  (
1327  artik_zigbee_endpoint_handle handle
1328  );
1329 
1349  artik_error(*ezmode_commissioning_target_stop)
1350  (
1351  artik_zigbee_endpoint_handle handle
1352  );
1354 
1355 extern const artik_zigbee_device_remote_control device_remote_control_func;
1356 
1360 typedef void(*artik_zigbee_client_callback)(void *user_data,
1361  artik_zigbee_response_type response_type,
1362  void *payload);
1363 
1371 typedef struct {
1378  artik_error(*reset_local)(void);
1387  artik_error(*set_local_endpoint)
1388  (
1389  artik_zigbee_local_endpoint_info * endpoint_info
1390  );
1399  artik_error(*get_local_endpoint)
1400  (
1401  artik_zigbee_local_endpoint_info * endpoint_info
1402  );
1419  void *user_data);
1423  void (*deinitialize)(void);
1435  artik_error(*network_start)(artik_zigbee_network_state * state);
1447  artik_error(*network_form)(void);
1454  artik_error(*network_form_manually)
1455  (
1456  const artik_zigbee_network_info *network_info
1457  );
1464  artik_error(*network_permitjoin)(int duration_sec);
1469  artik_error(*network_leave)(void);
1488  artik_error(*network_join)(void);
1497  artik_error(*network_stop_scan)(void);
1504  artik_error(*network_join_manually)(
1506  network_info);
1516  artik_error(*network_find)(void);
1525  artik_error(*network_request_my_network_status)
1526  (
1527  artik_zigbee_network_state * state
1528  );
1555  artik_error(*device_discover)(void);
1564  artik_error(*set_discover_cycle_time)(unsigned int time_minutes);
1573  artik_error(*get_discovered_device_list)
1574  (
1575  artik_zigbee_device_info * device_info
1576  );
1583  artik_error(*device_request_my_node_type)(artik_zigbee_node_type
1584  * type);
1594  void (*device_find_by_cluster)(artik_zigbee_endpoint_list *endpoints,
1595  int cluster_id, int is_server);
1601  void (*raw_request)(const char *command);
1603 
1604 extern const artik_zigbee_module zigbee_module;
1605 
1606 #ifdef __cplusplus
1607 }
1608 #endif
1609 #endif /* __ARTIK_ZIGBEE_H__ */
artik_zigbee_device_discovery_status
Device discovery result.
Definition: artik_zigbee.h:215
artik_zigbee_network_find_status
Network find status.
Definition: artik_zigbee.h:231
artik_zigbee_reporting_type
Request for device attribute information reporting.
Definition: artik_zigbee.h:335
Attribute changed response from zigbeed.
Definition: artik_zigbee.h:447
artik_zigbee_onoff_status
On/Off status for On/Off cluster This is used when both sending and receiving command.
artik_zigbee_node_type
Receiving node type from ZigBee Daemon This is one of response types.
Definition: artik_zigbee.h:194
A structure used to store reporting configurations. If endpoint field is ::EMBER_AF_PLUGIN_REPORTING_...
Definition: artik_zigbee.h:457
Device discovery response.
Definition: artik_zigbee.h:411
Structure for network information.
Definition: artik_zigbee.h:418
Ieee addr response Used in callback, to notify user.
Definition: artik_zigbee.h:573
Local endpoint information.
Definition: artik_zigbee.h:369
ZigBee module operations.
void * artik_zigbee_endpoint_handle
endpoint instance
Definition: artik_zigbee.h:643
Custom types.
Structure for device remote control, to storage the local endpoint information and functions can be i...
Structure for endpoint information.
Definition: artik_zigbee.h:376
Simple descriptor response Used in callback, to notify user.
Definition: artik_zigbee.h:549
Structure for device light sensor, to storage the local endpoint information and functions can be inv...
artik_zigbee_network_notification
Receiving network notification type from ZigBee Daemon This is one of response types.
Definition: artik_zigbee.h:167
Structure for report attribute from remote server.
Definition: artik_zigbee.h:479
Structure for device on/off switch, to storage the local endpoint information and functions can be in...
Definition: artik_zigbee.h:649
Broadcast identify query response Used in callback, to notify user.
Definition: artik_zigbee.h:563
Structure of clusters that bound by ezmode commissioning Used in callback, to notify user...
Definition: artik_zigbee.h:508
Match descriptor response Used in callback, to notify user.
Definition: artik_zigbee.h:583
int artik_error
Error type.
Definition: artik_error.h:35
void(* artik_zigbee_client_callback)(void *user_data, artik_zigbee_response_type response_type, void *payload)
Callback function type.
artik_zigbee_binding_type
Zigbee binding type.
Definition: artik_zigbee.h:593
artik_zigbee_tx_power
Selectable tx power level.
Definition: artik_zigbee.h:305
Structure of target that ezmode commissioning find Used in callback, to notify user.
Definition: artik_zigbee.h:499
artik_zigbee_occupancy_status
The status of occupancy.
Zigbee binding table entry.
Definition: artik_zigbee.h:615
Structure for device level control switch, to storage the local endpoint information and functions ca...
Definition: artik_zigbee.h:747
Structure for endpoint list to find endpoints by cluster ID.
Definition: artik_zigbee.h:386
artik_zigbee_response_type
Receiving response type from ZigBee Daemon.
Definition: artik_zigbee.h:245
artik_zigbee_attribute_type
Attribute change type.
Definition: artik_zigbee.h:278
Structure for device information This is used when sending cluster commands to select device...
Definition: artik_zigbee.h:395
Structure for device dimmable light, to storage the local endpoint information and functions can be i...
Definition: artik_zigbee.h:950
artik_zigbee_commissioning_state
Commissioning state Used in callback, to notify user.
Definition: artik_zigbee.h:518
List of device information.
Definition: artik_zigbee.h:404
Structure for device on/off light, to storage the local endpoint information and functions can be inv...
Definition: artik_zigbee.h:859
ZIGBEE module definition.
Structure for Level Control cluster command.
Error codes.
artik_zigbee_notification
Receiving command notification type from ZigBee Daemon This is one of response types.
Definition: artik_zigbee.h:152
Received command from remote device.
Definition: artik_zigbee.h:433
A structure for notifying identify feedback.
Definition: artik_zigbee.h:490
artik_zigbee_network_state
Receiving network state from ZigBee Daemon This is one of response types.
Definition: artik_zigbee.h:205
Last updated on: