aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-12-05 19:38:14 -0500
committerScott Murray <scott.murray@konsulko.com>2019-12-06 00:49:14 +0000
commit717601ead4c45b05407ff394e1f82622495d269f (patch)
treed581f99da3029ee89cfa50a900120ba7dbcad491
parent5dea708711fb10b3c02f2d8970a9ebe381feb620 (diff)
Add definitions for the steering wheel button CAN signals to provide an abstraction for application usage. Also add signals based on the non-diagnostic vehicle speed, engine speed, and fuel CAN signals to allow abstracting usage of those by e.g. the dashboard application. In addition, SourceAPI::addSignal in source.cpp required a tweak to allow subscribing to signals without specifying an explicit action, i.e. getting the default on receive behavior as documented. Without this change, the signals will silently not be subscribed to, and no events are generated. Since there is no longer an explicit built-in plugin function that could be called in an action to yield the same behavior (it was removed in commit 3e45dda and not restored with the other built-in function by commit bf964e8), I believe this restores the intended default behavior. Bug-AGL: SPEC-3024 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I86e8be66ff27484b34a52145b969661277332a50
-rw-r--r--conf.d/project/etc/control-signal-composer.json2
-rw-r--r--conf.d/project/etc/sig-demoboard.json19
-rw-r--r--conf.d/project/etc/sig-steering-wheel.json77
-rw-r--r--signal-composer-binding/source.cpp2
4 files changed, 98 insertions, 2 deletions
diff --git a/conf.d/project/etc/control-signal-composer.json b/conf.d/project/etc/control-signal-composer.json
index 0ed9fac..58f8435 100644
--- a/conf.d/project/etc/control-signal-composer.json
+++ b/conf.d/project/etc/control-signal-composer.json
@@ -25,7 +25,7 @@
}
],
"signals": {
- "files": ["sig-doors", "sig-demoboard", "sig-geoloc" ]
+ "files": [ "sig-doors", "sig-demoboard", "sig-steering-wheel", "sig-geoloc" ]
},
"sources": {
"files": "sources-basic"
diff --git a/conf.d/project/etc/sig-demoboard.json b/conf.d/project/etc/sig-demoboard.json
index bdd5e4e..bf67144 100644
--- a/conf.d/project/etc/sig-demoboard.json
+++ b/conf.d/project/etc/sig-demoboard.json
@@ -39,6 +39,25 @@
"retention":30,
"unit": "Nm",
"frequency": 1
+ },
+ {
+ "uid": "event.vehicle.speed",
+ "event": "low-can/messages.vehicle.average.speed",
+ "unit": "km/h"
+ },
+ {
+ "uid": "event.engine.speed",
+ "event": "low-can/messages.engine.speed",
+ "unit": "rpm"
+ },
+ {
+ "uid": "event.fuel.level",
+ "event": "low-can/messages.fuel.level",
+ "unit": "liters"
+ },
+ {
+ "uid": "event.fuel.level.low",
+ "event": "low-can/messages.fuel.level.low",
}
]
}
diff --git a/conf.d/project/etc/sig-steering-wheel.json b/conf.d/project/etc/sig-steering-wheel.json
new file mode 100644
index 0000000..6c03f73
--- /dev/null
+++ b/conf.d/project/etc/sig-steering-wheel.json
@@ -0,0 +1,77 @@
+{
+ "$schema": "http://iot.bzh/download/public/schema/json/signal-composer-schema.json",
+ "signals": [
+ {
+ "uid": "event.media.previous",
+ "event": "low-can/messages.steering_wheel.previous"
+ },
+ {
+ "uid": "event.media.next",
+ "event": "low-can/messages.steering_wheel.next"
+ },
+ {
+ "uid": "event.media.mode",
+ "event": "low-can/messages.steering_wheel.mode"
+ },
+ {
+ "uid": "event.volume.up",
+ "event": "low-can/messages.steering_wheel.volume.up"
+ },
+ {
+ "uid": "event.volume.down",
+ "event": "low-can/messages.steering_wheel.volume.down"
+ },
+ {
+ "uid": "event.volume.mute",
+ "event": "low-can/messages.steering_wheel.volume.mute"
+ },
+ {
+ "uid": "event.phone.call",
+ "event": "low-can/messages.steering_wheel.phone.call"
+ },
+ {
+ "uid": "event.phone.hangup",
+ "event": "low-can/messages.steering_wheel.phone.hangup"
+ },
+ {
+ "uid": "event.cruise.enable",
+ "event": "low-can/messages.steering_wheel.cruise.enable"
+ },
+ {
+ "uid": "event.cruise.resume",
+ "event": "low-can/messages.steering_wheel.cruise.resume"
+ },
+ {
+ "uid": "event.cruise.set",
+ "event": "low-can/messages.steering_wheel.cruise.set"
+ },
+ {
+ "uid": "event.cruise.cancel",
+ "event": "low-can/messages.steering_wheel.cruise.cancel"
+ },
+ {
+ "uid": "event.cruise.limit",
+ "event": "low-can/messages.steering_wheel.cruise.limit"
+ },
+ {
+ "uid": "event.cruise.distance",
+ "event": "low-can/messages.steering_wheel.cruise.distance"
+ },
+ {
+ "uid": "event.lane_departure_warning.enable",
+ "event": "low-can/messages.steering_wheel.lane_departure_warning"
+ },
+ {
+ "uid": "event.info",
+ "event": "low-can/messages.steering_wheel.info"
+ },
+ {
+ "uid": "event.voice",
+ "event": "low-can/messages.steering_wheel.voice"
+ },
+ {
+ "uid": "event.horn",
+ "event": "low-can/messages.steering_wheel.horn"
+ }
+ ]
+}
diff --git a/signal-composer-binding/source.cpp b/signal-composer-binding/source.cpp
index 4b21443..f265f40 100644
--- a/signal-composer-binding/source.cpp
+++ b/signal-composer-binding/source.cpp
@@ -147,7 +147,7 @@ void SourceAPI::addSignal(const std::string& id, const std::string& event, std::
{
std::shared_ptr<Signal> sig = std::make_shared<Signal>(id, event, depends, unit, metadata, retention, frequency, onReceived, getSignalsArgs);
- if(onReceived && ! event.empty())
+ if(!event.empty())
afb_api_event_handler_add(afbBindingV3root, event.c_str(), SourceAPI::onSignalEvents, (void*)sig.get());
newSignalsM_[id] = sig;