/*
- * Copyright (C) 2010-2012 jeanfi@gmail.com
+ * Copyright (C) 2010-2014 jeanfi@gmail.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
json_object_object_add(o,
ATT_MEASURE_VALUE,
- json_object_new_double(m->value.d_num));
+ json_object_new_double(m->value));
json_object_object_add(o, ATT_MEASURE_TIME,
json_object_new_int((m->time).tv_sec));
return o;
mo = json_object_new_object();
json_object_object_add(mo,
ATT_MEASURE_VALUE,
- json_object_new_double(m->value.d_num));
+ json_object_new_double(m->value));
json_object_object_add(mo, ATT_MEASURE_TIME,
json_object_new_int((m->time).tv_sec));
json_object_object_add(obj, ATT_SENSOR_LAST_MEASURE, mo);
struct psensor *s;
char *eid, *url;
- oid = json_object_object_get(o, "id");
- oname = json_object_object_get(o, "name");
- otype = json_object_object_get(o, "type");
+ json_object_object_get_ex(o, "id", &oid);
+ json_object_object_get_ex(o, "name", &oname);
+ json_object_object_get_ex(o, "type", &otype);
eid = url_encode(json_object_get_string(oid));
url = malloc(strlen(sensors_url) + 1 + strlen(eid) + 1);
s = psensor_create(strdup(url),
strdup(json_object_get_string(oname)),
+ NULL,
json_object_get_int(otype) | SENSOR_TYPE_REMOTE,
values_max_length);
s->url = url;