7 A demo of ubus publisher binding. Should be run before subscriber.lua
13 local conn = ubus.connect()
15 error("Failed to connect to ubus")
18 local ubus_objects = {
22 conn:reply(req, {message="foo"});
23 print("Call to function 'hello'")
24 for k, v in pairs(msg) do
25 print("key=" .. k .. " value=" .. tostring(v))
27 end, {id = ubus.INT32, msg = ubus.STRING }
31 conn:reply(req, {message="foo1"});
32 conn:reply(req, {message="foo2"});
33 print("Call to function 'hello1'")
34 end, {id = ubus.INT32, msg = ubus.STRING }
36 __subscriber_cb = function( subs )
37 print("total subs: ", subs )
42 conn:add( ubus_objects )
43 print("Objects added, starting loop")
53 conn:notify( ubus_objects.test.__ubusobj, "test.alarm", params )
56 timer = uloop.timer(t)