aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-cb.cpp
AgeCommit message (Collapse)AuthorFilesLines
2019-08-30Remove file socketcan-j1939 that was not removed beforeArthur Guyader1-0/+1
Bug-AGL : SPEC-2780 Change-Id: I4ddf9389faffebe0334b0004b69bb7336277c29d Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Add some typedef to reduce the size of the linesArthur Guyader1-11/+11
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-8/+24
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 Guyader1-35/+81
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 Guyader1-20/+20
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-30Only defined signals can be writtenArthur Guyader1-26/+59
This commits ensure that only known signals could be written using the binding's api. Before that you was able to wrote raw frames on the CAN bus without any checks if this was a known signals to the binding. Bug-AGL : SPEC-2779 Change-Id: Ied6680e926f2a9c221fee31d8fb78d2d39c41132 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-30Update function rx_filter_can for multi frame prevision.Arthur Guyader1-1/+1
This commit updates the functions rx_filter_can to anticipate the development of the multi-frame. Bug-AGL : SPEC-2779 Change-Id: I5f67cf84e5d3e47c75c588f8776ead92eb6c3c8e Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
2019-08-29Update function to encode and decode messageArthur Guyader1-1/+1
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-29Uniform indentation with tabulationArthur Guyader1-17/+17
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 Forlot1-2/+1
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 Guyader1-12/+80
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 Guyader1-29/+134
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-27Minor improvementsRomain Forlot1-2/+2
- 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-26Small fixes (include and pointer)Romain Forlot1-1/+1
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-26Add the possibility to subscribe an id or a pgnArthur Guyader1-21/+86
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 Forlot1-14/+14
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 Forlot1-5/+5
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-26Use subscription's sockets as shared_ptrRomain Forlot1-9/+13
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-26Implement a new socket type CAN for j1939 protocolArthur Guyader1-4/+4
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 Forlot1-1/+1
- 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 Forlot1-46/+39
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 Forlot1-3/+1
Also formating and retabulating some comments Change-Id: I95eda93e78fabeb336ca02e94307364954ab2318 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-12-14CAN FD implementationRomain Forlot1-33/+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-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-10-15Migration to binding v3Romain Forlot1-43/+40
Change-Id: I0bcccb15200064bd7d83edbf06c1e7202069189a 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 Moeller1-9/+9
2018-05-24Fixing typos made in commentsydimitrov1-9/+9
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 Aillet1-3/+28
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>
2018-04-17Add possibility to subscribe to a recurring request permanentlyJonathan Aillet1-8/+17
Add possibility to subscribe to a recurring request that won't be deleted when no subscriber is detected. For now, this functionnality is implemented for internal use only. Bug-AGL: SPEC-1347 Change-Id: I48f6f647677596ba7920c4348d5406ea7bf1081b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-03-15Change subscribed signals search to check filters as wellJonathan Aillet1-3/+2
When a new subscription is made, search in existing subscription for a combination of a signal and a filter instead of searching for just a signal. In this way, each subscription will receive signals according to their requesting filter. Bug-AGL: SPEC-1339 Change-Id: I22cb96a2dbaaf48dbd77025ff1610bde151b19b4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2017-11-30Fails write request if CAN signal not writableRomain Forlot1-1/+4
Change-Id: I8d75a232ba7fad9cc95f286e521c2451a3a29061 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-09-28Use afb_genskel tools to generate api definitionRomain Forlot1-1/+23
Generated files hand fixed because of usage of C++ which has to use c++ binding function afb::auth to add afb_auth struct Change-Id: I80ee9cb751cc813754c949d8746aec197da6d52f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-09-28Handle batched subscriptions in a JSON arrayRomain Forlot1-22/+30
Change-Id: I33ade46eaf022a5c7e7cf874f8b838a4a6827f87 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-09-01Add get() and list() APIYuichi Kusakabe1-0/+110
This patch is porting AMB get() and list() API. Change-Id: Ic1d391219f1d64ab127bc1977a5b198abe0fc94b Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
2017-09-01Fix can write API resultYuichi Kusakabe1-2/+2
write_raw_frame() and write_signal() return results. Change-Id: I3f6d03eaf02bde9ad02fd8de912c5816d249570f Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
2017-09-01Fix write CAN bus nameYuichi Kusakabe1-1/+1
This patch is low-can write device use /dev/dev-mapping device name. Change-Id: I165bdbd37a4e988b85f6ad7a669e6b1306957d45 Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
2017-08-09FormatRomain Forlot1-7/+28
Change-Id: I995fa8af8e8fc330f07b9609129723c09e0b13bf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-21FormatRomain Forlot1-1/+1
Change-Id: I036befbfb38b01d046d35a1364c28e0835dcbd41 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-21Check whether a signal is writable before sendingRomain Forlot1-3/+8
Change-Id: Id04d04a07e43738f7379e33fa7c6022eaa426343 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-21Split big function to several smallerRomain Forlot1-45/+73
Change-Id: I070fdafd51e789eb37b963a100b57cae9dff3e25 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-21Be able to write raw frame & encode value to sentRomain Forlot1-30/+64
Check whether the argument is a raw frame or a Signal + Value to encode then send. 1 new class to handle encoding part of a value as well as a new method for can_signal_t which return index of a map from its value. Change-Id: I288d2aeec28ce74c9ca35750db18557c9251e1df Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-21Create an auth verb to raise privilege of sessionRomain Forlot1-0/+6
Simply raise to a LOA of 1 the current session if asked Need to add some checks to not allow anyone raise its session must hold a specific permission urn:AGL:permission::platform:can:write to be able to authenticate. Change-Id: Id4e01ca20ba8437e97a64db682fdd3ebf45ce7b4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-21Implements new verbs to write on CAN busRomain Forlot1-0/+60
This will open a new BCM socket not dedicated to a subscription use to that mean. Change-Id: Idf353015f731e32d6eb7c7856bd73167c66e790f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-07-20Fix subscribe responseRomain Forlot1-1/+4
This patch is "No signal(s) found for %s." return value is ret = -1. Change-Id: Ia6f4f2db13beb7f9d3507d890383fc13cbddac0f Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
2017-07-04DAB RC3 Fixes follows appfw API break.Romain Forlot1-9/+9
Following functions now return 0 on success and negative value on failure : o afb_req_subcall o afb_req_subcall_sync o afb_service_call o afb_service_call_sync Verbosity macros used in v2 bindings now needs to be prefixed with AFB_ (ERROR -> AFB_ERROR) Change-Id: Ica4346f215bb142fcda0c6ea15e7074f7091f4cc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-22Add some reminder...Romain Forlot1-0/+1
Change-Id: Ifb81989c39f31f73ce7dc7dcbebfc6039f6a6a47 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-20Separation Generator to a dedicated repoRomain Forlot1-0/+358
Change-Id: Id94831651c3266861435272a6e36c7884bef2c45 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>