Functions for converting JSON types into C types
◆ golioth_payload_as_bool()
bool golioth_payload_as_bool |
( |
const uint8_t * | payload, |
|
|
size_t | payload_size ) |
Convert raw byte payload into a bool
- Parameters
-
payload | Pointer to payload data |
payload_size | Size of payload, in bytes |
- Return values
-
true | payload is exactly the string "true" |
false | otherwise |
◆ golioth_payload_as_float()
float golioth_payload_as_float |
( |
const uint8_t * | payload, |
|
|
size_t | payload_size ) |
Convert raw byte payload into a float
- Parameters
-
payload | Pointer to payload data |
payload_size | Size of payload, in bytes |
- Returns
- float value returned from strtof(payload, NULL)
◆ golioth_payload_as_int()
int32_t golioth_payload_as_int |
( |
const uint8_t * | payload, |
|
|
size_t | payload_size ) |
Convert raw byte payload into an int32_t
- Parameters
-
payload | Pointer to payload data |
payload_size | Size of payload, in bytes |
- Returns
- int32_t value returned from strtol(payload, NULL, 10)
◆ golioth_payload_is_null()
bool golioth_payload_is_null |
( |
const uint8_t * | payload, |
|
|
size_t | payload_size ) |
Returns true if payload has no contents
- Parameters
-
payload | Pointer to payload data |
payload_size | Size of payload, in bytes |
- Return values
-
true | payload is NULL, payload_size is 0 or payload is exactly the string "null" |
false | otherwise |