summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-28 21:29:17 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-28 21:45:49 +0100
commita1a9eedd710c46d533167cf34831cfc867a9bc9d (patch)
treec1528efa118145f8fd83d6c702e6ba5c9c180204 /src
parentca998f6733e3de11886ac6c3ee6525dbaaf3b525 (diff)
Implement a new method returning the can device
map. Change-Id: Ie44bb825269034f9f071bd286c7830a77ba5c479 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/can-bus.cpp5
-rw-r--r--src/can-bus.hpp44
2 files changed, 18 insertions, 31 deletions
diff --git a/src/can-bus.cpp b/src/can-bus.cpp
index e15a3043..355997fc 100644
--- a/src/can-bus.cpp
+++ b/src/can-bus.cpp
@@ -279,6 +279,11 @@ void can_bus_t::push_new_vehicle_message(const openxc_VehicleMessage& v_msg)
has_vehicle_message_ = true;
}
+std::map<std::string, std::shared_ptr<can_bus_dev_t>> can_bus_t::get_can_devices();
+{
+ return can_devices_m_;
+}
+
/********************************************************************************
*
* can_bus_dev_t method implementation
diff --git a/src/can-bus.hpp b/src/can-bus.hpp
index 83b104b6..8d40ff0d 100644
--- a/src/can-bus.hpp
+++ b/src/can-bus.hpp
@@ -183,6 +183,13 @@ class can_bus_t {
* @param the const reference openxc_VehicleMessage object to push into the queue
*/
void push_new_vehicle_message(const openxc_VehicleMessage& v_msg);
+
+ /**
+ * @brief Return a map with the can_bus_dev_t initialized
+ *
+ * @return map can_bus_dev_m_ map
+ */
+ std::map<std::string, std::shared_ptr<can_bus_dev_t>> get_can_bus_devices();
};
@@ -275,13 +282,7 @@ class can_bus_dev_t {
int send_can_message(can_message_t& can_msg);
};
-/**
- * @brief Return an array of the metadata for the 2 CAN buses you want to
- * monitor. The size of this array is fixed at 2.
- */
-can_bus_dev_t getCanBuses();
-
-/**
+/** TODO: implement this function as method into can_bus class
* @fn void pre_initialize(can_bus_dev_t* bus, bool writable, can_bus_dev_t* buses, const int busCount);
* @brief Pre initialize actions made before CAN bus initialization
*
@@ -293,7 +294,7 @@ can_bus_dev_t getCanBuses();
*/
void pre_initialize(can_bus_dev_t* bus, bool writable, can_bus_dev_t* buses, const int busCount);
-/**
+/** TODO: implement this function as method into can_bus class
* @fn void post_initialize(can_bus_dev_t* bus, bool writable, can_bus_dev_t* buses, const int busCount);
* @brief Post-initialize actions made after CAN bus initialization
*
@@ -305,7 +306,7 @@ void pre_initialize(can_bus_dev_t* bus, bool writable, can_bus_dev_t* buses, con
*/
void post_initialize(can_bus_dev_t* bus, bool writable, can_bus_dev_t* buses, const int busCount);
-/**
+/** TODO: implement this function as method into can_bus class
* @fn bool isBusActive(can_bus_dev_t* bus);
* @brief Check if the device is connected to an active CAN bus, i.e. it's
* received a message in the recent past.
@@ -315,31 +316,12 @@ void post_initialize(can_bus_dev_t* bus, bool writable, can_bus_dev_t* buses, co
*/
bool isBusActive(can_bus_dev_t* bus);
-/**
+/** TODO: implement this function as method into can_bus class
+ *
* @fn void logBusStatistics(can_bus_dev_t* buses, const int busCount);
* @brief Log transfer statistics about all active CAN buses to the debug log.
*
* @param[in] buses - an array of active CAN buses.
* @param[in] busCount - the length of the buses array.
*/
-void logBusStatistics(can_bus_dev_t* buses, const int busCount);
-
-/**
- * @fn void can_decode_message(can_bus_t& can_bus);
- *
- * @brief Thread function used to decode can messages read into the can_message_q_
- *
- * @param[in] can_bus_t object used to pop can_message_q_ queue and fill decoded message
- * into vehicle_message_q_ queue.
- */
-void can_decode_message(can_bus_t& can_bus);
-
-/**
- * @fn void can_decode_message(can_bus_t& can_bus);
- *
- * @brief Thread function used to push afb_event
- *
- * @param[in] can_bus_t object used to pop can_message_q_ queue and fill decoded message
- * into vehicle_message_q_ queue.
- */
-void can_event_push(can_bus_t& can_bus); \ No newline at end of file
+void logBusStatistics(can_bus_dev_t* buses, const int busCount); \ No newline at end of file