Skip to content

Commit 9336d5b

Browse files
samples: matter: Align sdk-nrf Matter files with Matter 1.6
WIP Provided all required changes in sdk-nrf Matter files to work with Matter 1.6 Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent 8620561 commit 9336d5b

7 files changed

Lines changed: 51 additions & 43 deletions

File tree

samples/matter/common/src/app/fabric_table_delegate.h

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class AppFabricTableDelegate : public chip::FabricTable::Delegate {
3333
{
3434
#ifndef CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
3535
static AppFabricTableDelegate sAppFabricDelegate;
36-
chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAppFabricDelegate);
36+
TEMPORARY_RETURN_IGNORED chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(
37+
&sAppFabricDelegate);
3738
k_timer_init(&sFabricRemovedTimer, &OnFabricRemovedTimerCallback, nullptr);
3839
#endif // CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
3940
}
@@ -59,35 +60,37 @@ class AppFabricTableDelegate : public chip::FabricTable::Delegate {
5960
{
6061
#ifndef CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
6162
if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0) {
62-
chip::DeviceLayer::PlatformMgr().ScheduleWork([](intptr_t) {
63+
if (CHIP_NO_ERROR == chip::DeviceLayer::PlatformMgr().ScheduleWork([](intptr_t) {
6364
#ifdef CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_AND_REBOOT
64-
chip::Server::GetInstance().ScheduleFactoryReset();
65+
chip::Server::GetInstance().ScheduleFactoryReset();
6566
#elif defined(CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_ONLY) || \
6667
defined(CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_AND_PAIRING_START)
6768
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
68-
chip::DeviceLayer::ThreadStackMgr().ClearAllSrpHostAndServices();
69+
chip::DeviceLayer::ThreadStackMgr().ClearAllSrpHostAndServices();
6970
#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
70-
/* Erase Matter data */
71-
chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().DoFactoryReset();
72-
/* Erase Network credentials and disconnect */
73-
chip::DeviceLayer::ConnectivityMgr().ErasePersistentInfo();
71+
/* Erase Matter data */
72+
chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().DoFactoryReset();
73+
/* Erase Network credentials and disconnect */
74+
chip::DeviceLayer::ConnectivityMgr().ErasePersistentInfo();
7475
#ifdef CONFIG_CHIP_WIFI
75-
chip::DeviceLayer::WiFiManager::Instance().Disconnect();
76-
chip::DeviceLayer::ConnectivityMgr().ClearWiFiStationProvision();
76+
chip::DeviceLayer::WiFiManager::Instance().Disconnect();
77+
chip::DeviceLayer::ConnectivityMgr().ClearWiFiStationProvision();
7778
#endif
7879
#ifdef CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_AND_PAIRING_START
79-
/* Start the New BLE advertising */
80-
if (!chip::DeviceLayer::ConnectivityMgr().IsBLEAdvertisingEnabled()) {
81-
if (CHIP_NO_ERROR == chip::Server::GetInstance()
82-
.GetCommissioningWindowManager()
83-
.OpenBasicCommissioningWindow()) {
84-
return;
85-
}
86-
}
87-
ChipLogError(FabricProvisioning, "Could not start Bluetooth LE advertising");
80+
/* Start the New BLE advertising */
81+
if (!chip::DeviceLayer::ConnectivityMgr().IsBLEAdvertisingEnabled()) {
82+
if (CHIP_NO_ERROR == chip::Server::GetInstance()
83+
.GetCommissioningWindowManager()
84+
.OpenBasicCommissioningWindow()) {
85+
return;
86+
}
87+
}
88+
ChipLogError(FabricProvisioning, "Could not start Bluetooth LE advertising");
8889
#endif // CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_AND_PAIRING_START
8990
#endif // CONFIG_CHIP_LAST_FABRIC_REMOVED_ERASE_AND_REBOOT
90-
});
91+
})) {
92+
ChipLogError(FabricProvisioning, "Could not schedule factory reset");
93+
}
9194
}
9295
#endif // CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
9396
}

