aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding
AgeCommit message (Collapse)AuthorFilesLines
2019-08-30Add function remove last bcm frameArthur Guyader2-0/+12
This commit creates the function remove_last_bcm_frame. This function removes the last bcm frame of the subscription. Bug-AGL : SPEC-2779 Change-Id: I5bb6f07a8d677c4aa882549fc1950f00a0b1da04 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Add many frames in a subscription in the function tx_send.Arthur Guyader1-3/+6
This commit convert the message to a vector of canfd_frame. If there are several canfd frames then we add all of them to the subscription. Bug-AGL : SPEC-2779 Change-Id: I876aaf5ab7fed2fedb79367f77b987ba4745cdfc Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-29Add function to convert vector to canfd or can frame.Arthur Guyader2-1/+64
This commit allows to convert the data vector to canfd or can frame. In the two cases the struct is a canfd frame, but if the type is not fd, the max size of a frame is 8. Bug-AGL : SPEC-2779 Change-Id: I60edf6a602a47572d5e5bfb508c7ca6d8761832b Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-29Add function get_data_vector with indexArthur Guyader2-0/+35
This commit adds the function get_data_vector to get another vector between the index indicates. Bug-AGL : SPEC-2779 Change-Id: I704d78467839ee7f9a2fec397e9b0db8da43d79d Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-29Update function to encode and decode messageArthur Guyader4-91/+165
This commit update encoder and decoder files. This new implementation allows to manage larger signals. Bug-AGL : SPEC-2779 Change-Id: Iec6dfbd279863aa8b8e8f9e3ce951f0c8aa80dae Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-29Update j1939 decode with function to_hexArthur Guyader1-19/+2
Bug-AGL: SPEC-2386 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Change-Id: Ia10abfd73a6ea9d42770566e23bc4b206723f081
2019-08-29Add file converter to manage all conversionsArthur Guyader3-0/+86
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 Guyader12-450/+448
Bug-AGL : SPEC-2779 Change-Id: I834221ae1a04fdb188062ce1b7251e648c4845de Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-13Fix: only one subscription could be madeRomain Forlot2-4/+8
Only one subscription could be made and then only one subscriber could receive associated events. As the relationship between events and subscriber is not 1-1 but 1-N, so this was the mistake. Now 1 event is created for N subscriber where before there was 1 event for 1 subscriber and subsequent subscribers could not receive same events than the ones already subscribed. Bug-AGL: SPEC-2726 Change-Id: I4e4a80ac9f9b6b4c6b006108ee55f355a7c1e377 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-08-12Integrate the J1939 features : address claiming and write.Arthur Guyader17-112/+1192
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 Guyader22-133/+524
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-08-12Update examples and can_samplesArthur Guyader1-48/+1017
Update of examples for new features (is_fd,is_extended,is_j1939). Bug-AGL: SPEC-2386 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Change-Id: I8c3afbafdde4f5818d73c0e71a3b7e47fb7d8fc6
2019-07-03signals.cpp: Make an insensitive string comparisonhalibut_8.0.2halibut_8.0.1halibut_8.0.0halibut_7.99.3halibut/8.0.2halibut/8.0.1halibut/8.0.0halibut/7.99.38.0.28.0.18.0.07.99.3Romain Forlot2-1/+11
When sending a CAN signal make an case-insensitive comparison as it isn't necessary to be strict on that, so case insensitive if fine. Update the documentation accordingly. Bug-AGL: SPEC-2582 Change-Id: I998b64cdd9a381da3da582aeba42ab726fff1259 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-06-27Fix spellinghalibut_7.99.2halibut/7.99.27.99.2Sebastien Douheret1-1/+1
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh> Change-Id: Iea56414f8ccf3d96b2fc67126b066c4032fe86a8
2019-06-27Minor improvementsRomain Forlot9-20/+14
- Remove now unused forward declaration of active_diagnostic_request_t - Factorize calling the signals_manager at binding initialization. - retab... Bug-AGL: SPEC-2386 Change-Id: I418fddd80ef8b856c198dc697760a6edf0918012 Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-06-27Updating application-generated.cpp.Romain Forlot1-514/+396
This commit updates differents application-generated.cpp files with the low-can generator updated with j1939. This commit adds the description of j1939 messages. Bug-AGL: SPEC-2386 Change-Id: I798a7da34c1be3526fec6bc3e424a6b88eaf46ff 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-26Small fixes (include and pointer)Romain Forlot3-3/+5
Bug-AGL: SPEC-2386 Change-Id: I3a622b9d236283aff479f187451cd86557a9aba7 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-26Modify function to open socket j1939Romain Forlot2-21/+59
The function open_socket has been modified to open a j1939 socket with a filter Bug-AGL: SPEC-2386 Change-Id: Ieed5c1d14efdb469f5a7b831c9e8a950e04e9d42 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-26Add the possibility to subscribe an id or a pgnArthur Guyader3-22/+106
The commit allows at the time of subscription to do: -> low-can subscribe {"id": 48} -> low-can subscribe {"pgn": 61442} The generation of event_filter has been extracted in a separate function. Bug-AGL: SPEC-2386 Change-Id: I592e668c63be448562b27c81fcdc111cd34f3676 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-26Rename some of the classes removing can- prefixRomain Forlot31-299/+394
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-26New constructor j1939 message definitionRomain Forlot2-0/+33
Add a new constructor for the j1939 message definition with additional name and data length member. Bug-AGL: SPEC-2386 Change-Id: Iff531f122942b6741a6a97718e639a4814b8d2bf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-06-26Change can_message_t class usage for new j1939Romain Forlot27-231/+654
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-26Add CMake option to compile with J1939Romain Forlot1-1/+10
Add option USE_FEATURE_J1939 to compile j1939 in file config.cmake This will be set up by default depending on the presence on the building host of the J1939 CAN module headers. Bug-AGL: SPEC-2386 Change-Id: I54d4594ff01d4e509bfa0862f3cb486562024aed Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-06-26Use subscription's sockets as shared_ptrRomain Forlot3-20/+24
This change is made to leverage C++ to read and write the different socket classes depending on CAN protocol used. Bug-AGL: SPEC-2386 Change-Id: I5e25e271fc82e9627f836aeb43b2af5ef25db83a Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-06-26Use shared_ptr to set message_set parentRomain Forlot3-5/+5
Better to use shared_ptr instead of raw pointer if possible. Bug-AGL: SPEC-2386 Change-Id: Id853d8ac6cddd1e53edd84e3bf27b0f1f5d92d4b 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 Guyader10-55/+305
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>
2019-06-19Modify to receive signal with bigger value than the number of statesHiroki Koga1-1/+1
Fix the bug about a part of decode_state in can-signals.cpp. If a state of signal is allocated not in order, the signal which is bigger value than the number of states cannot be received, because can_signal_t::get_states compares signal value with the number of states. By this modification, get_states is changed to judges whether a signal value exists in states or not. Bug AGL: SPEC-2504 Change-Id: Ia67413507950654567808f7a08d0b0b3b47cbd23 Signed-off-by: Hiroki Koga <hiroki@witz-inc.co.jp>
2019-05-17Fix: double free issuehalibut_7.99.1halibut/7.99.17.99.1Romain Forlot1-2/+0
handle is already freed during the active_diagnostic_request destruction. Bug-AGL: SPEC-2415 Change-Id: Ia26d5c9d2974ca34d411c3182b218141a84c8f21 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2019-02-06Add fake can data for dashboardzheng_wenlong1-0/+156
Add these fake can data. We want to modify dashboard, let is show more information. accelerator.pedal.position steering.wheel.angle transmission.gearinfo transmission.mode turnsignal.status lightstatus.brake parking.brake.status Change-Id: Ief9f29684f3463af0d0f98f1dd213b633d1889bb Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
2018-12-14Smalls improvementsRomain Forlot5-8/+21
- 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-14Simpler handling of binding subscriptionsRomain Forlot8-494/+474
Don't use a child class for subscription, only use one because there isn't other different subscriptions type to be implemented about now and if so then we could split again. Remove functions no longer useful and move afb events and afb subscriptions part to low-can-subscription Change-Id: Ie3e4255961ac557465098cdb48730098a950461a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-14Cleaning the code for now unused functionsRomain Forlot12-176/+23
Also formating and retabulating some comments Change-Id: I95eda93e78fabeb336ca02e94307364954ab2318 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-14CAN FD implementationRomain Forlot13-233/+187
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-22Rework writing CAN message on CAN buses.Romain Forlot1-79/+64
- Adds the possibility to use a custom encoder function - Use of wrap_json functions instead of raw json-c functions - Return the error informations in the request return. - Reduce conditionnal imbrication Bug-AGL: SPEC-1965 Change-Id: I766b3cf3e6998d03a8a2f3e51117e8b26fc9b56f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-11-22Use newly generated cpp file with default encodersRomain Forlot1-0/+1
Change-Id: I7bf15568a16e0c84c4f590ca07eba48ecd34157f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-11-22Handle several can_frame in a BCM messageRomain Forlot2-31/+2
Also clean an unused function Change-Id: I4faabf5a1af53da898ee70f2bc4b528acea3ded3 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-11-22Adjust "encoder" signature to fit cpp usageRomain Forlot1-2/+2
Adjust "encoder" signature to fit cpp usage like for the decoder functions. Change-Id: I5872c5e32fd69356124fefbc82fd1f77ab8acbf4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-11-22Code format and style changesRomain Forlot2-7/+7
Change-Id: Icfb7cdb53deba8d82b91f884c6b815adf0f17adf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-11-20Added afb-helpers submoduleRomain Forlot1-2/+3
Use the afb helpers lib to be able to use wrap_json functions. Change-Id: I3a66ac4eb7d80ff921de13a7e749311d33f0572e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-10-15Migration to binding v3Romain Forlot9-54/+50
Change-Id: I0bcccb15200064bd7d83edbf06c1e7202069189a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-08-23Cleaning, set up binding version in config.cmakeflounder_5.99.6flounder_5.99.5flounder_5.99.4flounder/5.99.6flounder/5.99.5flounder/5.99.45.99.65.99.55.99.4Romain Forlot3-46/+0
Change-Id: I2e8d89b09982c9f3770a5a3e10d281e0ad87651c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-27Updated examples files and default configurationRomain Forlot1-6/+6
Let use the new decoder's function and set some hvac signals as writable to be able to test this feature. Change-Id: I27e1c2be069b8bb55ed931ad1fb629aa2d4e5b86 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-25Remove generated files from git repoRomain Forlot1-130/+0
This files is generated by afb-genskel tools at build time. Having it in the repo could make some unwanted side effects. Change-Id: Ib5c6b010fe56245694fe267aca0548575b6e063b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-09Add testssandbox/excale/wipRomain Forlot2-51/+51
Create first tests to be used with afb-test binding The test binding is now found using pkg-config command. Change-Id: Ib1cd08236b6b8fab93ccb67ac613a9c83908d12e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-06Fix: correctly stop the binding.Romain Forlot2-2/+13
Automatically destroying C++ objects wasn't sufficient since it uses thread with locks that were waiting forever if there is no CAN bus activity. Now correctly wake-up the threads to ends them even if there without activity on the CAN bus. Change-Id: I69d74a34a8dbea4df7c8090aa47abf1c43133020 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-25Merge "Fixing typos made in comments"flounder_5.99.1flounder/5.99.15.99.1Jan-Simon Moeller16-74/+74
2018-05-24Fixing typos made in commentsydimitrov16-74/+74
This change set fixes the comments made by previous contributors v2: Fix line end v3: Making changes to comments as suggested by reviewers v4: Removing trailing spaces v5: Clearing small typo in low-can-cb.cpp on line 142 Change-Id: Ifbcfc3b2d131d1db0b25e472955b21e98cc09f45 Signed-off-by: ydimitrov <y.dimitrov.14@gmail.com>
2018-05-16Fix compilation warningRomain Forlot1-1/+1
Change-Id: I3ea7b3aa91d4251f90a4ccf5da83ae8de7a58db4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-04-17Detect engine state and use it during diagnostic messages subscriptionsJonathan Aillet3-3/+86
Get engine state recurringly by requesting a permanent diagnostic messages request. Use these information to warn that diagnostic request won't have any responses at the moment of subscription if engine is off. Bug-AGL: SPEC-1347 Change-Id: If8bd79bba89acd1c8f5452d3efdbf00a89f8cc77 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>