HVAC bindings and client application for Application Framework Binder
(Application Framework Binder can be found on https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/app-framework-binder)
Installation
Download and install IoT.bzh docker image and sdk.
1. Follow [this guide](http://iot.bzh/download/public/2016/sdk/AGL-Devkit-Image-and-SDK-for-porter.pdf)
to get your docker ready and running.
2. Check out this repository
git clone https://gerrit.automotivelinux.org/gerrit/src/hvacplugin -c b sandbox/claneys/hvac-bindings
Build project
Get into build directory under hvacplugin repo and build the widget:
- cd hvacplugin/build
- cmake .. && make
It will build the binding with QML Frontend and package all that into a wgt file named : hvac-demo.wgt
Install and test the widget
Installation
Transfer the wgt file on your platform with scp :
$ scp hvac-demo.wgt root@<your_porter_board>:/tmp
than install it using afm-util:
# afm-util install /tmp/hvac-demo.wgt
{ "added": "hvac-demo@0.1" }
Test
You can launch bindings using the afb-daemon, starting them manually like this,
don't forget to change
# /usr/bin/afb-daemon --ldpaths=/usr/lib/afb:/usr/share/afm/applications/hvac-demo/0.1/lib --mode=local --alias=/icons:/usr/share/afm/icons --port=<chosen_port> --rootdir=/usr/share/afm/applications/hvac-demo/0.1 --roothttp=htdocs --token=<chosen_token> --sessiondir=/home/root/app-data/hvac-demo/.afb-daemon &
NOTICE: binding [/usr/lib/afb/afb-dbus-binding.so] calling registering function afbBindingV1Register
NOTICE: binding /usr/lib/afb/afb-dbus-binding.so loaded with API prefix dbus
NOTICE: binding [/usr/lib/afb/authLogin.so] calling registering function afbBindingV1Register
NOTICE: binding /usr/lib/afb/authLogin.so loaded with API prefix auth
NOTICE: binding [/usr/share/afm/applications/hvac-demo/0.1/lib/hvac-demo.so] calling registering function afbBindingV1Register
NOTICE: binding /usr/share/afm/applications/hvac-demo/0.1/lib/hvac-demo.so loaded with API prefix hvac
NOTICE: Waiting port=12357 rootdir=/usr/share/afm/applications/hvac-demo/0.1
NOTICE: Browser URL= http:/*localhost:12357
With bindings launched you can now test them using afb-client-demo as you have
to communicate with bindings using WebSocket protocol. When connection
established you can dialog with binding using api/verbs from application
framework and running bindings. At first, try to authenticate with auth
connect
which will renew token and create a new session context for the running
app.
Then test following verbs using api hvac:
- ping : Ping the binder
- get_temp_left_zone : Get the left zone temperature
- get_temp_right_zone : Get the right zone temperature
- get_fanspeed : Read fan speed
- get : Read all values
- set : Set value(s)
# afb-client-demo ws://localhost:<chosen_port>/api?token=<chosen_token>
hvac get
ON-REPLY 1:hvac/get: {"response":{"LeftTemperature":21,"RightTemperature":21,"FanSpeed":0},"jtype":"afb-reply","request":{"status":"success","uuid":"f6175a3f-f57a-49ae-80f5-d215abd6e24c"}}
hvac get_temp_left_zone
ON-REPLY 2:hvac/get_temp_left_zone: {"response":{"LeftTemperature":21},"jtype":"afb-reply","request":{"status":"success","info":"Left zone Temperature is:21 query=\"null\""}}
hvac set {"FanSpeed":23, "RightTemperature": 55, "LeftTemperature": 54}
ON-REPLY 3:hvac/set: {"response":{"FanSpeed":23,"RightTemperature":55,"LeftTemperature":54},"jtype":"afb-reply","request":{"status":"success","info":"HVAC settings updated"}}
hvac get_all
ON-REPLY 4:hvac/get_all: {"response":{"LeftTemperature":54,"RightTemperature":55,"FanSpeed":23},"jtype":"afb-reply","request":{"status":"success"}}
hvac set {"FanSpeed":23}
ON-REPLY 5:hvac/set: {"response":{"FanSpeed":23},"jtype":"afb-reply","request":{"status":"success","info":"HVAC settings updated"}}
hvac get_all
ON-REPLY 6:hvac/get_all: {"response":{"LeftTemperature":54,"RightTemperature":55,"FanSpeed":23},"jtype":"afb-reply","request":{"status":"success"}}
TODO: QML files aren't modified to fit with bindings for now. They have to be modified to make hybrid application works.