/************************************************************************//** \file clusters.h \brief The header file describes the ZCLclusters The file describes the ZCL clusters \author Atmel Corporation: http://www.atmel.com \n Support email: avr@atmel.com Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. Licensed under Atmel's Limited License Agreement (BitCloudTM). \internal History: 01.12.08 I. Fedina & A. Potashov - Created. ******************************************************************************/ #ifndef _CLUSTERS_H #define _CLUSTERS_H #include #include /****************************************************************************** Define(s) section ******************************************************************************/ #define DEFINE_ATTRIBUTE(name, props, aid, atype) \ .name = {.id = aid, .type = atype, .properties = props} #define DEFINE_REPORTABLE_ATTRIBUTE(name, props, aid, atype, min, max) \ .name = {.id = aid, .type = atype, .properties = ZCL_REPORTABLE_ATTRIBUTE | (props), .minReportInterval = min, .maxReportInterval = max} #define COMMAND_OPTIONS(cldirection, clwaitingResponse, clackRequest) \ {.direction = ZCL_FRAME_CONTROL_DIRECTION_##cldirection, .waitingResponse = clwaitingResponse, \ .ackRequest = clackRequest} #define DEFINE_COMMAND(cname, cid, coptions, cind) \ .cname = {.id = cid, .options = coptions, cind} /***************************************************************************//** \brief The type describes possible parts of a ZCL cluster. A cluster is a related collection of commands and attributes, which together define an interface to specific functionality. Typically, the entity that stores the attributes of a cluster is referred to as the server of that cluster and an entity that affects or manipulates those attributes is referred to as the client of that cluster. However, if required, attributes may also be present on the client of a cluster. Commands that allow devices to manipulate attributes, e.g. the read attribute or write attribute commands, are (typically) sent from a client device and received by the server device. Any response to those commands, e.g. the read attribute response or the write attribute response commands, are sent from the server device and received by the client device. *******************************************************************************/ /*ZCL command ack request field*/ #define ZCL_COMMAND_NO_ACK 0 #define ZCL_COMMAND_ACK 1 #define ZCL_SERVER_CLUSTER_TYPE 0 //!< server part of a cluster #define ZCL_CLIENT_CLUSTER_TYPE 1 //!< client part of a cluster /*ZCL Header Direction sub-field value*/ #define ZCL_FRAME_CONTROL_DIRECTION_CLIENT_TO_SERVER 0x00 #define ZCL_FRAME_CONTROL_DIRECTION_SERVER_TO_CLIENT 0x01 /*ZCL cluster side possible values*/ #define ZCL_CLUSTER_SIDE_SERVER ZCL_FRAME_CONTROL_DIRECTION_CLIENT_TO_SERVER #define ZCL_CLUSTER_SIDE_CLIENT ZCL_FRAME_CONTROL_DIRECTION_SERVER_TO_CLIENT /*! A value to disable default response for a cluster's command*/ #define ZCL_FRAME_CONTROL_DISABLE_DEFAULT_RESPONSE 0x01 /*! A value to enable default response for a cluster's command*/ #define ZCL_FRAME_CONTROL_ENABLE_DEFAULT_RESPONSE 0x00 /* There is other relevant response specified for the command or not */ #define ZCL_THERE_IS_RELEVANT_RESPONSE 0x01 #define ZCL_THERE_IS_NO_RELEVANT_RESPONSE 0x00 #define ZCL_NETWORK_KEY_CLUSTER_SECURITY 0 #define ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY 1 /* Bits for declaring properties bitmask of attribute */ #define ZCL_READWRITE_ATTRIBUTE 0U #define ZCL_REPORTABLE_ATTRIBUTE 1U #define ZCL_READONLY_ATTRIBUTE 2U #ifdef _ZCL_SECURITY_ #define ZCL_DEFAULT_CLUSTER_SECURITY ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY #else #define ZCL_DEFAULT_CLUSTER_SECURITY ZCL_NETWORK_KEY_CLUSTER_SECURITY #endif /*************************************************************************//** \brief Clusters Id definition *****************************************************************************/ enum { /* General clusters defined by ZCL Specification */ BASIC_CLUSTER_ID = CCPU_TO_LE16(0x0000), //!