diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.md similarity index 67% rename from RELEASE_NOTES.txt rename to RELEASE_NOTES.md index 84945eaef..333a275f3 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.md @@ -1,8 +1,27 @@ # 15-March-2023 -  + API Change +``` +esp_err_t esp_matter::identification::init(uint16_t endpoint_id, uint8_t identify_type, + uint8_t effect_identifier = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK, + uint8_t effect_variant = EMBER_ZCL_IDENTIFY_EFFECT_VARIANT_DEFAULT); +``` + +- Above API now accepts the parameters for initial identification `effect_identifier` and `effect_variant`. +- If not used then default value will be used for initialization + +``` +typedef esp_err_t (*callback_t)(callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, uint8_t effect_variant, + void *priv_data); +``` + +- Added additional parameter `effect_variant` in identification callback. + +``` esp_matter::start(event_callback_t callback, intptr_t callback_arg = static_cast(NULL)) +``` + - This API now accepts a parameter to pass additional data to the event callback. By default, the data is set to NULL in the API. # 14-June-2022 diff --git a/components/esp_matter/esp_matter_identify.cpp b/components/esp_matter/esp_matter_identify.cpp index cec0bb44e..d0ac92506 100644 --- a/components/esp_matter/esp_matter_identify.cpp +++ b/components/esp_matter/esp_matter_identify.cpp @@ -31,11 +31,11 @@ esp_err_t set_callback(callback_t callback) return ESP_OK; } -static esp_err_t execute_callback(callback_type_t type, uint16_t endpoint_id, uint8_t effect_id) +static esp_err_t execute_callback(callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, uint8_t effect_variant) { if (identification_callback) { void *priv_data = endpoint::get_priv_data(endpoint_id); - return identification_callback(type, endpoint_id, effect_id, priv_data); + return identification_callback(type, endpoint_id, effect_id, effect_variant, priv_data); } return ESP_OK; } @@ -43,24 +43,26 @@ static esp_err_t execute_callback(callback_type_t type, uint16_t endpoint_id, ui static void start_cb(Identify *identify) { ESP_LOGI(TAG, "Start callback"); - execute_callback(START, identify->mEndpoint, identify->mCurrentEffectIdentifier); + execute_callback(START, identify->mEndpoint, identify->mCurrentEffectIdentifier, identify->mEffectVariant); } static void stop_cb(Identify *identify) { ESP_LOGI(TAG, "Stop callback"); - execute_callback(STOP, identify->mEndpoint, identify->mCurrentEffectIdentifier); + execute_callback(STOP, identify->mEndpoint, identify->mCurrentEffectIdentifier, identify->mEffectVariant); } static void effect_cb(Identify *identify) { ESP_LOGI(TAG, "Effect callback"); - execute_callback(EFFECT, identify->mEndpoint, identify->mCurrentEffectIdentifier); + execute_callback(EFFECT, identify->mEndpoint, identify->mCurrentEffectIdentifier, identify->mEffectVariant); } -esp_err_t init(uint16_t endpoint_id, uint8_t identify_type) +esp_err_t init(uint16_t endpoint_id, uint8_t identify_type, uint8_t effect_identifier, uint8_t effect_variant) { - Identify *identify = new Identify(endpoint_id, start_cb, stop_cb, (EmberAfIdentifyIdentifyType)identify_type, effect_cb); + Identify *identify = new Identify(endpoint_id, start_cb, stop_cb, (EmberAfIdentifyIdentifyType)identify_type, + effect_cb, static_cast(effect_identifier), + static_cast(effect_variant)); if (!identify) { ESP_LOGE(TAG, "Fail to create identify object"); return ESP_FAIL; diff --git a/components/esp_matter/esp_matter_identify.h b/components/esp_matter/esp_matter_identify.h index 9c424d9b9..cc31a25f4 100644 --- a/components/esp_matter/esp_matter_identify.h +++ b/components/esp_matter/esp_matter_identify.h @@ -34,12 +34,14 @@ typedef enum callback_type { * @param[in] type callback type. * @param[in] endpoint_id Endpoint ID to identify. * @param[in] effect_id Effect ID to identify with. + * @param[in] effect_variant Effect Variant * @param[in] priv_data Pointer to the private data passed while creating the endpoint. * * @return ESP_OK on success. * @return error in case of failure. */ -typedef esp_err_t (*callback_t)(callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, void *priv_data); +typedef esp_err_t (*callback_t)(callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, uint8_t effect_variant, + void *priv_data); /** Set identification callback * @@ -60,11 +62,15 @@ esp_err_t set_callback(callback_t callback); * * @param[in] endpoint_id Endpoint ID to identify. * @param[in] identify_type The type supported by the device. + * @param[in] effect_identifier Effect identifier, default is EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK + * @param[in] effect_variant Effect variant, default is EMBER_ZCL_IDENTIFY_EFFECT_VARIANT_DEFAULT * * @return ESP_OK on success. * @return error in case of failure. */ -esp_err_t init(uint16_t endpoint_id, uint8_t identify_type); +esp_err_t init(uint16_t endpoint_id, uint8_t identify_type, + uint8_t effect_identifier = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK, + uint8_t effect_variant = EMBER_ZCL_IDENTIFY_EFFECT_VARIANT_DEFAULT); } /* identification */ } /* esp_matter */ diff --git a/docs/en/developing.rst b/docs/en/developing.rst index 52b1a011f..95b15f857 100644 --- a/docs/en/developing.rst +++ b/docs/en/developing.rst @@ -1,7 +1,7 @@ 2. Developing with the SDK ========================== -Please refer the :project_file:`Release Notes ` to know more about +Please refer the :project_file:`Release Notes ` to know more about the releases 2.1 Development Setup diff --git a/examples/generic_switch/main/app_main.cpp b/examples/generic_switch/main/app_main.cpp index ce6398a92..68419a608 100644 --- a/examples/generic_switch/main/app_main.cpp +++ b/examples/generic_switch/main/app_main.cpp @@ -62,9 +62,9 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg) } static esp_err_t app_identification_cb(identification::callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, - void *priv_data) + uint8_t effect_variant, void *priv_data) { - ESP_LOGI(TAG, "Identification callback: type: %d, effect: %d", type, effect_id); + ESP_LOGI(TAG, "Identification callback: type: %u, effect: %u, variant: %u", type, effect_id, effect_variant); return ESP_OK; } diff --git a/examples/light/main/app_main.cpp b/examples/light/main/app_main.cpp index b9db4ad78..2cd9da9f4 100644 --- a/examples/light/main/app_main.cpp +++ b/examples/light/main/app_main.cpp @@ -100,9 +100,9 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg) } static esp_err_t app_identification_cb(identification::callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, - void *priv_data) + uint8_t effect_variant, void *priv_data) { - ESP_LOGI(TAG, "Identification callback: type: %d, effect: %d", type, effect_id); + ESP_LOGI(TAG, "Identification callback: type: %u, effect: %u, variant: %u", type, effect_id, effect_variant); return ESP_OK; } diff --git a/examples/light_switch/main/app_main.cpp b/examples/light_switch/main/app_main.cpp index 227fa7f0e..52ecfc17e 100644 --- a/examples/light_switch/main/app_main.cpp +++ b/examples/light_switch/main/app_main.cpp @@ -61,9 +61,9 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg) } static esp_err_t app_identification_cb(identification::callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, - void *priv_data) + uint8_t effect_variant, void *priv_data) { - ESP_LOGI(TAG, "Identification callback: type: %d, effect: %d", type, effect_id); + ESP_LOGI(TAG, "Identification callback: type: %u, effect: %u, variant: %u", type, effect_id, effect_variant); return ESP_OK; }