Imported Upstream version 0.8.0.4
[psensor-pkg-debian.git] / src / lib / psensor_json.c
index 1d4668c..b6feecf 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C) 2010-2012 jeanfi@gmail.com
+ * Copyright (C) 2010-2013 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
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -39,7 +39,7 @@ measure_to_json_object(struct measure *m)
 
        json_object_object_add(o,
                               ATT_MEASURE_VALUE,
 
        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;
        json_object_object_add(o, ATT_MEASURE_TIME,
                               json_object_new_int((m->time).tv_sec));
        return o;
@@ -89,7 +89,7 @@ static json_object *sensor_to_json(struct psensor *s)
        mo = json_object_new_object();
        json_object_object_add(mo,
                               ATT_MEASURE_VALUE,
        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);
        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);
@@ -150,6 +150,7 @@ struct psensor *psensor_new_from_json(json_object *o,
 
        s = psensor_create(strdup(url),
                           strdup(json_object_get_string(oname)),
 
        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;
                           json_object_get_int(otype) | SENSOR_TYPE_REMOTE,
                           values_max_length);
        s->url = url;