summaryrefslogtreecommitdiffstats
path: root/low-can-binding/utils
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-07-17 10:59:10 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-07-21 12:02:11 +0200
commite2af4a871c6a8bcab4733193948833aed9c5ceb8 (patch)
tree2589bafe5de543fbc0dbccc3e13db8daa4acfabf /low-can-binding/utils
parent61adb20886a9cc611a8b48a86998cfeaad31d7b7 (diff)
Format
Change-Id: I036befbfb38b01d046d35a1364c28e0835dcbd41 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/utils')
-rw-r--r--low-can-binding/utils/openxc-utils.cpp32
-rw-r--r--low-can-binding/utils/signals.cpp6
-rw-r--r--low-can-binding/utils/signals.hpp2
-rw-r--r--low-can-binding/utils/socketcan-bcm.cpp2
-rw-r--r--low-can-binding/utils/socketcan-raw.cpp2
-rw-r--r--low-can-binding/utils/timer.cpp10
6 files changed, 27 insertions, 27 deletions
diff --git a/low-can-binding/utils/openxc-utils.cpp b/low-can-binding/utils/openxc-utils.cpp
index f39f4184..3b404f09 100644
--- a/low-can-binding/utils/openxc-utils.cpp
+++ b/low-can-binding/utils/openxc-utils.cpp
@@ -28,7 +28,7 @@
/// and put into the DiagnosticResponse of the VehicleMessage.
/// @param[in] parsed_value - raw parsed value of the payload from CAN message
///
-/// @return a vehicle message including simple message that will be convert into
+/// @return a vehicle message including simple message that will be convert into
/// a JSON object before being pushed to the subscribers
///
const openxc_VehicleMessage build_VehicleMessage(active_diagnostic_request_t* request, const DiagnosticResponse& response, float parsed_value)
@@ -92,13 +92,13 @@ const openxc_VehicleMessage build_VehicleMessage(active_diagnostic_request_t* re
/// @param[in] message - simple message to include into openxc_VehicleMessage
/// @param[in] timestamp - timestamp from ioctl when reading the socket
///
-/// @return a vehicle message including simple message that will be convert into
+/// @return a vehicle message including simple message that will be convert into
/// a JSON object before being pushed to the subscribers
///
const openxc_VehicleMessage build_VehicleMessage(const openxc_SimpleMessage& message, uint64_t timestamp)
{
openxc_VehicleMessage v;
-
+
v.has_type = true,
v.type = openxc_VehicleMessage_Type::openxc_VehicleMessage_Type_SIMPLE;
v.has_simple_message = true;
@@ -114,13 +114,13 @@ const openxc_VehicleMessage build_VehicleMessage(const openxc_SimpleMessage& mes
///
/// @param[in] message - simple message to include into openxc_VehicleMessage
///
-/// @return a vehicle message including simple message that will be convert into
+/// @return a vehicle message including simple message that will be convert into
/// a JSON object before being pushed to the subscribers
///
const openxc_VehicleMessage build_VehicleMessage(const openxc_SimpleMessage& message)
{
openxc_VehicleMessage v;
-
+
v.has_type = true,
v.type = openxc_VehicleMessage_Type::openxc_VehicleMessage_Type_SIMPLE;
v.has_simple_message = true;
@@ -162,7 +162,7 @@ bool is_valid(const openxc_VehicleMessage& v)
/// @brief Build an openxc_SimpleMessage associating a name to an openxc_DynamicField
///
/// @param[in] name - const string reference name to assign to the created SimpleMessage
-/// this will set has_name member to true and assign name to the name member. Maximum size for name is
+/// this will set has_name member to true and assign name to the name member. Maximum size for name is
/// set to 100 char.
/// @param[in] value - const reference with DynamicField to assign to SimpleMessage
/// value.
@@ -216,12 +216,12 @@ const openxc_DynamicField build_DynamicField(const std::string& value)
openxc_DynamicField d;
d.has_type = true;
d.type = openxc_DynamicField_Type_STRING;
-
+
d.has_string_value = true;
d.has_numeric_value = false;
d.has_boolean_value = false;
::strncpy(d.string_value, value.c_str(), 100);
-
+
return d;
}
@@ -239,12 +239,12 @@ const openxc_DynamicField build_DynamicField(double value)
openxc_DynamicField d;
d.has_type = true;
d.type = openxc_DynamicField_Type_NUM;
-
+
d.has_string_value = false;
d.has_numeric_value = true;
d.has_boolean_value = false;
d.numeric_value = value;
-
+
return d;
}
@@ -260,12 +260,12 @@ const openxc_DynamicField build_DynamicField(bool value)
openxc_DynamicField d;
d.has_type = true;
d.type = openxc_DynamicField_Type_BOOL;
-
+
d.has_string_value = false;
d.has_numeric_value = false;
d.has_boolean_value = true;
d.boolean_value = value;
-
+
return d;
}
@@ -306,7 +306,7 @@ const openxc_SimpleMessage get_simple_message(const openxc_VehicleMessage& v_msg
{
if (v_msg.has_simple_message)
return v_msg.simple_message;
-
+
openxc_SimpleMessage s_msg = { false, "", false, build_DynamicField(false), false, build_DynamicField(false)};
return s_msg;
}
@@ -331,10 +331,10 @@ void jsonify_DynamicField(const openxc_DynamicField& field, json_object* value)
///
/// @brief Make a JSON object from a SimpleMessage
///
-/// @param[in] s_msg - const reference to an openxc_SimpleMessage
+/// @param[in] s_msg - const reference to an openxc_SimpleMessage
/// struct to convert into a json object.
/// @param[out] json - pointer with the DynamicField converted into json object
-///
+///
/// @return True if SimpleMessage has been transformed into json object
/// and false if not. In such case, a json object is returned { "error": "error msg"}
///
@@ -348,4 +348,4 @@ bool jsonify_simple(const openxc_SimpleMessage& s_msg, json_object* json)
}
json_object_object_add(json, "error", json_object_new_string("openxc_SimpleMessage doesn't have name'"));
return false;
-} \ No newline at end of file
+}
diff --git a/low-can-binding/utils/signals.cpp b/low-can-binding/utils/signals.cpp
index 5c08eaaf..7011fa5a 100644
--- a/low-can-binding/utils/signals.cpp
+++ b/low-can-binding/utils/signals.cpp
@@ -37,7 +37,7 @@ namespace utils
///
/// @brief return the subscribed_signals map.
- ///
+ ///
/// @return Map of subscribed signals.
std::map<int, std::shared_ptr<low_can_subscription_t> >& signals_manager_t::get_subscribed_signals()
{
@@ -48,10 +48,10 @@ namespace utils
/// @fn std::vector<std::string> find_signals(const openxc_DynamicField &key)
/// @brief return signals name found searching through CAN_signals and OBD2 pid
///
- /// @param[in] key : can contain numeric or string value in order to search against
+ /// @param[in] key : can contain numeric or string value in order to search against
/// can signals or obd2 signals name.
///
- /// @return Vector of signals name found.
+ /// @return Vector of signals name found.
///
struct signals_found signals_manager_t::find_signals(const openxc_DynamicField &key)
{
diff --git a/low-can-binding/utils/signals.hpp b/low-can-binding/utils/signals.hpp
index c604b87d..ddaf229b 100644
--- a/low-can-binding/utils/signals.hpp
+++ b/low-can-binding/utils/signals.hpp
@@ -37,7 +37,7 @@ namespace utils
std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_messages;
};
- /// @brief Signal manager singleton hold subscription object with attached afb_event and its mutex
+ /// @brief Signal manager singleton hold subscription object with attached afb_event and its mutex
/// to read and write it safely.
/// It can be used to browse CAN signals and Diagnostic messages vectors and find a particular signal to
/// subscribe to.
diff --git a/low-can-binding/utils/socketcan-bcm.cpp b/low-can-binding/utils/socketcan-bcm.cpp
index 39b53f56..750e772d 100644
--- a/low-can-binding/utils/socketcan-bcm.cpp
+++ b/low-can-binding/utils/socketcan-bcm.cpp
@@ -39,7 +39,7 @@ namespace utils
int socketcan_bcm_t::open(std::string device_name)
{
close();
-
+
struct ifreq ifr;
socket_ = socketcan_t::open(PF_CAN, SOCK_DGRAM, CAN_BCM);
diff --git a/low-can-binding/utils/socketcan-raw.cpp b/low-can-binding/utils/socketcan-raw.cpp
index 58b443be..ca892e70 100644
--- a/low-can-binding/utils/socketcan-raw.cpp
+++ b/low-can-binding/utils/socketcan-raw.cpp
@@ -36,7 +36,7 @@ namespace utils
int socketcan_raw_t::open(std::string device_name)
{
close();
-
+
struct ifreq ifr;
socket_ = socketcan_t::open(PF_CAN, SOCK_RAW, CAN_RAW);
diff --git a/low-can-binding/utils/timer.cpp b/low-can-binding/utils/timer.cpp
index d21b7474..9152a096 100644
--- a/low-can-binding/utils/timer.cpp
+++ b/low-can-binding/utils/timer.cpp
@@ -16,7 +16,7 @@
*/
#include <time.h>
-#include <stdlib.h>
+#include <stdlib.h>
#include <cmath>
#include "timer.hpp"
@@ -25,7 +25,7 @@ long long int system_time_us()
{
struct timespec t_usec;
long long int timestamp_usec = 0;
-
+
if(!::clock_gettime(CLOCK_MONOTONIC, &t_usec))
timestamp_usec = (t_usec.tv_nsec / 1000ll) + (t_usec.tv_sec* 1000000ll);
return timestamp_usec;
@@ -35,7 +35,7 @@ long long int system_time_ms()
{
struct timespec t_msec;
long long int timestamp_msec = 0;
-
+
if(!::clock_gettime(CLOCK_MONOTONIC, &t_msec))
timestamp_msec = (t_msec.tv_nsec / 1000000ll) + (t_msec.tv_sec* 1000ll);
return timestamp_msec;
@@ -45,7 +45,7 @@ long long int system_time_s()
{
struct timespec t_sec;
long long int timestamp_sec = 0;
-
+
if(!::clock_gettime(CLOCK_MONOTONIC, &t_sec))
timestamp_sec = t_sec.tv_sec;
return timestamp_sec;
@@ -76,7 +76,7 @@ float frequency_clock_t::frequency_to_period() const
return frequency_ == 0 ? 0 : 1 / frequency_;
}
-/// @brief Return a timeval struct based on the frequency_ member. used to
+/// @brief Return a timeval struct based on the frequency_ member. used to
/// specified CAN BCM timers.
const struct timeval frequency_clock_t::get_timeval_from_period() const
{