Skip to content

Commit 210311d

Browse files
committed
Merge branch 'esp_matter/test_event_trigger' into 'main'
esp_matter: Make Test Event Trigger Delegate configurable See merge request app-frameworks/esp-matter!1086
2 parents 68a1825 + 0db4a89 commit 210311d

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

components/esp_matter/esp_matter_core.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <esp_log.h>
1717
#include <esp_matter.h>
1818
#include <esp_matter_core.h>
19+
#include <esp_matter_test_event_trigger.h>
1920
#include <nvs.h>
2021

2122
#include <app/clusters/general-diagnostics-server/general-diagnostics-server.h>
@@ -718,6 +719,7 @@ static void esp_matter_chip_init_task(intptr_t context)
718719

719720
initParams.InitializeStaticResourcesBeforeServerInit();
720721
initParams.appDelegate = &s_app_delegate;
722+
initParams.testEventTriggerDelegate = test_event_trigger::get_delegate();
721723
initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate);
722724

723725
#ifdef CONFIG_ESP_MATTER_ENABLE_DATA_MODEL
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2025 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include <esp_matter_core.h>
16+
#include <esp_matter_test_event_trigger.h>
17+
18+
namespace esp_matter {
19+
namespace test_event_trigger {
20+
21+
static chip::TestEventTriggerDelegate *s_test_event_trigger = nullptr;
22+
23+
esp_err_t set_delegate(chip::TestEventTriggerDelegate *test_event_trigger_delegate)
24+
{
25+
if (esp_matter::is_started()) {
26+
return ESP_ERR_INVALID_STATE;
27+
}
28+
s_test_event_trigger = test_event_trigger_delegate;
29+
return ESP_OK;
30+
}
31+
32+
chip::TestEventTriggerDelegate *get_delegate()
33+
{
34+
return s_test_event_trigger;
35+
}
36+
37+
} // namespace test_event_trigger
38+
} // namespace esp_matter
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2025 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#pragma once
16+
17+
#include <esp_err.h>
18+
19+
#include <app/TestEventTriggerDelegate.h>
20+
21+
namespace esp_matter {
22+
namespace test_event_trigger {
23+
24+
/** Set TestEventTriggerDelegate which can be triggered by TestEventTrigger command of GeneralDiagnostics cluster
25+
*
26+
* Note: This function should be called before esp_matter::start()
27+
*
28+
* @param[in] test_event_trigger_delegate TestEventTriggerDelegate
29+
*
30+
* @return ESP_OK on success
31+
* ESP_ERR_INVALID_STATE when calling the function after esp_matter::start()
32+
*/
33+
esp_err_t set_delegate(chip::TestEventTriggerDelegate *test_event_trigger_delegate);
34+
35+
/** Get TestEventTriggerDelegate which can be triggered by TestEventTrigger command of GeneralDiagnostics cluster
36+
*
37+
* @return TestEventTriggerDelegate set by set_delegate()
38+
*/
39+
chip::TestEventTriggerDelegate *get_delegate();
40+
} // namespace test_event_trigger
41+
} // namespace esp_matter

0 commit comments

Comments
 (0)