License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

SPDX-License-Identifier: Zlib

The licensor of this software is Silicon Laboratories Inc.

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

  3. This notice may not be removed or altered from any source distribution.

/***************************************************************************/
#ifndef _OTA_BROADCAST_BOOTLOADER_CLIENT_H_
#define _OTA_BROADCAST_BOOTLOADER_CLIENT_H_

#include "ota-broadcast-bootloader/ota-broadcast-bootloader-protocol.h"
#include "ota-broadcast-bootloader/ota-broadcast-bootloader-types.h"

EmberAfOtaBootloaderStatus emberAfPluginOtaBootloaderClientAbortImageDownload(uint8_t imageTag,
                                                                              uint8_t applicationErrorStatus);

//------------------------------------------------------------------------------
// Callbacks

bool emberAfPluginOtaBootloaderClientNewIncomingImageCallback(EmberNodeId serverId,
                                                              EmberNodeId *alternateServerId,
                                                              uint8_t imageTag);

void emberAfPluginOtaBootloaderClientIncomingImageSegmentCallback(EmberNodeId serverId,
                                                                  uint32_t startIndex,
                                                                  uint32_t endIndex,
                                                                  uint8_t imageTag,
                                                                  uint8_t *imageSegment);

void emberAfPluginOtaBootloaderClientImageDownloadCompleteCallback(EmberAfOtaBootloaderStatus status,
                                                                   uint8_t imageTag,
                                                                   uint32_t imageSize);

void emberAfPluginOtaBootloaderClientIncomingRequestStatusCallback(EmberNodeId serverId,
                                                                   uint8_t applicationServerStatus,
                                                                   uint8_t *applicationStatus);

bool emberAfPluginOtaBootloaderClientIncomingRequestBootloadCallback(EmberNodeId serverId,
                                                                     uint8_t imageTag,
                                                                     uint32_t bootloadDelayMs,
                                                                     uint8_t *applicationStatus);

#endif // _OTA_BROADCAST_BOOTLOADER_CLIENT_H_

Callbacks#

bool
emberAfPluginOtaBootloaderClientNewIncomingImageCallback(EmberNodeId serverId, EmberNodeId *alternateServerId, uint8_t imageTag)

A callback invoked when the OTA Bootloader Client starts receiving a new image. The application can choose to start receiving the image or it can ignore it. If the application chooses to receive the image, other images sent out by other servers are ignored until the client completes this download.

void
emberAfPluginOtaBootloaderClientIncomingImageSegmentCallback(EmberNodeId serverId, uint32_t startIndex, uint32_t endIndex, uint8_t imageTag, uint8_t *imageSegment)

A callback invoked when an image segment, that is part of an image that the application elected to download, was received on the OTA Bootloader Client.

void
emberAfPluginOtaBootloaderClientImageDownloadCompleteCallback(EmberAfOtaBootloaderStatus status, uint8_t imageTag, uint32_t imageSize)

A callback invoked on an OTA Bootloader Client to indicate that an image downlaod is completed.

void
emberAfPluginOtaBootloaderClientIncomingRequestStatusCallback(EmberNodeId serverId, uint8_t applicationServerStatus, uint8_t *applicationStatus)

A callback invoked on the OTA Bootloader Client to indicate that an OTA Bootloader Server has requested the status of the client device.

bool
emberAfPluginOtaBootloaderClientIncomingRequestBootloadCallback(EmberNodeId serverId, uint8_t imageTag, uint32_t bootloadDelayMs, uint8_t *applicationStatus)

A callback invoked by the OTA Bootloader Client plugin to indicate that an OTA Bootloader Server has requested to perform a bootload operation at a certain point in time in the future.

Functions#

emberAfPluginOtaBootloaderClientAbortImageDownload(uint8_t imageTag, uint8_t applicationErrorStatus)

Abort an ongoing image download process.

Callbacks Documentation#

emberAfPluginOtaBootloaderClientNewIncomingImageCallback#

bool emberAfPluginOtaBootloaderClientNewIncomingImageCallback (EmberNodeId serverId, EmberNodeId * alternateServerId, uint8_t imageTag)

A callback invoked when the OTA Bootloader Client starts receiving a new image. The application can choose to start receiving the image or it can ignore it. If the application chooses to receive the image, other images sent out by other servers are ignored until the client completes this download.

Parameters
[in]serverId

The node ID of the server that initiated the new image distribution process.

[out]alternateServerId

This node ID can be set by the application to include a well-known alternate server. If this is set to a valid address, the client allows segments also from this alternate server. If this is set to EMBER_BROADCAST_ADDRESS, the client accepts segments with the same image tag from any server.

[in]imageTag

A 1-byte tag that identifies the incoming image.

Returns

  • Return true to accept the image or false to ignore it.


