summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-16 16:12:14 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-16 16:12:14 +0000
commitec95cbf8d430f9616eff050f510268f9901944b6 (patch)
tree0d4c360910b31a2bdfd61f5208e9787ce9fd98ff /src
parentd6d322103eaf1d2d5a1a94a0720a01a692f6a134 (diff)
Change CanMessage_c to can_message_t class name
Change-Id: I58a8d05ef226c22c9218cd3bf4932216e33f0de0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/can-utils.cpp46
-rw-r--r--src/can-utils.h14
-rw-r--r--src/can_decode_message.cpp4
-rw-r--r--src/can_event_push.cpp2
-rw-r--r--src/can_reader.cpp4
-rw-r--r--src/low-can-binding.cpp2
-rw-r--r--src/obd2.cpp4
7 files changed, 38 insertions, 38 deletions
diff --git a/src/can-utils.cpp b/src/can-utils.cpp
index 7dfe2286..fde92f9a 100644
--- a/src/can-utils.cpp
+++ b/src/can-utils.cpp
@@ -23,12 +23,12 @@
*
*********************************************************************************/
-CanBus_t::CanBus_t(afb_binding_interface *itf, const std:string& dev_name)
+can_bus_t::can_bus_t(afb_binding_interface *itf, const std:string& dev_name)
: interface{itf}, deviceName{dev_name}
{
}
-int CanBus_t::open()
+int can_bus_t::open()
{
const int canfd_on = 1;
struct ifreq ifr;
@@ -81,14 +81,14 @@ int CanBus_t::open()
return -1;
}
-int CanBus_t::close()
+int can_bus_t::close()
{
::close(can_socket_);
can_socket_ = -1;
}
-canfd_frame CanBus_t::can_read()
+canfd_frame can_bus_t::can_read()
{
ssize_t nbytes;
int maxdlen;
@@ -124,7 +124,7 @@ canfd_frame CanBus_t::can_read()
return canfd_frame;
}
-void CanBus_t::start_threads()
+void can_bus_t::start_threads()
{
th_reading_ = std::thread(can_reader, interface, socket, can_message_q_);
is_running_ = true;
@@ -136,15 +136,15 @@ void CanBus_t::start_threads()
/*
* Return is_running_ bool
*/
-bool CanBus_t::is_running()
+bool can_bus_t::is_running()
{
return is_running_;
}
/*
- * Send a can message from a CanMessage_c object.
+ * Send a can message from a can_message_t object.
*/
-int CanBus_t::send_can_message(CanMessage_c &can_msg)
+int can_bus_t::send_can_message(can_message_t &can_msg)
{
int nbytes;
canfd_frame *f;
@@ -177,11 +177,11 @@ int CanBus_t::send_can_message(CanMessage_c &can_msg)
*
* Return the next queue element or NULL if queue is empty.
*/
-CanMessage_c* CanBus_t::next_can_message()
+can_message_t* can_bus_t::next_can_message()
{
if(! can_message_q_.empty())
{
- CanMessage_c can_msg = can_message_q_.front();
+ can_message_t can_msg = can_message_q_.front();
can_message_q_.pop()
return &can_msg;
}
@@ -189,7 +189,7 @@ CanMessage_c* CanBus_t::next_can_message()
return nullptr;
}
-void CanBus_t::insert_new_can_message(CanMessage_c &can_msg)
+void can_bus_t::insert_new_can_message(can_message_t &can_msg)
{
can_message_q_.push(can_msg);
}
@@ -200,7 +200,7 @@ void CanBus_t::insert_new_can_message(CanMessage_c &can_msg)
*
* Return the next queue element or NULL if queue is empty.
*/
-openxc_VehicleMessage* CanBus_t::next_vehicle_message()
+openxc_VehicleMessage* can_bus_t::next_vehicle_message()
{
if(! vehicle_message_q_.empty())
{
@@ -212,7 +212,7 @@ openxc_VehicleMessage* CanBus_t::next_vehicle_message()
return nullptr;
}
-void CanBus_t::insert_new_vehicle_message(openxc_VehicleMessage *v_msg)
+void can_bus_t::insert_new_vehicle_message(openxc_VehicleMessage *v_msg)
{
vehicle_message_q_.push(v_msg);
}
@@ -222,26 +222,26 @@ void CanBus_t::insert_new_vehicle_message(openxc_VehicleMessage *v_msg)
*
*********************************************************************************/
-uint32_t CanMessage_c::get_id() const
+uint32_t can_message_t::get_id() const
{
return id;
}
-int CanMessage_c::get_format() const
+int can_message_t::get_format() const
{
return format;
}
-uint8_t CanMessage_c::get_data() const
+uint8_t can_message_t::get_data() const
{
return data;
}
-uint8_t CanMessage_c::get_lenght() const
+uint8_t can_message_t::get_lenght() const
{
return lenght;
}
-void CanMessage_c::set_id(uint32_t new_id)
+void can_message_t::set_id(uint32_t new_id)
{
switch(format):
case CanMessageFormat::SIMPLE:
@@ -252,7 +252,7 @@ void CanMessage_c::set_id(uint32_t new_id)
ERROR(interface, "ERROR: Can set id, not a compatible format or format not set prior to set id.");
}
-void CanMessage_c::set_format(CanMessageFormat new_format)
+void can_message_t::set_format(CanMessageFormat new_format)
{
if(new_format == CanMessageFormat::SIMPLE || new_format == CanMessageFormat::EXTENDED)
format = new_format;
@@ -260,12 +260,12 @@ void CanMessage_c::set_format(CanMessageFormat new_format)
ERROR(interface, "ERROR: Can set format, wrong format chosen");
}
-void CanMessage_c::set_data(uint8_t new_data)
+void can_message_t::set_data(uint8_t new_data)
{
data = new_data;
}
-void CanMessage_c::set_lenght(uint8_t new_length)
+void can_message_t::set_lenght(uint8_t new_length)
{
lenght = new_lenght;
}
@@ -276,7 +276,7 @@ void CanMessage_c::set_lenght(uint8_t new_length)
*
* params: canfd_frame pointer
*/
-void CanMessage_c::convert_from_canfd_frame(canfd_frame *frame)
+void can_message_t::convert_from_canfd_frame(canfd_frame *frame)
{
lenght = (canfd_frame->len > maxdlen) ? maxdlen : canfd_frame->len;
@@ -299,7 +299,7 @@ void CanMessage_c::convert_from_canfd_frame(canfd_frame *frame)
memcpy(data, canfd_frame->data, lenght);
return 0;
} else if (sizeof(canfd_frame->data) >= CAN_MAX_DLEN)
- ERROR(interface, "CanMessage_c: canfd_frame data too long to be stored into CanMessage object");
+ ERROR(interface, "can_message_t: canfd_frame data too long to be stored into CanMessage object");
}
canfd_frame* convert_to_canfd_frame()
diff --git a/src/can-utils.h b/src/can-utils.h
index 3a6070ad..9fd35c65 100644
--- a/src/can-utils.h
+++ b/src/can-utils.h
@@ -85,7 +85,7 @@ typedef uint64_t (*SignalEncoder)(struct CanSignal* signal,
/*
* CanBus represent a can device definition gotten from configuraiton file
*/
-class CanBus_c {
+class can_bus_t {
private:
afb_binding_interface *interface_;
@@ -101,7 +101,7 @@ class CanBus_c {
std::thread th_decoding_;
std::thread th_pushing_;
- std::queue <CanMessage_c> can_message_q_;
+ std::queue <can_message_t> can_message_q_;
std::queue <openxc_VehicleMessage> vehicle_message_q_;
public:
@@ -111,10 +111,10 @@ class CanBus_c {
void start_threads();
bool is_running();
- int send_can_message(CanMessage_c can_msg);
+ int send_can_message(can_message_t can_msg);
- CanMessage_c* next_can_message();
- void insert_new_can_message(CanMessage_c &can_msg);
+ can_message_t* next_can_message();
+ void insert_new_can_message(can_message_t &can_msg);
openxc_VehicleMessage* next_vehicle_message();
void insert_new_vehicle_message(openxc_VehicleMessage *v_msg);
@@ -135,7 +135,7 @@ struct CanMessage {
};
typedef struct CanMessage CanMessage;
*/
-class CanMessage_c {
+class can_message_t {
private:
uint32_t id;
CanMessageFormat format;
@@ -157,7 +157,7 @@ class CanMessage_c {
canfd_frame convert_to_canfd_frame();
};
-QUEUE_DECLARE(CanMessage_c, 8);
+QUEUE_DECLARE(can_message_t, 8);
/* Public: The ID format for a CAN message.
*
diff --git a/src/can_decode_message.cpp b/src/can_decode_message.cpp
index 9870c90e..762a6acc 100644
--- a/src/can_decode_message.cpp
+++ b/src/can_decode_message.cpp
@@ -34,9 +34,9 @@ union DynamicField
std::bool boolean_value;
};
-void can_decode_message(CanBus_c *can_bus)
+void can_decode_message(can_bus_t *can_bus)
{
- CanMessage_c *can_message;
+ can_message_t *can_message;
std:vector <CanSignal> *signals;
std:vector <CanSignal>::iterator signals_i;
openxc_VehicleMessage vehicle_message;
diff --git a/src/can_event_push.cpp b/src/can_event_push.cpp
index ccfe6b19..a59aba75 100644
--- a/src/can_event_push.cpp
+++ b/src/can_event_push.cpp
@@ -26,7 +26,7 @@
#include "openxc.pb.h"
#include "json-c/json.h"
-void can_event_push(CanBus_c *can_bus)
+void can_event_push(can_bus_t *can_bus)
{
openxc_VehicleMessage *v_message;
openxc_SimpleMessage *s_message;
diff --git a/src/can_reader.cpp b/src/can_reader.cpp
index 80889372..aab47b65 100644
--- a/src/can_reader.cpp
+++ b/src/can_reader.cpp
@@ -23,9 +23,9 @@
#include "can-utils.h"
-void can_reader(CanBus_t &can_bus)
+void can_reader(can_bus_t &can_bus)
{
- CanMessage_c can_message;
+ can_message_t can_message;
while(can_bus.is_running())
{
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index 18f5a75e..d5c116f8 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -276,7 +276,7 @@ int afbBindingV1ServiceInit(struct afb_service service)
jo_canbus = json_tokener_parse(&fd_conf_content);
/* Open CAN socket */
- CanBus_c CanBus_handler(interface, json_object_get_string(json_object_object_get(jo_canbus, "deviceName"));
+ can_bus_t CanBus_handler(interface, json_object_get_string(json_object_object_get(jo_canbus, "deviceName"));
CanBus_handler.open();
CanBus_handler.start_threads();
}
diff --git a/src/obd2.cpp b/src/obd2.cpp
index ae2db98a..3563928c 100644
--- a/src/obd2.cpp
+++ b/src/obd2.cpp
@@ -28,9 +28,9 @@ void shims_timer()
/*
* Will scan for supported Obd2 pids
*/
-obd2_handler_c::obd2_handler_c(afb_binding_interface *itf, CanBus_c cb)
+obd2_handler_c::obd2_handler_c(afb_binding_interface *itf, can_bus_t cb)
{
- CanBus_c can_bus = cb;
+ can_bus_t can_bus = cb;
DiagnosticShims shims = diagnostic_init_shims(shims_logger, can_bus.send_can_message, NULL);
int n_pids, i;