X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fpsensor_json.c;h=d97a620b30670afa40dcfbb1c1053b60c50fb807;hb=f3b05dae619a7909bd7422b3a82422c9442aa114;hp=898b1f095181681ec4f3151d1b0f9e8f1c743b17;hpb=3615684b941f8a726e0c8aefbeeda4670238ad36;p=psensor.git diff --git a/src/lib/psensor_json.c b/src/lib/psensor_json.c index 898b1f0..d97a620 100644 --- a/src/lib/psensor_json.c +++ b/src/lib/psensor_json.c @@ -1,22 +1,21 @@ /* - Copyright (C) 2010-2011 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 published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - + * 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 + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ #include #include @@ -40,7 +39,7 @@ measure_to_json_object(struct measure *m) 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; @@ -90,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, - 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); @@ -151,6 +150,7 @@ struct psensor *psensor_new_from_json(json_object *o, 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;