Welcome to mirror list, hosted at ThFree Co, Russian Federation.

zcl.onoff.h « zcl « include « stack « zigbee « STM32_WPAN « ST « Middlewares - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8c430e6abd71594b15cc705c1f78911e0ab24f0b (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
/* Copyright [2009 - 2019] Exegin Technologies Limited. All rights reserved. */

#ifndef ZCL_ONOFF_H
# define ZCL_ONOFF_H

/*--------------------------------------------------------------------------
 *  DESCRIPTION
 *      Interface definition for the ZCL OnOff cluster.
 *--------------------------------------------------------------------------
 */

/* PICS.ZCL.OnOff
 *
 * OO.S | True
 * OO.C | True
 *
 * OO.S.A0000 | True
 * OO.S.A0000.Scene | True
 * OO.S.A0000.Report.Tx | True
 *
 * OO.S.A4000 | False
 * OO.S.A4001 | False
 * OO.S.A4002 | False
 * OO.S.A4003 | False
 *
 * OO.S.Afffd | True
 *
 * OO.S.C00.Rsp | True
 * OO.S.C01.Rsp | True
 * OO.S.C02.Rsp | True
 *
 * OO.S.C40.Rsp | False
 * OO.S.C41.Rsp | False
 * OO.S.C42.Rsp | False
 *
 * OO.C.A0000.Report.Rsp | False
 *
 * OO.C.Afffd | True
 *
 * OO.C.C00.Tx | True
 * OO.C.C01.Tx | True
 * OO.C.C02.Tx | True
 *
 * OO.C.C40.Tx | False
 * OO.C.C41.Tx | False
 * OO.C.C42.Tx | False
 */

#ifdef __cplusplus
extern "C" {
#endif

#include "zcl/zcl.h"

/* Attribute Identifiers */
enum {
    ZCL_ONOFF_ATTR_ONOFF = 0x0000,
    ZCL_ONOFF_ATTR_GLOBAL_SCENE_CONTROL = 0x4000,
    ZCL_ONOFF_ATTR_ON_TIME, /* 0x4001 */
    ZCL_ONOFF_OFF_WAIT_TIME, /* 0x4002 */
};

/* Commands */
enum {
    ZCL_ONOFF_COMMAND_OFF = 0x00,
    ZCL_ONOFF_COMMAND_ON = 0x01,
    ZCL_ONOFF_COMMAND_TOGGLE = 0x02,
};

/*---------------------------------------------------------------
 * OnOff Server Cluster
 *---------------------------------------------------------------
 */
struct ZbZclOnOffServerCallbacksT {
    /* The application is expected to update ZCL_ONOFF_ATTR_ONOFF if these callbacks are
     * successfully executed. */
    enum ZclStatusCodeT (*off)(struct ZbZclClusterT *clusterPtr, struct ZbZclAddrInfoT *srcInfo, void *arg);
    enum ZclStatusCodeT (*on)(struct ZbZclClusterT *clusterPtr, struct ZbZclAddrInfoT *srcInfo, void *arg);
    enum ZclStatusCodeT (*toggle)(struct ZbZclClusterT *clusterPtr, struct ZbZclAddrInfoT *srcInfo, void *arg);
};

struct ZbZclClusterT * ZbZclOnOffServerAlloc(struct ZigBeeT *zb, uint8_t endpoint,
    struct ZbZclOnOffServerCallbacksT *callbacks, void *arg);

/* Allow the Level Control Cluster to be notified of OnOff commands */
typedef void (*ZbZclLevelControlCallbackT)(struct ZbZclClusterT *level_cluster, uint8_t on_off_command);
void ZbZclOnOffServerSetLevelControlCallback(struct ZbZclClusterT *on_off_cluster,
    struct ZbZclClusterT *level_cluster, ZbZclLevelControlCallbackT levelControlCallback);

/*---------------------------------------------------------------
 * OnOff Client Cluster
 *---------------------------------------------------------------
 */
struct ZbZclClusterT * ZbZclOnOffClientAlloc(struct ZigBeeT *zb, uint8_t endpoint);

/* Client Cluster Commands */
enum ZclStatusCodeT ZbZclOnOffClientOnReq(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);
/* Blocking version. Not supported on all platforms. */
enum ZclStatusCodeT ZbZclOnOffClientOnWait(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst);

enum ZclStatusCodeT ZbZclOnOffClientOffReq(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);
/* Blocking version. Not supported on all platforms. */
enum ZclStatusCodeT ZbZclOnOffClientOffWait(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst);

enum ZclStatusCodeT ZbZclOnOffClientToggleReq(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);
/* Blocking version. Not supported on all platforms. */
enum ZclStatusCodeT ZbZclOnOffClientToggleWait(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* ZCL_ONOFF_H */