Over The Air (OTA) Update Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
OTA User Configurations

General Description

Customer overrides for the OTA library.

Macros

#define CY_OTA_INITIAL_CHECK_SECS   (10) /* 10 seconds. */
 Initial time for checking for OTA updates. More...
 
#define CY_OTA_NEXT_CHECK_INTERVAL_SECS   (24 * 60 * 60) /* 1 day between checks. */
 Next time for checking for OTA updates. More...
 
#define CY_OTA_RETRY_INTERVAL_SECS   (5) /* 5 seconds between retries after an error. */
 Retry time which checking for OTA updates. More...
 
#define CY_OTA_CHECK_TIME_SECS   (10 * 60) /* 10 minutes. */
 Length of time to check for downloads. More...
 
#define CY_OTA_PACKET_INTERVAL_SECS   (0) /* Default disabled. */
 Expected maximum download time between each OTA packet arrival. More...
 
#define CY_OTA_JOB_CHECK_TIME_SECS   (30) /* 30 seconds. */
 Length of time to check for getting Job document. More...
 
#define CY_OTA_DATA_CHECK_TIME_SECS   (20 * 60) /* 20 minutes. */
 Length of time to check for getting the OTA image data. More...
 
#define CY_OTA_RETRIES   (3) /* Retry entire process 3 times. */
 Number of retries when attempting an OTA update. More...
 
#define CY_OTA_CONNECT_RETRIES   (3) /* 3 server connect retries. */
 Number of retries when attempting to contact the server. More...
 
#define CY_OTA_MAX_DOWNLOAD_TRIES   (3) /* 3 download OTA image retries. */
 Number of OTA download retries. More...
 
#define PUBLISHER_LISTEN_TOPIC   "publish_notify"
 Last part of the topic to subscribe. More...
 
#define COMPANY_TOPIC_PREPEND   "anycloud"
 First part of the topic to subscribe / publish. More...
 
#define PUBLISHER_DIRECT_TOPIC   "OTAImage"
 End of topic to send a message to the Publisher for Direct download.
 
#define CY_OTA_RESULT_SUCCESS   "Success"
 Update Successful message. More...
 
#define CY_OTA_RESULT_FAILURE   "Failure"
 Update Failure message. More...
 
#define CY_OTA_HTTP_JOB_FILE   "/ota_update.json"
 Default Job document name. More...
 
#define CY_OTA_HTTP_DATA_FILE   "/anycloud-ota.bin"
 Default OTA image file name. More...
 
#define CY_OTA_SUBSCRIBE_UPDATES_AVAIL   "{\\"Message\":\"Update Availability\", \\"Manufacturer\": \"Express Widgits Corporation\", \\"ManufacturerID\": \"EWCO\", \\"ProductID\": \"Easy Widgit\", \\"SerialNumber\": \"ABC213450001\", \\"BoardName\": \"CY8CPROTO_062_4343W\", \\"Version\": \"%d.%d.%d\", \\"UniqueTopicName\": \"%s\"\}"
 Device message to the Publisher to ask about updates. More...
 
#define CY_OTA_DOWNLOAD_REQUEST   "{\\"Message\":\"Request Update\", \\"Manufacturer\": \"Express Widgits Corporation\", \\"ManufacturerID\": \"EWCO\", \\"ProductID\": \"Easy Widgit\", \\"SerialNumber\": \"ABC213450001\", \\"BoardName\": \"CY8CPROTO_062_4343W\", \\"Version\": \"%d.%d.%d\", \\"UniqueTopicName\": \"%s\" \}"
 Device message to the Publisher to ask for a full download. More...
 
#define CY_OTA_DOWNLOAD_CHUNK_REQUEST   "{\\"Message\":\"Request Data Chunk\", \\"Manufacturer\": \"Express Widgits Corporation\", \\"ManufacturerID\": \"EWCO\", \\"ProductID\": \"Easy Widgit\", \\"SerialNumber\": \"ABC213450001\", \\"BoardName\": \"CY8CPROTO_062_4343W\", \\"Version\": \"%d.%d.%d\", \\"UniqueTopicName\": \"%s\", \\"Filename\": \"%s\", \\"Offset\": \"%ld\", \\"Size\": \"%ld\"\}"
 Device message to the Publisher to ask for a chunk of data. More...
 
#define CY_OTA_MQTT_RESULT_JSON   "{\\"Message\":\"%s\", \\"UniqueTopicName\": \"%s\"\}"
 Device JSON document to respond to the MQTT Publisher. More...
 
