summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Guyader <arthur.guyader@iot.bzh>2019-08-27 14:37:01 +0200
committerArthur Guyader <arthur.guyader@iot.bzh>2019-08-29 18:02:13 +0200
commit923002874271bacdd2e8b12377e8093e628a1756 (patch)
tree379058308a650878399736d1f156d4fb1dd6c56c
parent3d8c0459bcfde576581246b6d2e0e0d5595ac638 (diff)
Update j1939 decode with function to_hex
Bug-AGL: SPEC-2386 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Change-Id: Ia10abfd73a6ea9d42770566e23bc4b206723f081
-rw-r--r--low-can-binding/can/message/j1939-message.cpp21
1 files changed, 2 insertions, 19 deletions
diff --git a/low-can-binding/can/message/j1939-message.cpp b/low-can-binding/can/message/j1939-message.cpp
index a0ca4b2a..7dc388b3 100644
--- a/low-can-binding/can/message/j1939-message.cpp
+++ b/low-can-binding/can/message/j1939-message.cpp
@@ -16,10 +16,10 @@
*/
#include <cstring>
-#include <sstream>
#include <iomanip>
#include <net/if.h>
#include "../../binding/low-can-hat.hpp"
+#include "../../utils/converter.hpp"
#include "j1939-message.hpp"
/**
@@ -86,23 +86,6 @@ uint8_t j1939_message_t::get_addr() const{
return addr_;
}
-/**
- * @brief Convert hex data to string
- *
- * @param data An array of data
- * @param length The length of the data
- * @return std::string The string data
- */
-std::string to_hex( uint8_t data[], const size_t length)
-{
- std::stringstream stream;
- stream << std::hex << std::setfill('0');
- for(int i = 0; i < length; i++)
- {
- stream << std::hex << ((int) data[i]);
- }
- return stream.str();
-}
/// @brief Take a sockaddr_can struct and array of data to initialize class members
///
@@ -138,7 +121,7 @@ std::shared_ptr<j1939_message_t> j1939_message_t::convert_from_addr(struct socka
data_vector.clear();
std::string data_string;
- data_string = to_hex(data,length);
+ data_string = converter_t::to_hex(data,length);
for(i=0;i<length;i++)
{