CBOR encode/decode routines for AWS IoT Over-the-Air updates.
More...
#include <stdlib.h>
#include "cbor.h"
#include "ota_cbor_private.h"
|
#define | OTA_CBOR_GETSTREAMREQUEST_ITEM_COUNT 6 |
| Number of keys in cbor get stream request message.
|
|
|
static CborError | checkDataType (CborType expectedType, const CborValue *cborValue) |
| Helper function to verify the data type of the value in map.
|
|
bool | OTA_CBOR_Decode_GetStreamResponseMessage (const uint8_t *pMessageBuffer, size_t messageSize, int32_t *pFileId, int32_t *pBlockId, int32_t *pBlockSize, uint8_t *const *pPayload, size_t *pPayloadSize) |
| Decode a Get Stream response message from AWS IoT OTA.
|
|
bool | OTA_CBOR_Encode_GetStreamRequestMessage (uint8_t *pMessageBuffer, size_t messageBufferSize, size_t *pEncodedMessageSize, const char *pClientToken, int32_t fileId, int32_t blockSize, int32_t blockOffset, const uint8_t *pBlockBitmap, size_t blockBitmapSize, int32_t numOfBlocksRequested) |
| Create an encoded Get Stream Request message for the AWS IoT OTA service. The service allows block count or block bitmap to be requested, but not both.
|
|
CBOR encode/decode routines for AWS IoT Over-the-Air updates.
◆ checkDataType()
static CborError checkDataType |
( |
CborType |
expectedType, |
|
|
const CborValue * |
cborValue |
|
) |
| |
|
static |
Helper function to verify the data type of the value in map.
- Parameters
-
[in] | expectedType | Data type expected. |
[in] | cborValue | Value to check. |
- Returns
- CborError
◆ OTA_CBOR_Decode_GetStreamResponseMessage()
bool OTA_CBOR_Decode_GetStreamResponseMessage |
( |
const uint8_t * |
pMessageBuffer, |
|
|
size_t |
messageSize, |
|
|
int32_t * |
pFileId, |
|
|
int32_t * |
pBlockId, |
|
|
int32_t * |
pBlockSize, |
|
|
uint8_t *const * |
pPayload, |
|
|
size_t * |
pPayloadSize |
|
) |
| |
Decode a Get Stream response message from AWS IoT OTA.
- Parameters
-
[in] | pMessageBuffer | message to decode. |
[in] | messageSize | size of the message to decode. |
[out] | pFileId | Decoded file id value. |
[out] | pBlockId | Decoded block id value. |
[out] | pBlockSize | Decoded block size value. |
[out] | pPayload | Buffer for the decoded payload. |
[in,out] | pPayloadSize | maximum size of the buffer as in and actual payload size for the decoded payload as out. |
- Returns
- TRUE when success, otherwise FALSE.
◆ OTA_CBOR_Encode_GetStreamRequestMessage()
bool OTA_CBOR_Encode_GetStreamRequestMessage |
( |
uint8_t * |
pMessageBuffer, |
|
|
size_t |
messageBufferSize, |
|
|
size_t * |
pEncodedMessageSize, |
|
|
const char * |
pClientToken, |
|
|
int32_t |
fileId, |
|
|
int32_t |
blockSize, |
|
|
int32_t |
blockOffset, |
|
|
const uint8_t * |
pBlockBitmap, |
|
|
size_t |
blockBitmapSize, |
|
|
int32_t |
numOfBlocksRequested |
|
) |
| |
Create an encoded Get Stream Request message for the AWS IoT OTA service. The service allows block count or block bitmap to be requested, but not both.
- Parameters
-
[in,out] | pMessageBuffer | Buffer to store the encoded message. |
[in] | messageBufferSize | Size of the buffer to store the encoded message. |
[out] | pEncodedMessageSize | Size of the final encoded message. |
[in] | pClientToken | Client token in the encoded message. |
[in] | fileId | Value of file id in the encoded message. |
[in] | blockSize | Value of block size in the encoded message. |
[in] | blockOffset | Value of block offset in the encoded message. |
[in] | pBlockBitmap | bitmap in the encoded message. |
[in] | blockBitmapSize | Size of the provided bitmap buffer. |
[in] | numOfBlocksRequested | number of blocks to request in the encoded message. |
- Returns
- TRUE when success, otherwise FALSE.