A modelling and serializer library for Microsoft Azure IoTHub client applications
Dependents: sht15_remote_monitoring f767zi_mqtt remote_monitoring simplesample_amqp ... more
This library implements a serializer library to be used in projects involving Microsoft Azure IoT Hub connectivity. The code is replicated from https://github.com/Azure/azure-iot-sdks
Diff: jsonencoder.c
- Revision:
- 11:b1327861f5e0
- Parent:
- 10:c2aee3965a83
- Child:
- 13:16e88f0cfa5f
--- a/jsonencoder.c Fri Apr 08 13:25:09 2016 -0700 +++ b/jsonencoder.c Sun Apr 24 16:40:59 2016 -0700 @@ -31,13 +31,13 @@ (toStringFunc == NULL)) { result = JSON_ENCODER_INVALID_ARG; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } /*Codes_SRS_JSON_ENCODER_99_035:[ JSON encoder shall inquire the number of child nodes (further called childCount) of the current node (given by parameter treeHandle.]*/ else if (MultiTree_GetChildCount(treeHandle, &childCount) != MULTITREE_OK) { result = JSON_ENCODER_MULTITREE_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { @@ -46,7 +46,7 @@ if (STRING_concat(destination, "{") != 0) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { @@ -59,12 +59,12 @@ (STRING_concat(destination, ", ") != 0)) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else if (STRING_concat(destination, "\"") != 0) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { @@ -72,29 +72,29 @@ if (name == NULL) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { if (MultiTree_GetChild(treeHandle, i, &childTreeHandle) != MULTITREE_OK) { result = JSON_ENCODER_MULTITREE_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else if (MultiTree_GetName(childTreeHandle, name) != MULTITREE_OK) { result = JSON_ENCODER_MULTITREE_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else if (STRING_concat_with_STRING(destination, name) != 0) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else if (STRING_concat(destination, "\":") != 0) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { @@ -102,7 +102,7 @@ if (MultiTree_GetChildCount(childTreeHandle, &innerChildCount) != MULTITREE_OK) { result = JSON_ENCODER_MULTITREE_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { @@ -112,18 +112,18 @@ if (child == NULL) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { if ((result = JSONEncoder_EncodeTree(childTreeHandle, child, toStringFunc)) != JSON_ENCODER_OK) { - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else if (STRING_concat_with_STRING(destination, child)!=0) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } STRING_delete(child); } @@ -134,7 +134,7 @@ if (MultiTree_GetValue(childTreeHandle, &value) != MULTITREE_OK) { result = JSON_ENCODER_MULTITREE_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else @@ -143,19 +143,19 @@ if (childValue == NULL) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { if (toStringFunc(childValue, value) != JSON_ENCODER_TOSTRING_OK) { result = JSON_ENCODER_TOSTRING_FUNCTION_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else if (STRING_concat_with_STRING(destination, childValue)!=0) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { @@ -177,7 +177,7 @@ if (STRING_concat(destination, "}") != 0) { result = JSON_ENCODER_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_RESULT, result)); } else { @@ -203,14 +203,14 @@ (value == NULL)) { result = JSON_ENCODER_TOSTRING_INVALID_ARG; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result)); } /*Codes_SRS_JSON_ENCODER_99_048:[ JSONEncoder_CharPtr_ToString shall use strcpy_s to copy from value to destination.]*/ else if (STRING_concat(destination, (const char*)value) != 0) { /*Codes_SRS_JSON_ENCODER_99_049:[ If strcpy_s fails then JSONEncoder_CharPtr_ToString shall return JSON_ENCODER_TOSTRING_ERROR.]*/ result = JSON_ENCODER_TOSTRING_ERROR; - LogError("(result = %s)\r\n", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result)); + LogError("(result = %s)", ENUM_TO_STRING(JSON_ENCODER_TOSTRING_RESULT, result)); } else {