Skip to content

Commit efaefec

Browse files
Merge branch 'master' into feature/icdm_5.1
2 parents d89f2ce + 068da61 commit efaefec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1186
-1099
lines changed

.github/workflows/examples-efr32.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
if: github.actor != 'restyled-io[bot]'
4141

4242
container:
43-
image: ghcr.io/project-chip/chip-build-efr32:73
43+
image: ghcr.io/project-chip/chip-build-efr32:74
4444
volumes:
4545
- "/tmp/bloat_reports:/tmp/bloat_reports"
4646
steps:

.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,17 @@
213213
[submodule "third_party/silabs/simplicity_sdk"]
214214
path = third_party/silabs/simplicity_sdk
215215
url = https://github.com/SiliconLabs/simplicity_sdk.git
216-
branch = v2024.6.0
216+
branch = v2024.6.1-0
217217
platforms = silabs
218218
[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"]
219219
path = third_party/silabs/wiseconnect-wifi-bt-sdk
220220
url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git
221-
branch = 2.8.2
221+
branch = 2.10.0
222222
platforms = silabs
223223
[submodule "third_party/silabs/wifi_sdk"]
224224
path = third_party/silabs/wifi_sdk
225225
url = https://github.com/SiliconLabs/wiseconnect.git
226-
branch = v3.3.0
226+
branch = v3.3.1
227227
platforms = silabs
228228
[submodule "editline"]
229229
path = third_party/editline/repo

config/telink/chip-module/Kconfig.defaults

-5
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,7 @@ config NVS_LOOKUP_CACHE_SIZE
219219
config SETTINGS_NVS_SECTOR_SIZE_MULT
220220
default 1
221221

222-
# Set sector counter of NVS
223-
config SETTINGS_NVS_SECTOR_COUNT
224-
default 12
225-
226222
# Enable OpenThread
227-
228223
config NET_L2_OPENTHREAD
229224
default y if !WIFI
230225

examples/fabric-admin/commands/clusters/ClusterCommand.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
8484
if (data != nullptr)
8585
{
8686
LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, data));
87-
DeviceMgr().HandleCommandResponse(path, data);
87+
DeviceMgr().HandleCommandResponse(path, *data);
8888
}
8989
}
9090

examples/fabric-admin/commands/clusters/ReportCommand.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void ReportCommand::OnAttributeData(const app::ConcreteDataAttributePath & path,
4646

4747
LogErrorOnFailure(RemoteDataModelLogger::LogAttributeAsJSON(path, data));
4848

49-
DeviceMgr().HandleAttributeData(path, data);
49+
DeviceMgr().HandleAttributeData(path, *data);
5050
}
5151

5252
void ReportCommand::OnEventData(const app::EventHeader & eventHeader, TLV::TLVReader * data, const app::StatusIB * status)
@@ -73,5 +73,5 @@ void ReportCommand::OnEventData(const app::EventHeader & eventHeader, TLV::TLVRe
7373

7474
LogErrorOnFailure(RemoteDataModelLogger::LogEventAsJSON(eventHeader, data));
7575

76-
DeviceMgr().HandleEventData(eventHeader, data);
76+
DeviceMgr().HandleEventData(eventHeader, *data);
7777
}

examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_E
6464

6565
DeviceMgr().SubscribeRemoteFabricBridge();
6666

67-
// After successful commissioning of the Commissionee, initiate Reverse Commissioning
68-
// via the Commissioner Control Cluster. However, we must first verify that the
69-
// remote Fabric-Bridge supports Fabric Synchronization.
70-
//
71-
// Note: The Fabric-Admin MUST NOT send the RequestCommissioningApproval command
72-
// if the remote Fabric-Bridge lacks Fabric Synchronization support.
73-
DeviceLayer::PlatformMgr().ScheduleWork(CheckFabricBridgeSynchronizationSupport, 0);
67+
if (DeviceMgr().IsLocalBridgeReady())
68+
{
69+
// After successful commissioning of the Commissionee, initiate Reverse Commissioning
70+
// via the Commissioner Control Cluster. However, we must first verify that the
71+
// remote Fabric-Bridge supports Fabric Synchronization.
72+
//
73+
// Note: The Fabric-Admin MUST NOT send the RequestCommissioningApproval command
74+
// if the remote Fabric-Bridge lacks Fabric Synchronization support.
75+
DeviceLayer::PlatformMgr().ScheduleWork(CheckFabricBridgeSynchronizationSupport, 0);
76+
}
7477
}
7578
else
7679
{

examples/fabric-admin/device_manager/DeviceManager.cpp

+82-77
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,25 @@ void DeviceManager::ReadSupportedDeviceCategories()
237237
PushCommand(commandBuilder.c_str());
238238
}
239239

