summaryrefslogtreecommitdiffstats
path: root/low-can-binding
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-11-20 13:02:24 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 15:55:03 +0100
commit779da0a54b29db5dd4c12387970026a264d2e6cb (patch)
treef15bc290e899682a0e2abfd2d7559b3d2cd499e1 /low-can-binding
parent5b9913d4d7fcf273380b2aeb780cf0a42cc99725 (diff)
message: More explicit define about CAN protocols.
Change a bit CAN binding define about used protocol. There was a mistake about BCM define which isn't a protocol at all but a maner to filter and retrieve CAN message through SocketCAN. Also FD_FRAME was using the same name than SocketCAN which isn't a good idea, better to distinguis both of them. Bug-AGL: SPEC-2988 Change-Id: I255fa03029c7d5f90a33448e5e7692d8c249279b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding')
-rw-r--r--low-can-binding/binding/low-can-cb.cpp12
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp6
-rw-r--r--low-can-binding/can/message-definition.cpp4
-rw-r--r--low-can-binding/can/message/message.hpp4
4 files changed, 13 insertions, 13 deletions
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index 0445de3e..14e1f87e 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -526,7 +526,7 @@ static int send_message(message_t *message, const std::string& bus_name, uint32_
cd[bus_name]->set_signal(signal);
- if(flags&BCM_PROTOCOL)
+ if(flags&CAN_PROTOCOL)
return low_can_subscription_t::tx_send(*cd[bus_name], message, bus_name);
#ifdef USE_FEATURE_ISOTP
else if(flags&ISOTP_PROTOCOL)
@@ -552,12 +552,12 @@ static void write_raw_frame(afb_req_t request, const std::string& bus_name, mess
if( !sf.signals.empty() )
{
AFB_DEBUG("ID WRITE RAW : %d", sf.signals.front()->get_message()->get_id());
- if(flags & BCM_PROTOCOL)
+ if(flags & CAN_PROTOCOL)
{
if(sf.signals.front()->get_message()->is_fd())
{
AFB_DEBUG("CANFD_MAX_DLEN");
- message->set_flags(CAN_FD_FRAME);
+ message->set_flags(CAN_PROTOCOL_WITH_FD_FRAME);
message->set_maxdlen(CANFD_MAX_DLEN);
}
else
@@ -591,7 +591,7 @@ static void write_raw_frame(afb_req_t request, const std::string& bus_name, mess
}
else
{
- if(flags&BCM_PROTOCOL)
+ if(flags&CAN_PROTOCOL)
afb_req_fail(request, "Invalid", "Frame BCM");
else if(flags&J1939_PROTOCOL)
afb_req_fail(request, "Invalid", "Frame J1939");
@@ -631,7 +631,7 @@ static void write_frame(afb_req_t request, const std::string& bus_name, json_obj
"can_data", &can_data))
{
message = new can_message_t(0, id, length, false, 0, data, 0);
- write_raw_frame(request, bus_name, message, can_data, BCM_PROTOCOL, event_filter);
+ write_raw_frame(request, bus_name, message, can_data, CAN_PROTOCOL, event_filter);
}
#ifdef USE_FEATURE_J1939
else if(!wrap_json_unpack(json_value, "{si, si, so !}",
@@ -688,7 +688,7 @@ static void write_signal(afb_req_t request, const std::string& name, json_object
else if(sig->get_message()->is_isotp())
flags = ISOTP_PROTOCOL;
else
- flags = BCM_PROTOCOL;
+ flags = CAN_PROTOCOL;
// cfd = encoder_t::build_frame(sig, value);
message_t *message = encoder_t::build_message(sig, value, false, false);
diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp
index c3a0b3fa..05367b79 100644
--- a/low-can-binding/binding/low-can-subscription.cpp
+++ b/low-can-binding/binding/low-can-subscription.cpp
@@ -364,7 +364,7 @@ int low_can_subscription_t::open_socket(low_can_subscription_t &subscription, co
int ret = -1;
if(! subscription.socket_)
{
- if(flags & BCM_PROTOCOL)
+ if(flags & CAN_PROTOCOL)
{
subscription.socket_ = std::make_shared<utils::socketcan_bcm_t>();
if( subscription.signal_ )
@@ -666,7 +666,7 @@ int low_can_subscription_t::create_rx_filter(std::shared_ptr<diagnostic_message_
int low_can_subscription_t::create_rx_filter_bcm(low_can_subscription_t &subscription, struct bcm_msg& bcm_msg)
{
// Make sure that socket is opened.
- if(subscription.open_socket(subscription, "", BCM_PROTOCOL) < 0)
+ if(subscription.open_socket(subscription, "", CAN_PROTOCOL) < 0)
return -1;
// If it's not an OBD2 CAN ID then just add a simple RX_SETUP job
@@ -709,7 +709,7 @@ int low_can_subscription_t::tx_send(low_can_subscription_t &subscription, messag
std::vector<canfd_frame> cfd_vect = cm->convert_to_canfd_frame_vector();
- if(subscription.open_socket(subscription, bus_name, BCM_PROTOCOL) < 0)
+ if(subscription.open_socket(subscription, bus_name, CAN_PROTOCOL) < 0)
return -1;
struct bcm_msg &bcm_cm = cm->get_bcm_msg();
diff --git a/low-can-binding/can/message-definition.cpp b/low-can-binding/can/message-definition.cpp
index 80609827..63541277 100644
--- a/low-can-binding/can/message-definition.cpp
+++ b/low-can-binding/can/message-definition.cpp
@@ -79,12 +79,12 @@ uint32_t message_definition_t::get_id() const
bool message_definition_t::is_fd() const
{
- return (flags_&FD_FRAME);
+ return (flags_ & CAN_PROTOCOL_WITH_FD_FRAME);
}
bool message_definition_t::is_j1939() const
{
- return (flags_&J1939_PROTOCOL);
+ return (flags_ & J1939_PROTOCOL);
}
bool message_definition_t::is_isotp() const
diff --git a/low-can-binding/can/message/message.hpp b/low-can-binding/can/message/message.hpp
index 7f13ac47..af34615a 100644
--- a/low-can-binding/can/message/message.hpp
+++ b/low-can-binding/can/message/message.hpp
@@ -37,13 +37,13 @@
*/
#define INVALID_FLAG 0x0001
-#define BCM_PROTOCOL 0x0002
+#define CAN_PROTOCOL 0x0002
#define J1939_PROTOCOL 0x0004
#define J1939_ADDR_CLAIM_PROTOCOL 0x0008
#define ISOTP_PROTOCOL 0x0010
#define ISOTP_SEND 0x0020
#define ISOTP_RECEIVE 0x0040
-#define FD_FRAME 0x0080
+#define CAN_PROTOCOL_WITH_FD_FRAME 0x0080
/// @class message_t
///