Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Temporary) OTA: change protocolsSupported to single value instead of list #8632

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5755,7 +5755,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
uint16_t imageType;
uint16_t hardwareVersion;
uint32_t currentVersion;
/* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported;
uint8_t protocolsSupported;
const uint8_t * location;
uint8_t requestorCanConsent;
chip::ByteSpan metadataForProvider;
Expand Down Expand Up @@ -5804,8 +5804,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
TLVUnpackError = aDataTlv.Get(currentVersion);
break;
case 5:
// Just for compatibility, we will add array type support in IM later.
TLVUnpackError = aDataTlv.GetDataPtr(const_cast<const uint8_t *&>(protocolsSupported));
TLVUnpackError = aDataTlv.Get(protocolsSupported);
break;
case 6:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5309,7 +5309,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
uint16_t imageType;
uint16_t hardwareVersion;
uint32_t currentVersion;
/* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported;
uint8_t protocolsSupported;
const uint8_t * location;
uint8_t requestorCanConsent;
chip::ByteSpan metadataForProvider;
Expand Down Expand Up @@ -5358,8 +5358,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
TLVUnpackError = aDataTlv.Get(currentVersion);
break;
case 5:
// Just for compatibility, we will add array type support in IM later.
TLVUnpackError = aDataTlv.GetDataPtr(const_cast<const uint8_t *&>(protocolsSupported));
TLVUnpackError = aDataTlv.Get(protocolsSupported);
break;
case 6:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
Expand Down
5 changes: 2 additions & 3 deletions examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3438,7 +3438,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
uint16_t imageType;
uint16_t hardwareVersion;
uint32_t currentVersion;
/* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported;
uint8_t protocolsSupported;
const uint8_t * location;
uint8_t requestorCanConsent;
chip::ByteSpan metadataForProvider;
Expand Down Expand Up @@ -3487,8 +3487,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman
TLVUnpackError = aDataTlv.Get(currentVersion);
break;
case 5:
// Just for compatibility, we will add array type support in IM later.
TLVUnpackError = aDataTlv.GetDataPtr(const_cast<const uint8_t *&>(protocolsSupported));
TLVUnpackError = aDataTlv.Get(protocolsSupported);
break;
case 6:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/ota-provider/ota-provider-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ namespace clusters {
class OTAProviderDelegate
{
public:
// TODO: protocolsSupported should be list of OTADownloadProtocol enums, not uint8_t*
// TODO(#8605): protocolsSupported should be list of OTADownloadProtocol enums, not uint8_t
virtual EmberAfStatus HandleQueryImage(uint16_t vendorId, uint16_t productId, uint16_t imageType, uint16_t hardwareVersion,
uint32_t currentVersion, uint8_t * protocolsSupported, const chip::ByteSpan & location,
uint32_t currentVersion, uint8_t protocolsSupported, const chip::ByteSpan & location,
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
bool clientCanConsent, const chip::ByteSpan & metadataForProvider) = 0;

virtual EmberAfStatus HandleApplyUpdateRequest(const chip::ByteSpan & updateToken, uint32_t newVersion) = 0;
Expand Down
11 changes: 6 additions & 5 deletions src/app/clusters/ota-provider/ota-provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,12 @@ bool emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(chip::ap
* @param metadataForProvider Optional, max 512 octets. A TLV-encoded Vendor-specific payload.
*/

bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(
chip::app::CommandHandler * commandObj, uint16_t vendorId, uint16_t productId, uint16_t imageType, uint16_t hardwareVersion,
uint32_t currentVersion,
/* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported, uint8_t * location, uint8_t clientCanConsent,
chip::ByteSpan metadataForProvider)
bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(chip::app::CommandHandler * commandObj, uint16_t vendorId,
uint16_t productId, uint16_t imageType, uint16_t hardwareVersion,
uint32_t currentVersion,
/* TODO(#8605): change this to list */ uint8_t protocolsSupported,
uint8_t * location, uint8_t clientCanConsent,
chip::ByteSpan metadataForProvider)
{
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
chip::EndpointId endpointId = emberAfCurrentEndpoint();
Expand Down
9 changes: 5 additions & 4 deletions src/app/common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -15539,10 +15539,11 @@ bool emberAfBasicClusterLeaveCallback(chip::app::CommandSender * commandObj);
/**
* @brief Cluster QueryImage Command callback (from client)
*/
bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(
chip::app::CommandHandler * commandObj, uint16_t vendorId, uint16_t productId, uint16_t imageType, uint16_t hardwareVersion,
uint32_t currentVersion, /* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported, uint8_t * location,
uint8_t requestorCanConsent, chip::ByteSpan metadataForProvider);
bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(chip::app::CommandHandler * commandObj, uint16_t vendorId,
uint16_t productId, uint16_t imageType, uint16_t hardwareVersion,
uint32_t currentVersion, uint8_t protocolsSupported,
uint8_t * location, uint8_t requestorCanConsent,
chip::ByteSpan metadataForProvider);
/**
* @brief Cluster ApplyUpdateRequest Command callback (from client)
*/
Expand Down
10 changes: 4 additions & 6 deletions src/app/common/gen/client-command-macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -1736,20 +1736,18 @@
* @param imageType INT16U
* @param hardwareVersion INT16U
* @param currentVersion INT32U
* @param protocolsSupported OTADownloadProtocol []
* @param protocolsSupportedLen int
* @param protocolsSupported OTADownloadProtocol
* @param location CHAR_STRING
* @param requestorCanConsent BOOLEAN
* @param metadataForProvider OCTET_STRING
*/
#define emberAfFillCommandOTA \
Software Update ProviderClusterQueryImage(vendorId, productId, imageType, hardwareVersion, currentVersion, protocolsSupported, \
protocolsSupportedLen, location, requestorCanConsent, metadataForProvider) \
location, requestorCanConsent, metadataForProvider) \
emberAfFillExternalBuffer(mask, \
\
ZCL_QUERY_IMAGE_COMMAND_ID, "uuuuubuuu", vendorId, productId, imageType, hardwareVersion, \
currentVersion, protocolsSupported, protocolsSupportedLen, location, requestorCanConsent, \
metadataForProvider);
ZCL_QUERY_IMAGE_COMMAND_ID, "uuuuuuuuu", vendorId, productId, imageType, hardwareVersion, \
currentVersion, protocolsSupported, location, requestorCanConsent, metadataForProvider);

/** @brief Command description for ApplyUpdateRequest
*
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/zcl/data-model/chip/chip-ota.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ limitations under the License.
<arg name="imageType" type="INT16U"/>
<arg name="hardwareVersion" type="INT16U"/>
<arg name="currentVersion" type="INT32U"/>
<arg name="protocolsSupported" type="OTADownloadProtocol" array="true"/>
<arg name="protocolsSupported" type="OTADownloadProtocol"/> <!-- TODO(#8605): add array="true" when lists are supported -->
<arg name="location" type="CHAR_STRING" length="2"/>
<arg name="requestorCanConsent" type="BOOLEAN"/>
<arg name="metadataForProvider" type="OCTET_STRING" length="512"/>
Expand Down