summaryrefslogtreecommitdiffstats
path: root/low-can-binding/utils
AgeCommit message (Collapse)AuthorFilesLines
2020-01-09openxc-utils : No send string but send array_object for signalsArthur Guyader1-1/+1
Change-Id: Iee28c1216ad5a3a4cdc76bd3edef4f7b5ccf0866 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09message: move bit position flag and actionRomain Forlot2-37/+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-09converter : Add "0x" for hex dataArthur Guyader1-0/+1
Change-Id: I9a46b0b87d56a73fb75fafafb0509ca66bb68dd3 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09openxc-utils : Add json value for DynamicFieldArthur Guyader2-11/+30
Change-Id: I93d31768804d4e30994897487e9fd312a56c547b 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-1/+0
Change-Id: I0689d62e32b9b60059adc2d4be78fa3b2581441c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
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 Guyader2-2/+18
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 Guyader2-5/+9
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-09j1939: Follow updates of the kernelArthur GUYADER4-17/+19
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-09converter: Improve bit_position computationRomain Forlot2-30/+23
- 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-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 Forlot2-9/+14
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-09misc: Some cleanup and fixes about signatures.Romain Forlot2-1/+12
Change-Id: Ib3e1df0d3741274336c8806ae82082e33d4d3a92 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-09all: format typoRomain Forlot2-5/+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-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-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-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-09can-bus: Use configuration from JSON fileRomain Forlot2-111/+0
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-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 Gall2-0/+31
- 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-09All: Make format coherent with the whole projectRomain Forlot7-39/+39
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 Forlot8-8/+8
Bug-AGL: SPEC-2988 Change-Id: I9794c48d0f7567cc3fdc7dff21b4fcee47296514 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2020-01-08all: Format one line 'if' or 'for' statement.Romain Forlot7-59/+16
Bug-AGL: SPEC-2988 Change-Id: Ic3b9670a2ce9e982220c54f3632f690ee4eea686 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-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-08-30Remove file socketcan-j1939 that was not removed beforeArthur Guyader1-195/+0
Bug-AGL : SPEC-2780 Change-Id: I4ddf9389faffebe0334b0004b69bb7336277c29d Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Add new decoders bytes for signal of long sizeArthur Guyader2-1/+54
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-30Add some typedef to reduce the size of the linesArthur Guyader2-7/+10
Bug-AGL : SPEC-2779 Change-Id: Iebcf7492133cd7789d301593ff999b24ae10a054 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Change vector to list to allow to remove signal.Arthur Guyader1-4/+5
This commit allows to remove signals. We need that because subscription to an iso tp message needs to be individual. Bug-AGL : SPEC-2779 Change-Id: I1d6410ebfc8ea82d33addf1bb828d9cd810b006a Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Add feature ISO TP (multi frames and peer to peer)Arthur Guyader3-2/+231
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 Guyader2-12/+1
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-29Add file converter to manage all conversionsArthur Guyader2-0/+85
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>
2019-08-29Uniform indentation with tabulationArthur Guyader4-75/+74
Bug-AGL : SPEC-2779 Change-Id: I834221ae1a04fdb188062ce1b7251e648c4845de Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-12Integrate the J1939 features : address claiming and write.Arthur Guyader7-44/+921
This commit allows to write J1939 messages and add the management of the address claiming. Bug-AGL: SPEC-2386 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Change-Id: I1bb95a7ba6f6ebe463319c3972d9d46897181d51
2019-08-12Add feature to build messages and fix some functionsArthur Guyader8-39/+59
Allows to build a message (J1939,BCM) with a signal and a value. Bug-AGL: SPEC-2386 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Change-Id: Iadca13a927ff83f713f39da441c88356695a1285
2019-06-26Rename some of the classes removing can- prefixRomain Forlot2-7/+7
This commit renames files and classes : - can_message_definition_t -> message_definition_t - can_message_set_t -> message_set_t - can_signals_t -> signals_t This prepares the implementation of j1939 protocol. Bug-AGL: SPEC-2386 Change-Id: Ie3ee4f25c236c861b92eb12a56fa03a5a9afffbb Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-06-26Change can_message_t class usage for new j1939Romain Forlot4-38/+17
This commit transforms the class can_message_t as the base class and creates two derived classes: j1939_message_t and can_message_t. Bug-AGL: SPEC-2386 Change-Id: I6d3afd8e4f5abff2cd0ec4e9910bd52a2893de76 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-06-26Implement a new socket type CAN for j1939 protocolArthur Guyader7-47/+297
This commit implements a new socket class for the j1939 protocol and prepares the bases classes by modifying the write and read methods. Bug-AGL: SPEC-2386 Change-Id: I16ba493418a4bb37a0262b61a2a2629be6ab5051 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-14Smalls improvementsRomain Forlot2-3/+14
- Improve robustness reading a BCM socket Adding checks on system calls and remove the initialization of the struct that will hold the received message, not so much needed in that case. - More accurate log message at subscription/unsubscription step whether this is a FD CAN messages or not and if this a subscription or an unsubscription that is requested. - Initialize the full struct of vehicle message to avoid memory warning about conditionnal jump based on uninitialized bytes. - Memleak: Free raw pointer on active diagnostic requests Change-Id: I4bbf4d851c0fa1efdb6fa6034fac3d1dcafa1a73 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-14CAN FD implementationRomain Forlot2-20/+30
Add a flag to CAN message definitions which set the message as using FD protocol if true. Use a new generated file with the new FD flag field on the message definitions. Change BCM socket "struct" using an union to store the CAN frames either using the FD struct or the classic non FD struct. A BCM socket can only one frame type once configured. Use as much as possible the "struct canfd_frame" in the binding and only make a difference before writing or reading the socket. From a memory point of view both struct are identical and only the last member differ and could hold more data with messages of 64 bytes long. So the canfd_frame is compatible with the can_frame and can be differentiated by a flag set in the can_id member. Remove now unused code processing can_frame. Keep the diagnostic manager using the classic CAN frame. Set the maximum number of frames that a BCM socket can handle to 257. Bug-AGL: SPEC-1980 Change-Id: Ifcc041281ea6745fc25cbd384743761f4446f489 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-11-22Adds a new function to build from a json_object.Romain Forlot2-0/+27
Build an openxc_DynamicField from a json_object. Change-Id: I57033daca5fd4f198b872f015255893d9f8f9303 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-10-15Migration to binding v3Romain Forlot2-2/+2
Change-Id: I0bcccb15200064bd7d83edbf06c1e7202069189a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-04-09Correct errors in commentsJonathan Aillet1-1/+1
Change-Id: I1e02bdfe2473e776e35694b883f084077227853c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-01-02Make low-can use afb-genskel by defaultRomain Forlot1-1/+0
Cleaning header file inclusion Change-Id: Ic0dd9637ecd491692bd4b8b39e9602e85498c0a9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-07Initialize struct to avoid unexpected behaviorRomain Forlot1-2/+4
Change-Id: I8c160b427f0844e9bc6c7e65fb48cd122160bc65 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-09-28Add timestamp to diagnostic message event tooRomain Forlot1-1/+1
Change-Id: Id01a15efe1b6aa063ac9bb2d3989ff195035eeb0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-09-13Add timestamp val to returned json object on eventRomain Forlot2-1/+28
Change-Id: Ibfb514eb27c0378dba7e302755e5f6f95b0ca242 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-25Make Kernel check not mandatoryRomain Forlot2-1/+3
Use 2 different checks, one specify a mandatory kernel version and the other will output a warning and position a preprocessing variable that can be used in the code to exclude portions of code that use kernel features not available under a certain version. Bug-AGL: SPEC-772 Change-Id: I04523abe96749aeeb185e90eee154fd70a4cbf19 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>