modbusd
modbus master daemon
|
cJSON helper functions header More...
#include "json/cJSON.h"
Go to the source code of this file.
Functions | |
char * | json_get_char (cJSON *inJson, const char *key) |
Get char string via key from cJSON object. More... | |
int | json_get_int (cJSON *inJson, const char *key) |
Get integer value via key from cJSON object. More... | |
void | json_set_int (cJSON *inJson, const char *key, int value) |
Set integer value via key to existed cJSON object. More... | |
double | json_get_double (cJSON *inJson, const char *key) |
Get double integer value via key from cJSON object. More... | |
void | json_set_double (cJSON *inJson, const char *key, double value) |
Set double integer value via key to existed cJSON object. More... | |
long | json_get_long (cJSON *inJson, const char *key) |
Get long integer value via key from cJSON object. More... | |
int | file_to_json (const char *fname, cJSON **outJson) |
Load JSON file to cJSON object. More... | |
int | json_to_file (const char *fname, cJSON *inJson) |
Save cJSON object to JSON file. More... | |
cJSON helper functions header
int file_to_json | ( | const char * | fname, |
cJSON ** | outJson | ||
) |
Load JSON file to cJSON object.
fname | File name string. |
outJson | Pointer to cJSON output object. |
References cJSON_Parse().
char* json_get_char | ( | cJSON * | inJson, |
const char * | key | ||
) |
Get char string via key from cJSON object.
inJson | cJSON object. |
key | Json key. |
References cJSON_GetObjectItem(), and cJSON::valuestring.
Referenced by main(), mbtcp_cmd_hanlder(), mbtcp_multi_write_req_fn(), mbtcp_read_bit_req_fn(), mbtcp_read_reg_req_fn(), and mbtcp_single_write_req_fn().
double json_get_double | ( | cJSON * | inJson, |
const char * | key | ||
) |
Get double integer value via key from cJSON object.
inJson | cJSON object. |
key | Json key. |
References cJSON_GetObjectItem(), and cJSON::valuedouble.
int json_get_int | ( | cJSON * | inJson, |
const char * | key | ||
) |
Get integer value via key from cJSON object.
inJson | cJSON object. |
key | Json key. |
References cJSON_GetObjectItem(), and cJSON::valueint.
Referenced by main(), mbtcp_cmd_hanlder(), mbtcp_multi_write_req_fn(), mbtcp_read_bit_req_fn(), mbtcp_read_reg_req_fn(), and mbtcp_single_write_req_fn().
long json_get_long | ( | cJSON * | inJson, |
const char * | key | ||
) |
Get long integer value via key from cJSON object.
inJson | cJSON object. |
key | Json key. |
References cJSON_GetObjectItem(), and cJSON::valuedouble.
Referenced by main().
void json_set_double | ( | cJSON * | inJson, |
const char * | key, | ||
double | value | ||
) |
Set double integer value via key to existed cJSON object.
inJson | cJSON object. |
key | Json key. |
double | Double integer value. |
References cJSON_GetObjectItem(), and cJSON::valuedouble.
void json_set_int | ( | cJSON * | inJson, |
const char * | key, | ||
int | value | ||
) |
Set integer value via key to existed cJSON object.
inJson | cJSON object. |
key | Json key. |
value | Integer value. |
References cJSON_GetObjectItem(), and cJSON::valueint.
int json_to_file | ( | const char * | fname, |
cJSON * | inJson | ||
) |
Save cJSON object to JSON file.
fname | File name string. |
inJson | cJSON input object. |
References cJSON_Print().