diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-08-24 12:47:41 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-10-17 10:40:30 +0200 |
commit | 238cabda41dd88a9ac482b3b28886acd0a31ca6c (patch) | |
tree | 49735a1929690725886f142781b31820192fdaf4 | |
parent | 1cd92a82c9efb72785903cf2fe089f1c3e9ef6dd (diff) |
Rename API from high-can to high-viwi
This service is meant to be more generic and expose as
many information from several sources.
Change-Id: I657dedf397ab55e048e435dfd16ce47066820347
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | conf.d/config.cmake | 4 | ||||
-rw-r--r-- | conf.d/wgt/config.xml.in | 2 | ||||
-rw-r--r-- | docs/1-Architecture.md | 2 | ||||
-rw-r--r-- | docs/3-Usage.md | 16 | ||||
-rw-r--r-- | high-can-binding/CMakeLists.txt | 4 | ||||
-rw-r--r-- | high-can-binding/high-can-binding-hat.cpp | 4 | ||||
-rw-r--r-- | high-can-binding/high-can-binding.cpp | 2 | ||||
-rw-r--r-- | high-can-binding/high.cpp | 26 |
9 files changed, 35 insertions, 35 deletions
@@ -13,7 +13,7 @@ mkdir build;cd build; cmake ..; make natively under linux you can launch afb-daemon with the low-level and high-level bindings with a command like: ```bash -afb-daemon --rootdir=<path_to_low_binding>/CAN-binder/build/package --ldpaths=<path_to_low_binding>/CAN-binder/build/package/lib:<path_to_high_binding>/build/high-can-binding --port=1234 --tracereq=common --token=1 --verbose +afb-daemon --rootdir=<path_to_low_binding>/CAN-binder/build/package --ldpaths=<path_to_low_binding>/CAN-binder/build/package/lib:<path_to_high_binding>/build/high-viwi-binding --port=1234 --tracereq=common --token=1 --verbose ``` #json configuration file @@ -96,10 +96,10 @@ For instance: You can use *afb-client-demo* to test high level binding. For instance, once daemon has been launched with the 2 bindings, you can use commands such as: ```bash -high-can subscribe {"name":"/car/doors/","interval":10000} -high-can unsubscribe {"name":"/car/doors/","interval":10000} -high-can get {"name":"/car/demoboard/"} -high-can get {"name":"/car/demoboard/","fields":["fuelLevel","engineLoad"]} +high-viwi subscribe {"name":"/car/doors/","interval":10000} +high-viwi unsubscribe {"name":"/car/doors/","interval":10000} +high-viwi get {"name":"/car/demoboard/"} +high-viwi get {"name":"/car/demoboard/","fields":["fuelLevel","engineLoad"]} ``` You can also inject some data in CAN bus using canplayer (example of data can be find in low-level binding example directory) ```bash diff --git a/conf.d/config.cmake b/conf.d/config.cmake index 3554631..7ed1336 100644 --- a/conf.d/config.cmake +++ b/conf.d/config.cmake @@ -18,7 +18,7 @@ # Project Info # ------------------ -set(PROJECT_NAME high-can-service) +set(PROJECT_NAME high-viwi-service) set(PROJECT_VERSION "4.0") set(PROJECT_PRETTY_NAME "High level CAN service") set(PROJECT_DESCRIPTION "Expose CAN Low Level APIs through AGL Framework") @@ -110,7 +110,7 @@ set(WIDGET_TYPE application/vnd.agl.service) # This is the file that will be executed, loaded, # at launch time by the application framework. # -set(WIDGET_ENTRY_POINT "lib/afb-high-can.so") +set(WIDGET_ENTRY_POINT "lib/afb-high-viwi.so") # Optional dependencies order # --------------------------- diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in index d0ddf03..1ae4795 100644 --- a/conf.d/wgt/config.xml.in +++ b/conf.d/wgt/config.xml.in @@ -12,6 +12,6 @@ </feature> <feature name="urn:AGL:widget:provided-api"> <param name="#target" value="main" /> - <param name="high-can" value="ws" /> + <param name="high-viwi" value="ws" /> </feature> </widget> diff --git a/docs/1-Architecture.md b/docs/1-Architecture.md index d92fea9..d5b5005 100644 --- a/docs/1-Architecture.md +++ b/docs/1-Architecture.md @@ -1,4 +1,4 @@ -# AGL VIWI HIGH-CAN binding architecture +# AGL VIWI HIGH-VIWI binding architecture This binding is intended to act between low-level binding(s) and clients. It builds ViWi resources as defined in a json configuration file. It implements subscribe/unsubscribe/get verbs for the clients accordingly with protocol specification. diff --git a/docs/3-Usage.md b/docs/3-Usage.md index e525a29..3467935 100644 --- a/docs/3-Usage.md +++ b/docs/3-Usage.md @@ -110,7 +110,7 @@ Then you can natively under linux you can launch afb-daemon with the low-level a ```bash $ cd $WD -$ afb-daemon --rootdir=$WD/low-level-can-service/CAN-binder/build/package --binding=$WD/low-level-can-service/CAN-binder/build/package/lib/afb-low-can.so --binding=$WD/high-level-viwi-service/build/package/lib/afb-high-can.so --port=1234 --tracereq=common --token=1 --verbose +$ afb-daemon --rootdir=$WD/low-level-can-service/CAN-binder/build/package --binding=$WD/low-level-can-service/CAN-binder/build/package/lib/afb-low-can.so --binding=$WD/high-level-viwi-service/build/package/lib/afb-high-viwi.so --port=1234 --tracereq=common --token=1 --verbose ``` ### Use afb-client-demo to test high level binding @@ -134,24 +134,24 @@ To use the _**AFB Websocket CLI**_ tool, a command line will be like the followi Where: -* API : _**high-can**_. +* API : _**high-viwi**_. * Verb : _**get**_, _**subscribe**_ or _**unsubscribe**_ * Arguments : _**{ "name": "/car/doors/" }**_ You can therefore use commands such as: ``` -high-can subscribe {"name":"/car/doors/","interval":10000} -high-can unsubscribe {"name":"/car/doors/","interval":10000} -high-can get {"name":"/car/demoboard/"} -high-can get {"name":"/car/demoboard/","fields":["fuelLevel","engineLoad"]} +high-viwi subscribe {"name":"/car/doors/","interval":10000} +high-viwi unsubscribe {"name":"/car/doors/","interval":10000} +high-viwi get {"name":"/car/demoboard/"} +high-viwi get {"name":"/car/demoboard/","fields":["fuelLevel","engineLoad"]} ``` For instance the output of the third command should be: ``` -high-can get {"name":"/car/demoboard/"} -ON-REPLY 1:high-can/get: {"response":{"\/car\/demoboard\/2159e2-5b638a-39e242-7a2f5":{"id":"2159e2-5b638a-39e242-7a2f5","name":"vehicleSpeed","speed":0.000000,"unit":"km\/h","uri":"\/car\/demoboard\/2159e2-5b638a-39e242-7a2f5"},"\/car\/demoboard\/22ad2c-5a3c2b-50fabb-324c82":{"id":"22ad2c-5a3c2b-50fabb-324c82","level":0.000000,"name":"fuelLevel","unit":"litre","uri":"\/car\/demoboard\/22ad2c-5a3c2b-50fabb-324c82"},"\/car\/demoboard\/3a3ab9-2bd52c-11d30-689acf":{"id":"3a3ab9-2bd52c-11d30-689acf","name":"engineSpeed","rpm":0.000000,"unit":"rpm","uri":"\/car\/demoboard\/3a3ab9-2bd52c-11d30-689acf"},"\/car\/demoboard\/5ae808-8093cb-99716-30a605":{"id":"5ae808-8093cb-99716-30a605","load":0.000000,"name":"engineLoad","unit":"Nm","uri":"\/car\/demoboard\/5ae808-8093cb-99716-30a605"}},"jtype":"afb-reply","request":{"status":"success","uuid":"44ce03f9-a7ca-49e1-a62a-40c74db0caa0"}} +high-viwi get {"name":"/car/demoboard/"} +ON-REPLY 1:high-viwi/get: {"response":{"\/car\/demoboard\/2159e2-5b638a-39e242-7a2f5":{"id":"2159e2-5b638a-39e242-7a2f5","name":"vehicleSpeed","speed":0.000000,"unit":"km\/h","uri":"\/car\/demoboard\/2159e2-5b638a-39e242-7a2f5"},"\/car\/demoboard\/22ad2c-5a3c2b-50fabb-324c82":{"id":"22ad2c-5a3c2b-50fabb-324c82","level":0.000000,"name":"fuelLevel","unit":"litre","uri":"\/car\/demoboard\/22ad2c-5a3c2b-50fabb-324c82"},"\/car\/demoboard\/3a3ab9-2bd52c-11d30-689acf":{"id":"3a3ab9-2bd52c-11d30-689acf","name":"engineSpeed","rpm":0.000000,"unit":"rpm","uri":"\/car\/demoboard\/3a3ab9-2bd52c-11d30-689acf"},"\/car\/demoboard\/5ae808-8093cb-99716-30a605":{"id":"5ae808-8093cb-99716-30a605","load":0.000000,"name":"engineLoad","unit":"Nm","uri":"\/car\/demoboard\/5ae808-8093cb-99716-30a605"}},"jtype":"afb-reply","request":{"status":"success","uuid":"44ce03f9-a7ca-49e1-a62a-40c74db0caa0"}} ``` As you can see for the moment all values are 0, because we didn't inject any CAN data in the binder. To do this, you can use **canplayer** to feed the bindings with some data. diff --git a/high-can-binding/CMakeLists.txt b/high-can-binding/CMakeLists.txt index 3eb64c7..f8f1dc3 100644 --- a/high-can-binding/CMakeLists.txt +++ b/high-can-binding/CMakeLists.txt @@ -18,10 +18,10 @@ ########################################################################### # Add target to project dependency list -PROJECT_TARGET_ADD(high-can) +PROJECT_TARGET_ADD(high-viwi) # Define project Targets - add_library(${TARGET_NAME} MODULE ${TARGET_NAME}-binding.cpp high-can-binding-hat.cpp high.cpp) + add_library(${TARGET_NAME} MODULE ${TARGET_NAME}-binding.cpp high-viwi-binding-hat.cpp high.cpp) # Binder exposes a unique public entry point SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES diff --git a/high-can-binding/high-can-binding-hat.cpp b/high-can-binding/high-can-binding-hat.cpp index 4a5e348..6376cf0 100644 --- a/high-can-binding/high-can-binding-hat.cpp +++ b/high-can-binding/high-can-binding-hat.cpp @@ -1,4 +1,4 @@ -#include "high-can-binding-hat.hpp" +#include "high-viwi-binding-hat.hpp" #include <cstddef> /// Interface between the daemon and the binding @@ -13,7 +13,7 @@ static const struct afb_verb_v2 verbs[]= }; const struct afb_binding_v2 afbBindingV2 = { - .api = "high-can", + .api = "high-viwi", .specification = "", .info = "High CAN ViWi API connected to low-can AGL service", .verbs = verbs, diff --git a/high-can-binding/high-can-binding.cpp b/high-can-binding/high-can-binding.cpp index 4891f6c..2ded902 100644 --- a/high-can-binding/high-can-binding.cpp +++ b/high-can-binding/high-can-binding.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "high-can-binding-hat.hpp" +#include "high-viwi-binding-hat.hpp" #include <json-c/json.h> #include "high.hpp" High high; diff --git a/high-can-binding/high.cpp b/high-can-binding/high.cpp index d7314e5..9d6a074 100644 --- a/high-can-binding/high.cpp +++ b/high-can-binding/high.cpp @@ -1,21 +1,21 @@ /** TYPICAL COMMANDS: -high-can start -high-can get {"name":"/car/doors/"} -high-can get {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3"} -high-can get {"name":"/car/doors/","fields":["isDoorOpen"]} -high-can subscribe {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3"} note: fields parameter on subscribe is not implemented yet -high-can unsubscribe {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3"} -high-can subscribe {"name":"/car/doors/"} -high-can subscribe {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3","interval":5000} -high-can subscribe {"name":"/car/doors/","interval":5000} -high-can unsubscribe {"name":"/car/doors/","interval":5000} +high-viwi start +high-viwi get {"name":"/car/doors/"} +high-viwi get {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3"} +high-viwi get {"name":"/car/doors/","fields":["isDoorOpen"]} +high-viwi subscribe {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3"} note: fields parameter on subscribe is not implemented yet +high-viwi unsubscribe {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3"} +high-viwi subscribe {"name":"/car/doors/"} +high-viwi subscribe {"name":"/car/doors/6078d4-23b89b-8faaa9-8bd0f3","interval":5000} +high-viwi subscribe {"name":"/car/doors/","interval":5000} +high-viwi unsubscribe {"name":"/car/doors/","interval":5000} */ #include <json-c/json.h> #include <algorithm> #include "high.hpp" -#include "high-can-binding-hat.hpp" +#include "high-viwi-binding-hat.hpp" #include <time.h> #include <sstream> #include <iterator> @@ -156,9 +156,9 @@ void High::parseConfigAndSubscribe() json_object *dummy; const std::string js = json_object_get_string(jobj); if(afb_service_call_sync("low-can", "subscribe", jobj, &dummy) < 0) - AFB_ERROR("high-can subscription to low-can FAILED %s", js.c_str()); + AFB_ERROR("high-viwi subscription to low-can FAILED %s", js.c_str()); else - AFB_NOTICE("high-can subscribed to low-can %s", js.c_str()); + AFB_NOTICE("high-viwi subscribed to low-can %s", js.c_str()); json_object_put(dummy); } json_object_put(config); |