#define CY_OTA_HTTP_RESULT_JSON   "{\\"Message\":\"%s\", \\"File\":\"%s\" \}"
 Device JSON document to respond to the HTTP server. More...
 
#define CY_OTA_HTTP_GET_TEMPLATE
 HTTP GET template. More...
 
#define CY_OTA_HTTP_GET_RANGE_TEMPLATE
 HTTP GET Range template. More...
 
#define CY_OTA_HTTP_POST_TEMPLATE
 HTTP POST template. More...
 
#define CY_OTA_MQTT_KEEP_ALIVE_SECONDS   (60) /* 60 second keepalive. */
 The keepalive interval for MQTT. More...
 
#define CY_OTA_MQTT_MAX_TOPICS   (2)
 Maximum number of MQTT Topics. More...
 
#define CY_OTA_MQTT_TOPIC_PREFIX   "cy_ota_device"
 TOPIC prefix. More...
 
#define CY_OTA_MQTT_CLIENT_ID_PREFIX   "cy_device"
 The first characters in the client identifier. More...
 

Macro Definition Documentation

#define CY_OTA_INITIAL_CHECK_SECS   (10) /* 10 seconds. */

Initial time for checking for OTA updates.

This is used to start the timer for the initial OTA update check after calling cy_ota_agent_start().

#define CY_OTA_NEXT_CHECK_INTERVAL_SECS   (24 * 60 * 60) /* 1 day between checks. */

Next time for checking for OTA updates.

This is used to restart the timer after an OTA update check in the OTA Agent.

#define CY_OTA_RETRY_INTERVAL_SECS   (5) /* 5 seconds between retries after an error. */

Retry time which checking for OTA updates.

This is used to restart the timer after failing to contact the server during an OTA update check.

#define CY_OTA_CHECK_TIME_SECS   (10 * 60) /* 10 minutes. */

Length of time to check for downloads.

THE OTA Agent wakes up, connects to server, and waits this much time before disconnecting. This allows the OTA Agent to be inactive for long periods of time, only checking for short periods. Use 0x00 to continue checking once started.

#define CY_OTA_PACKET_INTERVAL_SECS   (0) /* Default disabled. */

Expected maximum download time between each OTA packet arrival.

This is used to verify that the download occurs in a reasonable time frame. Set to 0 to disable this check.

#define CY_OTA_JOB_CHECK_TIME_SECS   (30) /* 30 seconds. */

Length of time to check for getting Job document.

The OTA Agent wakes up, connects to broker/server, and waits this much time before disconnecting. This allows the OTA Agent to be inactive for long periods of time, only checking for short periods. Use 0x00 to continue checking once started.

#define CY_OTA_DATA_CHECK_TIME_SECS   (20 * 60) /* 20 minutes. */

Length of time to check for getting the OTA image data.

After getting the Job (or during a direct download), this is the amount of time to wait before canceling the download. Use 0x00 to disable.

#define CY_OTA_RETRIES   (3) /* Retry entire process 3 times. */

Number of retries when attempting an OTA update.

This is used to determine # retries when attempting an OTA update.

#define CY_OTA_CONNECT_RETRIES   (3) /* 3 server connect retries. */

Number of retries when attempting to contact the server.

This is used to determine # retries when connecting to the server during an OTA update check.

#define CY_OTA_MAX_DOWNLOAD_TRIES   (3) /* 3 download OTA image retries. */

Number of OTA download retries.

Retry count for attempts at downloading the OTA image.

#define PUBLISHER_LISTEN_TOPIC   "publish_notify"

Last part of the topic to subscribe.

Topic for the device to send a message to the Publisher: "COMPANY_TOPIC_PREPEND / BOARD_NAME / PUBLISHER_LISTEN_TOPIC" The combined topic must match the Publisher's subscribe topic.

Override in cy_ota_config.h

#define COMPANY_TOPIC_PREPEND   "anycloud"

First part of the topic to subscribe / publish.

Topic for the device to send a message to the Publisher: "COMPANY_TOPIC_PREPEND / BOARD_NAME / PUBLISHER_LISTEN_TOPIC"

#define CY_OTA_RESULT_SUCCESS   "Success"

Update Successful message.

Used with sprintf() to create the RESULT message to the Broker/server.

#define CY_OTA_RESULT_FAILURE   "Failure"

Update Failure message.

Used with sprintf() to create the RESULT message to the Broker/server.

#define CY_OTA_HTTP_JOB_FILE   "/ota_update.json"

Default Job document name.

Name of the update JSON file for HTTP.

#define CY_OTA_HTTP_DATA_FILE   "/anycloud-ota.bin"