samples/matter/common/src/app/matter_event_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void DefaultEventHandler(const ChipDeviceEvent *event, intptr_t /* unused */)
5151
chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE));
5252
}
5353
} else if (event->CHIPoBLEAdvertisingChange.Result == kActivity_Stopped) {
54-
NFCOnboardingPayloadMgr().StopTagEmulation();
54+
TEMPORARY_RETURN_IGNORED NFCOnboardingPayloadMgr().StopTagEmulation();
5555
}
5656
#endif
5757
break;

samples/matter/common/src/app/matter_init.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ CHIP_ERROR InitNetworkingStack()
195195
error = ConfigureThreadRole();
196196
VerifyOrReturnLogError(error == CHIP_NO_ERROR, error);
197197

198-
sThreadNetworkDriver.Init();
198+
error = sThreadNetworkDriver.Init();
199+
VerifyOrReturnLogError(error == CHIP_NO_ERROR, error);
199200

200201
return error;
201202
}
@@ -217,7 +218,8 @@ void UnlockOpenThreadTask(void)
217218
CHIP_ERROR InitNetworkingStack()
218219
{
219220
if (sLocalInitData.mNetworkingInstance) {
220-
sLocalInitData.mNetworkingInstance->Init();
221+
CHIP_ERROR error = sLocalInitData.mNetworkingInstance->Init();
222+
VerifyOrReturnError(error == CHIP_NO_ERROR, error);
221223
}
222224

223225
return CHIP_NO_ERROR;
@@ -299,11 +301,12 @@ void DoInitChipServer(intptr_t /* unused */)
299301
MutableByteSpan enableKey(enableKeyData);
300302
sInitResult = sLocalInitData.mFactoryDataProvider->GetEnableKey(enableKey);
301303
VerifyInitResultOrReturn(sInitResult, "GetEnableKey() failed");
302-
Nrf::Matter::TestEventTrigger::Instance().SetEnableKey(enableKey);
304+
sInitResult = Nrf::Matter::TestEventTrigger::Instance().SetEnableKey(enableKey);
303305
VerifyInitResultOrReturn(sInitResult, "SetEnableKey() failed");
304306
#ifdef CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS_REGISTER_DEFAULTS
305307
sLocalInitData.mServerInitParams->testEventTriggerDelegate = &Nrf::Matter::TestEventTrigger::Instance();
306-
Nrf::Matter::DefaultTestEventTriggers::Register();
308+
sInitResult = Nrf::Matter::DefaultTestEventTriggers::Register();
309+
VerifyInitResultOrReturn(sInitResult, "DefaultTestEventTriggers::Register() failed");
307310
#endif /* CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS_REGISTER_DEFAULTS */
308311
#endif /* CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS */
309312
#else

samples/matter/common/src/certification/thread_platform/thread_certification.zap

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,10 @@
888888
"side": "server",
889889
"type": "boolean",
890890
"included": 1,
891-
"storageOption": "RAM",
891+
"storageOption": "External",
892892
"singleton": 0,
893893
"bounded": 0,
894-
"defaultValue": "1",
894+
"defaultValue": null,
895895
"reportable": 1,
896896
"minInterval": 0,
897897
"maxInterval": 65344,
@@ -904,10 +904,10 @@
904904
"side": "server",
905905
"type": "UpdateStateEnum",
906906
"included": 1,
907-
"storageOption": "RAM",
907+
"storageOption": "External",
908908
"singleton": 0,
909909
"bounded": 0,
910-
"defaultValue": "0",
910+
"defaultValue": null,
911911
"reportable": 1,
912912
"minInterval": 0,
913913
"maxInterval": 65344,
@@ -920,10 +920,10 @@
920920
"side": "server",
921921
"type": "int8u",
922922
"included": 1,
923-
"storageOption": "RAM",
923+
"storageOption": "External",
924924
"singleton": 0,
925925
"bounded": 0,
926-
"defaultValue": "",
926+
"defaultValue": null,
927927
"reportable": 1,
928928
"minInterval": 1,
929929
"maxInterval": 65534,
@@ -984,10 +984,10 @@
984984
"side": "server",
985985
"type": "bitmap32",
986986
"included": 1,
987-
"storageOption": "RAM",
987+
"storageOption": "External",
988988
"singleton": 0,
989989
"bounded": 0,
990-
"defaultValue": "0",
990+
"defaultValue": null,
991991
"reportable": 1,
992992
"minInterval": 1,
993993
"maxInterval": 65534,
@@ -1000,10 +1000,10 @@
10001000
"side": "server",
10011001
"type": "int16u",
10021002
"included": 1,
1003-
"storageOption": "RAM",
1003+
"storageOption": "External",
10041004
"singleton": 0,
10051005
"bounded": 0,
1006-
"defaultValue": "1",
1006+
"defaultValue": null,
10071007
"reportable": 1,
10081008
"minInterval": 0,
10091009
"maxInterval": 65344,
@@ -3655,10 +3655,10 @@
36553655
"side": "server",
36563656
"type": "int16u",
36573657
"included": 1,
3658-
"storageOption": "RAM",
3658+
"storageOption": "External",
36593659
"singleton": 0,
36603660
"bounded": 0,
3661-
"defaultValue": "2",
3661+
"defaultValue": null,
36623662
"reportable": 1,
36633663
"minInterval": 1,
36643664
"maxInterval": 65534,
@@ -4623,10 +4623,10 @@
46234623
"side": "server",
46244624
"type": "int16u",
46254625
"included": 1,
4626-
"storageOption": "RAM",
4626+
"storageOption": "External",
46274627
"singleton": 0,
46284628
"bounded": 0,
4629-
"defaultValue": "3",
4629+
"defaultValue": null,
46304630
"reportable": 1,
46314631
"minInterval": 1,
46324632
"maxInterval": 65534,

samples/matter/common/src/clusters/identify.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "app/task_executor.h"
1010
#include "board/board.h"
1111

12-
#include <app/DefaultTimerDelegate.h>
12+
#include <platform/DefaultTimerDelegate.h>
1313
#include <app/clusters/identify-server/IdentifyCluster.h>
1414
#include <app/server-cluster/ServerClusterInterfaceRegistry.h>
1515
#include <data-model-providers/codegen/CodegenDataModelProvider.h>

samples/matter/common/src/dfu/ota/ota_util.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#if CONFIG_CHIP_OTA_REQUESTOR
1010
#include <app/clusters/ota-requestor/BDXDownloader.h>
11+
#include <app/clusters/ota-requestor/CodegenIntegration.h>
1112
#include <app/clusters/ota-requestor/DefaultOTARequestor.h>
1213
#include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
1314
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
@@ -54,7 +55,9 @@ void InitBasicOTARequestor()
5455
imageProcessor.SetOTADownloader(&sBDXDownloader);
5556
sBDXDownloader.SetImageProcessorDelegate(&imageProcessor);
5657
sOTARequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
57-
sOTARequestor.Init(Server::GetInstance(), sOTARequestorStorage, sOTARequestorDriver, sBDXDownloader);
58+
TEMPORARY_RETURN_IGNORED sOTARequestor.Init(Server::GetInstance(), sOTARequestorStorage, sOTARequestorDriver,
59+
sBDXDownloader, GetOTARequestorAttributes(),
60+
GetDefaultOTARequestorEventGenerator());
5861
chip::SetRequestorInstance(&sOTARequestor);
5962
sOTARequestorDriver.Init(&sOTARequestor, &imageProcessor);
6063
}

samples/matter/light_bulb/src/app_task.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ CHIP_ERROR AppTask::Init()
217217
/* Initialize Matter stack */
218218
ReturnErrorOnFailure(Nrf::Matter::PrepareServer(Nrf::Matter::InitData{ .mPostServerInitClbk = []() {
219219
app::SetAttributePersistenceProvider(&gDeferredAttributePersister);
220-
gSimpleAttributePersistence.Init(Nrf::Matter::GetPersistentStorageDelegate());
221-
return CHIP_NO_ERROR;
220+
return gSimpleAttributePersistence.Init(Nrf::Matter::GetPersistentStorageDelegate());
222221
} }));
223222

224223
if (!Nrf::GetBoard().Init(ButtonEventHandler)) {

0 commit comments

Comments
 (0)