From e67188b8683c2d63eda9c3d493853dde1423bfa0 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Mon, 11 Nov 2024 13:34:13 -0800 Subject: [PATCH] Add remote bridge to local bridge after pairing --- .../device_manager/DeviceSynchronization.cpp | 2 ++ examples/fabric-admin/rpc/RpcServer.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/examples/fabric-admin/device_manager/DeviceSynchronization.cpp b/examples/fabric-admin/device_manager/DeviceSynchronization.cpp index 9ce37c2b7e9ac0..9274b98d4a0d52 100644 --- a/examples/fabric-admin/device_manager/DeviceSynchronization.cpp +++ b/examples/fabric-admin/device_manager/DeviceSynchronization.cpp @@ -209,6 +209,8 @@ void DeviceSynchronizer::StartDeviceSynchronization(Controller::DeviceController mNodeId = nodeId; + ChipLogProgress(NotSpecified, "Start device synchronization for NodeId:" ChipLogFormatX64, ChipLogValueX64(mNodeId)); + #if defined(PW_RPC_ENABLED) mCurrentDeviceData = chip_rpc_SynchronizedDevice_init_default; mCurrentDeviceData.has_id = true; diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index b91338d86cc6ad..40a773912f13e2 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -113,6 +113,16 @@ class FabricAdmin final : public rpc::FabricAdmin, public admin::PairingDelegate if (err == CHIP_NO_ERROR) { DeviceManager::Instance().SetRemoteBridgeNodeId(deviceId); + + // We need to register the remote bridge device as a bridged device on the local bridge. This ensures that the ecosystem + // triggering the fabric sync process is notified of the successful reverse commissioning. + chip_rpc_SynchronizedDevice deviceData = chip_rpc_SynchronizedDevice_init_default; + deviceData.has_id = true; + deviceData.id.node_id = deviceId; + deviceData.id.fabric_index = PairingManager::Instance().CurrentCommissioner().GetFabricIndex(); + deviceData.has_is_icd = true; + deviceData.is_icd = false; + AddSynchronizedDevice(deviceData); } else {