240+
void DeviceManager::HandleReadSupportedDeviceCategories(chip::TLV::TLVReader & data)
241+
{
242+
ChipLogProgress(NotSpecified, "Attribute SupportedDeviceCategories detected.");
243+
244+
BitMask<CommissionerControl::SupportedDeviceCategoryBitmap> value;
245+
CHIP_ERROR error = app::DataModel::Decode(data, value);
246+
if (error != CHIP_NO_ERROR)
247+
{
248+
ChipLogError(NotSpecified, "Failed to decode attribute value. Error: %" CHIP_ERROR_FORMAT, error.Format());
249+
return;
250+
}
251+
252+
if (value.Has(CommissionerControl::SupportedDeviceCategoryBitmap::kFabricSynchronization))
253+
{
254+
ChipLogProgress(NotSpecified, "Remote Fabric-Bridge supports Fabric Synchronization, start reverse commissioning.");
255+
RequestCommissioningApproval();
256+
}
257+
}
258+
240259
void DeviceManager::RequestCommissioningApproval()
241260
{
242261
ChipLogProgress(NotSpecified, "Starting reverse commissioning for bridge device: NodeId: " ChipLogFormatX64,
@@ -254,12 +273,12 @@ void DeviceManager::RequestCommissioningApproval()
254273
PushCommand(commandBuilder.c_str());
255274
}
256275

257-
void DeviceManager::HandleCommissioningRequestResult(TLV::TLVReader * data)
276+
void DeviceManager::HandleCommissioningRequestResult(TLV::TLVReader & data)
258277
{
259278
ChipLogProgress(NotSpecified, "CommissioningRequestResult event received.");
260279

261280
CommissionerControl::Events::CommissioningRequestResult::DecodableType value;
262-
CHIP_ERROR error = app::DataModel::Decode(*data, value);
281+
CHIP_ERROR error = app::DataModel::Decode(data, value);
263282
if (error != CHIP_NO_ERROR)
264283
{
265284
ChipLogError(NotSpecified, "Failed to decode event value. Error: %" CHIP_ERROR_FORMAT, error.Format());
@@ -283,82 +302,12 @@ void DeviceManager::HandleCommissioningRequestResult(TLV::TLVReader * data)
283302
SendCommissionNodeRequest(value.requestId, kResponseTimeoutSeconds);
284303
}
285304

286-
void DeviceManager::SendCommissionNodeRequest(uint64_t requestId, uint16_t responseTimeoutSeconds)
287-
{
288-
ChipLogProgress(NotSpecified, "Request the Commissioner Control Server to begin commissioning a previously approved request.");
289-
290-
StringBuilder<kMaxCommandSize> commandBuilder;
291-
commandBuilder.Add("commissionercontrol commission-node ");
292-
commandBuilder.AddFormat("%lu %u %lu %d", requestId, responseTimeoutSeconds, mRemoteBridgeNodeId, kRootEndpointId);
293-
294-
PushCommand(commandBuilder.c_str());
295-
}
296-
297-
void DeviceManager::HandleReverseOpenCommissioningWindow(TLV::TLVReader * data)
305+
void DeviceManager::HandleAttributePartsListUpdate(chip::TLV::TLVReader & data)
298306
{
299-
CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType value;
300-
CHIP_ERROR error = app::DataModel::Decode(*data, value);
301-
if (error != CHIP_NO_ERROR)
302-
{
303-
ChipLogError(NotSpecified, "Failed to decode command response value. Error: %" CHIP_ERROR_FORMAT, error.Format());
304-
return;
305-
}
306-
307-
// Log all fields
308-
ChipLogProgress(NotSpecified, "DecodableType fields:");
309-
ChipLogProgress(NotSpecified, " commissioningTimeout: %u", value.commissioningTimeout);
310-
ChipLogProgress(NotSpecified, " discriminator: %u", value.discriminator);
311-
ChipLogProgress(NotSpecified, " iterations: %u", value.iterations);
312-
313-
char verifierHex[Crypto::kSpake2p_VerifierSerialized_Length * 2 + 1];
314-
Encoding::BytesToHex(value.PAKEPasscodeVerifier.data(), value.PAKEPasscodeVerifier.size(), verifierHex, sizeof(verifierHex),
315-
Encoding::HexFlags::kNullTerminate);
316-
ChipLogProgress(NotSpecified, " PAKEPasscodeVerifier: %s", verifierHex);
317-
318-
char saltHex[Crypto::kSpake2p_Max_PBKDF_Salt_Length * 2 + 1];
319-
Encoding::BytesToHex(value.salt.data(), value.salt.size(), saltHex, sizeof(saltHex), Encoding::HexFlags::kNullTerminate);
320-
ChipLogProgress(NotSpecified, " salt: %s", saltHex);
321-
322-
OpenDeviceCommissioningWindow(mLocalBridgeNodeId, value.commissioningTimeout, value.iterations, value.discriminator, saltHex,
323-
verifierHex);
324-
}
325-
326-
void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & path, TLV::TLVReader * data)
327-
{
328-
if (path.mClusterId == CommissionerControl::Id &&
329-
path.mAttributeId == CommissionerControl::Attributes::SupportedDeviceCategories::Id)
330-
{
331-
ChipLogProgress(NotSpecified, "Attribute SupportedDeviceCategories detected.");
332-
333-
BitMask<CommissionerControl::SupportedDeviceCategoryBitmap> value;
334-
CHIP_ERROR error = app::DataModel::Decode(*data, value);
335-
if (error != CHIP_NO_ERROR)
336-
{
337-
ChipLogError(NotSpecified, "Failed to decode attribute value. Error: %" CHIP_ERROR_FORMAT, error.Format());
338-
return;
339-
}
340-
341-
if (value.Has(CommissionerControl::SupportedDeviceCategoryBitmap::kFabricSynchronization))
342-
{
343-
ChipLogProgress(NotSpecified, "Remote Fabric-Bridge supports Fabric Synchronization, start reverse commissioning.");
344-
RequestCommissioningApproval();
345-
}
346-
347-
return;
348-
}
349-
350-
if (path.mClusterId != Descriptor::Id || path.mAttributeId != Descriptor::Attributes::PartsList::Id)
351-
{
352-
return;
353-
}
354-
355-
ChipLogProgress(NotSpecified, "Attribute change detected:");
356-
ChipLogProgress(
357-
NotSpecified, "Endpoint: %u, Cluster: " ChipLogFormatMEI ", Attribute: " ChipLogFormatMEI ", DataVersion: %" PRIu32,
358-
path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId), path.mDataVersion.ValueOr(0));
307+
ChipLogProgress(NotSpecified, "Attribute PartsList change detected:");
359308

360309
app::DataModel::DecodableList<EndpointId> value;
361-
CHIP_ERROR error = app::DataModel::Decode(*data, value);
310+
CHIP_ERROR error = app::DataModel::Decode(data, value);
362311
if (error != CHIP_NO_ERROR)
363312
{
364313
ChipLogError(NotSpecified, "Failed to decode attribute value. Error: %" CHIP_ERROR_FORMAT, error.Format());
@@ -456,7 +405,63 @@ void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & p
456405
}
457406
}
458407

