Skip to content

Commit

Permalink
Add OTA Provider server cluster to the Darwin framework. (#15887)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Nov 14, 2023
1 parent c90c45c commit 4d20e16
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
32 changes: 8 additions & 24 deletions src/app/clusters/ota-provider/ota-provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ using namespace chip::app::Clusters;
using namespace chip::app::Clusters::OtaSoftwareUpdateProvider;
using chip::app::Clusters::OTAProviderDelegate;

// EMBER_AF_OTA_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT is only defined if the
// cluster is actually enabled in the ZAP config. To allow operation in setups
// where that's not the case (and custom dispatch is used), define it here as
// needed.
#ifndef EMBER_AF_OTA_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT
#define EMBER_AF_OTA_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT 0
#endif // EMBER_AF_OTA_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT

static constexpr size_t kOtaProviderDelegateTableSize =
EMBER_AF_OTA_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT;

Expand Down Expand Up @@ -66,11 +74,7 @@ bool SendStatusIfDelegateNull(EndpointId endpoint)
* @brief OTA Software Update Provider Cluster ApplyUpdateRequest Command callback
*
* @note It is the application's reponsibility to send the ApplyUpdateRequestResponse command after this is handled.
*
* @param updateToken Identifier for the Software Image to be applied. Should be 32 octets long.
* @param newVersion The SoftwareVersion value of the new Software Image that the client is ready to apply.
*/

bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(
app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::ApplyUpdateRequest::DecodableType & commandData)
Expand Down Expand Up @@ -109,13 +113,7 @@ bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(

/**
* @brief OTA Software Update Provider Cluster NotifyUpdateApplied Command callback
*
*
* @param updateToken Identifier for the Software Image that was applied. Should be 32 octets long.
* @param softwareVersion The current SoftwareVersion value. Should match the SoftwarVersion attribute in the
* OTA Requestor's Basic Information Cluster.
*/

bool emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(
app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Commands::NotifyUpdateApplied::DecodableType & commandData)
Expand Down Expand Up @@ -154,21 +152,7 @@ bool emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(

/**
* @brief OTA Software Update Provider Cluster QueryImage Command callback
*
* @param vendorId The Vendor ID applying to the OTA Requestor’s Node. Should match the value in the Basic Information Cluster.
* @param productId The Product ID applying to the OTA Requestor’s Node. Should match the value in the Basic Information Cluster.
* @param imageType A Vendor-specific numerical value that may help an OTA Provider select the correct payload.
* @param hardwareVersion The OTA Requestor’s hardware version. Should match the HardwareVersion attribute of the Client's Basic
* Information Cluster.
* @param softwareVersion The current version running on the OTA Requestor. Should match the SoftwareVersion attribute of the
* Client's Basic Information Cluster.
* @param protocolsSupported A list of OTADownloadProtocol enum values indicating download protocols supported by the OTA Requestor
* (max length 8 entries).
* @param location Optional, 2 chars. If present, it should match the Location value in the Client's Basic Information Cluster.
* @param clientCanConsent Optional. May be set by an OTA Requestor which is capable of obtaining user consent for OTA application.
* @param metadataForProvider Optional, max 512 octets. A TLV-encoded Vendor-specific payload.
*/

bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath,
const Commands::QueryImage::DecodableType & commandData)
Expand Down
4 changes: 4 additions & 0 deletions src/darwin/Framework/CHIP.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
5129BCFD26A9EE3300122DDF /* CHIPError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5129BCFC26A9EE3300122DDF /* CHIPError.h */; settings = {ATTRIBUTES = (Public, ); }; };
513DDB862761F69300DAA01A /* CHIPAttributeTLVValueDecoder_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 513DDB852761F69300DAA01A /* CHIPAttributeTLVValueDecoder_Internal.h */; };
513DDB8A2761F6F900DAA01A /* CHIPAttributeTLVValueDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 513DDB892761F6F900DAA01A /* CHIPAttributeTLVValueDecoder.mm */; };
51431AFB27D29CA4008A7943 /* ota-provider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51431AFA27D29CA4008A7943 /* ota-provider.cpp */; };
51B22C1E2740CB0A008D5055 /* CHIPStructsObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B22C1D2740CB0A008D5055 /* CHIPStructsObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
51B22C222740CB1D008D5055 /* CHIPCommandPayloadsObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B22C212740CB1D008D5055 /* CHIPCommandPayloadsObjc.h */; settings = {ATTRIBUTES = (Public, ); }; };
51B22C262740CB32008D5055 /* CHIPStructsObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B22C252740CB32008D5055 /* CHIPStructsObjc.mm */; };
Expand Down Expand Up @@ -149,6 +150,7 @@
5129BCFC26A9EE3300122DDF /* CHIPError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CHIPError.h; path = CHIP/CHIPError.h; sourceTree = "<group>"; };
513DDB852761F69300DAA01A /* CHIPAttributeTLVValueDecoder_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPAttributeTLVValueDecoder_Internal.h; sourceTree = "<group>"; };
513DDB892761F6F900DAA01A /* CHIPAttributeTLVValueDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CHIPAttributeTLVValueDecoder.mm; path = "zap-generated/CHIPAttributeTLVValueDecoder.mm"; sourceTree = "<group>"; };
51431AFA27D29CA4008A7943 /* ota-provider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "ota-provider.cpp"; path = "../../../app/clusters/ota-provider/ota-provider.cpp"; sourceTree = "<group>"; };
51B22C1D2740CB0A008D5055 /* CHIPStructsObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CHIPStructsObjc.h; path = "zap-generated/CHIPStructsObjc.h"; sourceTree = "<group>"; };
51B22C212740CB1D008D5055 /* CHIPCommandPayloadsObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CHIPCommandPayloadsObjc.h; path = "zap-generated/CHIPCommandPayloadsObjc.h"; sourceTree = "<group>"; };
51B22C252740CB32008D5055 /* CHIPStructsObjc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CHIPStructsObjc.mm; path = "zap-generated/CHIPStructsObjc.mm"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -229,6 +231,7 @@
isa = PBXGroup;
children = (
2FD775542695557E00FF4B12 /* error-mapping.cpp */,
51431AFA27D29CA4008A7943 /* ota-provider.cpp */,
1E85731926551A490050A4D9 /* af-event.cpp */,
1E85731F26551A490050A4D9 /* attribute-size-util.cpp */,
1E85731626551A490050A4D9 /* attribute-storage.cpp */,
Expand Down Expand Up @@ -578,6 +581,7 @@
5A6FEC9827B5C6AF00F25F42 /* CHIPDeviceOverXPC.m in Sources */,
1E85732826551A490050A4D9 /* attribute-table.cpp in Sources */,
5A830D6E27CFCFF90053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.m in Sources */,
51431AFB27D29CA4008A7943 /* ota-provider.cpp in Sources */,
1E85732626551A490050A4D9 /* attribute-storage.cpp in Sources */,
1E85732C26551A490050A4D9 /* DataModelHandler.cpp in Sources */,
);
Expand Down
7 changes: 7 additions & 0 deletions src/platform/Darwin/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,10 @@

// TODO: CHIP has redesigned the crypto interface, pending on the final version of CHIP HASH APIs
#define CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH 0

// Reserve a single dynamic endpoint that we can use to host things like OTA
// Provider server.
#if !defined(CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT) || CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT == 0
#undef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT
#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 1
#endif // CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT

0 comments on commit 4d20e16

Please sign in to comment.