Query network cluster using wildcard reads (#14567)
* Read parts list from descriptor cluster
* Add step to read server clusters from descriptor.
* Read basic cluster information during commissioning.
* Pass back status from iter.
* sequence network cluster existance and feature checks.
If we check the feature map right after we check for the existance
of the networking cluster, we can just bail out once we find a
networking cluster that matches
Test: on-network with lighting app on linux
wifi on all-clusters app on M5
tested thread using all clusters app - saw reads of endpoints,
found network cluster on different endpoint.
* Restyled by clang-format
* Use multi-endpoint wildcard to simplify commissioning
* Restyled by clang-format
* Update src/controller/AutoCommissioner.cpp
Co-authored-by: Michael Sandstedt <michael.sandstedt@gmail.com>
* Update src/controller/CHIPDeviceController.cpp
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
* Update src/controller/CHIPDeviceController.cpp
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
* Restyled by clang-format
* Address review comments.
Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Michael Sandstedt <michael.sandstedt@gmail.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
diff --git a/src/app/AttributeCache.h b/src/app/AttributeCache.h
index 97e3bd6..1e682d2 100644
--- a/src/app/AttributeCache.h
+++ b/src/app/AttributeCache.h
@@ -279,6 +279,7 @@
}
}
}
+ return CHIP_NO_ERROR;
}
/*
diff --git a/src/controller/AutoCommissioner.cpp b/src/controller/AutoCommissioner.cpp
index d14db40..e46f277 100644
--- a/src/controller/AutoCommissioner.cpp
+++ b/src/controller/AutoCommissioner.cpp
@@ -102,20 +102,27 @@
{
return CommissioningStage::kCleanup;
}
+
switch (currentStage)
{
case CommissioningStage::kSecurePairing:
- return CommissioningStage::kArmFailsafe;
- case CommissioningStage::kArmFailsafe:
+ return CommissioningStage::kReadVendorId;
+ case CommissioningStage::kReadVendorId:
+ return CommissioningStage::kReadProductId;
+ case CommissioningStage::kReadProductId:
+ return CommissioningStage::kReadSoftwareVersion;
+ case CommissioningStage::kReadSoftwareVersion:
if (mNeedsNetworkSetup)
{
return CommissioningStage::kGetNetworkTechnology;
}
else
{
- return CommissioningStage::kConfigRegulatory;
+ return CommissioningStage::kArmFailsafe;
}
case CommissioningStage::kGetNetworkTechnology:
+ return CommissioningStage::kArmFailsafe;
+ case CommissioningStage::kArmFailsafe:
return CommissioningStage::kConfigRegulatory;
case CommissioningStage::kConfigRegulatory:
return CommissioningStage::kSendPAICertificateRequest;
@@ -139,15 +146,11 @@
// operational network because the provisioning of certificates will trigger the device to start operational advertising.
if (mNeedsNetworkSetup)
{
- if (mParams.GetWiFiCredentials().HasValue() &&
- mNetworkTechnology.Has(
- chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kWiFiNetworkInterface))
+ if (mParams.GetWiFiCredentials().HasValue() && mNetworkEndpoints.wifi != kInvalidEndpointId)
{
return CommissioningStage::kWiFiNetworkSetup;
}
- else if (mParams.GetThreadOperationalDataset().HasValue() &&
- mNetworkTechnology.Has(
- chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kThreadNetworkInterface))
+ else if (mParams.GetThreadOperationalDataset().HasValue() && mNetworkEndpoints.thread != kInvalidEndpointId)
{
return CommissioningStage::kThreadNetworkSetup;
}
@@ -168,8 +171,7 @@
#endif
}
case CommissioningStage::kWiFiNetworkSetup:
- if (mParams.GetThreadOperationalDataset().HasValue() &&
- mNetworkTechnology.Has(chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kThreadNetworkInterface))
+ if (mParams.GetThreadOperationalDataset().HasValue() && mNetworkEndpoints.thread != kInvalidEndpointId)
{
return CommissioningStage::kThreadNetworkSetup;
}
@@ -178,8 +180,7 @@
return CommissioningStage::kWiFiNetworkEnable;
}
case CommissioningStage::kThreadNetworkSetup:
- if (mParams.GetWiFiCredentials().HasValue() &&
- mNetworkTechnology.Has(chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kWiFiNetworkInterface))
+ if (mParams.GetWiFiCredentials().HasValue() && mNetworkEndpoints.wifi != kInvalidEndpointId)
{
return CommissioningStage::kWiFiNetworkEnable;
}
@@ -189,8 +190,7 @@
}
case CommissioningStage::kWiFiNetworkEnable:
- if (mParams.GetThreadOperationalDataset().HasValue() &&
- mNetworkTechnology.Has(chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kThreadNetworkInterface))
+ if (mParams.GetThreadOperationalDataset().HasValue() && mNetworkEndpoints.thread != kInvalidEndpointId)
{
return CommissioningStage::kThreadNetworkEnable;
}
@@ -221,6 +221,23 @@
return CommissioningStage::kError;
}
+EndpointId AutoCommissioner::GetEndpoint(const CommissioningStage & stage)
+{
+ switch (stage)
+ {
+ case CommissioningStage::kWiFiNetworkSetup:
+ case CommissioningStage::kWiFiNetworkEnable:
+ return mNetworkEndpoints.wifi;
+ case CommissioningStage::kThreadNetworkSetup:
+ case CommissioningStage::kThreadNetworkEnable:
+ return mNetworkEndpoints.thread;
+ case CommissioningStage::kGetNetworkTechnology:
+ return kInvalidEndpointId;
+ default:
+ return kRootEndpointId;
+ }
+}
+
CHIP_ERROR AutoCommissioner::StartCommissioning(DeviceCommissioner * commissioner, CommissioneeDeviceProxy * proxy)
{
// TODO: check that there is no commissioning in progress currently.
@@ -242,7 +259,8 @@
Transport::Type::kBle;
CHIP_ERROR err = CHIP_NO_ERROR;
CommissioningStage nextStage = GetNextCommissioningStage(CommissioningStage::kSecurePairing, err);
- mCommissioner->PerformCommissioningStep(mCommissioneeDeviceProxy, nextStage, mParams, this, 0, GetCommandTimeout(nextStage));
+ mCommissioner->PerformCommissioningStep(mCommissioneeDeviceProxy, nextStage, mParams, this, GetEndpoint(nextStage),
+ GetCommandTimeout(nextStage));
return CHIP_NO_ERROR;
}
@@ -297,23 +315,17 @@
{
switch (report.stageCompleted)
{
+ case CommissioningStage::kReadVendorId:
+ mVendorId = report.Get<BasicVendor>().vendorId;
+ break;
+ case CommissioningStage::kReadProductId:
+ mProductId = report.Get<BasicProduct>().productId;
+ break;
+ case CommissioningStage::kReadSoftwareVersion:
+ mSoftwareVersion = report.Get<BasicSoftware>().softwareVersion;
+ break;
case CommissioningStage::kGetNetworkTechnology:
- mNetworkTechnology.SetRaw(report.Get<FeatureMap>().features);
- // Only one of these features can be set at a time.
- if (!mNetworkTechnology.HasOnly(
- chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kWiFiNetworkInterface) &&
- !mNetworkTechnology.HasOnly(
- chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kThreadNetworkInterface) &&
- mNetworkTechnology.HasOnly(
- chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kEthernetNetworkInterface))
- {
- ChipLogError(
- Controller,
- "Network Commissioning cluster is malformed - more than one network technology is specified (0x%" PRIX32 ")",
- report.Get<FeatureMap>().features);
- err = CHIP_ERROR_INTEGRITY_CHECK_FAILED;
- break;
- }
+ mNetworkEndpoints = report.Get<NetworkClusters>();
break;
case CommissioningStage::kSendPAICertificateRequest:
SetPAI(report.Get<RequestedCertificate>().certificate);
@@ -355,6 +367,7 @@
mCommissioneeDeviceProxy = nullptr;
mOperationalDeviceProxy = nullptr;
mParams = CommissioningParameters();
+ mNetworkEndpoints = NetworkClusters();
return CHIP_NO_ERROR;
default:
break;
@@ -382,7 +395,7 @@
mParams.SetCompletionStatus(err);
// TODO: Get real endpoint
- mCommissioner->PerformCommissioningStep(proxy, nextStage, mParams, this, 0, GetCommandTimeout(nextStage));
+ mCommissioner->PerformCommissioningStep(proxy, nextStage, mParams, this, GetEndpoint(nextStage), GetCommandTimeout(nextStage));
return CHIP_NO_ERROR;
}
diff --git a/src/controller/AutoCommissioner.h b/src/controller/AutoCommissioner.h
index 5849ae6..8c262ad 100644
--- a/src/controller/AutoCommissioner.h
+++ b/src/controller/AutoCommissioner.h
@@ -50,19 +50,23 @@
CHIP_ERROR NOCChainGenerated(ByteSpan noc, ByteSpan icac, ByteSpan rcac, AesCcm128KeySpan ipk, NodeId adminSubject);
Optional<System::Clock::Timeout> GetCommandTimeout(CommissioningStage stage);
+ EndpointId GetEndpoint(const CommissioningStage & stage);
DeviceCommissioner * mCommissioner = nullptr;
CommissioneeDeviceProxy * mCommissioneeDeviceProxy = nullptr;
OperationalDeviceProxy * mOperationalDeviceProxy = nullptr;
OperationalCredentialsDelegate * mOperationalCredentialsDelegate = nullptr;
CommissioningParameters mParams = CommissioningParameters();
+ VendorId mVendorId;
+ uint16_t mProductId;
+ uint32_t mSoftwareVersion;
// Memory space for the commisisoning parameters that come in as ByteSpans - the caller is not guaranteed to retain this memory
uint8_t mSsid[CommissioningParameters::kMaxSsidLen];
uint8_t mCredentials[CommissioningParameters::kMaxCredentialsLen];
uint8_t mThreadOperationalDataset[CommissioningParameters::kMaxThreadDatasetLen];
- // TODO: if the device library adds a network commissioning device type, this will need to be 1 per endpoint.
- BitFlags<chip::app::Clusters::NetworkCommissioning::NetworkCommissioningFeature> mNetworkTechnology;
+
bool mNeedsNetworkSetup = false;
+ NetworkClusters mNetworkEndpoints;
// TODO: Why were the nonces statically allocated, but the certs dynamically allocated?
uint8_t * mDAC = nullptr;
@@ -74,6 +78,5 @@
uint8_t mNOCertBuffer[Credentials::kMaxCHIPCertLength];
uint8_t mICACertBuffer[Credentials::kMaxCHIPCertLength];
};
-
} // namespace Controller
} // namespace chip
diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp
index 2ca8476..5014d44 100644
--- a/src/controller/CHIPDeviceController.cpp
+++ b/src/controller/CHIPDeviceController.cpp
@@ -36,6 +36,8 @@
#include <controller/CHIPDeviceController.h>
#include <app-common/zap-generated/enums.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
#include <controller-clusters/zap-generated/CHIPClusters.h>
#if CONFIG_DEVICE_LAYER
@@ -442,7 +444,7 @@
CHIP_ERROR DeviceController::OpenCommissioningWindowWithCallback(NodeId deviceId, uint16_t timeout, uint16_t iteration,
uint16_t discriminator, uint8_t option,
- Callback::Callback<OnOpenCommissioningWindow> * callback,
+ chip::Callback::Callback<OnOpenCommissioningWindow> * callback,
bool readVIDPIDAttributes)
{
mSetupPayload = SetupPayload();
@@ -781,8 +783,8 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR DeviceCommissioner::GetConnectedDevice(NodeId deviceId, Callback::Callback<OnDeviceConnected> * onConnection,
- Callback::Callback<OnDeviceConnectionFailure> * onFailure)
+CHIP_ERROR DeviceCommissioner::GetConnectedDevice(NodeId deviceId, chip::Callback::Callback<OnDeviceConnected> * onConnection,
+ chip::Callback::Callback<OnDeviceConnectionFailure> * onFailure)
{
return DeviceController::GetConnectedDevice(deviceId, onConnection, onFailure);
}
@@ -1582,15 +1584,31 @@
void DeviceCommissioner::SetupCluster(ClusterBase & base, DeviceProxy * proxy, EndpointId endpoint,
Optional<System::Clock::Timeout> timeout)
{
- base.Associate(proxy, 0);
+ base.Associate(proxy, endpoint);
base.SetCommandTimeout(timeout);
}
-void OnFeatureMapSuccess(void * context, uint32_t value)
+void BasicVendorCallback(void * context, VendorId vendorId)
{
DeviceCommissioner * commissioner = static_cast<DeviceCommissioner *>(context);
CommissioningDelegate::CommissioningReport report;
- report.Set<FeatureMap>(value);
+ report.Set<BasicVendor>(vendorId);
+ commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
+}
+
+void BasicProductCallback(void * context, uint16_t productId)
+{
+ DeviceCommissioner * commissioner = static_cast<DeviceCommissioner *>(context);
+ CommissioningDelegate::CommissioningReport report;
+ report.Set<BasicProduct>(productId);
+ commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
+}
+
+void BasicSoftwareCallback(void * context, uint32_t softwareVersion)
+{
+ DeviceCommissioner * commissioner = static_cast<DeviceCommissioner *>(context);
+ CommissioningDelegate::CommissioningReport report;
+ report.Set<BasicSoftware>(softwareVersion);
commissioner->CommissioningStageComplete(CHIP_NO_ERROR, report);
}
@@ -1600,6 +1618,64 @@
commissioner->CommissioningStageComplete(status);
}
+// AttributeCache::Callback impl
+void DeviceCommissioner::OnDone()
+{
+ NetworkClusters clusters;
+
+ CHIP_ERROR err = mAttributeCache->ForEachAttribute(
+ app::Clusters::NetworkCommissioning::Id, [this, &clusters](const app::ConcreteAttributePath & path) {
+ if (path.mAttributeId != app::Clusters::NetworkCommissioning::Attributes::FeatureMap::Id)
+ {
+ return CHIP_NO_ERROR;
+ }
+ TLV::TLVReader reader;
+ if (this->mAttributeCache->Get(path, reader) == CHIP_NO_ERROR)
+ {
+ BitFlags<app::Clusters::NetworkCommissioning::NetworkCommissioningFeature> features;
+ if (app::DataModel::Decode(reader, features) == CHIP_NO_ERROR)
+ {
+ if (features.Has(app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kWiFiNetworkInterface))
+ {
+ clusters.wifi = path.mEndpointId;
+ }
+ else if (features.Has(
+ app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kThreadNetworkInterface))
+ {
+ clusters.thread = path.mEndpointId;
+ }
+ else if (features.Has(
+ app::Clusters::NetworkCommissioning::NetworkCommissioningFeature::kEthernetNetworkInterface))
+ {
+ clusters.eth = path.mEndpointId;
+ }
+ else
+ {
+ // TODO: Gross workaround for the empty feature map on all clusters. Remove.
+ if (clusters.thread == kInvalidEndpointId)
+ {
+ clusters.thread = path.mEndpointId;
+ }
+ if (clusters.wifi == kInvalidEndpointId)
+ {
+ clusters.wifi = path.mEndpointId;
+ }
+ }
+ }
+ }
+ return CHIP_NO_ERROR;
+ });
+
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Controller, "Error parsing Network commissioning features");
+ }
+ mAttributeCache = nullptr;
+ mReadClient = nullptr;
+ CommissioningDelegate::CommissioningReport report;
+ report.Set<NetworkClusters>(clusters);
+ CommissioningStageComplete(err, report);
+}
void DeviceCommissioner::OnArmFailSafe(void * context,
const GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType & data)
{
@@ -1663,6 +1739,30 @@
switch (step)
{
+ case CommissioningStage::kReadVendorId: {
+ ChipLogProgress(Controller, "Reading vendor ID");
+ BasicCluster basic;
+ SetupCluster(basic, proxy, endpoint, timeout);
+ basic.ReadAttribute<chip::app::Clusters::Basic::Attributes::VendorID::TypeInfo>(this, BasicVendorCallback,
+ AttributeReadFailure);
+ }
+ break;
+ case CommissioningStage::kReadProductId: {
+ ChipLogProgress(Controller, "Reading product ID");
+ BasicCluster basic;
+ SetupCluster(basic, proxy, endpoint, timeout);
+ basic.ReadAttribute<chip::app::Clusters::Basic::Attributes::ProductID::TypeInfo>(this, BasicProductCallback,
+ AttributeReadFailure);
+ }
+ break;
+ case CommissioningStage::kReadSoftwareVersion: {
+ ChipLogProgress(Controller, "Reading software version");
+ BasicCluster basic;
+ SetupCluster(basic, proxy, endpoint, timeout);
+ basic.ReadAttribute<chip::app::Clusters::Basic::Attributes::SoftwareVersion::TypeInfo>(this, BasicSoftwareCallback,
+ AttributeReadFailure);
+ }
+ break;
case CommissioningStage::kArmFailsafe: {
ChipLogProgress(Controller, "Arming failsafe");
// TODO: should get the endpoint information from the descriptor cluster.
@@ -1675,11 +1775,29 @@
break;
case CommissioningStage::kGetNetworkTechnology: {
ChipLogProgress(Controller, "Sending request for network cluster feature map");
- NetworkCommissioningCluster netCom;
- // TODO: swap to given endpoint once that PR is merged
- netCom.Associate(proxy, 0);
- netCom.ReadAttribute<app::Clusters::NetworkCommissioning::Attributes::FeatureMap::TypeInfo>(this, OnFeatureMapSuccess,
- AttributeReadFailure);
+ app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance();
+ app::ReadPrepareParams readParams(proxy->GetSecureSession().Value());
+ app::AttributePathParams readPath(app::Clusters::NetworkCommissioning::Id,
+ app::Clusters::NetworkCommissioning::Attributes::FeatureMap::Id);
+ readParams.mpAttributePathParamsList = &readPath;
+ readParams.mAttributePathParamsListSize = 1;
+ if (timeout.HasValue())
+ {
+ readParams.mTimeout = timeout.Value();
+ }
+ auto attributeCache = Platform::MakeUnique<app::AttributeCache>(*this);
+ auto readClient = chip::Platform::MakeUnique<app::ReadClient>(
+ engine, proxy->GetExchangeManager(), attributeCache->GetBufferedCallback(), app::ReadClient::InteractionType::Read);
+ CHIP_ERROR err = readClient->SendRequest(readParams);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Controller, "Failed to send read request for networking clusters");
+ CommissioningStageComplete(err);
+ return;
+ }
+ mAttributeCache = std::move(attributeCache);
+ mReadClient = std::move(readClient);
+ return;
}
break;
case CommissioningStage::kConfigRegulatory: {
diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h
index 1a96640..80beefd 100644
--- a/src/controller/CHIPDeviceController.h
+++ b/src/controller/CHIPDeviceController.h
@@ -28,6 +28,7 @@
#pragma once
+#include <app/AttributeCache.h>
#include <app/CASEClientPool.h>
#include <app/CASESessionManager.h>
#include <app/OperationalDeviceProxy.h>
@@ -211,7 +212,7 @@
* callback. If it fails to establish the connection, it calls `onError` callback.
*/
virtual CHIP_ERROR GetConnectedDevice(NodeId deviceId, Callback::Callback<OnDeviceConnected> * onConnection,
- Callback::Callback<OnDeviceConnectionFailure> * onFailure)
+ chip::Callback::Callback<OnDeviceConnectionFailure> * onFailure)
{
VerifyOrReturnError(mState == State::Initialized && mFabricInfo != nullptr, CHIP_ERROR_INCORRECT_STATE);
return mCASESessionManager->FindOrEstablishSession(mFabricInfo->GetPeerIdForNode(deviceId), onConnection, onFailure);
@@ -446,7 +447,8 @@
#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY // make this commissioner discoverable
public Protocols::UserDirectedCommissioning::InstanceNameResolver,
#endif
- public SessionEstablishmentDelegate
+ public SessionEstablishmentDelegate,
+ public app::AttributeCache::Callback
{
public:
DeviceCommissioner();
@@ -547,8 +549,8 @@
CHIP_ERROR GetDeviceBeingCommissioned(NodeId deviceId, CommissioneeDeviceProxy ** device);
- CHIP_ERROR GetConnectedDevice(NodeId deviceId, Callback::Callback<OnDeviceConnected> * onConnection,
- Callback::Callback<OnDeviceConnectionFailure> * onFailure) override;
+ CHIP_ERROR GetConnectedDevice(NodeId deviceId, chip::Callback::Callback<OnDeviceConnected> * onConnection,
+ chip::Callback::Callback<OnDeviceConnectionFailure> * onFailure) override;
/**
* @brief
@@ -676,6 +678,9 @@
void RegisterPairingDelegate(DevicePairingDelegate * pairingDelegate) { mPairingDelegate = pairingDelegate; }
+ // AttributeCache::Callback impl
+ void OnDone() override;
+
private:
DevicePairingDelegate * mPairingDelegate;
@@ -849,18 +854,21 @@
static CHIP_ERROR ConvertFromNodeOperationalCertStatus(uint8_t err);
- Callback::Callback<OnDeviceConnected> mOnDeviceConnectedCallback;
- Callback::Callback<OnDeviceConnectionFailure> mOnDeviceConnectionFailureCallback;
+ chip::Callback::Callback<OnDeviceConnected> mOnDeviceConnectedCallback;
+ chip::Callback::Callback<OnDeviceConnectionFailure> mOnDeviceConnectionFailureCallback;
- Callback::Callback<Credentials::OnAttestationInformationVerification> mDeviceAttestationInformationVerificationCallback;
+ chip::Callback::Callback<Credentials::OnAttestationInformationVerification> mDeviceAttestationInformationVerificationCallback;
- Callback::Callback<OnNOCChainGeneration> mDeviceNOCChainCallback;
+ chip::Callback::Callback<OnNOCChainGeneration> mDeviceNOCChainCallback;
SetUpCodePairer mSetUpCodePairer;
AutoCommissioner mAutoCommissioner;
CommissioningDelegate * mDefaultCommissioner =
nullptr; // Commissioning delegate to call when PairDevice / Commission functions are used
CommissioningDelegate * mCommissioningDelegate =
nullptr; // Commissioning delegate that issued the PerformCommissioningStep command
+
+ Platform::UniquePtr<app::AttributeCache> mAttributeCache;
+ Platform::UniquePtr<app::ReadClient> mReadClient;
};
} // namespace Controller
diff --git a/src/controller/CommissioningDelegate.h b/src/controller/CommissioningDelegate.h
index 2425b37..16474ee 100644
--- a/src/controller/CommissioningDelegate.h
+++ b/src/controller/CommissioningDelegate.h
@@ -30,11 +30,14 @@
{
kError,
kSecurePairing,
+ kReadVendorId,
+ kReadProductId,
+ kReadSoftwareVersion,
+ kGetNetworkTechnology,
kArmFailsafe,
// kConfigTime, // NOT YET IMPLEMENTED
// kConfigTimeZone, // NOT YET IMPLEMENTED
// kConfigDST, // NOT YET IMPLEMENTED
- kGetNetworkTechnology,
kConfigRegulatory,
kSendPAICertificateRequest,
kSendDACCertificateRequest,
@@ -235,22 +238,41 @@
OperationalNodeFoundData(OperationalDeviceProxy * proxy) : operationalProxy(proxy) {}
OperationalDeviceProxy * operationalProxy;
};
-struct FeatureMap
+
+struct BasicVendor
{
- FeatureMap(uint32_t featureBitmap) : features(featureBitmap) {}
- uint32_t features;
+ BasicVendor(VendorId id) : vendorId(id) {}
+ VendorId vendorId;
+};
+
+struct BasicProduct
+{
+ BasicProduct(uint16_t id) : productId(id) {}
+ uint16_t productId;
+};
+
+struct BasicSoftware
+{
+ BasicSoftware(uint32_t version) : softwareVersion(version) {}
+ uint32_t softwareVersion;
+};
+
+struct NetworkClusters
+{
+ EndpointId wifi = kInvalidEndpointId;
+ EndpointId thread = kInvalidEndpointId;
+ EndpointId eth = kInvalidEndpointId;
};
class CommissioningDelegate
{
public:
virtual ~CommissioningDelegate(){};
-
- struct CommissioningReport : Variant<RequestedCertificate, AttestationResponse, NocChain, OperationalNodeFoundData, FeatureMap>
+ struct CommissioningReport : Variant<RequestedCertificate, AttestationResponse, NocChain, OperationalNodeFoundData, BasicVendor,
+ BasicProduct, BasicSoftware, NetworkClusters>
{
CommissioningReport() : stageCompleted(CommissioningStage::kError) {}
CommissioningStage stageCompleted;
- // TODO: Add other things the delegate needs to know.
};
virtual CHIP_ERROR SetCommissioningParameters(const CommissioningParameters & params) = 0;
virtual void SetOperationalCredentialsDelegate(OperationalCredentialsDelegate * operationalCredentialsDelegate) = 0;