Skip to content

Commit

Permalink
Fix fabric-bridge is accidentally added into sync list (#35132)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Oct 9, 2024
1 parent c9f0cc7 commit 2904841
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <device_manager/DeviceManager.h>

using namespace ::chip;
using namespace ::chip::app;
Expand Down Expand Up @@ -120,7 +121,10 @@ void DeviceSynchronizer::OnReportEnd()
{
// Report end is at the end of all attributes (success)
#if defined(PW_RPC_ENABLED)
AddSynchronizedDevice(mCurrentDeviceData);
if (!DeviceMgr().IsCurrentBridgeDevice(mCurrentDeviceData.node_id))
{
AddSynchronizedDevice(mCurrentDeviceData);
}
#else
ChipLogError(NotSpecified, "Cannot synchronize device with fabric bridge: RPC not enabled");
#endif
Expand Down
9 changes: 9 additions & 0 deletions examples/fabric-admin/device_manager/DeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ class DeviceManager : public PairingDelegate

void RemoveSyncedDevice(chip::NodeId nodeId);

/**
* @brief Determines whether a given nodeId corresponds to the "current bridge device," either local or remote.
*
* @param nodeId The ID of the node being checked.
*
* @return true if the nodeId matches either the local or remote bridge device; otherwise, false.
*/
bool IsCurrentBridgeDevice(chip::NodeId nodeId) const { return nodeId == mLocalBridgeNodeId || nodeId == mRemoteBridgeNodeId; }

/**
* @brief Open the commissioning window for a specific device within its own fabric.
*
Expand Down

0 comments on commit 2904841

Please sign in to comment.