From 1545845ff73dacc1f1d9459311cb3c2e3a469a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Thu, 9 Dec 2021 00:37:31 +0100 Subject: [PATCH] [ota-requestor] Build QueryImage based on Basic cluster attributes (#12671) --- .../ota-requestor-app.zap | 5 +- .../clusters/ota-requestor/OTARequestor.cpp | 160 +++++++++--------- src/app/clusters/ota-requestor/OTARequestor.h | 3 + src/lib/core/DataModelTypes.h | 7 +- .../zap-generated/IMClusterCommandHandler.cpp | 12 ++ .../PluginApplicationCallbacks.h | 1 + .../zap-generated/callback-stub.cpp | 8 + .../zap-generated/endpoint_config.h | 99 +++++++---- .../zap-generated/gen_config.h | 6 + 9 files changed, 186 insertions(+), 115 deletions(-) diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap index 37947998492ac5..3456fc0f833bf5 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap @@ -776,7 +776,7 @@ "mfgCode": null, "define": "BASIC_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "StartUp", @@ -3711,5 +3711,6 @@ "endpointVersion": 1, "deviceIdentifier": 22 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/src/app/clusters/ota-requestor/OTARequestor.cpp b/src/app/clusters/ota-requestor/OTARequestor.cpp index 44927a74147412..224e974cb5ba77 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.cpp +++ b/src/app/clusters/ota-requestor/OTARequestor.cpp @@ -29,6 +29,7 @@ #include "BDXDownloader.h" +#include #include #include #include @@ -36,29 +37,13 @@ #include #include -using chip::ByteSpan; -using chip::CASESessionManager; -using chip::CASESessionManagerConfig; -using chip::CharSpan; -using chip::DeviceProxy; -using chip::EndpointId; -using chip::FabricIndex; -using chip::FabricInfo; -using chip::NodeId; -using chip::OnDeviceConnected; -using chip::OnDeviceConnectionFailure; -using chip::PeerId; -using chip::Server; -using chip::VendorId; -using chip::bdx::TransferSession; -using chip::Callback::Callback; -using chip::System::Layer; -using chip::Transport::PeerAddress; -// using namespace chip::ArgParser; +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::bdx; using namespace chip::Messaging; using namespace chip::app::Clusters::OtaSoftwareUpdateProvider::Commands; -using chip::Inet::IPAddress; +namespace { // Global instance of the OTARequestorInterface. OTARequestorInterface * globalOTARequestorInstance = nullptr; @@ -66,24 +51,14 @@ constexpr uint32_t kImmediateStartDelayMs = 1; // Start the timer with this valu // Callbacks for connection management void OnConnected(void * context, chip::OperationalDeviceProxy * deviceProxy); -Callback mOnConnectedCallback(OnConnected, nullptr); +Callback::Callback mOnConnectedCallback(OnConnected, nullptr); void OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error); -Callback mOnConnectionFailureCallback(OnConnectionFailure, nullptr); +Callback::Callback mOnConnectionFailureCallback(OnConnectionFailure, nullptr); void OnQueryImageResponse(void * context, const QueryImageResponse::DecodableType & response); void OnQueryImageFailure(void * context, EmberAfStatus status); -void SetRequestorInstance(OTARequestorInterface * instance) -{ - globalOTARequestorInstance = instance; -} - -OTARequestorInterface * GetRequestorInstance() -{ - return globalOTARequestorInstance; -} - void StartDelayTimerHandler(chip::System::Layer * systemLayer, void * appState) { VerifyOrReturn(appState != nullptr); @@ -95,6 +70,17 @@ void OnQueryImageFailure(void * context, EmberAfStatus status) ChipLogDetail(SoftwareUpdate, "QueryImage failure response %" PRIu8, status); } +// Called whenever FindOrEstablishSession is successful. Finds the Requestor instance +// and calls the corresponding OTARequestor member function +void OnConnected(void * context, chip::OperationalDeviceProxy * deviceProxy) +{ + OTARequestor * requestorCore = static_cast(GetRequestorInstance()); + + VerifyOrDie(requestorCore != nullptr); + + requestorCore->mOnConnected(context, deviceProxy); +} + void OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error) { ChipLogError(SoftwareUpdate, "failed to connect to 0x%" PRIX64 ": %" CHIP_ERROR_FORMAT, deviceId, error.Format()); @@ -104,10 +90,27 @@ void OnQueryImageResponse(void * context, const QueryImageResponse::DecodableTyp { OTARequestor * requestorCore = static_cast(GetRequestorInstance()); - assert(requestorCore != nullptr); + VerifyOrDie(requestorCore != nullptr); requestorCore->mOnQueryImageResponse(context, response); } +} // namespace + +void SetRequestorInstance(OTARequestorInterface * instance) +{ + globalOTARequestorInstance = instance; +} + +OTARequestorInterface * GetRequestorInstance() +{ + return globalOTARequestorInstance; +} + +struct OTARequestor::QueryImageRequest +{ + char location[2]; + QueryImage::Type args; +}; void OTARequestor::mOnQueryImageResponse(void * context, const QueryImageResponse::DecodableType & response) { @@ -297,7 +300,7 @@ void OTARequestor::ConnectToProvider() // Explicitly calling UpdateDeviceData() should not be needed once OperationalDeviceProxy can resolve IP address from node ID // and fabric index - PeerAddress addr = PeerAddress::UDP(mIpAddress, CHIP_PORT); + Transport::PeerAddress addr = Transport::PeerAddress::UDP(mIpAddress, CHIP_PORT); operationalDeviceProxy->UpdateDeviceData(addr, operationalDeviceProxy->GetMRPConfig()); CHIP_ERROR err = operationalDeviceProxy->Connect(&mOnConnectedCallback, &mOnConnectionFailureCallback); @@ -307,58 +310,25 @@ void OTARequestor::ConnectToProvider() } } -// Called whenever FindOrEstablishSession is successful. Finds the Requestor instance -// and calls the corresponding OTARequestor member function -void OnConnected(void * context, chip::OperationalDeviceProxy * deviceProxy) -{ - OTARequestor * requestorCore = static_cast(GetRequestorInstance()); - - assert(requestorCore != nullptr); - - requestorCore->mOnConnected(context, deviceProxy); -} - // Member function called whenever FindOrEstablishSession is successful void OTARequestor::mOnConnected(void * context, chip::DeviceProxy * deviceProxy) { switch (onConnectedState) { case kQueryImage: { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::Controller::OtaSoftwareUpdateProviderCluster cluster; constexpr EndpointId kOtaProviderEndpoint = 0; - // These QueryImage params have been chosen arbitrarily - constexpr VendorId kExampleVendorId = VendorId::Common; - constexpr uint16_t kExampleProductId = 77; - constexpr uint16_t kExampleHWVersion = 3; - constexpr uint16_t kExampleSoftwareVersion = 0; - constexpr EmberAfOTADownloadProtocol kExampleProtocolsSupported[] = { EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_BDX_SYNCHRONOUS }; - const char locationBuf[] = { 'U', 'S' }; - CharSpan exampleLocation(locationBuf); - constexpr bool kExampleClientCanConsent = false; - ByteSpan metadata; - - err = cluster.Associate(deviceProxy, kOtaProviderEndpoint); - if (err != CHIP_NO_ERROR) - { - ChipLogError(SoftwareUpdate, "Associate() failed: %" CHIP_ERROR_FORMAT, err.Format()); - return; - } - QueryImage::Type args; - args.vendorId = kExampleVendorId; - args.productId = kExampleProductId; - args.softwareVersion = kExampleSoftwareVersion; - args.protocolsSupported = kExampleProtocolsSupported; - args.hardwareVersion.Emplace(kExampleHWVersion); - args.location.Emplace(exampleLocation); - args.requestorCanConsent.Emplace(kExampleClientCanConsent); - args.metadataForProvider.Emplace(metadata); - err = cluster.InvokeCommand(args, /* context = */ nullptr, OnQueryImageResponse, OnQueryImageFailure); - if (err != CHIP_NO_ERROR) - { - ChipLogError(SoftwareUpdate, "QueryImage() failed: %" CHIP_ERROR_FORMAT, err.Format()); - } + QueryImageRequest request; + CHIP_ERROR err = BuildQueryImageRequest(request); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(SoftwareUpdate, "Failed to build QueryImage command: %" CHIP_ERROR_FORMAT, err.Format())); + + Controller::OtaSoftwareUpdateProviderCluster cluster; + cluster.Associate(deviceProxy, kOtaProviderEndpoint); + + err = cluster.InvokeCommand(request.args, /* context = */ nullptr, OnQueryImageResponse, OnQueryImageFailure); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(SoftwareUpdate, "Failed to send QueryImage command: %" CHIP_ERROR_FORMAT, err.Format())); break; } @@ -410,3 +380,37 @@ void OTARequestor::TriggerImmediateQuery() // Perhaps we don't need a separate function ConnectToProvider, revisit this ConnectToProvider(); } + +CHIP_ERROR OTARequestor::BuildQueryImageRequest(QueryImageRequest & request) +{ + constexpr EmberAfOTADownloadProtocol kProtocolsSupported[] = { EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_BDX_SYNCHRONOUS }; + constexpr bool kRequestorCanConsent = false; + QueryImage::Type & args = request.args; + + uint16_t vendorId; + VerifyOrReturnError(Basic::Attributes::VendorID::Get(kRootEndpointId, &vendorId) == EMBER_ZCL_STATUS_SUCCESS, + CHIP_ERROR_READ_FAILED); + args.vendorId = static_cast(vendorId); + + VerifyOrReturnError(Basic::Attributes::ProductID::Get(kRootEndpointId, &args.productId) == EMBER_ZCL_STATUS_SUCCESS, + CHIP_ERROR_READ_FAILED); + + VerifyOrReturnError(Basic::Attributes::SoftwareVersion::Get(kRootEndpointId, &args.softwareVersion) == EMBER_ZCL_STATUS_SUCCESS, + CHIP_ERROR_READ_FAILED); + + args.protocolsSupported = kProtocolsSupported; + args.requestorCanConsent.SetValue(kRequestorCanConsent); + + uint16_t hardwareVersion; + if (Basic::Attributes::HardwareVersion::Get(kRootEndpointId, &hardwareVersion) == EMBER_ZCL_STATUS_SUCCESS) + { + args.hardwareVersion.SetValue(hardwareVersion); + } + + if (Basic::Attributes::Location::Get(kRootEndpointId, MutableCharSpan(request.location)) == EMBER_ZCL_STATUS_SUCCESS) + { + args.location.SetValue(CharSpan(request.location)); + } + + return CHIP_NO_ERROR; +} diff --git a/src/app/clusters/ota-requestor/OTARequestor.h b/src/app/clusters/ota-requestor/OTARequestor.h index a0755fe74ca956..5f028a5ea8dbae 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.h +++ b/src/app/clusters/ota-requestor/OTARequestor.h @@ -85,6 +85,8 @@ class OTARequestor : public OTARequestorInterface kStartBDX, }; + struct QueryImageRequest; + // TODO: the application should define this, along with initializing the BDXDownloader // This class is purely for delivering messages and sending outgoing messages to/from the BDXDownloader. @@ -169,4 +171,5 @@ class OTARequestor : public OTARequestorInterface // Functions CHIP_ERROR SetupCASESessionManager(chip::FabricIndex fabricIndex); + CHIP_ERROR BuildQueryImageRequest(QueryImageRequest & req); }; diff --git a/src/lib/core/DataModelTypes.h b/src/lib/core/DataModelTypes.h index 406818a96abf22..9b2b7b64fb5162 100644 --- a/src/lib/core/DataModelTypes.h +++ b/src/lib/core/DataModelTypes.h @@ -43,9 +43,10 @@ typedef uint32_t FieldId; typedef uint16_t ListIndex; typedef uint32_t TransactionId; -static constexpr FabricIndex kUndefinedFabricIndex = 0; -static constexpr EndpointId kInvalidEndpointId = 0xFFFF; -static constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. +constexpr FabricIndex kUndefinedFabricIndex = 0; +constexpr EndpointId kInvalidEndpointId = 0xFFFF; +constexpr EndpointId kRootEndpointId = 0; +constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. // ClusterId, AttributeId and EventId are MEIs, // 0xFFFF is not a valid manufacturer code, thus 0xFFFF'FFFF is not a valid MEI. diff --git a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp index a15f71c4739fb6..fbdaea73b60146 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp @@ -41,6 +41,15 @@ namespace app { namespace Clusters { +namespace Basic { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + ReportCommandUnsupported(apCommandObj, aCommandPath); +} + +} // namespace Basic + namespace GeneralCommissioning { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -561,6 +570,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: switch (aCommandPath.mClusterId) { + case Clusters::Basic::Id: + Clusters::Basic::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::GeneralCommissioning::Id: Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h index 759ae6494cfb01..5e0a39c4c44479 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h @@ -22,6 +22,7 @@ #include #define MATTER_PLUGINS_INIT \ + MatterBasicPluginServerInitCallback(); \ MatterGeneralCommissioningPluginServerInitCallback(); \ MatterNetworkCommissioningPluginServerInitCallback(); \ MatterOtaSoftwareUpdateProviderPluginClientInitCallback(); \ diff --git a/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp b/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp index 87bbd91ee33619..ccadfab0aacdeb 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp @@ -29,6 +29,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) { switch (clusterId) { + case ZCL_BASIC_CLUSTER_ID: + emberAfBasicClusterInitCallback(endpoint); + break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: emberAfGeneralCommissioningClusterInitCallback(endpoint); break; @@ -50,6 +53,11 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) } } +void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h b/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h index 4e9b63188b20c8..f221ff4d734912 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h +++ b/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h @@ -27,12 +27,17 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), big-endian */ \ \ - /* 0 - Breadcrumb, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + /* 0 - SoftwareVersion, */ \ + 0x00, 0x00, 0x00, 0x00, \ \ - /* 8 - BasicCommissioningInfoList, */ \ + /* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \ + \ + /* 4 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 12 - BasicCommissioningInfoList, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -48,12 +53,12 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 262 - FeatureMap, */ \ + /* 266 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Network Commissioning (server), big-endian */ \ \ - /* 266 - FeatureMap, */ \ + /* 270 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ } @@ -61,12 +66,17 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), little-endian */ \ + \ + /* 0 - SoftwareVersion, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ \ - /* 0 - Breadcrumb, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + /* 4 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 8 - BasicCommissioningInfoList, */ \ + /* 12 - BasicCommissioningInfoList, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -82,18 +92,18 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 262 - FeatureMap, */ \ + /* 266 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Network Commissioning (server), little-endian */ \ \ - /* 266 - FeatureMap, */ \ + /* 270 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (4) +#define GENERATED_DEFAULTS_COUNT (5) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -121,12 +131,28 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 18 +#define GENERATED_ATTRIBUTE_COUNT 30 #define GENERATED_ATTRIBUTES \ { \ \ - /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + /* Endpoint: 0, Cluster: Basic (server) */ \ + { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* InteractionModelVersion */ \ + { 0x0001, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ + { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorID */ \ + { 0x0003, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* ProductName */ \ + { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* ProductID */ \ + { 0x0005, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* NodeLabel */ \ + { 0x0006, ZAP_TYPE(CHAR_STRING), 3, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* Location */ \ + { 0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(0) }, /* HardwareVersion */ \ + { 0x0008, ZAP_TYPE(CHAR_STRING), 65, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* HardwareVersionString */ \ + { 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(0) }, /* SoftwareVersion */ \ + { 0x000A, ZAP_TYPE(CHAR_STRING), 65, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* SoftwareVersionString */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ { 0x0001, ZAP_TYPE(OCTET_STRING), 17, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* default ota provider */ \ @@ -134,15 +160,15 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: General Commissioning (server) */ \ - { 0x0000, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(0) }, /* Breadcrumb */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(8) }, /* BasicCommissioningInfoList */ \ + { 0x0000, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4) }, /* Breadcrumb */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(12) }, /* BasicCommissioningInfoList */ \ { 0x0002, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* RegulatoryConfig */ \ { 0x0003, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* LocationCapability */ \ - { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(262) }, /* FeatureMap */ \ + { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(266) }, /* FeatureMap */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ - { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(266) }, /* FeatureMap */ \ + { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(270) }, /* FeatureMap */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ @@ -160,26 +186,35 @@ #define ZAP_ATTRIBUTE_INDEX(index) ((EmberAfAttributeMetadata *) (&generatedAttributes[index])) // Cluster function static arrays -#define GENERATED_FUNCTION_ARRAYS +#define GENERATED_FUNCTION_ARRAYS \ + const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ + (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ + }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 5 +#define GENERATED_CLUSTER_COUNT 6 #define GENERATED_CLUSTERS \ { \ - { \ - 0x0029, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ - }, /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ + { 0x0028, \ + ZAP_ATTRIBUTE_INDEX(0), \ + 12, \ + 246, \ + ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + chipFuncArrayBasicServer }, /* Endpoint: 0, Cluster: Basic (server) */ \ + { \ + 0x0029, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ { \ - 0x002A, ZAP_ATTRIBUTE_INDEX(1), 3, 20, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002A, ZAP_ATTRIBUTE_INDEX(13), 3, 20, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(4), 6, 270, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0030, ZAP_ATTRIBUTE_INDEX(16), 6, 270, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { \ - 0x0031, ZAP_ATTRIBUTE_INDEX(10), 2, 6, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(22), 2, 6, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { \ - 0x003E, ZAP_ATTRIBUTE_INDEX(12), 6, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003E, ZAP_ATTRIBUTE_INDEX(24), 6, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ } @@ -188,17 +223,17 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 5, 302 }, \ + { ZAP_CLUSTER_INDEX(0), 6, 548 }, \ } // Largest attribute size is needed for various buffers #define ATTRIBUTE_LARGEST (401) // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (0) +#define ATTRIBUTE_SINGLETONS_SIZE (246) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (302) +#define ATTRIBUTE_MAX_SIZE (548) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/zzz_generated/ota-requestor-app/zap-generated/gen_config.h b/zzz_generated/ota-requestor-app/zap-generated/gen_config.h index 63e61e4f155001..0dc804287607e4 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/gen_config.h +++ b/zzz_generated/ota-requestor-app/zap-generated/gen_config.h @@ -29,6 +29,7 @@ #define EMBER_APS_UNICAST_MESSAGE_COUNT 10 /**** Cluster endpoint counts ****/ +#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_OTA_PROVIDER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -37,6 +38,11 @@ /**** Cluster Plugins ****/ +// Use this macro to check if the server side of the Basic cluster is included +#define ZCL_USING_BASIC_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_BASIC_SERVER +#define EMBER_AF_PLUGIN_BASIC + // Use this macro to check if the server side of the General Commissioning cluster is included #define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_SERVER