summaryrefslogtreecommitdiff
path: root/cethcan/light.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2013-03-26 21:26:32 +0100
committerDavid Lamparter <equinox@diac24.net>2013-03-26 21:26:32 +0100
commitd18e85802a7878450d84bb9190cce0e368c55515 (patch)
treeecfa6a7670fa63c07c1be45add44b542bae891a0 /cethcan/light.c
parentac8beb0cb06e8aef35d9cfa134111e5c6ae09935 (diff)
cethcan: long poll
Diffstat (limited to 'cethcan/light.c')
-rw-r--r--cethcan/light.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cethcan/light.c b/cethcan/light.c
index cb3e94f..cd646d8 100644
--- a/cethcan/light.c
+++ b/cethcan/light.c
@@ -23,11 +23,13 @@ static void light_json_handler(void *arg, json_t *json, enum json_subtype type)
json_object_set_new(lobj, "addr", json_integer(l->logical_addr));
json_object_set_new(lobj, "actual", json_integer(l->actual.val));
- json_object_set_new(lobj, "actual_ts", json_integer(l->actual.valid));
+ if (type != JSON_LONGPOLL)
+ json_object_set_new(lobj, "actual_ts", json_integer(l->actual.valid));
json_object_set_new(lobj, "actual_tschg", json_integer(l->actual.change));
json_object_set_new(lobj, "set", json_integer(l->set.val));
- json_object_set_new(lobj, "set_ts", json_integer(l->set.valid));
+ if (type != JSON_LONGPOLL)
+ json_object_set_new(lobj, "set_ts", json_integer(l->set.valid));
json_object_set_new(lobj, "set_tschg", json_integer(l->set.change));
json_object_set_new(json, l->name, lobj);
@@ -59,6 +61,8 @@ static void light_can_handler(void *arg, struct can_message *msg)
v->val = dval;
time(&v->change);
lprintf("%s: set %02x", l->u->name, dval);
+
+ json_bump_longpoll();
}
}