Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
aws_iot_shadow_json.c File Reference
Shadow client JSON parsing API definitions. More...
Go to the source code of this file.
Functions | |
| IoT_Error_t | aws_iot_shadow_init_json_document (char *pJsonDocument, size_t maxSizeOfJsonDocument) |
| Initialize the JSON document with Shadow expected name/value. | |
| IoT_Error_t | aws_iot_shadow_add_desired (char *pJsonDocument, size_t maxSizeOfJsonDocument, uint8_t count,...) |
| Add the desired section of the JSON document of jsonStruct_t. | |
| IoT_Error_t | aws_iot_shadow_add_reported (char *pJsonDocument, size_t maxSizeOfJsonDocument, uint8_t count,...) |
| Add the reported section of the JSON document of jsonStruct_t. | |
| IoT_Error_t | aws_iot_fill_with_client_token (char *pBufferToBeUpdatedWithClientToken, size_t maxSizeOfJsonDocument) |
| Fill the given buffer with client token for tracking the Repsonse. | |
| IoT_Error_t | aws_iot_finalize_json_document (char *pJsonDocument, size_t maxSizeOfJsonDocument) |
| Finalize the JSON document with Shadow expected client Token. | |
Detailed Description
Shadow client JSON parsing API definitions.
Definition in file aws_iot_shadow_json.c.
Function Documentation
| IoT_Error_t aws_iot_fill_with_client_token | ( | char * | pBufferToBeUpdatedWithClientToken, |
| size_t | maxSizeOfJsonDocument | ||
| ) |
Fill the given buffer with client token for tracking the Repsonse.
This function will add the AWS_IOT_MQTT_CLIENT_ID with a sequence number. Every time this function is used the sequence number gets incremented
- Parameters:
-
pBufferToBeUpdatedWithClientToken buffer to be updated with the client token string maxSizeOfJsonDocument maximum size of the pBufferToBeUpdatedWithClientToken that can be used
- Returns:
- An IoT Error Type defining if the buffer was null or the entire string was not filled up
Definition at line 278 of file aws_iot_shadow_json.c.
| IoT_Error_t aws_iot_finalize_json_document | ( | char * | pJsonDocument, |
| size_t | maxSizeOfJsonDocument | ||
| ) |
Finalize the JSON document with Shadow expected client Token.
This function will automatically increment the client token every time this function is called.
- Note:
- Ensure the size of the Buffer is enough to hold the entire JSON Document. If the finalized section is not invoked then the JSON doucment will not be valid
- Parameters:
-
pJsonDocument The JSON Document filled in this char buffer maxSizeOfJsonDocument maximum size of the pJsonDocument that can be used to fill the JSON document
- Returns:
- An IoT Error Type defining if the buffer was null or the entire string was not filled up
Definition at line 286 of file aws_iot_shadow_json.c.
| IoT_Error_t aws_iot_shadow_add_desired | ( | char * | pJsonDocument, |
| size_t | maxSizeOfJsonDocument, | ||
| uint8_t | count, | ||
| ... | |||
| ) |
Add the desired section of the JSON document of jsonStruct_t.
This is a variadic function and please be careful with the usage. count is the number of jsonStruct_t types that you would like to add in the reported section This function will add "desired":{<all the="" values="" that="" needs="" to="" be="" added>="">}
- Note:
- Ensure the size of the Buffer is enough to hold the reported section + the init section. Always use the same JSON document buffer used in the iot_shadow_init_json_document function. This function will accommodate the size of previous null terminated string, so pass the max size of the buffer
- Parameters:
-
pJsonDocument The JSON Document filled in this char buffer maxSizeOfJsonDocument maximum size of the pJsonDocument that can be used to fill the JSON document count total number of arguments(jsonStruct_t object) passed in the arguments
- Returns:
- An IoT Error Type defining if the buffer was null or the entire string was not filled up
Definition at line 128 of file aws_iot_shadow_json.c.
| IoT_Error_t aws_iot_shadow_add_reported | ( | char * | pJsonDocument, |
| size_t | maxSizeOfJsonDocument, | ||
| uint8_t | count, | ||
| ... | |||
| ) |
Add the reported section of the JSON document of jsonStruct_t.
This is a variadic function and please be careful with the usage. count is the number of jsonStruct_t types that you would like to add in the reported section This function will add "reported":{<all the="" values="" that="" needs="" to="" be="" added>="">}
- Note:
- Ensure the size of the Buffer is enough to hold the reported section + the init section. Always use the same JSON document buffer used in the iot_shadow_init_json_document function. This function will accommodate the size of previous null terminated string, so pass teh max size of the buffer
- Parameters:
-
pJsonDocument The JSON Document filled in this char buffer maxSizeOfJsonDocument maximum size of the pJsonDocument that can be used to fill the JSON document count total number of arguments(jsonStruct_t object) passed in the arguments
- Returns:
- An IoT Error Type defining if the buffer was null or the entire string was not filled up
Definition at line 197 of file aws_iot_shadow_json.c.
| IoT_Error_t aws_iot_shadow_init_json_document | ( | char * | pJsonDocument, |
| size_t | maxSizeOfJsonDocument | ||
| ) |
Initialize the JSON document with Shadow expected name/value.
This Function will fill the JSON Buffer with a null terminated string. Internally it uses snprintf This function should always be used First, followed by iot_shadow_add_reported and/or iot_shadow_add_desired. Always finish the call sequence with iot_finalize_json_document
- Note:
- Ensure the size of the Buffer is enough to hold the entire JSON Document.
- Parameters:
-
pJsonDocument The JSON Document filled in this char buffer maxSizeOfJsonDocument maximum size of the pJsonDocument that can be used to fill the JSON document
- Returns:
- An IoT Error Type defining if the buffer was null or the entire string was not filled up
Definition at line 112 of file aws_iot_shadow_json.c.
Generated on Tue Jul 12 2022 19:02:38 by
1.7.2