diff options
m--------- | afb-utilities | 0 | ||||
-rw-r--r-- | conf.d/project/etc/sig-demoboard.json | 86 | ||||
-rw-r--r-- | conf.d/project/etc/sig-doors.json | 160 | ||||
-rw-r--r-- | conf.d/project/etc/sig-geoloc.json | 338 | ||||
-rw-r--r-- | conf.d/project/etc/sig-sources.json | 67 | ||||
-rw-r--r-- | signal-composer-binding/ctl-lua.h | 12 |
6 files changed, 271 insertions, 392 deletions
diff --git a/afb-utilities b/afb-utilities -Subproject 0ac08beab3581b9b1beecc1cf8debb96ec0c804 +Subproject f352a03a19ebe8a013a96387ec2cd28b98ca069 diff --git a/conf.d/project/etc/sig-demoboard.json b/conf.d/project/etc/sig-demoboard.json index 4b81989..c078d27 100644 --- a/conf.d/project/etc/sig-demoboard.json +++ b/conf.d/project/etc/sig-demoboard.json @@ -1,58 +1,36 @@ { - "resources": [{ - "name": "/car/demoboard/", - "values": [{ - "name": "vehicleSpeed", - "additionnals_infos": { - "unit": "km/h", - "interval": 1000 - }, - "source": "CAN bus", - "class": "raw", - "type": "double", - "source_args": { - "event": "diagnostic_messages.vehicle.speed", - "filter": { - "frequency": "100", - "min": 10 + "signals": [ + { + "label": "low-can/messages.vehicle.speed", + "class": "temporal", + "unit": "km/h", + "frequency": 1, + "actions": { + "label": "Unit converter", + "lua": "_Unit_Converter", + "args": { + "from": "km/h", + "to": "mi/h" } } - }, { - "name": "engineSpeed", - "additionnals_infos": { - "unit": "rpm", - "interval": 1000 - }, - "source":"CAN bus", - "class": "raw", - "type": "double", - "source_args": { - "event": "diagnostic_messages.engine.speed" - } - }, { - "name": "fuelLevel", - "additionnals_infos": { - "unit": "litre", - "interval": 1000 - }, - "class":"raw", - "source":"CAN bus", - "type": "double", - "source_args": { - "event": "diagnostic_messages.fuel.level" - } - }, { - "name": "engineLoad", - "additionnals_infos": { - "unit": "Nm", - "interval": 1000 - }, - "source":"CAN bus", - "type":"double", - "class":"raw", - "source_args": { - "event": "diagnostic_messages.engine.load" - } - }] - }] + }, + { + "name": "low-can/diagnostic_messages.engine.speed", + "class": "temporal", + "unit": "rpm", + "frequency": 1 + }, + { + "name": "low-can/diagnostic_messages.fuel.level", + "class":"temporal", + "unit": "litre", + "frequency": 1 + }, + { + "name": "low-can/diagnostic_messages.engine.load", + "class":"temporal", + "unit": "Nm", + "interval": 1 + } + ] } diff --git a/conf.d/project/etc/sig-doors.json b/conf.d/project/etc/sig-doors.json index 46d37cc..05b7e54 100644 --- a/conf.d/project/etc/sig-doors.json +++ b/conf.d/project/etc/sig-doors.json @@ -1,85 +1,129 @@ { "signals": [ { - "label": "low-can/messages.windows.front_left.open", - "actions": { - "label": "Door open event action", - "lua": "_Door_opened", + "id": "rear_left_windows", + "source": "low-can/messages.windows.rear_left.open", + "class": "state", + "onReceived": { + "function": "_Door_opened", "args": { - "evtname": "messages.windows.front_left.open" + "evtname": "messages.windows.rear_left.open" } } }, { - "label": "low-can/messages.windows.front_right.open", - "actions": { - "label": "Door open event action", - "lua": "_Door_opened", + "id": "rear_left_door", + "source": "low-can/messages.doors.rear_left.open", + "class": "state", + "onReceived": { + "function": "_Door_opened", + "args": { + "evtname": "messages.doors.rear_left.open" + } + } + }, + { + "id": "rear_left", + "source": [ + "rear_left_windows", + "rear_left_doors" + ], + "class": "state", + "onReceived": { + "function": "_Door_opened", + "args": { + "ojoi": "pok" + } + } + }, + { + "id": "front_right_window", + "source": "low-can/messages.windows.front_right.open", + "class": "state", + "onReceived": { + "function": "_Door_opened", "args": { "evtname": "messages.windows.front_right.open" } } }, { - "label": "low-can/messages.windows.rear_left.open", - "actions": { - "label": "Door open event action", - "lua": "_Door_opened", + "id": "rear_right_door", + "source": "low-can/messages.doors.rear_right.open", + "class": "state", + "onReceived": { + "function": "_Door_opened", "args": { - "evtname": "messages.windows.rear_left.open" + "evtname": "messages.doors.rear_right.open" } } }, { - "label": "low-can/messages.windows.rear_right.open", - "actions": { - "label": "Door open event action", - "lua": "_Door_opened", + "id": "rear_right_window", + "source": "low-can/messages.windows.rear_right.open", + "class": "state", + "onReceived": { + "function": "_Door_opened", "args": { "evtname": "messages.windows.rear_right.open" } } - }], - "virtual_signals": [ - { - "label": "sig-orc/doors.open", - "depends_on": [ - "front_left_doors", - "front_left_windows", - "front_right_doors", - "front_right_windows", - "rear_left_doors", - "rear_left_windows", - "rear_right_doors", - "rear_right_windows" - ], - "actions": { - "label": "A door is open", - "lua": "_Door_opened", - "args": { - "evtname": "doors.open" + }, + { + "id": "rear_right", + "source": [ + "rear_right_doors", + "rear_right_windows" + ], + "class": "state", + "onReceived": { + "function": "_Complete_Door", + "args": {} } - } - }, - { - "label": "sig-orc/doors.average", - "depends_on": [ - "front_left_doors", - "front_left_windows", - "front_right_doors", - "front_right_windows", - "rear_left_doors", - "rear_left_windows", - "rear_right_doors", - "rear_right_windows" - ], - "actions": { - "label": "A door is open", - "lua": "_Door_average", - "args": { - "evtname": "door.average", - "time": 120 + }, + { + "id": "front_left", + "source": [ + "front_left_door", + "front_left_windows" + ], + "class": "state", + "onReceived": { + "function": "_Complete_Door", + "args": {} + } + }, + { + "id": "front_right", + "source": [ + "front_right_doors", + "front_right_windows" + ], + "class": "state", + "onReceived": { + "function": "_Complete_Door", + "args": {} + } + }, + { + "id": "all_doors", + "source": [ + "front_left_doors", + "front_left_windows", + "front_right_doors", + "front_right_windows", + "rear_left_doors", + "rear_left_windows", + "rear_right_doors", + "rear_right_windows" + ], + "class": "state", + "onReceived": { + "function": "_Door_opened", + "args": { + "evtname": "doors.open" + } } } - }] + ] }
\ No newline at end of file diff --git a/conf.d/project/etc/sig-geoloc.json b/conf.d/project/etc/sig-geoloc.json index 6db766d..7fc4d29 100644 --- a/conf.d/project/etc/sig-geoloc.json +++ b/conf.d/project/etc/sig-geoloc.json @@ -1,294 +1,136 @@ { - "resources": [{ - "group": "/car/geoloc/", - "values": [{ - "name": "latitude", - "additionnals_infos": { - "unit": "degree", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" - } + "signals": [ + { + "label": "gps/latitude", + "class": "state", + "unit": "degree", + "frequency": 1 }, { - "name": "longitude", - "additionnals_infos": { - "unit": "degree", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" - } + "label": "gps/longitude", + "class": "state", + "unit": "degree", + "frequency": 1 }, { - "name": "altitude", - "additionnals_infos": { - "unit": "meter", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" - } + "label": "gps/altitude", + "class": "state", + "unit": "meter", + "frequency": 1 }, { - "name": "heading", - "additionnals_infos": { - "unit": "degree", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" + "label": "heading", + "class": "state", + "unit": "degree", + "frequency": 1, + "dependsOn": [ + "gps/latitude", + "gps/longitude" + ], + "actions": { + "label": "Heading calculation", + "lua": "_Heading", + "args": {} } }, { - "name": "speed", - "additionnals_infos": { - "unit": "m/s", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" - } + "label": "gps/speed", + "class": "temporal", + "unit": "m/s", + "frequency": 1 }, { - "name": "climb", - "additionnals_infos": { - "unit": "degree", - "interval": 1000 - }, - "source": "Sensors", - "class": "raw", - "type": "double", - "source_args": { - "sensor": "gyro" - } + "label": "mraa/climb", + "class": "state", + "unit": "degree", + "frequency": 1 }, { - "name": "roll_rate", - "additionnals_infos": { - "unit": "degree/s", - "interval": 1000 - }, - "source": "Sensors", - "class": "raw", - "type": "double", - "source_args": { - "sensor": "roll_rate" - } + "label": "mraa/roll_rate", + "class": "state", + "unit": "degree/s", + "frequency": 1 }, { - "name": "roll_rate", - "additionnals_infos": { - "unit": "degree/s", - "interval": 1000 - }, - "source": "Sensors", - "class": "raw", - "type": "double", - "source_args": { - "sensor": "pitch_rate" - } + "label": "mraa/roll_rate", + "class": "state", + "unit": "degree/s", + "frequency": 1 }, { - "name": "roll_rate", - "additionnals_infos": { - "unit": "degree/s", - "interval": 1000 - }, - "source": "Sensors", - "class": "raw", - "type": "double", - "source_args": { - "sensor": "yaw_rate" - } + "label": "mraa/roll_rate", + "class": "state", + "unit": "degree/s", + "frequency": 1 }, { - "name": "pdop", - "additionnals_infos": { - "interval": 1000 - }, "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" - } + "label": "gps/pdop", + "frequency": 1 }, { - "name": "hdop", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" - } + "label": "gps/hdop", + "frequency": 1 }, { - "name": "vdop", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "location" - } + "label": "gps/vdop", + "frequency": 1 }, { - "name": "used_satellites", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "uint8", - "source_args": { - "value": "configuration" - } + "label": "gps/used_satellites", + "frequency": 1 }, { - "name": "tracked_satellites", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "uint8", - "source_args": { - "value": "configuration" - } + "label": "gps/tracked_satellites", + "frequency": 1 }, { - "name": "visible_satellites", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "uint8", - "source_args": { - "value": "configuration" - } + "label": "gps/visible_satellites", + "frequency": 1 }, { - "name": "sigma_hposition", - "additionnals_infos": { - "unit": "meter", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "configuration" - } + "label": "gps/sigma_hposition", + "class": "state", + "unit": "meter", + "frequency": 1 }, { - "name": "sigma_altitude", - "additionnals_infos": { - "unit": "meter", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "configuration" - } + "label": "gps/sigma_altitude", + "class": "state", + "unit": "meter", + "frequency": 1 }, { - "name": "sigma_heading", - "additionnals_infos": { - "unit": "degree", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "configuration" - } + "label": "gps/sigma_heading", + "class": "state", + "unit": "degree", + "frequency": 1 }, { - "name": "sigma_speed", - "additionnals_infos": { - "unit": "m/s", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "configuration" - } + "label": "gps/sigma_speed", + "class": "temporal", + "unit": "m/s", + "frequency": 1 }, { - "name": "sigma_climb", - "additionnals_infos": { - "unit": "degree", - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "double", - "source_args": { - "value": "configuration" - } + "label": "gps/sigma_climb", + "class": "state", + "unit": "degree", + "frequency": 1 }, { - "name": "gnss_fix_status", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "uint16", - "source_args": { - "value": "configuration" - } + "label": "gps/gnss_fix_status", + "class": "state", + "frequency": 1 }, { - "name": "dr_status", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "boolean", - "source_args": { - "value": "configuration" - } + "label": "gps/dr_status", + "class": "state", + "frequency": 1 }, { - "name": "reliabilty_index", - "additionnals_infos": { - "interval": 1000 - }, - "source": "GNSS/GPS", - "class": "raw", - "type": "uint8_t", - "source_args": { - "value": "configuration" - } - }] - }] -} + "label": "gps/reliabilty_index", + "class": "temporal", + "frequency": 1 + } + ] +}
\ No newline at end of file diff --git a/conf.d/project/etc/sig-sources.json b/conf.d/project/etc/sig-sources.json index 076139f..95de2fa 100644 --- a/conf.d/project/etc/sig-sources.json +++ b/conf.d/project/etc/sig-sources.json @@ -6,39 +6,54 @@ "name": "afb-signal-composer", "version": "1.0" }, - "onload": [{ - "label": "onload-signal-composer", - "info": "onload initialisation config", - "require": [ - { - "label": "CAN bus", - "api": "low-can", - "info": "Low level binding to handle CAN bus communications", - "callback": "c function to subscribe on signals", - "lua": "or a lua function to subscribe on signals", + "sources": [ + { + "api": "low-can", + "info": "Low level binding to handle CAN bus communications", + "init": { + "function": "c/lua (depend on name) function to initialize binding", "args": { "arg": "first argument" } }, - { - "label": "GNSS/GPS", - "api": "gps", - "info": "Low level binding which retrieve Satellite positionning values", - "callback": "c function to subscribe on signals", - "lua": "or a lua function to subscribe on signals", + "get_signal": { + "function": "c/lua (depend on name) function to get signals", "args": { - "value" : "arg" + "arg": "first argument" + } + } + }, + { + "api": "gps", + "info": "Low level binding which retrieve Satellite positionning values", + "init": { + "function": "c/lua (depend on name) function to initialize binding", + "args": { + "arg": "first argument" + } + }, + "get_signal": { + "function": "c/lua (depend on name) function to get signals", + "args": { + "arg": "first argument" + } + } + }, + { + "api": "mraa", + "info": "Low level binding which retrieve different values from several sensors like gyroscope, accelerometer, etc", + "init": { + "function": "c/lua (depend on name) function to initialize binding", + "args": { + "arg": "first argument" } }, - { - "label": "Sensors", - "api": "mraa", - "info": "Low level binding which retrieve different values from several sensors like gyroscope, accelerometer, etc", - "callback": "c function to subscribe on signals", - "lua": "or a lua function to subscribe on signals", + "get_signal": { + "function": "c/lua (depend on name) function to get signals", "args": { - "sensor" : "eg" + "arg": "first argument" } - }] - }] + } + } + ] } diff --git a/signal-composer-binding/ctl-lua.h b/signal-composer-binding/ctl-lua.h index b5b1414..df2379f 100644 --- a/signal-composer-binding/ctl-lua.h +++ b/signal-composer-binding/ctl-lua.h @@ -1,11 +1,11 @@ #ifdef SUSE_LUA_INCDIR -#include <lua5.3/lua.h> -#include <lua5.3/lauxlib.h> -#include <lua5.3/lualib.h> + #include <lua5.3/lua.h> + #include <lua5.3/lauxlib.h> + #include <lua5.3/lualib.h> #else -#include <lua.h> -#include <lauxlib.h> -#include <lualib.h> + #include <lua.h> + #include <lauxlib.h> + #include <lualib.h> #endif #include <json-c/json.h> |