3 package.cpath = "/lib/lua/?.so;" .. package.cpath
9 A demo of ubus publisher binding. Should be run before subscriber.lua
16 local conn = ubus.connect()
18 error("Failed to connect to ubus")
21 local ubus_objects = {
22 ["com.broadcom.gpon_md"] = {
25 conn:reply(req, {message="foo"});
26 print("Call to function 'hello'")
27 for k, v in pairs(msg) do
28 print("key=" .. k .. " value=" .. tostring(v))
30 end, {id = ubus.INT32, msg = ubus.STRING }
36 conn:reply(req, {message="foo"});
37 print("Call to function 'hello'")
38 for k, v in pairs(msg) do
39 print("key=" .. k .. " value=" .. tostring(v))
41 end, {id = ubus.INT32, msg = ubus.STRING }
45 conn:reply(req, {message="foo1"});
46 conn:reply(req, {message="foo2"});
47 print("Call to function 'hello1'")
48 end, {id = ubus.INT32, msg = ubus.STRING }
50 __subscriber_cb = function( subs )
51 print("total subs: ", subs )
57 conn:add( ubus_objects )
58 print("Objects added, starting loop")
69 conn:notify( ubus_objects.test.__ubusobj, "blabla", params )
72 timer = uloop.timer(t)