components/esp_matter: Introduced set_server_init_params() api to allow setting custom ServerInitParams

Submodule update for release-v1.4
This commit is contained in:
mahesh
2025-07-29 11:59:36 +05:30
parent 40dfb9b9cd
commit 0602d32fb4
5 changed files with 46 additions and 6 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ variables:
IDF_CHECKOUT_REF: "v5.4.1"
# This variable represents the short hash of the connectedhomeip submodule.
# Note: Do change this short hash on submodule update MRs.
CHIP_SHORT_HASH: "87cf8e5030"
CHIP_SHORT_HASH: "7a54749dc9"
DOCKER_IMAGE_NAME: "espressif/chip-idf"
.add_gitlab_ssh_key: &add_gitlab_ssh_key |
+1 -1
View File
@@ -28,7 +28,7 @@ section in the ESP-Matter Programming Guide.
## Supported ESP-IDF and connectedhomeip versions
- This SDK currently works with commit [87cf8e5030](https://github.com/project-chip/connectedhomeip/tree/87cf8e5030) of connectedhomeip.
- This SDK currently works with commit [7a54749dc9](https://github.com/project-chip/connectedhomeip/tree/7a54749dc9) of connectedhomeip.
- For Matter projects development with this SDK, it is recommended to utilize ESP-IDF [v5.4.1](https://github.com/espressif/esp-idf/tree/v5.4.1).
## Documentation
+18 -3
View File
@@ -66,6 +66,7 @@ using chip::DeviceLayer::ThreadStackMgr;
static const char *TAG = "esp_matter_core";
static bool esp_matter_started = false;
static chip::CommonCaseDeviceServerInitParams *s_server_init_params = nullptr;
#ifndef CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER
// If Matter Server is disabled, these functions are required by InteractionModelEngine but not linked
@@ -734,11 +735,18 @@ static void deinit_ble_if_commissioned(intptr_t unused)
static void esp_matter_chip_init_task(intptr_t context)
{
TaskHandle_t task_to_notify = reinterpret_cast<TaskHandle_t>(context);
static chip::CommonCaseDeviceServerInitParams initParams;
static chip::CommonCaseDeviceServerInitParams defaultInitParams;
chip::CommonCaseDeviceServerInitParams &initParams =
s_server_init_params ? *s_server_init_params : defaultInitParams;
initParams.InitializeStaticResourcesBeforeServerInit();
initParams.appDelegate = &s_app_delegate;
initParams.testEventTriggerDelegate = test_event_trigger::get_delegate();
if (!initParams.appDelegate) {
initParams.appDelegate = &s_app_delegate;
}
if (!initParams.testEventTriggerDelegate) {
initParams.testEventTriggerDelegate = test_event_trigger::get_delegate();
}
#ifdef CONFIG_ESP_MATTER_ENABLE_DATA_MODEL
// Group data provider injection for dynamic data model
@@ -890,6 +898,13 @@ bool is_started()
return esp_matter_started;
}
esp_err_t set_server_init_params(chip::CommonCaseDeviceServerInitParams *server_init_params)
{
VerifyOrReturnError(!esp_matter_started, ESP_ERR_INVALID_STATE, ESP_LOGE(TAG, "esp_matter has started"));
s_server_init_params = server_init_params;
return ESP_OK;
}
esp_err_t start(event_callback_t callback, intptr_t callback_arg)
{
VerifyOrReturnError(!esp_matter_started, ESP_ERR_INVALID_STATE, ESP_LOGE(TAG, "esp_matter has started"));
+25
View File
@@ -23,6 +23,7 @@
#include <app/AttributePathParams.h>
#include <app/CommandPathParams.h>
#include <app/EventPathParams.h>
#include <app/server/Server.h>
using chip::app::ConcreteCommandPath;
using chip::DeviceLayer::ChipDeviceEvent;
@@ -45,6 +46,30 @@ typedef handle_t command_t;
/** Event handle */
typedef handle_t event_t;
/**
* @brief Set the server initialization parameters for Matter.
*
* This function must be called before Matter is started. `esp_matter::start()`
* Calling it after Matter has started will have no effect and will return an error.
*
* @note Starting Matter without valid initialization parameters may lead to undefined behavior or startup failure.
*
* @note The provided pointer is stored internally and used later during Matter initialization.
* It is not copied, so the caller must ensure that the memory pointed to by `server_init_params`
* remains valid and unmodified until Matter is started.
*
* @note If this function is called with a `nullptr`, it will still return ESP_OK. The system
* will proceed with default initialization behavior.
*
* @param[in] server_init_params Pointer to the server initialization parameters. May be nullptr.
*
* @return ESP_OK Successfully set the server initialization parameters.
* @return ESP_ERR_INVALID_STATE If called after Matter has already started.
* @return error in case of failure.
*/
esp_err_t set_server_init_params(chip::CommonCaseDeviceServerInitParams *server_init_params);
/** Event callback
*
* @param[in] event event data pointer.