Default OTA image file name.

Name of the OTA image for HTTP.

#define CY_OTA_SUBSCRIBE_UPDATES_AVAIL   "{\\"Message\":\"Update Availability\", \\"Manufacturer\": \"Express Widgits Corporation\", \\"ManufacturerID\": \"EWCO\", \\"ProductID\": \"Easy Widgit\", \\"SerialNumber\": \"ABC213450001\", \\"BoardName\": \"CY8CPROTO_062_4343W\", \\"Version\": \"%d.%d.%d\", \\"UniqueTopicName\": \"%s\"\}"

Device message to the Publisher to ask about updates.

Used with sprintf() to insert the current version and UniqueTopicName at runtime. Override if desired by defining in cy_ota_config.h.

#define CY_OTA_DOWNLOAD_REQUEST   "{\\"Message\":\"Request Update\", \\"Manufacturer\": \"Express Widgits Corporation\", \\"ManufacturerID\": \"EWCO\", \\"ProductID\": \"Easy Widgit\", \\"SerialNumber\": \"ABC213450001\", \\"BoardName\": \"CY8CPROTO_062_4343W\", \\"Version\": \"%d.%d.%d\", \\"UniqueTopicName\": \"%s\" \}"

Device message to the Publisher to ask for a full download.

  • Used with sprintf() to insert values at runtime. Current Application Version UniqueTopicName Size Override if desired by defining in cy_ota_config.h.
#define CY_OTA_DOWNLOAD_CHUNK_REQUEST   "{\\"Message\":\"Request Data Chunk\", \\"Manufacturer\": \"Express Widgits Corporation\", \\"ManufacturerID\": \"EWCO\", \\"ProductID\": \"Easy Widgit\", \\"SerialNumber\": \"ABC213450001\", \\"BoardName\": \"CY8CPROTO_062_4343W\", \\"Version\": \"%d.%d.%d\", \\"UniqueTopicName\": \"%s\", \\"Filename\": \"%s\", \\"Offset\": \"%ld\", \\"Size\": \"%ld\"\}"

Device message to the Publisher to ask for a chunk of data.

  • Used with sprintf() to insert values at runtime. Current Application Version UniqueTopicName FileName Offset Size Override if desired by defining in cy_ota_config.h.
#define CY_OTA_MQTT_RESULT_JSON   "{\\"Message\":\"%s\", \\"UniqueTopicName\": \"%s\"\}"

Device JSON document to respond to the MQTT Publisher.

Used with sprintf() to create the JSON message. Override if desired by defining in cy_ota_config.h.

#define CY_OTA_HTTP_RESULT_JSON   "{\\"Message\":\"%s\", \\"File\":\"%s\" \}"

Device JSON document to respond to the HTTP server.

Used with sprintf() to create the JSON message. Override if desired by defining in cy_ota_config.h.

#define CY_OTA_HTTP_GET_TEMPLATE
Value:
"GET %s HTTP/1.1\r\n" \
"Host: %s:%d \r\n" \
"\r\n"

HTTP GET template.

Used with sprintf() to create the GET request for the HTTP server.

#define CY_OTA_HTTP_GET_RANGE_TEMPLATE
Value:
"GET %s HTTP/1.1\r\n" \
"Host: %s:%d \r\n" \
"Range: bytes=%ld-%ld \r\n" \
"\r\n"

HTTP GET Range template.

Used with sprintf() to create the GET request for the HTTP server when requesting a range of data.

#define CY_OTA_HTTP_POST_TEMPLATE
Value:
"POST %s HTTP/1.1\r\n" \
"Content-Length:%ld \r\n" \
"\r\n%s"

HTTP POST template.

Used with sprintf() to create the POST message for the HTTP server.

#define CY_OTA_MQTT_KEEP_ALIVE_SECONDS   (60) /* 60 second keepalive. */

The keepalive interval for MQTT.

Maximum number of MQTT Topics.

An MQTT ping request will be sent periodically at this interval. The maximum number of Topics for subscribing.

#define CY_OTA_MQTT_MAX_TOPICS   (2)

Maximum number of MQTT Topics.

The maximum number of Topics for subscribing.

#define CY_OTA_MQTT_TOPIC_PREFIX   "cy_ota_device"

TOPIC prefix.

Used as prefix for "Will" and "Acknowledgement" messages.

#define CY_OTA_MQTT_CLIENT_ID_PREFIX   "cy_device"

The first characters in the client identifier.

A timestamp is appended to this prefix to create a unique client identifer for each connection.