aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/utils/converter.cpp
AgeCommit message (Collapse)AuthorFilesLines
2020-01-09converter: Improve the continental bit calculRomain Forlot1-1/+1
This is an improvment of the bit_position computing. This now operate only on full bytes to get the position. Change-Id: Idb4993a3c9922d50d02379139e7cbbe5a2cb501b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: Add new decoders: ascii, date, timeArthur Guyader1-2/+17
Change-Id: I392bff2c1f4062aee186875335786fcda9cc0649 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09converter: Improve bit_position computationRomain Forlot1-30/+20
- Fix wrong bit_position swap computed: Need to multiply then lenght in bytes by 8 to get it for bits. - Add a continental bit_position function: This allow to get the correct bit_position using the weird Continental. bit numbering method where the Frame is read using little endianness and bit count using a big endianness - Use define CHAR_BIT instead of hardcoded 8 value Change-Id: I8d458ab457f80e5fa116af942acfceaaef51b763 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: rework how to swap frame layout.Romain Forlot1-8/+12
This also change the bit_position to retrieve the bit word starting from the left or the right of the frame depending on the endianness of the frame layout. Change-Id: I28658e9d46bd35d8ecabeece317331832229384a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09all: format typoRomain Forlot1-3/+3
Bug-AGL: SPEC-2988 Change-Id: I81c01a817cd31d577068350d8445a1df2751bff7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09converter: Fix to_hex conversionCorentin Le Gall1-1/+1
Convert byte to hex without forgetting '0's. ex: Before: '10' -> 'a' After: '10' -> '0a' Bug-AGL: SPEC-2991 Change-Id: I7346893eaf83aaa9294e48c20cbffd1a61789b51 Signed-off-by: Corentin Le Gall <corentin.legall@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09converter: Use unsigned int whenever it's possibleRomain Forlot1-1/+1
Use unsigned int whenever it is possible instead of uint32_t. This let the compiler decide the type. We do not need to use uint32_t explicitly for the converter. Bug-AGL: SPEC-2988 Change-Id: Ic2af875e7435668928c454df76e59c5c43b08407 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: Fix bit_position swappingCorentin Le Gall1-0/+7
-Added an attribute to signals that tells if the bit_position has been swapped. -Test if bit_size and bit_position gives an "out of range" data Bug-AGL: SPEC-3022 Change-Id: I589565ca923ec807da2d4f0db7c4c92fb737b579 Signed-off-by: Corentin Le Gall <corentin.legall@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09can: Add big endian CAN frame layout handleCorentin Le Gall1-0/+30
- can-decoder.cpp: translate_signal() : Tests "frame_layout_is_little". If false the signal's bit position is changed to fit the layout. - message-definition.cpp: Added the new attribute "frame_layout_is_little" and its getter. - signals.cpp: Added a setter to the bit_position attribute. - converter.cpp: Added a methode to convert a big endian bit_position to a right (little endian) bit_position. Bug-AGL: SPEC-2988 Change-Id: I004c9069eb00f389564927cd12d1b30470c3a59d Signed-off-by: Corentin Le Gall <corentin.legall@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08all: Format one line 'if' or 'for' statement.Romain Forlot1-4/+3
Bug-AGL: SPEC-2988 Change-Id: Ic3b9670a2ce9e982220c54f3632f690ee4eea686 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-08-29Add file converter to manage all conversionsArthur Guyader1-0/+58
This commits create a class converter to access conversions functions. For example to_hex, or for future usage in multi packet signal_to_bits_bytes. Bug-AGL : SPEC-2779 Change-Id: Ife652006a7756547184ed548bda5ffef0d09d941 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>