@@ -273,39 +273,76 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu
273
273
case Attributes::ClusterRevision::Id:
274
274
return aEncoder.Encode (kCurrentClusterRevision );
275
275
276
- case Attributes::SupportedWiFiBands::Id:
277
- #if (!CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION && !CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP)
278
- return CHIP_IM_GLOBAL_STATUS (UnsupportedAttribute);
279
- #else
280
- VerifyOrReturnError (mFeatureFlags .Has (Feature::kWiFiNetworkInterface ), CHIP_IM_GLOBAL_STATUS (UnsupportedAttribute));
281
-
282
- return aEncoder.EncodeList ([this ](const auto & encoder) {
283
- uint32_t bands = mpDriver.Get <WiFiDriver *>()->GetSupportedWiFiBandsMask ();
276
+ case Attributes::SupportedWiFiBands::Id: {
277
+ #if (CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP)
278
+ // TODO https://github.com/project-chip/connectedhomeip/issues/31431
279
+ // This is a case of shared zap config where mandatory wifi attributes are enabled for a thread platform (e.g
280
+ // all-cluster-app). Real world product must only enable the attributes tied to the network technology supported by their
281
+ // product. Temporarily return an list of 1 element of value 0 when wifi is not supported or WiFiNetworkInterface is not
282
+ // enabled until a solution is implemented with the attribute list.
283
+ // Final implementation will return UnsupportedAttribute if we get here without the needed WiFi support .
284
+ // VerifyOrReturnError(mFeatureFlags.Has(Feature::kWiFiNetworkInterface), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
285
+ if (mFeatureFlags .Has (Feature::kWiFiNetworkInterface ))
286
+ {
287
+ return aEncoder.EncodeList ([this ](const auto & encoder) {
288
+ uint32_t bands = mpDriver.Get <WiFiDriver *>()->GetSupportedWiFiBandsMask ();
284
289
285
- // Extract every band from the bitmap of supported bands, starting positionally on the right.
286
- for (uint32_t band_bit_pos = 0 ; band_bit_pos < std::numeric_limits<uint32_t >::digits; ++band_bit_pos)
287
- {
288
- uint32_t band_mask = static_cast <uint32_t >(1UL << band_bit_pos);
289
- if ((bands & band_mask) != 0 )
290
+ // Extract every band from the bitmap of supported bands, starting positionally on the right.
291
+ for (uint32_t band_bit_pos = 0 ; band_bit_pos < std::numeric_limits<uint32_t >::digits; ++band_bit_pos)
290
292
{
291
- ReturnErrorOnFailure (encoder.Encode (static_cast <WiFiBandEnum>(band_bit_pos)));
293
+ uint32_t band_mask = static_cast <uint32_t >(1UL << band_bit_pos);
294
+ if ((bands & band_mask) != 0 )
295
+ {
296
+ ReturnErrorOnFailure (encoder.Encode (static_cast <WiFiBandEnum>(band_bit_pos)));
297
+ }
292
298
}
293
- }
299
+ return CHIP_NO_ERROR;
300
+ });
301
+ }
302
+ #endif
303
+ return aEncoder.EncodeList ([](const auto & encoder) {
304
+ WiFiBandEnum bands = WiFiBandEnum::k2g4;
305
+ ReturnErrorOnFailure (encoder.Encode (bands));
294
306
return CHIP_NO_ERROR;
295
307
});
308
+ }
309
+ break ;
310
+ case Attributes::SupportedThreadFeatures::Id: {
311
+ // TODO https://github.com/project-chip/connectedhomeip/issues/31431
312
+ BitMask<ThreadCapabilities> ThreadCapabilities = 0 ;
313
+ #if (CHIP_DEVICE_CONFIG_ENABLE_THREAD)
314
+ // This is a case of shared zap config where mandatory thread attributes are enabled for a wifi platform (e.g
315
+ // all-cluster-app). Real world product must only enable the attributes tied to the network technology supported by their
316
+ // product. Temporarily encode a value of 0 reflecting no thread capabilities hen CHIP_DEVICE_CONFIG_ENABLE_THREAD or
317
+ // ThreadNetworkInterface are not enabled until a solution is implemented with the attribute list.
318
+ // Final implementation will return UnsupportedAttribute if we get here without the needed thread support
319
+ // VerifyOrReturnError(mFeatureFlags.Has(Feature::kThreadNetworkInterface), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
320
+ if (mFeatureFlags .Has (Feature::kThreadNetworkInterface ))
321
+ {
322
+ ThreadCapabilities = mpDriver.Get <ThreadDriver *>()->GetSupportedThreadFeatures ();
323
+ }
296
324
#endif
297
- break ;
298
-
299
- case Attributes::SupportedThreadFeatures::Id:
300
- VerifyOrReturnError (mFeatureFlags .Has (Feature::kThreadNetworkInterface ), CHIP_NO_ERROR);
301
- VerifyOrReturnError (mpDriver.Valid (), CHIP_NO_ERROR);
302
- return aEncoder.Encode (mpDriver.Get <ThreadDriver *>()->GetSupportedThreadFeatures ());
303
-
304
- case Attributes::ThreadVersion::Id:
305
- VerifyOrReturnError (mFeatureFlags .Has (Feature::kThreadNetworkInterface ), CHIP_NO_ERROR);
306
- VerifyOrReturnError (mpDriver.Valid (), CHIP_NO_ERROR);
307
- return aEncoder.Encode (mpDriver.Get <ThreadDriver *>()->GetThreadVersion ());
308
-
325
+ return aEncoder.Encode (ThreadCapabilities);
326
+ }
327
+ break ;
328
+ case Attributes::ThreadVersion::Id: {
329
+ // TODO https://github.com/project-chip/connectedhomeip/issues/31431ß
330
+ uint16_t threadVersion = 0 ;
331
+ #if (CHIP_DEVICE_CONFIG_ENABLE_THREAD)
332
+ // This is a case of shared zap config where mandatory thread attributes are enabled for a wifi platform (e.g
333
+ // all-cluster-app) Real world product must only enable the attributes tied to the network technology supported by their
334
+ // product. Temporarily encode a value of 0 reflecting no thread version when CHIP_DEVICE_CONFIG_ENABLE_THREAD or
335
+ // ThreadNetworkInterface are not enabled until a solution is implemented with the attribute list.
336
+ // Final implementation will return UnsupportedAttribute if we get here without the needed thread support
337
+ // VerifyOrReturnError(mFeatureFlags.Has(Feature::kThreadNetworkInterface), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute));
338
+ if (mFeatureFlags .Has (Feature::kThreadNetworkInterface ))
339
+ {
340
+ threadVersion = mpDriver.Get <ThreadDriver *>()->GetThreadVersion ();
341
+ }
342
+ #endif
343
+ return aEncoder.Encode (threadVersion);
344
+ }
345
+ break ;
309
346
default :
310
347
return CHIP_NO_ERROR;
311
348
}
0 commit comments