summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/ZCL/include/zclOnOffSwitchConfigurationCluster.h
blob: 97c1c57aa1c71d30a3d07e0011d1dc1629d96e91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/***************************************************************************//**
  \file zclOnOffSwitchConfigurationCluster.h

  \brief
    The header file describes the ZCL On/Off Switch Configuration Cluster and its interface

    The file describes the types and interface of the ZCL On/Off Switch Configuration 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:
    12.02.09 D. Kasyanov - Created.
*******************************************************************************/

#ifndef _ZCLONOFFSWITCHCONFIGURATIONCLUSTER_H
#define _ZCLONOFFSWITCHCONFIGURATIONCLUSTER_H

/*!
Attributes and commands for determining basic information about a device,
setting user device information such as location, enabling a device and resetting it
to factory defaults.
*/

/*******************************************************************************
                   Includes section
*******************************************************************************/

#include <zcl.h>
#include <clusters.h>

/*******************************************************************************
                   Define(s) section
*******************************************************************************/
/**
 * \brief On/Off Switch Configuration attributes values
*/

#define SWITCH_TYPE_ATTRIBUTE_VALUE_TOGGLE 0x00
#define SWITCH_TYPE_ATTRIBUTE_VALUE_MOMENTARY 0x01

#define SWITCH_ACTIONS_ATTRIBUTE_VALUE_ON_OFF 0x00
#define SWITCH_ACTIONS_ATTRIBUTE_VALUE_OFF_ON 0x01
#define SWITCH_ACTIONS_ATTRIBITE_VALUE_TOGGLE_TOGGLE 0x02

/**
 * \brief On/Off Switch Configuration Cluster server attributes amount
*/

#define ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_SERVER_ATTRIBUTES_AMOUNT 2

/**
 * \brief On/Off Switch Configuration Cluster client attributes amount. Clinet doesn't have attributes.
*/

#define ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_CLIENT_ATTRIBTUES_AMOUNT 0

/**
 * \brief On/Off Switch Configuration Cluster commands amount
*/

#define ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_COMMANDS_AMOUNT 0

/**
 * \brief On/Off Switch Configuration Cluster server's attributes identifiers
*/

#define ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_SWITCH_TYPE_SERVER_ATTRIBUTE_ID    CCPU_TO_LE16(0x0000)
#define ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_SWITCH_ACTIONS_SERVER_ATTRIBUTE_ID CCPU_TO_LE16(0x0010)

/**
 * \brief On/Off Switch Configuration Cluster server define attributes macros
*/

#define ZCL_DEFINE_ONOFF_SWITCH_CONFIGURATION_CLUSTER_SERVER_ATTRIBUTES() \
    DEFINE_ATTRIBUTE(switchType, ZCL_READONLY_ATTRIBUTE, ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_SWITCH_TYPE_SERVER_ATTRIBUTE_ID, ZCL_8BIT_ENUM_DATA_TYPE_ID), \
    DEFINE_ATTRIBUTE(switchActions, ZCL_READWRITE_ATTRIBUTE, ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_SWITCH_ACTIONS_SERVER_ATTRIBUTE_ID, ZCL_8BIT_ENUM_DATA_TYPE_ID)


/**
 * \brief On/Off Switch Configuration Cluster definition macros
*/

#define ONOFF_SWITCH_CONFIGURATION_CLUSTER_ZCL_CLIENT_CLUSTER_TYPE(clattributes, clcommands) \
{ \
   .id = ONOFF_SWITCH_CONFIGURATION_CLUSTER_ID, \
   .options = { \
                .type = ZCL_CLIENT_CLUSTER_TYPE, \
                .security = ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY, \
              }, \
   .attributesAmount = ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_CLIENT_ATTRIBTUES_AMOUNT, \
   .attributes = (uint8_t *)clattributes, \
   .commandsAmount = ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_COMMANDS_AMOUNT, \
   .commands = (uint8_t *)clcommands \
}

#define ONOFF_SWITCH_CONFIGURATION_CLUSTER_ZCL_SERVER_CLUSTER_TYPE(clattributes, clcommands) \
{ \
   .id = ONOFF_SWITCH_CONFIGURATION_CLUSTER_ID, \
   .options = { \
                .type = ZCL_SERVER_CLUSTER_TYPE, \
                .security = ZCL_APPLICATION_LINK_KEY_CLUSTER_SECURITY, \
              }, \
   .attributesAmount = ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_SERVER_ATTRIBUTES_AMOUNT, \
   .attributes = (uint8_t *)clattributes, \
   .commandsAmount = ZCL_ONOFF_SWITCH_CONFIGURATION_CLUSTER_COMMANDS_AMOUNT, \
   .commands = (uint8_t *)clcommands \
}

#define DEFINE_ONOFF_SWITCH_CONFIGURATION_CLUSTER(cltype, clattributes, clcommands) \
    ONOFF_SWITCH_CONFIGURATION_CLUSTER_##cltype(clattributes, clcommands)

/******************************************************************************
                    Types section
******************************************************************************/

BEGIN_PACK

/**
 * \brief On/Off Switch Configuration Cluster server's attributes
 */

typedef struct PACK
{
  struct PACK
  {
    ZCL_AttributeId_t id;
    uint8_t type;
    uint8_t properties;
    uint8_t value;
  } switchType;

  struct PACK
  {
    ZCL_AttributeId_t id;
    uint8_t type;
    uint8_t properties;
    uint8_t value;
  } switchActions;
} ZCL_OnOffSwitchConfigurationClusterServerAttributes_t;

END_PACK

#endif /* _ZCLONOFFSWITCHCONFIGURATIONCLUSTER_H */