aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/can
AgeCommit message (Collapse)AuthorFilesLines
2021-01-11Restore /etc/dev-mapping.conf supportneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.92.0marlin_12.91.0marlin_12.90.1marlin_12.90.0marlin/12.93.0marlin/12.92.0marlin/12.91.0marlin/12.90.1marlin/12.90.0lamprey_11.92.0lamprey_11.91.0lamprey/11.92.0lamprey/11.91.0koi_10.93.0koi_10.92.0koi/10.93.0koi/10.92.013.93.012.93.012.92.012.91.012.90.112.90.011.92.011.91.010.93.010.92.0Scott Murray3-0/+13
Add back the ini-config and config-parser code that existed previously, and use it in binding init to over-ride the device mapping from the controller JSON if /etc/dev-mapping.conf exists. This restores the documented behavior, and is needed for the existing AGL demo platform support and soon CI. Additionally: - Add code to validate the active_message_set, diagnostic_bus, and bus device mapping configuration values. - The above required moving plugin loading before the configuration callback in the controller configuration, but this change seems rational in that everything required by the generated plugin code is already initialized before then, and it makes validating the configuration possible without adding an extra callback. - Add logging of the used CAN bus to device mappings at info level to ease debugging any future issues. - Tweak the log level of the missing configuration file message to info from error, since it is a legitimate mode of operation if relying on the default bus values in the controller JSON. Bug-AGL: SPEC-3755 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I440f5e0fc85be41f7c4c1f47d824a403525a18f9
2020-01-09message: move bit position flag and actionRomain Forlot2-33/+1
Separate some define to be in a dedicated header file that will be installed on the system. Then the low-can-generator could use it instead of having to copy those defines in the generator code. Change-Id: I1716c8b20f0811ca4ac1e8f13609f05ad7d24d1f Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message: Fix copying all bytes but the last oneRomain Forlot3-64/+18
Change-Id: I8c2fce0f8080f213fda26a054f691ba3ed457bda Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09can-bus: process signal rework to subscribe messageArthur Guyader1-5/+27
This commits allows to subscribe message and have all signals in one frame. Change-Id: I95de0e46b30be09a47a04754266cb55650eeec31 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09can_decoder : Move frame swap to only do it one timeArthur Guyader1-11/+11
This commit allows to swap only one time a data message. Change-Id: I566c6ad72e266cd59a4397ab1a5ef423d752cf75 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09signal_t : Remove attribute is_big_endianArthur Guyader2-10/+0
It is not used in the actual context. Change-Id: I6334ff9a037cec4f61deea56048b3109ad1362ab Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09Update flag FRAME_LAYOUT_IS_BIGENDIAN to BYTE_FRAME_IS_BIG_ENDIANArthur Guyader3-3/+3
Change-Id: I13a3392aecd8d57fac6f94346c4cf209595775b4 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09format: remove uneeded brackets.Romain Forlot1-16/+3
Change-Id: I0689d62e32b9b60059adc2d4be78fa3b2581441c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: Add new decoders: ascii, date, timeArthur Guyader2-0/+64
Change-Id: I392bff2c1f4062aee186875335786fcda9cc0649 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09can_bus: Add unit in the json that low-can emitsArthur Guyader1-1/+1
This commit allow if the unit is defined to display it in the json emmits by low-can. Change-Id: Ia09d4d9614eba6de93292ffab351fa1f4e612b73 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09msg_def: returns pgn if j1939 usedArthur GUYADER1-1/+2
This commit patch function get_id. It was only capable to return id and id extended. Now it returns also pgn. Change-Id: If5feb7e2ee3bc5ca33b16620d1b998c95414dda8 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message: Rework message flagsRomain Forlot2-13/+17
Adding bit_position and frame manipulation flags Change-Id: Ibd727a54a33a78b49f2c319b4b70dcda21ea87cb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09encoder: use contructor to initialize the vectorRomain Forlot1-5/+3
Instead of initilizing using a for loop... Also fixes a wrong watched bit using a bcm socket Change-Id: Ib65a3da06dbd249c97b8ec11823247120505d545 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09converter: Improve bit_position computationRomain Forlot1-3/+4
- 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: reformat function to parse the bitfieldRomain Forlot1-8/+10
Change-Id: Ia024b9d87d219f69aac0613d6e14b623e37300a6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message: Default frame layout as little endian.Romain Forlot4-5/+5
Change the flags to be enable if frame use big endian rather than little Change-Id: I09ae9c54f1d807da4e740457cf04a001723edb0e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: rework how to swap frame layout.Romain Forlot5-22/+21
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-09message: optimize getting subpart of a vectorRomain Forlot1-19/+7
Change-Id: Ifdaea3bf0969f15eb70629a92c0293ddeee33491 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09msg_definition: integrate frame layout as a flagRomain Forlot3-9/+2
Integrate frame layout as a flag instead of a separate boolean Change-Id: I0fe32fd8a80238006ef89152af25001ecdf018c9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09misc: Some cleanup and fixes about signatures.Romain Forlot2-2/+2
Change-Id: Ib3e1df0d3741274336c8806ae82082e33d4d3a92 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09all: format typoRomain Forlot2-3/+1
Bug-AGL: SPEC-2988 Change-Id: I81c01a817cd31d577068350d8445a1df2751bff7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message-def: Fix code to avoid warningsCorentin Le Gall1-2/+2
Bug-AGL: SPEC-2988 Change-Id: I8ded9847a5923b3a78afc953551fc6daaf40b355 Signed-off-by: Corentin Le Gall <corentin.legall@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09all: formatRomain Forlot2-34/+28
Remove unecessary brackets and replace if possible if...else by ternary operator. Bug-AGL: SPEC-2991 Change-Id: Ibe46b83dea976e050b9cd9eb7ee7ab2c33b63905 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder/encoder: typoRomain Forlot2-2/+2
Bug-AGL: SPEC-2991 Change-Id: I9ebea118770a9ffe0dd4321408643e76250e3635 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder/encoder: simplification of code.Romain Forlot2-120/+36
- Useless tests removed - Bit operation changed to more readable ones - Handle correctly mask to decode signal on 1 byte or in-between bytes more clearly. - using static_cast now instead of C casting method. - Avoid manual vector initialization and using default constructors instead. - Avoid using intermediate variables when this isn't necessary. Bug-AGL: SPEC-2988 Change-Id: I049d65f460109772b57df7572bdac8e6500242e0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09encoder: use switch case to handle CAN protocolsRomain Forlot1-31/+37
Better using switch case than if...else. This would be more extendable and readable. Bug-AGL: SPEC-2988 Change-Id: I5fb03531ad77441bcb7d1620bdb07d82aa6a4eb4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message: Correctly detect extended CAN id.Romain Forlot1-3/+1
Previous test was always true. This fix the wrong test and then add the EFF flag correctly on messages using extended CAN id. Bug-AGL: SPEC-2988 Change-Id: I69686fd3d5a39ea3a0d1980b4bfa88fe36fb7fe5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09can-bus: Use configuration from JSON fileRomain Forlot2-26/+26
Use configuration from JSON file instead of the old INI file. Now all configuration files lies within the binding tree. Bug-AGL: SPEC-2988 Change-Id: Id986d19751db958ad5cf3b7f2b2c5443d4ceb062 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message: More explicit define about CAN protocols.Romain Forlot2-4/+4
Change a bit CAN binding define about used protocol. There was a mistake about BCM define which isn't a protocol at all but a maner to filter and retrieve CAN message through SocketCAN. Also FD_FRAME was using the same name than SocketCAN which isn't a good idea, better to distinguis both of them. Bug-AGL: SPEC-2988 Change-Id: I255fa03029c7d5f90a33448e5e7692d8c249279b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: fix left behind characterRomain Forlot1-1/+1
Bug-AGL: SPEC-2988 Change-Id: I28cf984024356925469b4971b993718276d1240f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: Fix bit_position swappingCorentin Le Gall3-1/+18
-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-09sign: handle decode methods sign from can valueClément Bénier4-14/+92
- add enumeration that represents the way of encoding: enum sign_t { UNSIGNED = 0, SIGN_BIT = 1, ONES_COMPLEMENT = 2, TWOS_COMPLEMENT = 3, SIGN_BIT_EXTERN = 4 }; - the function handle_sign allows to transform value if negative and return the sign of the value in order to be multiplied at the end ot the parcing Bug-AGL: SPEC-3021 Change-Id: I5766a286488170d930422474b4c4f3a8578ca726 Signed-off-by: Clément Bénier <clement.benier@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09can: Add big endian CAN frame layout handleCorentin Le Gall4-1/+20
- 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-09can_message: add missing signature due to conflictRomain Forlot1-4/+3
Bug-AGL: SPEC-2988 Change-Id: Ib705ae7c500bb9d3abc863053943298c87896bd2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09All: Make format coherent with the whole projectRomain Forlot9-32/+32
Add a space after a comma Change some aligments Bug-AGL: SPEC-2988 Change-Id: I5069120f4bbb33742bb4990e2e1f391ec8d5eeb6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09all: Copyright updateRomain Forlot4-4/+4
Bug-AGL: SPEC-2988 Change-Id: I9794c48d0f7567cc3fdc7dff21b4fcee47296514 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message_set: typedef long type signatureRomain Forlot2-4/+4
Convert two long types using typedef to get shorter one Bug-AGL: SPEC-2988 Change-Id: I9f5612def1bce512516a6e1a45711486368bbc51 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09controller: Prepare project ot use the ControllerArthur Guyader4-0/+46
Initialize an empty message_set to fill later when loading the Plugins Add the required method to be able to add a message_set Bug-AGL: SPEC-2988 Change-Id: I1dc784648f69832de8681184adaccbf5300f831d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08all: Format one line 'if' or 'for' statement.Romain Forlot3-51/+21
Bug-AGL: SPEC-2988 Change-Id: Ic3b9670a2ce9e982220c54f3632f690ee4eea686 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08can: Fix receiving and sending extended CAN framesRomain Forlot1-2/+4
Bug-AGL: SPEC-2779 Change-Id: I672450b51b46082b6a913bef2d6e27d64c49e6fc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08can: Remove extended flagsRomain Forlot2-12/+8
It doesn't matters to know whether or not a can signal is using standard or extended CAN ID because this could be retrieved using bit mask on the CAN ID when receiving and sending. Bug-AGL: SPEC-2988 Change-Id: Id96c576045bf087df51beb011742ad631336f814 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-12-05Fix filter bitmask generationScott Murray1-1/+1
Fix filter bitmask generation in encoder_t::encode_data; the mask bits need to be left-aligned in each byte, not right-aligned. Bug-AGL: SPEC-3013 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ie084f81e3d8c06e69b5bb7562055187395099ac7
2019-08-30Remove in function convert_from_addr, the variable flags was not usedArthur Guyader1-1/+0
Bug-AGL : SPEC-2780 Change-Id: Ib31a32565c3bc38ea039003bd924a43318fb7c4e Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Add new decoders bytes for signal of long sizeArthur Guyader2-0/+92
This commit adds the decoder bytes. It allows to return a sequence of bytes in hexadecimal form. Bug-AGL : SPEC-2780 Change-Id: I27180774f044c48a9d7baa2739b15a2e85b8b2e2 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Change signature of decodersArthur Guyader3-53/+54
This commit changes the signature of decoders. It is now necessary to specify the version of the signals so that the low-can-generator generates the associated wrapper and not need to modify the decoder already developed. Bug-AGL : SPEC-2780 Change-Id: I044b1a3a6bacb9fc59bd6d3f77a1dbc437a3aa86 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Add some typedef to reduce the size of the linesArthur Guyader6-22/+26
Bug-AGL : SPEC-2779 Change-Id: Iebcf7492133cd7789d301593ff999b24ae10a054 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Update bit position and bit size in signalArthur Guyader2-14/+15
It's necessary to change the size of attributes to manage multi packet signal. Bug-AGL : SPEC-2779 Change-Id: If211c218ffa5a2e81ccfb32d3a5eeae0267e8f74 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Add feature ISO TP (multi frames and peer to peer)Arthur Guyader8-7/+45
This commit adds the ISO TP feature. The ISO TP protocol allows to communicate between two ECU. The protocol allows multi packets management. Bug-AGL : SPEC-2779 Change-Id: Ic222615b547f28e926930e6c1dea2c0265055afd Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Replace all enum types with masksArthur Guyader9-90/+69
This commit allows to change all enum types by masks. Now to implement new protocol you don't need to add more attribute in class. All can be contained in the flags field. Bug-AGL : SPEC-2779 Change-Id: I814d0052139be5d5efefc9ff1b4b558f46b85e90 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Change function get_bcm_msg to return a reference.Arthur Guyader2-2/+2
Bug-AGL : SPEC-2779 Change-Id: I303d2423151dac497917299737070ffb645267d3 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>