summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-06-14 15:07:35 +0200
committerLoïc Collignon <loic.collignon@iot.bzh>2018-06-14 15:07:35 +0200
commitf1f15455d62e56135cd5e0131d415bbbc2a78fb6 (patch)
tree77ea666db14bff55e5df97f1eaa3856ec788860d
parent6cc7b3b79beab5d1f0a6a1cd23d565803b3c9b52 (diff)
Fix a bug that duplicate the roles arrayeel_5.1.0eel/5.1.05.1.0eel
Controller call the config twice due to multiple initialisation phase, the code should handle this behaviour to not doing things twice. Also removed an unused section from the config file. Change-Id: Iecf09fe494173b757c3557d838782c50153dbfb4 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
-rw-r--r--ahl-binding/ahl-binding.cpp2
-rw-r--r--conf.d/project/etc/policy-4a-sample1.json30
2 files changed, 2 insertions, 30 deletions
diff --git a/ahl-binding/ahl-binding.cpp b/ahl-binding/ahl-binding.cpp
index 2bf1664..37e6847 100644
--- a/ahl-binding/ahl-binding.cpp
+++ b/ahl-binding/ahl-binding.cpp
@@ -330,6 +330,8 @@ int ahl_binding_t::parse_roles_config(json_object* o)
{
assert(o != nullptr);
assert(json_object_is_type(o, json_type_array));
+
+ if (roles_.size()) return 0; // Roles already added, ignore.
size_t count = json_object_array_length(o);
roles_.reserve(count);
diff --git a/conf.d/project/etc/policy-4a-sample1.json b/conf.d/project/etc/policy-4a-sample1.json
index 8aa7a03..a1aebcd 100644
--- a/conf.d/project/etc/policy-4a-sample1.json
+++ b/conf.d/project/etc/policy-4a-sample1.json
@@ -12,36 +12,6 @@
"onload": [],
"controls": [],
"events": [],
- "ahl-4a": {
- "hals": ["4a-hal-ctxnop-laptop"],
- "roles": [
- {
- "uid": "multimedia",
- "description": "Multimedia content (e.g. tuner, media player, etc.)",
- "priority": 0,
- "stream": "multimedia"
- },
- {
- "uid": "emergency",
- "description": "Safety-relevant or critical alerts/alarms",
- "priority": 100,
- "stream": "emergency",
- "interrupts":[
- {"type": "ramp", "args": { "uid": "ramp-slow", "volume": 30} }
- ]
- },
- {
- "uid": "navigation",
- "name": "navigation",
- "description": "Navigation instructions (GPS, turn directions, etc...)",
- "priority": 25,
- "stream": "navigation",
- "interrupts":[
- {"type": "ramp", "args": { "uid": "ramp-slow", "volume": 30} }
- ]
- }
- ]
- },
"roles":[
{
"uid": "multimedia",