aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d/project/lua.d/signal-composer-daemon-10-event.lua
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-12-13 10:19:36 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 13:10:35 +0100
commit9a2be611dfb8fe4d542a67b204e5c61d96db911b (patch)
treef524d9d5562954bf465be4fc00724093e9d91e50 /conf.d/project/lua.d/signal-composer-daemon-10-event.lua
parent005cb9eed05cd5a6ddfad13e45c6807263408dab (diff)
Fixing afb function call from LUA and cleaning
Change-Id: I36d675ba7c38ce883a021da1a82dfbe8b077a39f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'conf.d/project/lua.d/signal-composer-daemon-10-event.lua')
-rw-r--r--conf.d/project/lua.d/signal-composer-daemon-10-event.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/conf.d/project/lua.d/signal-composer-daemon-10-event.lua b/conf.d/project/lua.d/signal-composer-daemon-10-event.lua
index 474ebe0..7724dec 100644
--- a/conf.d/project/lua.d/signal-composer-daemon-10-event.lua
+++ b/conf.d/project/lua.d/signal-composer-daemon-10-event.lua
@@ -24,11 +24,11 @@ _MyContext={}
-- WARNING: call back are global and should start with '_'
function _Timer_Test_CB (timer, context)
- local evtinfo= AFB:timerget(timer)
+ local evtinfo= AFB:timerget(source, timer)
printf ("[-- _Timer_Test_C --] evtInfo=%s", Dump_Table(evtinfo))
--send an event an event with count as value
- AFB:evtpush (_MyContext["event"], {["label"]= evtinfo["label"], ["count"]=evtinfo["count"], ["info"]=context["info"]})
+ AFB:evtpush (source, _MyContext["event"], {["label"]= evtinfo["label"], ["count"]=evtinfo["count"], ["info"]=context["info"]})
-- note when timerCB return!=0 timer is kill
return 0
@@ -44,7 +44,7 @@ function _Simple_Timer_Test (request, client)
-- if event does not exit create it now.
if (_MyContext["event"] == nil) then
- _MyContext["event"]= AFB:evtmake(client["label"])
+ _MyContext["event"]= AFB:evtmake(source, client["label"])
end
-- if delay not defined default is 5s
@@ -59,16 +59,16 @@ function _Simple_Timer_Test (request, client)
["delay"]=client["delay"],
["count"]=client["count"],
}
- AFB:notice ("Test_Timer myTimer=%s", myTimer)
+ AFB:notice (source, "Test_Timer myTimer=%s", myTimer)
-- subscribe to event
- AFB:subscribe (request, _MyContext["event"])
+ AFB:subscribe (source, request, _MyContext["event"])
-- settimer take a table with delay+count as input (count==0 means infinite)
- AFB:timerset (myTimer, "_Timer_Test_CB", context)
+ AFB:timerset (source, myTimer, "_Timer_Test_CB", context)
-- nothing special to return send back
- AFB:success (request, myTimer)
+ AFB:success (source, request, myTimer)
return 0
end