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

zcl.keepalive.h « se « 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: 6d8e70f974884f01d9bf438da0227fa19f1222a4 (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
/**
 * @file zcl.keepalive.h
 * @heading Keep Alive
 * @brief ZCL Keep Alive cluster header
 * ZCL 8 Section 3.18
 * @copyright Copyright [2009 - 2021] Exegin Technologies Limited. All rights reserved.
 */

/*--------------------------------------------------------------------------
 *  DESCRIPTION
 *      Interface definition for the ZCL Keep Alive cluster.
 *--------------------------------------------------------------------------
 */
#ifndef ZCL_KEEPALIVE_H
# define ZCL_KEEPALIVE_H

#include "zcl/zcl.h"

/** Keep Alive Server Attribute IDs */
enum ZbZclKeepAliveSvrAttrT {
    ZCL_KEEPALIVE_SVR_ATTR_BASE = 0x0000,
    /**< TC Keep-Alive Base - minutes (valid range is from 0x01 to 0xff,
     * but not enforced by cluster, for testing) */

    ZCL_KEEPALIVE_SVR_ATTR_JITTER = 0x0001
        /**< TC Keep-Alive Jitter - seconds (valid range is from 0x0000 to 0x0200) */
};

#define ZCL_KEEPALIVE_BASE_MIN              0x01U
#define ZCL_KEEPALIVE_BASE_MAX              0xffU
#define ZCL_KEEPALIVE_BASE_DEFAULT          10U /* minutes */

#define ZCL_KEEPALIVE_JITTER_MIN            0x0000U
#define ZCL_KEEPALIVE_JITTER_MAX            0x0200U
#define ZCL_KEEPALIVE_JITTER_DEFAULT        300U /* seconds */

/**
 * Create a new instance of the Keep Alive Server cluster
 * @param zb Zigbee stack instance
 * @param endpoint Endpoint on which to create cluster
 * @return Cluster pointer, or NULL if there is an error
 */
struct ZbZclClusterT * ZbZclKeepAliveServerAlloc(struct ZigBeeT *zb, uint8_t endpoint);

/**
 * Create a new instance of the Keep Alive Client cluster
 * @param zb Zigbee stack instance
 * @param endpoint Endpoint on which to create cluster
 * @param tcso_callback Callback function that will be invoked later when the TCSO is ever started (ZB_TCSO_STATUS_DISCOVERY_UNDERWAY),
 *  and when it completes, with the resultant status
 * @param tcso_arg Pointer to application data that will later be provided back to the callback function when invoked
 * @return Cluster pointer, or NULL if there is an error
 */
struct ZbZclClusterT * ZbZclKeepAliveClientAlloc(struct ZigBeeT *zb, uint8_t endpoint,
    void (*tcso_callback)(enum ZbTcsoStatusT status, void *arg), void *tcso_arg);

/**
 * Start Keep Alive
 * @param zb Zigbee stack instance
 * @return Void
 */
void ZbZclKeepAliveClientStart(struct ZigBeeT *zb);

/**
 * Stop Keep Alive and abort the TCSO
 * @param zb Zigbee stack instance
 * @return Void
 */
void ZbZclKeepAliveClientStop(struct ZigBeeT *zb);

#endif /* __ZCL_KEEPALIVE_H */