aboutsummaryrefslogtreecommitdiffstats
path: root/src/can-signals.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-06 18:45:35 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-06 18:47:40 +0100
commitd6c1b80cdbd87df96f3f648d67ccdbba6794f957 (patch)
treefe0b34aeeba161f48bf18903f7be080e418ab7b0 /src/can-signals.cpp
parentd7a294023e442d1e02f1b320326bf759ad49395c (diff)
Sort and comment the code
Change-Id: I1860c0d5fb03ce2217d5553159a090298596d939 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can-signals.cpp')
-rw-r--r--src/can-signals.cpp44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/can-signals.cpp b/src/can-signals.cpp
index bf6b4a4b..07689a01 100644
--- a/src/can-signals.cpp
+++ b/src/can-signals.cpp
@@ -42,56 +42,46 @@ std::vector<std::vector<CanSignal>> SIGNALS = {
},
};
-/**
- * @brief Can signal event map making access to afb_event
- * externaly to an openxc existing structure.
+/**
+ * @fn std::vector<CanSignal>& get_can_signals()
*
- * @desc Event map is making relation between CanSignal generic name
- * and the afb_event struct used by application framework to pushed
- * to the subscriber.
+ * @return A reference to a vector of signals
*/
-std::map<std::string, struct afb_event> subscribed_signals;
-
-/**
-* @brief Mutex allowing safe manipulation on subscribed_signals map.
-* @desc To ensure that the map object isn't modified when we read it, you
-* have to set this mutex before use subscribed_signals map object.
-*/
-std::mutex subscribed_signals_mutex;
-
-std::mutex& get_subscribed_signals_mutex()
-{
- return subscribed_signals_mutex;
-}
-
-std::map<std::string, struct afb_event>& get_subscribed_signals()
-{
- return subscribed_signals;
-}
-
std::vector<CanSignal>& get_can_signals()
{
return SIGNALS[MESSAGE_SET_ID];
}
+/**
+ * @fn size_t getSignalCount()
+ *
+ * @return the length of the array returned by get_can_signals().
+ */
size_t getSignalCount()
{
return SIGNALS[MESSAGE_SET_ID].size();
}
+/**
+ * @brief Retrieve can arbitration id of a given CanSignal
+ *
+ * @param[in] CanSignal& - a const reference to a CanSignal
+ *
+ * @return uint32_t - unsigned integer representing the arbitration id.
+ */
uint32_t get_signal_id(const CanSignal& sig)
{
return sig.message->id;
}
/**
- * @fn std::vector<std::string> find_signals(const openxc_DynamicField &key)
+ * @fn void find_can_signals(const openxc_DynamicField& key, std::vector<CanSignal*>& found_signals)
* @brief return signals name found searching through CAN_signals and OBD2 pid
*
* @param[in] const openxc_DynamicField : can contain numeric or string value in order to search against
* can signals or obd2 signals name.
+ * @param[out] std::vector<CanSignal*>& found_signals : provided vector to fill with ponter to signals matched.
*
- * @return std::vector<std::string> Vector of signals name found.
*/
void find_can_signals(const openxc_DynamicField& key, std::vector<CanSignal*>& found_signals)
{