459-
void DeviceManager::HandleEventData(const app::EventHeader & header, TLV::TLVReader * data)
408+
void DeviceManager::SendCommissionNodeRequest(uint64_t requestId, uint16_t responseTimeoutSeconds)
409+
{
410+
ChipLogProgress(NotSpecified, "Request the Commissioner Control Server to begin commissioning a previously approved request.");
411+
412+
StringBuilder<kMaxCommandSize> commandBuilder;
413+
commandBuilder.Add("commissionercontrol commission-node ");
414+
commandBuilder.AddFormat("%lu %u %lu %d", requestId, responseTimeoutSeconds, mRemoteBridgeNodeId, kRootEndpointId);
415+
416+
PushCommand(commandBuilder.c_str());
417+
}
418+
419+
void DeviceManager::HandleReverseOpenCommissioningWindow(TLV::TLVReader & data)
420+
{
421+
CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType value;
422+
CHIP_ERROR error = app::DataModel::Decode(data, value);
423+
if (error != CHIP_NO_ERROR)
424+
{
425+
ChipLogError(NotSpecified, "Failed to decode command response value. Error: %" CHIP_ERROR_FORMAT, error.Format());
426+
return;
427+
}
428+
429+
// Log all fields
430+
ChipLogProgress(NotSpecified, "DecodableType fields:");
431+
ChipLogProgress(NotSpecified, " commissioningTimeout: %u", value.commissioningTimeout);
432+
ChipLogProgress(NotSpecified, " discriminator: %u", value.discriminator);
433+
ChipLogProgress(NotSpecified, " iterations: %u", value.iterations);
434+
435+
char verifierHex[Crypto::kSpake2p_VerifierSerialized_Length * 2 + 1];
436+
Encoding::BytesToHex(value.PAKEPasscodeVerifier.data(), value.PAKEPasscodeVerifier.size(), verifierHex, sizeof(verifierHex),
437+
Encoding::HexFlags::kNullTerminate);
438+
ChipLogProgress(NotSpecified, " PAKEPasscodeVerifier: %s", verifierHex);
439+
440+
char saltHex[Crypto::kSpake2p_Max_PBKDF_Salt_Length * 2 + 1];
441+
Encoding::BytesToHex(value.salt.data(), value.salt.size(), saltHex, sizeof(saltHex), Encoding::HexFlags::kNullTerminate);
442+
ChipLogProgress(NotSpecified, " salt: %s", saltHex);
443+
444+
OpenDeviceCommissioningWindow(mLocalBridgeNodeId, value.commissioningTimeout, value.iterations, value.discriminator, saltHex,
445+
verifierHex);
446+
}
447+
448+
void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & path, TLV::TLVReader & data)
449+
{
450+
if (path.mClusterId == CommissionerControl::Id &&
451+
path.mAttributeId == CommissionerControl::Attributes::SupportedDeviceCategories::Id)
452+
{
453+
HandleReadSupportedDeviceCategories(data);
454+
return;
455+
}
456+
457+
if (path.mClusterId == Descriptor::Id && path.mAttributeId == Descriptor::Attributes::PartsList::Id)
458+
{
459+
HandleAttributePartsListUpdate(data);
460+
return;
461+
}
462+
}
463+
464+
void DeviceManager::HandleEventData(const app::EventHeader & header, TLV::TLVReader & data)
460465
{
461466
if (header.mPath.mClusterId == CommissionerControl::Id &&
462467
header.mPath.mEventId == CommissionerControl::Events::CommissioningRequestResult::Id)
@@ -465,7 +470,7 @@ void DeviceManager::HandleEventData(const app::EventHeader & header, TLV::TLVRea
465470
}
466471
}
467472

