feat(matter): moved all identify callback to endpoint.h
This commit is contained in:
parent
1dff8bc759
commit
0e22bb4bac
15 changed files with 32 additions and 187 deletions
|
|
@ -32,6 +32,10 @@
|
|||
// Single On/Off Light Endpoint - at least one per node
|
||||
MatterOnOffLight OnOffLight;
|
||||
|
||||
// WiFi is manually set and started
|
||||
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
|
||||
const char *password = "your-password"; // Change this to your WiFi password
|
||||
|
||||
// Light GPIO that can be controlled by Matter APP
|
||||
#ifdef LED_BUILTIN
|
||||
const uint8_t ledPin = LED_BUILTIN;
|
||||
|
|
@ -48,15 +52,23 @@ bool button_state = false; // false = released | true = pres
|
|||
const uint32_t decommissioningTimeout = 5000; // keep the button pressed for 5s, or longer, to decommission
|
||||
|
||||
// Matter Protocol Endpoint (On/OFF Light) Callback
|
||||
bool matterCB(bool state) {
|
||||
bool onOffLightCallback(bool state) {
|
||||
digitalWrite(ledPin, state ? HIGH : LOW);
|
||||
// This callback must return the success state to Matter core
|
||||
return true;
|
||||
}
|
||||
|
||||
// WiFi is manually set and started
|
||||
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
|
||||
const char *password = "your-password"; // Change this to your WiFi password
|
||||
bool onIdentifyLightCallback(bool identifyIsActive, uint8_t counter) {
|
||||
log_i("Identify Cluster is %s, counter: %d", identifyIsActive ? "Active" : "Inactive", counter);
|
||||
if (identifyIsActive) {
|
||||
// Start Blinking the light
|
||||
OnOffLight.toggle();
|
||||
} else {
|
||||
// Stop Blinking and restore the light to the its last state
|
||||
OnOffLight.updateAccessory();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
// Initialize the USER BUTTON (Boot button) that will be used to decommission the Matter Node
|
||||
|
|
@ -75,20 +87,10 @@ void setup() {
|
|||
OnOffLight.begin();
|
||||
|
||||
// On Identify Callback - Blink the LED
|
||||
OnOffLight.onIdentify([](bool identifyIsActive, uint8_t counter) {
|
||||
log_i("Identify Cluster is %s, counter: %d", identifyIsActive ? "Active" : "Inactive", counter);
|
||||
if (identifyIsActive) {
|
||||
// Start Blinking the light
|
||||
OnOffLight.toggle();
|
||||
} else {
|
||||
// Stop Blinking and restore the light to the its last state
|
||||
OnOffLight.updateAccessory();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
OnOffLight.onIdentify(onIdentifyLightCallback);
|
||||
|
||||
// Associate a callback to the Matter Controller
|
||||
OnOffLight.onChange(matterCB);
|
||||
OnOffLight.onChange(onOffLightCallback);
|
||||
|
||||
// Matter beginning - Last step, after all EndPoints are initialized
|
||||
Matter.begin();
|
||||
|
|
|
|||
|
|
@ -103,8 +103,21 @@ public:
|
|||
virtual bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val) = 0;
|
||||
|
||||
// This callback is invoked when clients interact with the Identify Cluster of an specific endpoint.
|
||||
virtual bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) = 0;
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
uint16_t endpoint_id = 0;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -46,18 +46,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
// User Callback for whenever the Light On/Off state is changed by the Matter Controller
|
||||
using EndPointOnOffCB = std::function<bool(bool)>;
|
||||
|
|
@ -83,6 +71,5 @@ protected:
|
|||
EndPointOnOffCB _onChangeOnOffCB = NULL;
|
||||
EndPointRGBColorCB _onChangeColorCB = NULL;
|
||||
EndPointCB _onChangeCB = NULL;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -51,18 +51,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
// User Callback for whenever the Light On/Off state is changed by the Matter Controller
|
||||
using EndPointOnOffCB = std::function<bool(bool)>;
|
||||
|
|
@ -97,7 +85,5 @@ protected:
|
|||
EndPointBrightnessCB _onChangeBrightnessCB = NULL;
|
||||
EndPointTemperatureCB _onChangeTemperatureCB = NULL;
|
||||
EndPointCB _onChangeCB = NULL;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -46,22 +46,9 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool started = false;
|
||||
bool contactState = false;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -46,18 +46,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
// User Callback for whenever the Light On/Off state is changed by the Matter Controller
|
||||
using EndPointOnOffCB = std::function<bool(bool)>;
|
||||
|
|
@ -83,6 +71,5 @@ protected:
|
|||
EndPointOnOffCB _onChangeOnOffCB = NULL;
|
||||
EndPointBrightnessCB _onChangeBrightnessCB = NULL;
|
||||
EndPointCB _onChangeCB = NULL;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -56,18 +56,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
// User Callback for whenever the Light On/Off state is changed by the Matter Controller
|
||||
using EndPointOnOffCB = std::function<bool(bool)>;
|
||||
|
|
@ -110,6 +98,5 @@ protected:
|
|||
EndPointRGBColorCB _onChangeColorCB = NULL;
|
||||
EndPointTemperatureCB _onChangeTemperatureCB = NULL;
|
||||
EndPointCB _onChangeCB = NULL;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -105,18 +105,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
// User Callback for whenever the Fan Mode (state) is changed by the Matter Controller
|
||||
using EndPointModeCB = std::function<bool(FanMode_t)>;
|
||||
|
|
@ -145,7 +133,6 @@ protected:
|
|||
EndPointModeCB _onChangeModeCB = NULL;
|
||||
EndPointSpeedCB _onChangeSpeedCB = NULL;
|
||||
EndPointCB _onChangeCB = NULL;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
|
||||
// bitmap for Fan Sequence Modes (OFF, LOW, MEDIUM, HIGH, AUTO)
|
||||
static const uint8_t fanSeqModeOff = 0x01;
|
||||
|
|
|
|||
|
|
@ -32,21 +32,8 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool started = false;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -57,18 +57,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool started = false;
|
||||
|
|
@ -77,6 +65,5 @@ protected:
|
|||
// internal function to set the raw humidity value (Matter Cluster)
|
||||
bool begin(uint16_t _rawHumidity);
|
||||
bool setRawHumidity(uint16_t _rawHumidity);
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -57,18 +57,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
protected:
|
||||
// bitmap for Occupancy Sensor Types
|
||||
|
|
@ -81,6 +69,5 @@ protected:
|
|||
|
||||
bool started = false;
|
||||
bool occupancyState = false;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -39,18 +39,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
// User Callback for whenever the Light state is changed by the Matter Controller
|
||||
using EndPointCB = std::function<bool(bool)>;
|
||||
|
|
@ -66,6 +54,5 @@ protected:
|
|||
bool onOffState = false; // default initial state is off, but it can be changed by begin(bool)
|
||||
EndPointCB _onChangeCB = NULL;
|
||||
EndPointCB _onChangeOnOffCB = NULL;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -39,18 +39,6 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
// User Callback for whenever the Plugin state is changed by the Matter Controller
|
||||
using EndPointCB = std::function<bool(bool)>;
|
||||
|
|
@ -66,6 +54,5 @@ protected:
|
|||
bool onOffState = false; // default initial state is off, but it can be changed by begin(bool)
|
||||
EndPointCB _onChangeCB = NULL;
|
||||
EndPointCB _onChangeOnOffCB = NULL;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
};
|
||||
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
|
||||
|
|
|
|||
|
|
@ -50,24 +50,11 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool started = false;
|
||||
// implementation keeps pressure in hPa
|
||||
int16_t rawPressure = 0;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
// internal function to set the raw pressure value (Matter Cluster)
|
||||
bool setRawPressure(int16_t _rawPressure);
|
||||
bool begin(int16_t _rawPressure);
|
||||
|
|
|
|||
|
|
@ -51,24 +51,11 @@ public:
|
|||
|
||||
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
|
||||
bool attributeChangeCB(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
// this function is invoked when clients interact with the Identify Cluster of an specific endpoint
|
||||
bool endpointIdentifyCB(uint16_t endpoint_id, bool identifyIsEnabled, uint8_t identifyCounter) {
|
||||
if (_onEndPointIdentifyCB) {
|
||||
return _onEndPointIdentifyCB(identifyIsEnabled, identifyCounter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// User callaback for the Identify Cluster functionality
|
||||
using EndPointIdentifyCB = std::function<bool(bool, uint8_t)>;
|
||||
void onIdentify(EndPointIdentifyCB onEndPointIdentifyCB) {
|
||||
_onEndPointIdentifyCB = onEndPointIdentifyCB;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool started = false;
|
||||
// implementation keeps temperature in 1/100th of a degree, any temperature unit
|
||||
int16_t rawTemperature = 0;
|
||||
EndPointIdentifyCB _onEndPointIdentifyCB = NULL;
|
||||
// internal function to set the raw temperature value (Matter Cluster)
|
||||
bool setRawTemperature(int16_t _rawTemperature);
|
||||
bool begin(int16_t _rawTemperature);
|
||||
|
|
|
|||
Loading…
Reference in a new issue