summaryrefslogtreecommitdiffstats
path: root/low-can-binding
AgeCommit message (Collapse)AuthorFilesLines
2020-01-09j1939: Follow updates of the kernelArthur GUYADER7-25/+45
This commit patch j1939 feature after the update of the kernel from linux-can-next to mainline. Now promisc option removes filter of the bind. The option is now a parameter in the event_filter. The feature recv_own isn't available, you can't receive on the same socket an emit frame from you. Not a big problem because receive and send method use two different sockets in the implementation. Change-Id: I5ac410177c1512090827870300b8aa1679477b84 Signed-off-by: Arthur GUYADER <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09socket-j1939: Function add_filter return int to check errorArthur GUYADER2-3/+5
Change-Id: Ia79320108e8293d2b7a5beba4f49036999d5ebbb 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-09diag_mngr: No diagnostic msg if no diagnostic_busRomain Forlot2-4/+7
Change-Id: I840fc6cc7e9cfd171b03cac508fedb8ece4b976d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09low-can-cb: Little optiRomain Forlot1-4/+2
Change-Id: I6f3e84700563fc60e643d770365c98342214bedd 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 Forlot3-33/+27
- 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-09diag-mngr: Fix sending and change initRomain Forlot3-17/+24
This commit fix the wrong bcm ival1 value set because the struct hasn't been initialized so it use a wrong value that can not be handled by the socket. Initialize diagnotstic manager depending on JSON configuration file This avoid to request engine_speed signal when there isn't any diagnostic_bus configured in the JSON file. Change-Id: I98145a6e20c29a644c856d818f104c6bd8069f9f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09socket-bcm: Format, simplification of open socketRomain Forlot1-12/+10
Change-Id: I8a012285a8d06f3c5778c82e543c944d8fa20e3c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: rework how to swap frame layout.Romain Forlot7-31/+35
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 Forlot4-3/+14
Change-Id: Ib3e1df0d3741274336c8806ae82082e33d4d3a92 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09ini-config: remove ini-config libRomain Forlot1-2/+0
No need to use ini-config now that the config is hold by the controller JSON configuration file. Bug-AGL: SPEC-2988 Change-Id: If82d22266fb2d592c140b81cda783ee63f1f13be Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09all: format typoRomain Forlot5-9/+7
Bug-AGL: SPEC-2988 Change-Id: I81c01a817cd31d577068350d8445a1df2751bff7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09init: Improve error message when not finding config fileRomain Forlot1-1/+1
Bug-AGL: SPEC-2988 Change-Id: I9a9dec6e577881bbd784bcae1d17ddb244d94599 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09low-can: Fix init failing when using without J1939Romain Forlot1-1/+1
Return variable was initialized to 1 instead of 0 and without using J1939 this variable isn't reaffected and so the final test fails. Bug-AGL: SPEC-2386 Change-Id: I53b7cd757b3b344d66ab18ba9795284105cbcfcc 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-09apidef: fix no preinit defined.Romain Forlot1-1/+1
This commit fixes the binding initialization by specifying a preinit function that parse and load the controller configuration Bug-AGL: SPEC-2988 Change-Id: I040c401fa2818d056a61a2858829bc4db2cffece Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09cmake: fix lib not populated and RPATH usageRomain Forlot1-0/+7
RPATH as to be used as target property. Bug-AGL: SPEC-2988 Change-Id: Ifaa66ceafbe7ed5f7de553b14da2dd8c5b1e8f9d 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-09socketcan-bcm: Fix wrongly opened socketRomain Forlot1-0/+1
This commit fixes a problem once a bcm socket has been opened but the following ioctl failed. Before we still return the socket number instead of returning a negative value as error. This resulted in problem because the subscription was considered as valid and binding was continuing using the closed file descriptor. Bug-AGL: SPEC-2988 Change-Id: Iaa64e7bb00980cb8c0e7080aca238cfb57d628b6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09init: Fix wrong diagnostic bus name returned.Romain Forlot1-1/+1
We use the bus name which isn't correct because it isn't the device name. Bug-AGL: SPEC-2988 Change-Id: I5c9313817a3f3d423f8934cfab03e2cf20d48af2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09all: formatRomain Forlot4-45/+30
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-09converter: Use unsigned int whenever it's possibleRomain Forlot2-3/+9
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/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-09socket: Raise an error if open function failed.Romain Forlot2-0/+5
The socket opening wasn't tested and we fails later on another function using the wrongly opened socket. This would not happens anymore. Bug-AGL: SPEC-2988 Change-Id: I9b30bd9fc13b99277cbef6f7aeaddadc57ad0b18 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09low-can-hat: improve formatRomain Forlot1-2/+2
Weird way test to make test are now fixed to be more readable. Bug-AGL: SPEC-2988 Change-Id: I81d716ac3799c4217e720a13d8ba78a46996a2c3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09low-can-cb: improve readabilityRomain Forlot1-11/+6
Just make thing more readable by define variables at the beginning of functions. And directly assign them if possible. Also improve format using the same format than in the rest of the project. Bug-AGL: SPEC-2932 Change-Id: I5cc7685b80734d0eb43a29fc06b2a8434f3469fa Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09can-bus: Use configuration from JSON fileRomain Forlot7-139/+38
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-09fix: missing include to find find_if functionRomain Forlot1-0/+1
Change-Id: I099b951011442ffaebf75a319236a39553999a41 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message: More explicit define about CAN protocols.Romain Forlot4-13/+13
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-09low-can-cb: Mark the end of the CtlSections arrayRomain Forlot1-1/+4
Bug-AGL: SPEC-2988 Change-Id: I433f4f699f3234fc07fcd909cd6b77b84e447ad7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09converter: littles improvements.Romain Forlot1-1/+1
Bug-AGL: SPEC-2988 Change-Id: I9198835b96c66c140f8b1d4167828302b9dc4959 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09cmake: cleaning and set RPATH for bindingRomain Forlot1-21/+36
Cleaning and set RPATH to find the low-can library Change-Id: I6e68a61bbeca385433028a716b9ac6d5e7f28769 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09decoder: Fix bit_position swappingCorentin Le Gall4-1/+25
-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 Gall6-1/+51
- 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-09application: Add dedicated function to set parentsRomain Forlot2-15/+18
Bug-AGL: SPEC-2988 Change-Id: Iedd493b9e4043290dae0aa9d1d94a3d9179525ae Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09low-can-cb: Retrieve application from external controller dataRomain Forlot1-5/+4
Bug-AGL: SPEC-2988 Change-Id: Iaa55b00539b1435b00fe076918d5eda5eeb5db30 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-09hat: Move some binding functions into the hatRomain Forlot2-1/+89
This is needed to move using a splitted binding/library model to have plugins linked to the lib as well as the binding to get there symbols Bug-AGL: SPEC-2988 Change-Id: I3a9f616078bc7fa9317995ec4300ee2b61aa4b08 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09binding: add preinit function to load the configRomain Forlot6-82/+100
Make as the others bindings using controller and load its configuration file at preinit step. diagnostic-manager: Change way to initialize the diag bus This was kind of hardcoded and now, it is initialized by a configuration key of the controller configuration JSON file. Bug-AGL: SPEC-2988 Change-Id: I344c1982893e47600a0b8cd03542de8069a42d24 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>