AWS IoT Device SDK C: Shadow
AWS IoT Device Shadow library
Return to main page ↑
aws_iot_shadow_parser.c File Reference

Implements JSON parsing functions of the Shadow library. More...

#include "iot_config.h"
#include <stdlib.h>
#include <string.h>
#include "private/aws_iot_shadow_internal.h"
#include "aws_iot_doc_parser.h"

Macros

#define ERROR_DOCUMENT_CODE_KEY   "code"
 The JSON key for the error code in a Shadow error document.
 
#define ERROR_DOCUMENT_CODE_KEY_LENGTH   ( sizeof( ERROR_DOCUMENT_CODE_KEY ) - 1 )
 The length of ERROR_DOCUMENT_CODE_KEY.
 
#define ERROR_DOCUMENT_MESSAGE_KEY   "message"
 The JSON key for the error message in a Shadow error document.
 
#define ERROR_DOCUMENT_MESSAGE_KEY_LENGTH   ( sizeof( ERROR_DOCUMENT_MESSAGE_KEY ) - 1 )
 The length of ERROR_DOCUMENT_MESSAGE_KEY.
 

Functions

static AwsIotShadowError_t _codeToShadowStatus (uint32_t code)
 Converts a unsigned long to an AwsIotShadowError_t. More...
 
AwsIotShadowError_t _AwsIotShadow_ParseErrorDocument (const char *pErrorDocument, size_t errorDocumentLength)
 Parse a Shadow error document. More...
 

Detailed Description

Implements JSON parsing functions of the Shadow library.

Function Documentation

◆ _codeToShadowStatus()

static AwsIotShadowError_t _codeToShadowStatus ( uint32_t  code)
static

Converts a unsigned long to an AwsIotShadowError_t.

Parameters
[in]codeA value between 400 and 500 to convert.
Returns
A corresponding AwsIotShadowError_t; AWS_IOT_SHADOW_BAD_RESPONSE if code is unknown.

◆ _AwsIotShadow_ParseErrorDocument()

AwsIotShadowError_t _AwsIotShadow_ParseErrorDocument ( const char *  pErrorDocument,
size_t  errorDocumentLength 
)

Parse a Shadow error document.

Parameters
[in]pErrorDocumentThe error document to parse.
[in]errorDocumentLengthThe length of pErrorDocument.
Returns
One of the AwsIotShadowError_t ranging from 400 to 500 on success. AWS_IOT_SHADOW_BAD_RESPONSE on error.