summaryrefslogtreecommitdiffstats
path: root/low-can-binding
AgeCommit message (Collapse)AuthorFilesLines
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>
2020-01-09All: Make format coherent with the whole projectRomain Forlot21-94/+94
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 Forlot12-12/+12
Bug-AGL: SPEC-2988 Change-Id: I9794c48d0f7567cc3fdc7dff21b4fcee47296514 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message_set: typedef long type signatureRomain Forlot3-5/+5
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 Guyader8-867/+90
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-08j1939: don't process signals using same busRomain Forlot1-6/+8
Bug-AGL: SPEC-2991 Change-Id: I8733a35e4f9cb3d0f2fce818b55a010fec19dc66 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08all: Format one line 'if' or 'for' statement.Romain Forlot13-209/+65
Bug-AGL: SPEC-2988 Change-Id: Ic3b9670a2ce9e982220c54f3632f690ee4eea686 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08app-generated: update for generated steering wheelRomain Forlot1-276/+2
Change-Id: I8af34595e4ea4d72af726c6c5db3ac05dda85bf2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08subscription: Optimizing opening socketsRomain Forlot2-30/+22
Also review some aligment and make more space between bool ops Bug-AGL: SPEC-2988 Change-Id: I613f294a630caf48eea7bb0c7b9c36b07cbacfbf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08socketcan-j1939: format how to define_opt()Romain Forlot1-7/+4
Bug-AGL: SPEC-2932 Change-Id: Ifec401451dc541b71dc2f98d25f5c953f1bcf532 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08can: clean and formatRomain Forlot1-48/+31
Little optimization in create_rx_filter_can function and make format coherent on bit operations. Bug-AGL: SPEC-2988 Change-Id: Ic9c53ba4c937604bbf3500ee89c7b5a5dbca7cfd 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 Forlot3-13/+9
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>
2020-01-08j1939: Following kernel updatesRomain Forlot2-2/+2
Compatatibility for latest kernel/glibc version See: https://github.com/torvalds/linux/commit/0768e17073dc527ccd18ed5f96ce85f9985e9115 Follow j1939 integration in the kernel which remove SO_J1939_RECV_OWN Bug-AGL: SPEC-2932 Change-Id: Id01e92330582da299af675676987cd667272e2c5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-12-06Change example message 0x3D9 back to non-FDicefish_8.99.4icefish_8.99.3icefish_8.99.2icefish/8.99.4icefish/8.99.3icefish/8.99.28.99.48.99.38.99.2Scott Murray1-1/+1
Update agl-vcar example definition to change message 0x3D9 back to regular CAN so it will be usable on non-FD capable hardware again. Bug-AGL: SPEC-3012 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I74064c5a8f4111f8f774104d27b86c8f15451539 (cherry picked from commit 12e75ea716e1b5054be0228e2859e14a11be622a)
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-12-03Update steering wheel LIN message definitionScott Murray1-1/+1
The steering wheel LIN message does not work in low-can after it has been updated to include commit "Update function rx_filter_can for multi frame prevision." (59bffa4 in master, a41ee0d in halibut), due to the length value now being required in the message definition. The length has been added to the definition for agl-vcar and the application-generated.cpp files regenerated. As well, the new J1939 and FD flags have been added to the message definition for consistency. Bug-AGL: SPEC-2951 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ice079268827dfbb2bf2c79b6c5e897dcab8fc433
2019-11-20Add steering wheel LIN message signal definitionsicefish_8.99.1icefish/8.99.18.99.1Scott Murray1-995/+248
Add signal definitions for the button status information in the steering wheel demo LIN message. Bug-AGL: SPEC-2951 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Id4909161f8f159858a3d29e310a3b43a787f2d03
2019-09-09Update documentationArthur Guyader1-1/+1
Bug-AGL : SPEC-2779 Change-Id: I461f7e32322faba7e822791ff2e3851039e03548 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Remove file socketcan-j1939 that was not removed beforeArthur Guyader4-197/+128
Bug-AGL : SPEC-2780 Change-Id: I4ddf9389faffebe0334b0004b69bb7336277c29d Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
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>