@@ -105,9 +105,7 @@ constexpr uint32_t kSessionEstablishmentTimeout = 40 * kMillisecondsPerSecond;
105
105
106
106
DeviceController::DeviceController ()
107
107
{
108
- mState = State::NotInitialized;
109
- mStorageDelegate = nullptr ;
110
- mPairedDevicesInitialized = false ;
108
+ mState = State::NotInitialized;
111
109
}
112
110
113
111
CHIP_ERROR DeviceController::Init (ControllerInitParams params)
@@ -118,7 +116,6 @@ CHIP_ERROR DeviceController::Init(ControllerInitParams params)
118
116
VerifyOrReturnError (params.systemState ->SystemLayer () != nullptr , CHIP_ERROR_INVALID_ARGUMENT);
119
117
VerifyOrReturnError (params.systemState ->UDPEndPointManager () != nullptr , CHIP_ERROR_INVALID_ARGUMENT);
120
118
121
- mStorageDelegate = params.storageDelegate ;
122
119
#if CONFIG_NETWORK_LAYER_BLE
123
120
VerifyOrReturnError (params.systemState ->BleLayer () != nullptr , CHIP_ERROR_INVALID_ARGUMENT);
124
121
#endif
@@ -231,8 +228,6 @@ CHIP_ERROR DeviceController::Shutdown()
231
228
mSystemState ->SessionMgr ()->ExpireAllPairingsForFabric (mFabricInfo ->GetFabricIndex ());
232
229
}
233
230
234
- mStorageDelegate = nullptr ;
235
-
236
231
if (mFabricInfo != nullptr )
237
232
{
238
233
mFabricInfo ->Reset ();
@@ -246,16 +241,6 @@ CHIP_ERROR DeviceController::Shutdown()
246
241
return CHIP_NO_ERROR;
247
242
}
248
243
249
- bool DeviceController::DoesDevicePairingExist (const PeerId & deviceId)
250
- {
251
- if (InitializePairedDeviceList () == CHIP_NO_ERROR)
252
- {
253
- return mPairedDevices .Contains (deviceId.GetNodeId ());
254
- }
255
-
256
- return false ;
257
- }
258
-
259
244
void DeviceController::ReleaseOperationalDevice (NodeId remoteDeviceId)
260
245
{
261
246
VerifyOrReturn (mState == State::Initialized && mFabricInfo != nullptr ,
@@ -329,64 +314,6 @@ void DeviceController::OnFirstMessageDeliveryFailed(const SessionHandle & sessio
329
314
}
330
315
}
331
316
332
- CHIP_ERROR DeviceController::InitializePairedDeviceList ()
333
- {
334
- CHIP_ERROR err = CHIP_NO_ERROR;
335
- uint8_t * buffer = nullptr ;
336
-
337
- VerifyOrExit (mStorageDelegate != nullptr , err = CHIP_ERROR_INCORRECT_STATE);
338
-
339
- if (!mPairedDevicesInitialized )
340
- {
341
- constexpr uint16_t max_size = sizeof (uint64_t ) * kNumMaxPairedDevices ;
342
- buffer = static_cast <uint8_t *>(chip::Platform::MemoryCalloc (max_size, 1 ));
343
- uint16_t size = max_size;
344
-
345
- VerifyOrExit (buffer != nullptr , err = CHIP_ERROR_INVALID_ARGUMENT);
346
-
347
- CHIP_ERROR lookupError = CHIP_NO_ERROR;
348
- PERSISTENT_KEY_OP (static_cast <uint64_t >(0 ), kPairedDeviceListKeyPrefix , key,
349
- lookupError = mStorageDelegate ->SyncGetKeyValue (key, buffer, size));
350
-
351
- // It's ok to not have an entry for the Paired Device list. We treat it the same as having an empty list.
352
- if (lookupError != CHIP_ERROR_KEY_NOT_FOUND)
353
- {
354
- VerifyOrExit (size <= max_size, err = CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR);
355
- err = SetPairedDeviceList (ByteSpan (buffer, size));
356
- SuccessOrExit (err);
357
- }
358
- }
359
-
360
- exit :
361
- if (buffer != nullptr )
362
- {
363
- chip::Platform::MemoryFree (buffer);
364
- }
365
- if (err != CHIP_NO_ERROR)
366
- {
367
- ChipLogError (Controller, " Failed to initialize the device list with error: %" CHIP_ERROR_FORMAT, err.Format ());
368
- }
369
-
370
- return err;
371
- }
372
-
373
- CHIP_ERROR DeviceController::SetPairedDeviceList (ByteSpan serialized)
374
- {
375
- CHIP_ERROR err = mPairedDevices .Deserialize (serialized);
376
-
377
- if (err != CHIP_NO_ERROR)
378
- {
379
- ChipLogError (Controller, " Failed to recreate the device list with buffer %.*s\n " , static_cast <int >(serialized.size ()),
380
- serialized.data ());
381
- }
382
- else
383
- {
384
- mPairedDevicesInitialized = true ;
385
- }
386
-
387
- return err;
388
- }
389
-
390
317
CHIP_ERROR DeviceController::GetPeerAddressAndPort (PeerId peerId, Inet::IPAddress & addr, uint16_t & port)
391
318
{
392
319
VerifyOrReturnError (mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE);
@@ -412,7 +339,6 @@ ControllerDeviceInitParams DeviceController::GetControllerDeviceInitParams()
412
339
.sessionManager = mSystemState ->SessionMgr (),
413
340
.exchangeMgr = mSystemState ->ExchangeMgr (),
414
341
.udpEndPointManager = mSystemState ->UDPEndPointManager (),
415
- .storageDelegate = mStorageDelegate ,
416
342
.fabricsTable = mSystemState ->Fabrics (),
417
343
};
418
344
}
@@ -423,7 +349,6 @@ DeviceCommissioner::DeviceCommissioner() :
423
349
mDeviceNOCChainCallback (OnDeviceNOCChainGeneration, this ), mSetUpCodePairer (this )
424
350
{
425
351
mPairingDelegate = nullptr ;
426
- mPairedDevicesUpdated = false ;
427
352
mDeviceBeingCommissioned = nullptr ;
428
353
mDeviceInPASEEstablishment = nullptr ;
429
354
}
@@ -632,10 +557,6 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re
632
557
VerifyOrExit (mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE);
633
558
VerifyOrExit (mDeviceInPASEEstablishment == nullptr , err = CHIP_ERROR_INCORRECT_STATE);
634
559
635
- // This will initialize the commissionee device pool if it has not already been initialized.
636
- err = InitializePairedDeviceList ();
637
- SuccessOrExit (err);
638
-
639
560
// TODO(#13940): We need to specify the peer address for BLE transport in bindings.
640
561
if (params.GetPeerAddress ().GetTransportType () == Transport::Type::kBle ||
641
562
params.GetPeerAddress ().GetTransportType () == Transport::Type::kUndefined )
@@ -1380,9 +1301,6 @@ CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(De
1380
1301
1381
1302
mSystemState ->SystemLayer ()->CancelTimer (OnSessionEstablishmentTimeoutCallback, this );
1382
1303
1383
- mPairedDevices .Insert (device->GetDeviceId ());
1384
- mPairedDevicesUpdated = true ;
1385
-
1386
1304
if (mPairingDelegate != nullptr )
1387
1305
{
1388
1306
mPairingDelegate ->OnStatusUpdate (DevicePairingDelegate::SecurePairingSuccess);
0 commit comments