@@ -2319,13 +2319,14 @@ CHIP_ERROR DeviceCommissioner::ParseICDInfo(ReadCommissioningInfo & info)
2319
2319
CHIP_ERROR err;
2320
2320
IcdManagement::Attributes::FeatureMap::TypeInfo::DecodableType featureMap;
2321
2321
bool hasUserActiveModeTrigger = false ;
2322
-
2322
+ bool isICD = false ;
2323
2323
err = mAttributeCache ->Get <IcdManagement::Attributes::FeatureMap::TypeInfo>(kRootEndpointId , featureMap);
2324
2324
if (err == CHIP_NO_ERROR)
2325
2325
{
2326
2326
info.icd .isLIT = !!(featureMap & to_underlying (IcdManagement::Feature::kLongIdleTimeSupport ));
2327
2327
info.icd .checkInProtocolSupport = !!(featureMap & to_underlying (IcdManagement::Feature::kCheckInProtocolSupport ));
2328
2328
hasUserActiveModeTrigger = !!(featureMap & to_underlying (IcdManagement::Feature::kUserActiveModeTrigger ));
2329
+ isICD = true ;
2329
2330
}
2330
2331
else if (err == CHIP_ERROR_KEY_NOT_FOUND)
2331
2332
{
@@ -2355,6 +2356,7 @@ CHIP_ERROR DeviceCommissioner::ParseICDInfo(ReadCommissioningInfo & info)
2355
2356
2356
2357
info.icd .userActiveModeTriggerHint .ClearAll ();
2357
2358
info.icd .userActiveModeTriggerInstruction = CharSpan ();
2359
+
2358
2360
if (hasUserActiveModeTrigger)
2359
2361
{
2360
2362
// Intentionally ignore errors since they are not mandatory.
@@ -2390,6 +2392,37 @@ CHIP_ERROR DeviceCommissioner::ParseICDInfo(ReadCommissioningInfo & info)
2390
2392
}
2391
2393
}
2392
2394
2395
+ if (!isICD)
2396
+ {
2397
+ info.icd .idleModeDuration = 0 ;
2398
+ info.icd .activeModeDuration = 0 ;
2399
+ info.icd .activeModeThreshold = 0 ;
2400
+ return CHIP_NO_ERROR;
2401
+ }
2402
+
2403
+ err = mAttributeCache ->Get <IcdManagement::Attributes::IdleModeDuration::TypeInfo>(kRootEndpointId , info.icd .idleModeDuration );
2404
+ if (err != CHIP_NO_ERROR)
2405
+ {
2406
+ ChipLogError (Controller, " IcdManagement.IdleModeDuration expected, but failed to read: %" CHIP_ERROR_FORMAT, err.Format ());
2407
+ return err;
2408
+ }
2409
+ err =
2410
+ mAttributeCache ->Get <IcdManagement::Attributes::ActiveModeDuration::TypeInfo>(kRootEndpointId , info.icd .activeModeDuration );
2411
+ if (err != CHIP_NO_ERROR)
2412
+ {
2413
+ ChipLogError (Controller, " IcdManagement.ActiveModeDuration expected, but failed to read: %" CHIP_ERROR_FORMAT,
2414
+ err.Format ());
2415
+ return err;
2416
+ }
2417
+
2418
+ err = mAttributeCache ->Get <IcdManagement::Attributes::ActiveModeThreshold::TypeInfo>(kRootEndpointId ,
2419
+ info.icd .activeModeThreshold );
2420
+ if (err != CHIP_NO_ERROR)
2421
+ {
2422
+ ChipLogError (Controller, " IcdManagement.ActiveModeThreshold expected, but failed to read: %" CHIP_ERROR_FORMAT,
2423
+ err.Format ());
2424
+ }
2425
+
2393
2426
return err;
2394
2427
}
2395
2428
@@ -2680,8 +2713,8 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio
2680
2713
// NOTE: this array cannot have more than 9 entries, since the spec mandates that server only needs to support 9
2681
2714
// See R1.1, 2.11.2 Interaction Model Limits
2682
2715
2683
- // Currently, we have at most 5 attributes to read in this stage.
2684
- app::AttributePathParams readPaths[5 ];
2716
+ // Currently, we have at most 8 attributes to read in this stage.
2717
+ app::AttributePathParams readPaths[8 ];
2685
2718
2686
2719
// Mandatory attribute
2687
2720
readPaths[numberOfAttributes++] =
@@ -2700,12 +2733,18 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio
2700
2733
readPaths[numberOfAttributes++] =
2701
2734
app::AttributePathParams (endpoint, IcdManagement::Id, IcdManagement::Attributes::FeatureMap::Id);
2702
2735
}
2736
+
2703
2737
// Always read the active mode trigger hint attributes to notify users about it.
2704
2738
readPaths[numberOfAttributes++] =
2705
2739
app::AttributePathParams (endpoint, IcdManagement::Id, IcdManagement::Attributes::UserActiveModeTriggerHint::Id);
2706
2740
readPaths[numberOfAttributes++] =
2707
2741
app::AttributePathParams (endpoint, IcdManagement::Id, IcdManagement::Attributes::UserActiveModeTriggerInstruction::Id);
2708
-
2742
+ readPaths[numberOfAttributes++] =
2743
+ app::AttributePathParams (endpoint, IcdManagement::Id, IcdManagement::Attributes::IdleModeDuration::Id);
2744
+ readPaths[numberOfAttributes++] =
2745
+ app::AttributePathParams (endpoint, IcdManagement::Id, IcdManagement::Attributes::ActiveModeDuration::Id);
2746
+ readPaths[numberOfAttributes++] =
2747
+ app::AttributePathParams (endpoint, IcdManagement::Id, IcdManagement::Attributes::ActiveModeThreshold::Id);
2709
2748
SendCommissioningReadRequest (proxy, timeout, readPaths, numberOfAttributes);
2710
2749
}
2711
2750
break ;
0 commit comments