Skip to content

Commit e36f5bc

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 8ee0089 commit e36f5bc

4 files changed

Lines changed: 48 additions & 39 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_init.cpp

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

196-
sThreadNetworkDriver.Init();
196+
error = sThreadNetworkDriver.Init();
197+
VerifyOrReturnLogError(error == CHIP_NO_ERROR, error);
197198

198199
return error;
199200
}
@@ -215,7 +216,8 @@ void UnlockOpenThreadTask(void)
215216
CHIP_ERROR InitNetworkingStack()
216217
{
217218
if (sLocalInitData.mNetworkingInstance) {
218-
sLocalInitData.mNetworkingInstance->Init();
219+
CHIP_ERROR error = sLocalInitData.mNetworkingInstance->Init();
220+
VerifyOrReturnError(error == CHIP_NO_ERROR, error);
219221
}
220222

221223
return CHIP_NO_ERROR;
@@ -297,11 +299,12 @@ void DoInitChipServer(intptr_t /* unused */)
297299
MutableByteSpan enableKey(enableKeyData);
298300
sInitResult = sLocalInitData.mFactoryDataProvider->GetEnableKey(enableKey);
299301
VerifyInitResultOrReturn(sInitResult, "GetEnableKey() failed");
300-
Nrf::Matter::TestEventTrigger::Instance().SetEnableKey(enableKey);
302+
sInitResult = Nrf::Matter::TestEventTrigger::Instance().SetEnableKey(enableKey);
301303
VerifyInitResultOrReturn(sInitResult, "SetEnableKey() failed");
302304
#ifdef CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS_REGISTER_DEFAULTS
303305
sLocalInitData.mServerInitParams->testEventTriggerDelegate = &Nrf::Matter::TestEventTrigger::Instance();
304-
Nrf::Matter::DefaultTestEventTriggers::Register();
306+
sInitResult = Nrf::Matter::DefaultTestEventTriggers::Register();
307+
VerifyInitResultOrReturn(sInitResult, "DefaultTestEventTriggers::Register() failed");
305308
#endif /* CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS_REGISTER_DEFAULTS */
306309
#endif /* CONFIG_NCS_SAMPLE_MATTER_TEST_EVENT_TRIGGERS */
307310
#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/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
}

0 commit comments

Comments
 (0)