aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-03 20:35:21 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-05 16:22:47 +0200
commit1c93ff74e3e7ec828a21e9028b99cd46752ebce8 (patch)
tree06b9ed43e55f70e354673d2e451f22e537e17b99 /conf.d
parente72c4b089a2e6c9f8529f9a4031913b7ca11c8a3 (diff)
Rework loading sources and signals.
Some function that are now included in the controller submodule do not need to be in the composer as well. Also initialize sources and signals in the same way . JSON configuration needs to be updated to fit this changes Change-Id: I2043791e7ee80f8350f33ed15bdf9980c0773b82 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'conf.d')
-rw-r--r--conf.d/cmake/config.cmake3
-rw-r--r--conf.d/project/data/signal-composer-daemon-04-oncall.lua2
-rw-r--r--conf.d/project/etc/control-basic-conf.json (renamed from conf.d/project/etc/control-txc-demo.json)8
-rw-r--r--conf.d/project/etc/control-signal-composer.json9
-rw-r--r--conf.d/project/etc/sig-demoboard.json5
-rw-r--r--conf.d/project/etc/sig-doors.json39
-rw-r--r--conf.d/project/etc/sig-geoloc.json9
-rw-r--r--conf.d/project/etc/sig-txc.json11
-rw-r--r--conf.d/project/etc/sources-txc.json6
-rw-r--r--conf.d/project/etc/sources.json6
10 files changed, 64 insertions, 34 deletions
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
index adc3122..82e252a 100644
--- a/conf.d/cmake/config.cmake
+++ b/conf.d/cmake/config.cmake
@@ -129,9 +129,8 @@ list(APPEND link_libraries afb-helpers)
# CACHE STRING "Compilation flags for RELEASE build type.")
set(CONTROL_SUPPORT_LUA 1)
-add_definitions(-DCONTROL_PLUGIN_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${CMAKE_BINARY_DIR}/package/lib/plugins")
+add_definitions(-DCONTROL_PLUGIN_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins:${CMAKE_BINARY_DIR}/package/lib/plugins:${CMAKE_BINARY_DIR}/package/var")
add_definitions(-DCONTROL_CONFIG_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/etc:${CMAKE_BINARY_DIR}/package/etc")
-add_definitions(-DCONTROL_LUA_PATH="${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/var:${CMAKE_BINARY_DIR}/package/var")
add_definitions(-DCTL_PLUGIN_MAGIC=1286576532)
# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
diff --git a/conf.d/project/data/signal-composer-daemon-04-oncall.lua b/conf.d/project/data/signal-composer-daemon-04-oncall.lua
index 9d31f25..a66d71f 100644
--- a/conf.d/project/data/signal-composer-daemon-04-oncall.lua
+++ b/conf.d/project/data/signal-composer-daemon-04-oncall.lua
@@ -64,7 +64,7 @@ function _Unit_Converter(source, args, event)
print('Converted value is: '.. event['value'] .. args["to"])
- _lua2c['setSignalValueWrap'](source, event)
+ composer:setSignalValueWrap(source, event)
end
-- Display receive arguments and echo them to caller
diff --git a/conf.d/project/etc/control-txc-demo.json b/conf.d/project/etc/control-basic-conf.json
index d44a8fe..dd7255f 100644
--- a/conf.d/project/etc/control-txc-demo.json
+++ b/conf.d/project/etc/control-basic-conf.json
@@ -19,10 +19,10 @@
"basename": "gps"
},
{
- "uid": "builtin",
- "info": "Builtin routine for onReceived or getSignals routines",
- "basename": "builtin",
- "lua2c": "setSignalValueWrap"
+ "uid": "convert",
+ "info": "LUA fonctions used to convert standard unit.",
+ "spath": "/tmp",
+ "file": "unit-conversion.lua"
}
],
"signals": {
diff --git a/conf.d/project/etc/control-signal-composer.json b/conf.d/project/etc/control-signal-composer.json
index da100e1..1ea7198 100644
--- a/conf.d/project/etc/control-signal-composer.json
+++ b/conf.d/project/etc/control-signal-composer.json
@@ -9,15 +9,20 @@
},
"plugins": [
{
+ "uid": "convert",
+ "info": "LUA fonctions used to convert standard unit.",
+ "libs": "unit-conversion.lua"
+ },
+ {
"uid": "gps-callbacks",
"info": "Manage interaction with gps service",
- "basename": "gps"
+ "libs": "gps.ctlso"
}
],
"signals": {
"files": ["sig-txc" ]
},
"sources": {
- "files": "sources"
+ "files": "sources-txc"
}
}
diff --git a/conf.d/project/etc/sig-demoboard.json b/conf.d/project/etc/sig-demoboard.json
index da64a26..2d9493f 100644
--- a/conf.d/project/etc/sig-demoboard.json
+++ b/conf.d/project/etc/sig-demoboard.json
@@ -24,10 +24,7 @@
"event": "low-can/diagnostic_messages.engine.speed",
"retention": 30,
"unit": "rpm",
- "frequency": 1,
- "onReceived": {
- "function": "plugin://defaultOnReceived"
- }
+ "frequency": 1
},
{
"uid": "fuel_level",
diff --git a/conf.d/project/etc/sig-doors.json b/conf.d/project/etc/sig-doors.json
index 98cec4e..35f617e 100644
--- a/conf.d/project/etc/sig-doors.json
+++ b/conf.d/project/etc/sig-doors.json
@@ -5,56 +5,64 @@
"uid": "rear_left_window",
"event": "low-can/messages.windows.rear_left.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
"uid": "rear_left_door",
"event": "low-can/messages.doors.rear_left.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
"uid": "rear_right_window",
"event": "low-can/messages.windows.rear_right.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
"uid": "rear_right_door",
"event": "low-can/messages.doors.rear_right.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
"uid": "front_left_window",
"event": "low-can/messages.windows.front_left.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
"uid": "front_left_door",
"event": "low-can/messages.doors.front_left.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
"uid": "front_right_window",
"event": "low-can/messages.windows.front_right.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
"uid": "front_right_door",
"event": "low-can/messages.doors.front_right.open",
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
@@ -64,7 +72,8 @@
"rear_left_door"
],
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen"
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen"
}
},
{
@@ -74,7 +83,8 @@
"rear_right_window"
],
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen",
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen",
"args": {}
}
},
@@ -85,7 +95,8 @@
"front_left_window"
],
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen",
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen",
"args": {}
}
},
@@ -96,7 +107,8 @@
"front_right_window"
],
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen",
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen",
"args": {}
}
},
@@ -113,7 +125,8 @@
"rear_right_window"
],
"onReceived": {
- "function": "plugin://low-can-callbacks/isOpen",
+ "uri": "plugin://low-can-callbacks",
+ "function": "isOpen",
"args": {
"evtname": "doors.open"
}
diff --git a/conf.d/project/etc/sig-geoloc.json b/conf.d/project/etc/sig-geoloc.json
index 09ec6f3..0922b18 100644
--- a/conf.d/project/etc/sig-geoloc.json
+++ b/conf.d/project/etc/sig-geoloc.json
@@ -7,7 +7,8 @@
"unit": "degree",
"frequency": 1,
"onReceived": {
- "function": "plugin://gps-callbacks/getLatitude"
+ "uri": "plugin://gps-callbacks",
+ "function": "getLatitude"
}
},
{
@@ -16,7 +17,8 @@
"unit": "degree",
"frequency": 1,
"onReceived": {
- "function": "plugin://gps-callbacks/getSignal",
+ "uri": "plugin://gps-callbacks",
+ "function": "getSignal",
"args": {
"what": "longitude"
}
@@ -38,7 +40,8 @@
"unit": "degree",
"frequency": 1,
"onReceived": {
- "function": "lua://_Heading"
+ "uri": "plugin://gps-callbacks",
+ "function": "getHeading"
}
},
{
diff --git a/conf.d/project/etc/sig-txc.json b/conf.d/project/etc/sig-txc.json
index 275eea6..abe8a73 100644
--- a/conf.d/project/etc/sig-txc.json
+++ b/conf.d/project/etc/sig-txc.json
@@ -8,6 +8,14 @@
"unit": "km/h",
"getSignalsArgs": {
"event": "vehicle_speed"
+ },
+ "onReceived": {
+ "uri": "lua://convert/",
+ "function": "_Unit_Converter",
+ "args": {
+ "from": "km/h",
+ "to": "mi/h"
+ }
}
},
{
@@ -96,7 +104,8 @@
"retention": 30,
"unit": "degrees",
"onReceived": {
- "function": "plugin://gps-callbacks/getHeading"
+ "uri": "plugin://gps-callbacks",
+ "function": "getHeading"
}
}
]
diff --git a/conf.d/project/etc/sources-txc.json b/conf.d/project/etc/sources-txc.json
index 4404d60..77bc99b 100644
--- a/conf.d/project/etc/sources-txc.json
+++ b/conf.d/project/etc/sources-txc.json
@@ -6,11 +6,13 @@
"api": "txc",
"info": "Use TXC demo binding as signals provider",
"init": {
- "function": "api://txc/start",
+ "uri": "api://txc",
+ "function": "start",
"args": {"filename": "var/nyc-downtown-crosstown.json"}
},
"getSignals": {
- "function": "api://txc/subscribe"
+ "uri": "api://txc",
+ "function": "subscribe"
}
}
]
diff --git a/conf.d/project/etc/sources.json b/conf.d/project/etc/sources.json
index c01ebd1..35d62a8 100644
--- a/conf.d/project/etc/sources.json
+++ b/conf.d/project/etc/sources.json
@@ -6,7 +6,8 @@
"api": "low-can",
"info": "Low level binding to handle CAN bus communications",
"getSignals": {
- "function": "plugin://low-can-callbacks/subscribeToLow"
+ "uri": "plugin://low-can-callbacks",
+ "function": "subscribeToLow"
}
},
{
@@ -14,7 +15,8 @@
"api": "gps",
"info": "Low level binding which retrieve Satellite positionning values",
"init": {
- "function": "api://gps/subscribe",
+ "uri": "api://gps",
+ "function": "subscribe",
"args": {
"value": "location"
}