Definition at line 94 of file /mnt/raid/workspaces/ws.Q8qnkBLX2/overlay/gsdk/protocol/flex/ota-broadcast-bootloader/ota-broadcast-bootloader-client/ota-broadcast-bootloader-client.h

emberAfPluginOtaBootloaderClientIncomingImageSegmentCallback#

void emberAfPluginOtaBootloaderClientIncomingImageSegmentCallback (EmberNodeId serverId, uint32_t startIndex, uint32_t endIndex, uint8_t imageTag, uint8_t * imageSegment)

A callback invoked when an image segment, that is part of an image that the application elected to download, was received on the OTA Bootloader Client.

Parameters
[in]serverId

The node ID of the server that initiated the image distribution process.

[in]startIndex

The index of the first byte of the passed segment.

[in]endIndex

The index of the last byte of the passed segment.

[in]imageTag

A 1-byte tag of the image the passed segment belongs to.

[in]imageSegment

An array containing the image segment.


Definition at line 114 of file /mnt/raid/workspaces/ws.Q8qnkBLX2/overlay/gsdk/protocol/flex/ota-broadcast-bootloader/ota-broadcast-bootloader-client/ota-broadcast-bootloader-client.h

emberAfPluginOtaBootloaderClientImageDownloadCompleteCallback#

void emberAfPluginOtaBootloaderClientImageDownloadCompleteCallback (EmberAfOtaBootloaderStatus status, uint8_t imageTag, uint32_t imageSize)

A callback invoked on an OTA Bootloader Client to indicate that an image downlaod is completed.

Parameters
[in]status

An EmberAfOtaBootloaderStatus value of:

[in]imageTag

A 1-byte tag of the image this callback refers to.

[in]imageSize

The total size of the downloaded image in bytes. This parameter is meaningful only in case the status parameter is set to EMBER_OTA_BROADCAST_BOOTLOADER_STATUS_SUCCESS.


Definition at line 143 of file /mnt/raid/workspaces/ws.Q8qnkBLX2/overlay/gsdk/protocol/flex/ota-broadcast-bootloader/ota-broadcast-bootloader-client/ota-broadcast-bootloader-client.h

emberAfPluginOtaBootloaderClientIncomingRequestStatusCallback#

void emberAfPluginOtaBootloaderClientIncomingRequestStatusCallback (EmberNodeId serverId, uint8_t applicationServerStatus, uint8_t * applicationStatus)

A callback invoked on the OTA Bootloader Client to indicate that an OTA Bootloader Server has requested the status of the client device.

Parameters
[in]serverId

The ID of the server the request came from.

[in]applicationServerStatus

The server application status, which was set by emberAfPluginBootloaderServerInitiateRequestTargetsStatus()

[out]applicationStatus

A 1-byte status set by the client application that is reported to the server.


Definition at line 158 of file /mnt/raid/workspaces/ws.Q8qnkBLX2/overlay/gsdk/protocol/flex/ota-broadcast-bootloader/ota-broadcast-bootloader-client/ota-broadcast-bootloader-client.h

emberAfPluginOtaBootloaderClientIncomingRequestBootloadCallback#

bool emberAfPluginOtaBootloaderClientIncomingRequestBootloadCallback (EmberNodeId serverId, uint8_t imageTag, uint32_t bootloadDelayMs, uint8_t * applicationStatus)

A callback invoked by the OTA Bootloader Client plugin to indicate that an OTA Bootloader Server has requested to perform a bootload operation at a certain point in time in the future.

Parameters
[in]serverId

The ID of the server the request came from.

[in]imageTag

A 1-byte tag of the image this callback refers to.

[in]bootloadDelayMs

The delay in milliseconds after which the client has been requested to perform a bootload operation.

[out]applicationStatus

A 1-byte status set by the client application that is reported to the server.

Returns

  • Return true if the application accepted the request of bootloading the specified image at the requested time, false otherwise.


Definition at line 179 of file /mnt/raid/workspaces/ws.Q8qnkBLX2/overlay/gsdk/protocol/flex/ota-broadcast-bootloader/ota-broadcast-bootloader-client/ota-broadcast-bootloader-client.h

Function Documentation#

emberAfPluginOtaBootloaderClientAbortImageDownload#

EmberAfOtaBootloaderStatus emberAfPluginOtaBootloaderClientAbortImageDownload (uint8_t imageTag, uint8_t applicationErrorStatus)

Abort an ongoing image download process.

Parameters
[in]imageTag

A 1-byte tag that identifies the image the client should no longer download.

[in]applicationErrorStatus

A 1-byte error code reported to the server.

Returns


Definition at line 62 of file /mnt/raid/workspaces/ws.Q8qnkBLX2/overlay/gsdk/protocol/flex/ota-broadcast-bootloader/ota-broadcast-bootloader-client/ota-broadcast-bootloader-client.h