468-
void DeviceManager::HandleCommandResponse(const app::ConcreteCommandPath & path, TLV::TLVReader * data)
473+
void DeviceManager::HandleCommandResponse(const app::ConcreteCommandPath & path, TLV::TLVReader & data)
469474
{
470475
ChipLogProgress(NotSpecified, "Command Response received.");
471476

examples/fabric-admin/device_manager/DeviceManager.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ class DeviceManager : public PairingDelegate
150150

151151
void ReadSupportedDeviceCategories();
152152

153-
void HandleAttributeData(const chip::app::ConcreteDataAttributePath & path, chip::TLV::TLVReader * data);
153+
void HandleAttributeData(const chip::app::ConcreteDataAttributePath & path, chip::TLV::TLVReader & data);
154154

155-
void HandleEventData(const chip::app::EventHeader & header, chip::TLV::TLVReader * data);
155+
void HandleEventData(const chip::app::EventHeader & header, chip::TLV::TLVReader & data);
156156

157-
void HandleCommandResponse(const chip::app::ConcreteCommandPath & path, chip::TLV::TLVReader * data);
157+
void HandleCommandResponse(const chip::app::ConcreteCommandPath & path, chip::TLV::TLVReader & data);
158158

159159
void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override;
160160

@@ -163,11 +163,15 @@ class DeviceManager : public PairingDelegate
163163

164164
void RequestCommissioningApproval();
165165

166-
void HandleCommissioningRequestResult(chip::TLV::TLVReader * data);
166+
void HandleReadSupportedDeviceCategories(chip::TLV::TLVReader & data);
167+
168+
void HandleCommissioningRequestResult(chip::TLV::TLVReader & data);
169+
170+
void HandleAttributePartsListUpdate(chip::TLV::TLVReader & data);
167171

168172
void SendCommissionNodeRequest(uint64_t requestId, uint16_t responseTimeoutSeconds);
169173

170-
void HandleReverseOpenCommissioningWindow(chip::TLV::TLVReader * data);
174+
void HandleReverseOpenCommissioningWindow(chip::TLV::TLVReader & data);
171175

172176
static DeviceManager sInstance;
173177

examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ source_set("fabric-bridge-lib") {
4141
public_configs = [ ":config" ]
4242

4343
sources = [
44+
"include/BridgedAdministratorCommissioning.h",
4445
"include/BridgedDevice.h",
4546
"include/BridgedDeviceBasicInformationImpl.h",
4647
"include/BridgedDeviceManager.h",
4748
"include/CHIPProjectAppConfig.h",
49+
"src/BridgedAdministratorCommissioning.cpp",
4850
"src/BridgedDevice.cpp",
4951
"src/BridgedDeviceBasicInformationImpl.cpp",
5052
"src/BridgedDeviceManager.cpp",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#pragma once
19+
20+
#include <app-common/zap-generated/cluster-objects.h>
21+
#include <app/AttributeAccessInterfaceRegistry.h>
22+
23+
/**
24+
* @brief CADMIN cluster implementation for handling attribute interactions of bridged device endpoints.
25+
*
26+
* The current Administrator Commissioning Cluster server's zap generated code will automatically
27+
* register an Attribute Access Interface for the root node endpoint implementation. In order to
28+
* properly respond to a read attribute for bridged devices we are representing, we override the
29+
* currently registered Attribute Interface such that we are first to receive any read attribute
30+
* request on Administrator Commissioning Cluster, and if it is not an endpoint for a device we
31+
* are a bridge for we redirect to the default cluster server implementation of Administrator
32+
* Commissioning Cluster.
33+
*/
34+
class BridgedAdministratorCommissioning : public chip::app::AttributeAccessInterface
35+
{
36+
public:
37+
// Register for the AdministratorCommissioning cluster on all endpoints.
38+
BridgedAdministratorCommissioning() :
39+
AttributeAccessInterface(chip::NullOptional, chip::app::Clusters::AdministratorCommissioning::Id)
40+
{}
41+
42+
CHIP_ERROR Init();
43+
44+
CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath & aPath, chip::app::AttributeValueEncoder & aEncoder) override;
45+
46+
// We do not allow writing to CADMIN attributes of a bridged device endpoint. We simply redirect
47+
// write requests to the original attribute interface.
48+
CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath & aPath, chip::app::AttributeValueDecoder & aDecoder) override
49+
{
50+
VerifyOrDie(mOriginalAttributeInterface);
51+
return mOriginalAttributeInterface->Write(aPath, aDecoder);
52+
}
53+
54+
private:
55+
// If mOriginalAttributeInterface is removed from here, the class description needs to be updated
56+
// to reflect this change.
57+
chip::app::AttributeAccessInterface * mOriginalAttributeInterface = nullptr;
58+
};

0 commit comments

Comments
 (0)