summaryrefslogtreecommitdiffstats
path: root/data/onload-control-script.lua
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2017-08-09 18:53:17 +0200
committerfulup <fulup.arfoll@iot.bzh>2017-08-09 18:53:17 +0200
commit302d4bfcc49c69ea8251e1755ba3876555f680aa (patch)
tree67442e1037462e667b368e1ee61e27499d836c04 /data/onload-control-script.lua
parentf817ce67ff6344f181d221c859e1cb2231a3dac4 (diff)
Not Working LUA user_data
Diffstat (limited to 'data/onload-control-script.lua')
-rw-r--r--data/onload-control-script.lua56
1 files changed, 50 insertions, 6 deletions
diff --git a/data/onload-control-script.lua b/data/onload-control-script.lua
index 7ded3be..ac316cd 100644
--- a/data/onload-control-script.lua
+++ b/data/onload-control-script.lua
@@ -23,14 +23,59 @@ count=0
-- Adjust Volume function of vehicle speed
function Adjust_Volume_Speed (speed_meters_second)
- message= string.format("**** Adjust_Volume_Speed speed=%d count=%d", speed_meters_second, count);
- print (message);
+ AFB:notice("In Adjust_Volume_Speed")
+
+ print (string.format("***** Adjust_Volume_Speed speed=%d count=%d", speed_meters_second, count));
-- compute volume
volume = speed_meters_second * 2
count=count+1
- return true, volume, count
+ AFB:success (1234, volume, count, 5678)
+end
+
+
+function Test_Binder_CB (result, context)
+
+ local myTable= { ["arg1"] = "myString", ["arg2"] = 1234, ["arg4"] = true, ["arg5"] = 3.1416 }
+
+ AFB:notice ("In Test_Binder_CB", result, context)
+
+ AFB:success (1234, "ABCD", myTable, 5678)
+
+end
+
+function Test_Binder_Call_Async ()
+
+ local query= {
+ ["arg1"] = "myString",
+ ["arg2"] = 1234,
+ ["arg4"] = true,
+ ["arg5"] = 3.1416,
+ }
+
+ AFB:service("alsacore","ping", query, Test_Binder_CB, "myContext")
+
+end
+
+function Test_Binder_Call_Sync ()
+
+ local query= {
+ ["arg1"] = "myString",
+ ["arg2"] = 1234,
+ ["arg4"] = true,
+ ["arg5"] = 3.1416,
+ }
+
+ err= AFB:service_sync ("alsacore","ping", query)
+
+ if (err) then
+ AFB:fail ("AFB:service_call_sync fail");
+ else
+ AFB:success (1234, "ABCD", myTable)
+ end
+
+
end
function Ping_Test(...)
@@ -41,10 +86,9 @@ function Ping_Test(...)
do
print(" -- ", tostring(v))
end
-
- -- return two arguments on top of status
- return true, 1234, "ABCD"
+ -- push response to client
+ AFB:success (true, 1234, "ABCD");
end