aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-hat.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-07-12 17:40:36 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-07-21 12:02:10 +0200
commit38f9b3de40b1d1d8e9ed5db0fee40bdaa763d577 (patch)
tree65a4357036ae32acefb725d1217c89aea3502c53 /low-can-binding/binding/low-can-hat.cpp
parentbe9884ab7d3c138e0adae6abd5a3a0dc4350a9fd (diff)
Implements new verbs to write on CAN bus
This will open a new BCM socket not dedicated to a subscription use to that mean. Change-Id: Idf353015f731e32d6eb7c7856bd73167c66e790f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding/low-can-hat.cpp')
-rw-r--r--low-can-binding/binding/low-can-hat.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/low-can-binding/binding/low-can-hat.cpp b/low-can-binding/binding/low-can-hat.cpp
index 6709089e..dae3a4af 100644
--- a/low-can-binding/binding/low-can-hat.cpp
+++ b/low-can-binding/binding/low-can-hat.cpp
@@ -32,10 +32,21 @@ extern "C"
{
static int initv2();
+ static constexpr struct afb_auth loa_afb_auth(const unsigned loa)
+ {
+ struct afb_auth a = {};
+ a.type = afb_auth_LOA;
+ a.loa = loa;
+ return a;
+ }
+
+ static const struct afb_auth loa_1 = { loa_afb_auth(1) };
+
static const struct afb_verb_v2 verbs[]=
{
{ .verb= "subscribe", .callback= subscribe, .auth= NULL, .info="Let subscribe to signals", .session= AFB_SESSION_NONE},
{ .verb= "unsubscribe", .callback= unsubscribe, .auth= NULL, .info="Let unsubscribe signals", .session= AFB_SESSION_NONE},
+ { .verb= "swrite", .callback= swrite, .auth= &loa_1, .info="Write a single CAN message on a CAN bus", .session= AFB_SESSION_LOA_1},
{ .verb= NULL, .callback= NULL, .auth= NULL, .info=NULL, .session= 0}
};