Gracias por tu visita. Esta página solo está disponible en inglés.

OTA Update Process (Bluetooth Low Energy)

This topic describes the process by which an Echo device and a gadget communicate to perform an over-the-air (OTA) update over Bluetooth Low Energy (BLE).

For the requirements that your gadget must meet to perform OTA updates, see OTA Update Prerequisites.

Overview

The following figure provides an overview of the OTA process, followed by a description of the steps. This process uses three streams: the control stream, Alexa stream, and OTA stream.

Alexa Gadget OTA Update over Bluetooth Low Energy

Connect over BLE

First, the Echo device and the gadget perform all of the steps up to and including the handshake over BLE, just as they do in the original pairing and connection or reconnection flow.

Find the gadget's firmware version

When the Echo device and the gadget connect, the Echo device sends the gadget a Discover directive. (This occurs anytime the Echo device and the gadget connect.) The gadget responds with a Discover.Response event that, along with other information, contains the current firmware version of the gadget. The Alexa service uses this information to determine whether the gadget needs a firmware update. Because Alexa.Discovery is an Alexa Gadgets Toolkit interface, the Discover directive and the Discover.Response event use the Alexa stream.

Start the OTA update

If the Alexa service determines that the gadget needs a firmware update, the Echo device sends the gadget an UpdateComponentSegment message over the control stream. The last packet of the transaction that contains the UpdateComponentSegment message will have the ACK flag set in the header, so the gadget must send an ACK/NACK packet in response to the last packet of the transaction.

Transfer the firmware image

Using the OTA stream, the Echo device transfers the firmware image to the gadget in chunks by sending the gadget one or more UpdateComponent messages. The chunk size is less than or equal to the maximum transactional data size that the gadget reported in the protocol version packet. For example, if the firmware image size is 540 KB and the maximum transactional data size is 100 KB, then the Echo device will send the gadget six UpdateComponent messages (five 100 KB chunks and one 40 KB chunk).

Apply the update

After the gadget receives the complete firmware image, it responds to the UpdateComponentSegment message using the control stream. Then, the Echo device sends the gadget an ApplyFirmware message, also over the control stream, to instruct the gadget to use the new firmware.

The packet that contains the ApplyFirmware message from the Echo device will have the ACK flag set in the header, so the gadget must send an ACK/NACK packet in response to the last packet of the transaction.

When the gadget sends a final response to the ApplyFirmware command, the update is complete.