forked from espressif/arduino-esp32
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathZigbeeLight.h
41 lines (33 loc) · 1006 Bytes
/
ZigbeeLight.h
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
/* Class of Zigbee On/Off Light endpoint inherited from common EP class */
#pragma once
#include "soc/soc_caps.h"
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
class ZigbeeLight : public ZigbeeEP {
public:
ZigbeeLight(uint8_t endpoint);
~ZigbeeLight() {}
// Use to set a cb function to be called on light change
void onLightChange(void (*callback)(bool)) {
_on_light_change = callback;
}
// Use to restore light state
void restoreLight() {
lightChanged();
}
// Use to control light state
void setLight(bool state);
// Use to get light state
bool getLightState() {
return _current_state;
}
private:
void zbAttributeSet(const esp_zb_zcl_set_attr_value_message_t *message) override;
//callback function to be called on light change
void (*_on_light_change)(bool);
void lightChanged();
bool _current_state;
};
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED