From b24866225a6301d3a663f874725e83c012dc25d3 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 26 Dec 2012 17:36:00 +0100 Subject: digital/beacon: add bitcloud stack into common directory digital/zigbit --- .../ZCL/include/zclSimpleMeteringCluster.h | 175 +++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 digital/zigbit/bitcloud/stack/Components/ZCL/include/zclSimpleMeteringCluster.h (limited to 'digital/zigbit/bitcloud/stack/Components/ZCL/include/zclSimpleMeteringCluster.h') diff --git a/digital/zigbit/bitcloud/stack/Components/ZCL/include/zclSimpleMeteringCluster.h b/digital/zigbit/bitcloud/stack/Components/ZCL/include/zclSimpleMeteringCluster.h new file mode 100644 index 00000000..e96f8043 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/ZCL/include/zclSimpleMeteringCluster.h @@ -0,0 +1,175 @@ +/************************************************************************//** + \file zclMemoryManager.h + + \brief + The header file describes the ZCL Simple Metering Cluster + + The header file describes the ZCL Simple Metering Cluster + + \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: + 27.11.08 A. Potashov - Created. +******************************************************************************/ + +#ifndef _SIMPLEMETERINGCLUSTER_H +#define _SIMPLEMETERINGCLUSTER_H + +#include +#include + +#define CURRENT_SUMMATION_DELIVERED_ATTRIBUTE_ID 0x00 + +/*************************************************************************//** + \brief Simple Metering Cluster attributes amount +*****************************************************************************/ +#define SIMPLE_METERING_CLUSTER_CLIENT_ATTRIBUTES_AMOUNT 0 +#define SIMPLE_METERING_CLUSTER_SERVER_ATTRIBUTES_AMOUNT 5 + +/*************************************************************************//** + \brief Simple Metering Cluster commands amount +*****************************************************************************/ +#define SIMPLE_METERING_CLUSTER_CLIENT_COMMANDS_AMOUNT 0 +#define SIMPLE_METERING_CLUSTER_SERVER_COMMANDS_AMOUNT 0 + +#define DEFINE_SIMPLE_METERING_SERVER_ATTRIBUTES(min, max) \ + DEFINE_REPORTABLE_ATTRIBUTE(currentSummationDelivered, ZCL_READONLY_ATTRIBUTE, CCPU_TO_LE16(0x0000), ZCL_U48BIT_DATA_TYPE_ID, min, max), \ + DEFINE_ATTRIBUTE(meterStatus, ZCL_READONLY_ATTRIBUTE, CCPU_TO_LE16(0x0200), ZCL_8BIT_BITMAP_DATA_TYPE_ID), \ + DEFINE_ATTRIBUTE(unitofMeasure, ZCL_READONLY_ATTRIBUTE, CCPU_TO_LE16(0x0300), ZCL_8BIT_ENUM_DATA_TYPE_ID), \ + DEFINE_ATTRIBUTE(summationFormatting, ZCL_READONLY_ATTRIBUTE, CCPU_TO_LE16(0x0303), ZCL_8BIT_BITMAP_DATA_TYPE_ID), \ + DEFINE_ATTRIBUTE(meteringDeviceType, ZCL_READONLY_ATTRIBUTE, CCPU_TO_LE16(0x0306), ZCL_8BIT_ENUM_DATA_TYPE_ID) + +#define SIMPLE_METERING_CLUSTER_ZCL_CLIENT_CLUSTER_TYPE(clattributes, clcommands) \ + { \ + .id = SIMPLE_METERING_CLUSTER_ID, \ + .options = {.type = ZCL_CLIENT_CLUSTER_TYPE, .security = ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY}, \ + .attributesAmount = SIMPLE_METERING_CLUSTER_CLIENT_ATTRIBUTES_AMOUNT, \ + .attributes = (uint8_t *)clattributes, \ + .commandsAmount = SIMPLE_METERING_CLUSTER_CLIENT_COMMANDS_AMOUNT, \ + .commands = NULL \ + } + +#define SIMPLE_METERING_CLUSTER_ZCL_SERVER_CLUSTER_TYPE(clattributes, clcommands) \ + { \ + .id = SIMPLE_METERING_CLUSTER_ID, \ + .options = {.type = ZCL_SERVER_CLUSTER_TYPE, .security = ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY}, \ + .attributesAmount = SIMPLE_METERING_CLUSTER_SERVER_ATTRIBUTES_AMOUNT, \ + .attributes = (uint8_t *)clattributes, \ + .commandsAmount = SIMPLE_METERING_CLUSTER_SERVER_COMMANDS_AMOUNT, \ + .commands = NULL \ + } + +#define DEFINE_SIMPLE_METERING_CLUSTER(cltype, clattributes, clcommands) SIMPLE_METERING_CLUSTER_##cltype(clattributes, clcommands) + +BEGIN_PACK + +/*************************************************************************//** + \brief ZCL Simple Metering Cluster Descriptor + + For internal use +*****************************************************************************/ +typedef struct PACK +{ + //!Reading information attribute set (Id = 0x00) + //!Current Summation Delivered Attribute descriptor + struct PACK + { + ZCL_AttributeId_t id; //!