mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-04-06 11:38:12 +00:00
Merge pull request #1651 from gebart/pr/lwm2m-json-sv-bv
oma-lwm2m: Use sv for string value, bv for boolean
This commit is contained in:
commit
98fcac15cd
@ -639,10 +639,10 @@ write_rd_json_data(const lwm2m_context_t *context,
|
||||
value = lwm2m_object_get_resource_string(resource, context);
|
||||
slen = lwm2m_object_get_resource_strlen(resource, context);
|
||||
if(value != NULL) {
|
||||
PRINTF("%s{\"n\":\"%u\",\"vs\":\"%.*s\"}", s,
|
||||
PRINTF("%s{\"n\":\"%u\",\"sv\":\"%.*s\"}", s,
|
||||
resource->id, slen, value);
|
||||
len = snprintf(&buffer[rdlen], size - rdlen,
|
||||
"%s{\"n\":\"%u\",\"vs\":\"%.*s\"}", s,
|
||||
"%s{\"n\":\"%u\",\"sv\":\"%.*s\"}", s,
|
||||
resource->id, slen, value);
|
||||
}
|
||||
} else if(lwm2m_object_is_resource_int(resource)) {
|
||||
@ -682,10 +682,10 @@ write_rd_json_data(const lwm2m_context_t *context,
|
||||
} else if(lwm2m_object_is_resource_boolean(resource)) {
|
||||
int value;
|
||||
if(lwm2m_object_get_resource_boolean(resource, context, &value)) {
|
||||
PRINTF("%s{\"n\":\"%u\",\"v\":%s}", s, resource->id,
|
||||
PRINTF("%s{\"n\":\"%u\",\"bv\":%s}", s, resource->id,
|
||||
value ? "true" : "false");
|
||||
len = snprintf(&buffer[rdlen], size - rdlen,
|
||||
"%s{\"n\":\"%u\",\"v\":%s}", s, resource->id,
|
||||
"%s{\"n\":\"%u\",\"bv\":%s}", s, resource->id,
|
||||
value ? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user