@@ -51,9 +51,14 @@ void EndpointListLoader::Initialize(chip::Messaging::ExchangeManager * exchangeM
51
51
mExchangeMgr = exchangeMgr;
52
52
mSessionHandle = sessionHandle;
53
53
54
+ chip::NodeId targetCastingPlayerNodeId = CastingPlayer::GetTargetCastingPlayer ()->GetNodeId ();
55
+ chip::FabricIndex targetCastingPlayerFabricIndex = CastingPlayer::GetTargetCastingPlayer ()->GetFabricIndex ();
56
+ ChipLogProgress (AppServer, " EndpointListLoader::Initialize() targetCastingPlayerNodeId: 0x" ChipLogFormatX64, ChipLogValueX64 (targetCastingPlayerNodeId));
57
+ ChipLogProgress (AppServer, " EndpointListLoader::Initialize() targetCastingPlayerFabricIndex: %d" , targetCastingPlayerFabricIndex);
58
+
54
59
for (const auto & binding : chip::BindingTable::GetInstance ())
55
60
{
56
- if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer ()-> GetNodeId () == binding.nodeId )
61
+ if (binding.type == MATTER_UNICAST_BINDING && targetCastingPlayerNodeId == binding.nodeId && targetCastingPlayerFabricIndex == binding. fabricIndex )
57
62
{
58
63
// check to see if we discovered a new endpoint in the bindings
59
64
chip::EndpointId endpointId = binding.remote ;
@@ -66,6 +71,7 @@ void EndpointListLoader::Initialize(chip::Messaging::ExchangeManager * exchangeM
66
71
}
67
72
}
68
73
}
74
+ ChipLogProgress (AppServer, " EndpointListLoader::Initialize() mNewEndpointsToLoad++, mNewEndpointsToLoad: %lu" , mNewEndpointsToLoad );
69
75
70
76
mPendingAttributeReads = mNewEndpointsToLoad * kTotalDesiredAttributes ;
71
77
mEndpointAttributesList = new EndpointAttributes[mNewEndpointsToLoad ];
@@ -78,16 +84,21 @@ CHIP_ERROR EndpointListLoader::Load()
78
84
79
85
VerifyOrReturnError (CastingPlayer::GetTargetCastingPlayer () != nullptr , CHIP_ERROR_INCORRECT_STATE);
80
86
87
+ chip::NodeId targetCastingPlayerNodeId = CastingPlayer::GetTargetCastingPlayer ()->GetNodeId ();
88
+ chip::FabricIndex targetCastingPlayerFabricIndex = CastingPlayer::GetTargetCastingPlayer ()->GetFabricIndex ();
89
+ ChipLogProgress (AppServer, " EndpointListLoader::Load() targetCastingPlayerNodeId: 0x" ChipLogFormatX64, ChipLogValueX64 (targetCastingPlayerNodeId));
90
+ ChipLogProgress (AppServer, " EndpointListLoader::Load() targetCastingPlayerFabricIndex: %d" , targetCastingPlayerFabricIndex);
91
+
81
92
int endpointIndex = -1 ;
82
93
bool isLoadingRequired = false ;
83
94
for (const auto & binding : chip::BindingTable::GetInstance ())
84
95
{
85
96
ChipLogProgress (AppServer,
86
- " Binding type=%d fab=%d nodeId=0x" ChipLogFormatX64
97
+ " EndpointListLoader::Load() Binding type=%d fab=%d nodeId=0x" ChipLogFormatX64
87
98
" groupId=%d local endpoint=%d remote endpoint=%d cluster=" ChipLogFormatMEI,
88
99
binding.type , binding.fabricIndex , ChipLogValueX64 (binding.nodeId ), binding.groupId , binding.local ,
89
100
binding.remote , ChipLogValueMEI (binding.clusterId .value_or (0 )));
90
- if (binding.type == MATTER_UNICAST_BINDING && CastingPlayer::GetTargetCastingPlayer ()-> GetNodeId () == binding.nodeId )
101
+ if (binding.type == MATTER_UNICAST_BINDING && targetCastingPlayerNodeId == binding.nodeId && targetCastingPlayerFabricIndex == binding. fabricIndex )
91
102
{
92
103
// if we discovered a new Endpoint from the bindings, read its EndpointAttributes
93
104
chip::EndpointId endpointId = binding.remote ;
@@ -98,7 +109,7 @@ CHIP_ERROR EndpointListLoader::Load()
98
109
}) == endpoints.end ())
99
110
{
100
111
// Read attributes and mEndpointAttributesList for (endpointIndex + 1)
101
- ChipLogProgress (AppServer, " EndpointListLoader::Load Reading attributes for endpointId %d" , endpointId);
112
+ ChipLogProgress (AppServer, " EndpointListLoader::Load() Reading attributes for endpointId: %d, on fabricIndex: %d " , endpointId, binding. fabricIndex );
102
113
isLoadingRequired = true ;
103
114
mEndpointAttributesList [++endpointIndex].mId = endpointId;
104
115
ReadVendorId (&mEndpointAttributesList [endpointIndex]);
@@ -121,7 +132,7 @@ CHIP_ERROR EndpointListLoader::Load()
121
132
122
133
void EndpointListLoader::Complete ()
123
134
{
124
- ChipLogProgress (AppServer, " EndpointListLoader::Complete called with mPendingAttributeReads %lu" , mPendingAttributeReads );
135
+ ChipLogProgress (AppServer, " EndpointListLoader::Complete() called with mPendingAttributeReads: %lu" , mPendingAttributeReads );
125
136
if (mPendingAttributeReads > 0 )
126
137
{
127
138
mPendingAttributeReads --;
@@ -161,7 +172,7 @@ void EndpointListLoader::Complete()
161
172
162
173
// callback client OnCompleted
163
174
VerifyOrReturn (CastingPlayer::GetTargetCastingPlayer ()->mOnCompleted ,
164
- ChipLogError (AppServer, " EndpointListLoader::Complete mOnCompleted() not found" ));
175
+ ChipLogError (AppServer, " EndpointListLoader::Complete() mOnCompleted() not found" ));
165
176
CastingPlayer::GetTargetCastingPlayer ()->mOnCompleted (CHIP_NO_ERROR, CastingPlayer::GetTargetCastingPlayer ());
166
177
}
167
178
}
@@ -180,7 +191,7 @@ CHIP_ERROR EndpointListLoader::ReadVendorId(EndpointAttributes * endpointAttribu
180
191
},
181
192
[](void * context, CHIP_ERROR err) {
182
193
EndpointAttributes * _endpointAttributes = static_cast <EndpointAttributes *>(context);
183
- ChipLogError (AppServer, " EndpointListLoader ReadAttribute(VendorID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT,
194
+ ChipLogError (AppServer, " EndpointListLoader:: ReadAttribute(VendorID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT,
184
195
_endpointAttributes->mId , err.Format ());
185
196
EndpointListLoader::GetInstance ()->Complete ();
186
197
});
@@ -201,7 +212,7 @@ CHIP_ERROR EndpointListLoader::ReadProductId(EndpointAttributes * endpointAttrib
201
212
[](void * context, CHIP_ERROR err) {
202
213
EndpointAttributes * _endpointAttributes = static_cast <EndpointAttributes *>(context);
203
214
ChipLogError (AppServer,
204
- " EndpointListLoader ReadAttribute(ProductID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT,
215
+ " EndpointListLoader:: ReadAttribute(ProductID) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT,
205
216
_endpointAttributes->mId , err.Format ());
206
217
EndpointListLoader::GetInstance ()->Complete ();
207
218
});
@@ -227,7 +238,7 @@ CHIP_ERROR EndpointListLoader::ReadDeviceTypeList(EndpointAttributes * endpointA
227
238
[](void * context, CHIP_ERROR err) {
228
239
EndpointAttributes * _endpointAttributes = static_cast <EndpointAttributes *>(context);
229
240
ChipLogError (AppServer,
230
- " EndpointListLoader ReadAttribute(DeviceTypeList) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT,
241
+ " EndpointListLoader:: ReadAttribute(DeviceTypeList) failed for endpointID %d. Err: %" CHIP_ERROR_FORMAT,
231
242
_endpointAttributes->mId , err.Format ());
232
243
EndpointListLoader::GetInstance ()->Complete ();
233
244
});
@@ -251,7 +262,7 @@ CHIP_ERROR EndpointListLoader::ReadServerList(std::vector<chip::ClusterId> * end
251
262
EndpointListLoader::GetInstance ()->Complete ();
252
263
},
253
264
[](void * context, CHIP_ERROR err) {
254
- ChipLogError (AppServer, " EndpointListLoader ReadAttribute(ServerList) failed. Err: %" CHIP_ERROR_FORMAT, err.Format ());
265
+ ChipLogError (AppServer, " EndpointListLoader::ReadServerList() ReadAttribute(ServerList) failed. Err: %" CHIP_ERROR_FORMAT, err.Format ());
255
266
EndpointListLoader::GetInstance ()->Complete ();
256
267
});
257
268
}
0 commit comments