Skip to content

Commit

Permalink
OTAServerDelegate class for vendor logic (#6476)
Browse files Browse the repository at this point in the history
* OTAServerDelegate class for vendor logic

- define OTAServerDelegate class for implementing vendor OTA Server
logic
- add some common logic for OTA Server Cluster commands
- use OTA_SERVER_CLUSTER_EXAMPLE_IMPL to conditionally build example
logic
- add OTA Server Cluster to all-clusters-app and chip-tool
- fix AnnounceOTAServer command direction

* add build macros to all-clusters-app esp32 build files

* use virtual delegate methods instead of static singleton

* fix whitespace

* add OTA Server to all-clusters-app, remove ota-client callbacks

ota-client response callbacks are automatically generated now

* generated files

* remove src/darwin edits

* edit zap files to include just ota clusters

* regenerate gen files after zap fix

* add multiple endpoint support and EMBER_ZCL_STATUS_INVALID_ARGUMENT

* remove OTA Server Cluster from all-clusters-app Endpoint 1

- There should only be one OTA Server Cluster, in endpoint 0

* fix darwin tests

- enable Cluster Revision attribute reporting for OTA Server Cluster in
all-clusters-app
- change darwin test to use endpoint 0 instead of endpoint 1

* edit helper.js in darwin to fix OTA Server test

- note: tv-app files were also modified and tv-app build is failing

* generated files after merge conflict

* resolve merge conflicts + regen

* default destructor for OTAServerDelegate

Co-authored-by: Tennessee Carmel-Veilleux <[email protected]>

* error logging and value change for EMBER_ZCL_STATUS_INVALID_ARGUMENT

* regenerate

* regenerated files after merge conflict fix

* add generated tv-app files

* Revert "add generated tv-app files"

This reverts commit 48acb90.

Co-authored-by: Tennessee Carmel-Veilleux <[email protected]>
  • Loading branch information
holbrookt and tcarmelveilleux authored Jun 10, 2021
1 parent e42d5ef commit f9d5741
Show file tree
Hide file tree
Showing 31 changed files with 1,838 additions and 229 deletions.
109 changes: 97 additions & 12 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,100 @@
}
]
},
{
"name": "OTA Software Update Server",
"code": 41,
"mfgCode": null,
"define": "OTA_SERVER_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "QueryImage",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "ApplyUpdateRequest",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "NotifyUpdateApplied",
"code": 2,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
}
],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "OTA Software Update Server",
"code": 41,
"mfgCode": null,
"define": "OTA_SERVER_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [
{
"name": "QueryImageResponse",
"code": 3,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
},
{
"name": "ApplyUpdateRequestResponse",
"code": 4,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
}
],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "General Commissioning",
"code": 48,
Expand Down Expand Up @@ -7005,7 +7099,7 @@
"mfgCode": null,
"define": "OTA_SERVER_CLUSTER",
"side": "server",
"enabled": 1,
"enabled": 0,
"commands": [
{
"name": "QueryImageResponse",
Expand Down Expand Up @@ -7104,17 +7198,8 @@
"mfgCode": null,
"define": "OTA_CLIENT_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [
{
"name": "AnnounceOtaServer",
"code": 0,
"mfgCode": null,
"source": "server",
"incoming": 0,
"outgoing": 1
}
],
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "cluster revision",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
emberAfNetworkCommissioningClusterInitCallback(endpoint);
break;
case ZCL_OTA_CLIENT_CLUSTER_ID:
emberAfOtaSoftwareUpdateClientClusterInitCallback(endpoint);
break;
case ZCL_OTA_SERVER_CLUSTER_ID:
emberAfOtaSoftwareUpdateServerClusterInitCallback(endpoint);
break;
Expand Down Expand Up @@ -311,11 +308,6 @@ void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(Endpoi
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfOtaSoftwareUpdateClientClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfOtaSoftwareUpdateServerClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
Expand Down
79 changes: 0 additions & 79 deletions examples/all-clusters-app/all-clusters-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,6 @@ void emberAfMediaPlaybackClusterInitCallback(chip::EndpointId endpoint);
*/
void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint);

/** @brief OTA Software Update Client Cluster Init
*
* Cluster Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfOtaSoftwareUpdateClientClusterInitCallback(chip::EndpointId endpoint);

/** @brief OTA Software Update Server Cluster Init
*
* Cluster Init
Expand Down Expand Up @@ -2303,77 +2295,6 @@ EmberAfStatus emberAfNetworkCommissioningClusterServerPreAttributeChangedCallbac
*/
void emberAfNetworkCommissioningClusterServerTickCallback(chip::EndpointId endpoint);

//
// OTA Software Update Client Cluster server
//

/** @brief OTA Software Update Client Cluster Server Init
*
* Server Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfOtaSoftwareUpdateClientClusterServerInitCallback(chip::EndpointId endpoint);

/** @brief OTA Software Update Client Cluster Server Attribute Changed
*
* Server Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute that changed
*/
void emberAfOtaSoftwareUpdateClientClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);

/** @brief OTA Software Update Client Cluster Server Manufacturer Specific Attribute Changed
*
* Server Manufacturer Specific Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute that changed
* @param manufacturerCode Manufacturer Code of the attribute that changed
*/
void emberAfOtaSoftwareUpdateClientClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
chip::AttributeId attributeId,
uint16_t manufacturerCode);

/** @brief OTA Software Update Client Cluster Server Message Sent
*
* Server Message Sent
*
* @param type The type of message sent
* @param destination The destination to which the message was sent
* @param apsFrame The APS frame for the message
* @param msgLen The length of the message
* @param message The message that was sent
* @param status The status of the sent message
*/
void emberAfOtaSoftwareUpdateClientClusterServerMessageSentCallback(const chip::MessageSendDestination & destination,
EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
EmberStatus status);

/** @brief OTA Software Update Client Cluster Server Pre Attribute Changed
*
* server Pre Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute to be changed
* @param attributeType Attribute type
* @param size Attribute size
* @param value Attribute value
*/
EmberAfStatus emberAfOtaSoftwareUpdateClientClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
chip::AttributeId attributeId,
EmberAfAttributeType attributeType,
uint16_t size, uint8_t * value);

/** @brief OTA Software Update Client Cluster Server Tick
*
* server Tick
*
* @param endpoint Endpoint that is being served
*/
void emberAfOtaSoftwareUpdateClientClusterServerTickCallback(chip::EndpointId endpoint);

//
// OTA Software Update Server Cluster server
//
Expand Down
Loading

0 comments on commit f9d5741

Please sign in to comment.