summaryrefslogtreecommitdiffstats
path: root/low-can-binding
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-11-26 16:19:02 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2019-11-28 16:11:47 +0100
commit1ebfa6dc2137bf6cbc487b6efc94ce976cf0ed27 (patch)
tree65613688c10d64faf662818372fed65d08b2cb04 /low-can-binding
parentb98027ffaa4e55b41a75f5b713918fea029131a9 (diff)
Update j1939 decode with function to_hex
Bug-AGL: SPEC-2386 Bug-AGL: SPEC-2976 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Change-Id: Ia10abfd73a6ea9d42770566e23bc4b206723f081 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding')
-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++)
{
1'>231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404