summaryrefslogtreecommitdiffstats
path: root/src/can
AgeCommit message (Collapse)AuthorFilesLines
2017-04-11Fix: Empty every queue before unlock mutex.Romain Forlot1-18/+25
Make sure that we finish to process every message in queue before refill them cause' CAN read run faster than decoding and pushing event. So it's a try to get all message processed. Change-Id: Idce2bc4d79920adc2bf478177c4e3defed39867b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Erase compilation WARNING.Romain Forlot3-8/+2
Useless tests and type cast about numbers. Change-Id: I6fe13b7dfec8529520730f83e83d2dd3da3a674c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-20Fix: Avoid segfault if diagnostic bus isn't correctly set.Romain Forlot1-0/+3
There is a segfault when binding configuration doesn't matches configuration generated. Improve general CAN bus device initialization. Change-Id: I17ea94ee54841d09ac63a7ffad303a88d99e0173 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-17Comments fixes, typo and formating.Romain Forlot9-412/+397
No more warning when generate the docs and all comments follow the same formating. Change-Id: I80d4c5c2d64401c2e53a550c60155680c4f968ce Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: decoded name will be prefixed as at subscription.Romain Forlot1-1/+1
Reason is that the simple message is used to match a subscribed signals in the map. So it has to be the same that at the subscription. Change-Id: Ie9504583948027523a7288b5e4a20707c49b6d59 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Include cleaningRomain Forlot6-7/+7
Change-Id: I5df96540400b833e684001f8fc5fa33ff1892bae Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Adding missing doxygen comments.Romain Forlot2-6/+38
Made some cleaning about unused things or obsolete. Review existing comments, adding missing comments. Reformat some long long constructor. Change-Id: Ibae247d1295a7a85b49d0ecee473022755d42b8b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Use index number between objects to set their links.Romain Forlot4-22/+69
Needed to use generator. Change-Id: I82b44fa1e53c55e2cd90ae7017906a22b7f0636e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2017-03-16Fix commentsRomain Forlot1-2/+1
Change-Id: Ia838d06885bc95196c5afc3668c0b028cb0f2763 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Follow rename operation in CMakeLists.txtRomain Forlot3-3/+3
Rename has been made with filter-branch using utility git-mv-with-history, so file history follow the rename operation. This is a commit to fix include and CMake file. Change-Id: I8542c7def3143854a2008fa069dd3232f2497394 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Small fixesRomain Forlot1-1/+0
Align frequency type to float and removed useless code. Change-Id: I13d9407808c42ece0d3fd761351752ad661e01e0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Finalization of decoding part of diagnostic messages.Romain Forlot2-31/+10
Diagnostic request must have a name to be subscribed. Else, we can't decode or event push for now. Change-Id: I0901a71da31320d8598e512614437aceb552713d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Make available decoding OBD2 messages method to be use as callback.Romain Forlot2-0/+22
Change the method to static 'cause it will be call from outside of the class. Change-Id: I88dcd845559fac7892cd489cd6e8198c143ee2a8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Simplification of checking Diagnostic response.Romain Forlot1-1/+1
A CAN message will be considered as a Diagnostic response when its arbitration ID is between standardized 0x7E8 and 0x7EF. Checking which request belong to that response will done in later methods Change-Id: I7a093edf44b62a4552b90fe3d8935f94dc677cf4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Improve memory allocation about Signal states.Romain Forlot3-10/+10
Returning to Signal states map avoiding hole in vector allocation as we did not know how many state a Signal can takes. So a map may be a better choice Will see. Change-Id: Ie3ccdbd31296c5c0ebaefc109e75f2e0cde03756 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Revert accessing CAN device with a map indexing on dev nameRomain Forlot5-16/+36
Main reason for that behavior revert is because of generator that rely on CAN device name and so we have point on these object by specify the device name. Instead of shared pointer between objects, instead binding is based on device name. With a device name you can get the shared pointer on it using new static method from can_bus_t object. Change-Id: I331e0ad8d03c88a15c697d12a9fce3699b0cd962 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Search signals against name not generic_name. It's madeRomain Forlot1-1/+1
to get able to get difference between classic CAN messages and diagnostic messages based on name signals prefix. Change-Id: I696facc58f38150e0457d519dcabffba750a8db3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Improve Doxygen comments and formating.Romain Forlot8-173/+189
Change-Id: Ia39e78aca00a49c7cee5e42d26ba1ef2b49d3709 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Improve: DEBUG messages.Romain Forlot1-1/+1
Change-Id: Ib52f22e7bc5bc5d14edbb31ad6006caee23c4098 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Make decoder systematic use of openxc-utils to buildRomain Forlot1-12/+5
its objects. We don't want random initialization on boolean value of openxc_DynamicField (has_string, has_numeric...) else we have a risk that the final decoded and convert into json object will not be the good one. Change-Id: If4d69e6ace615fd8e097ba9a04e5482c82b9a7db Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Implement signals states decoder and change mapRomain Forlot4-23/+26
to a vector. Change-Id: I185724f2966fecac6659d401751da56d2886ed9d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Search into generic_name as well as name + prefix, butRomain Forlot1-1/+1
always register generic_name into subscribed_signals. It will be the output on event and make easier to find the subscribed signals into the map without prefix. Change-Id: Iaf0060bedb54003b0c77121afd2bd35d832dba25 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Adding/Fix classes constructors to make them correspondRomain Forlot2-0/+13
to the ones generated. Change-Id: I6b0b778f59ac52fe66e36a327f60ae58550ac271 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Separation of classes in the same file.Romain Forlot4-64/+86
Change-Id: Ifc690cc27028659ffaf5a8a2e9caabc1e0718fd4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Move member from obd2_signals_t class toRomain Forlot1-1/+1
active_diagnostic_request_t (adr)class. It's more logical to have them here as call about incoming diagnostic CAN messages are made against adr class not obd2_signal_t that it's a subset of diagnostic messages. It's made to handle obd2 requests as well as normal UDS diagnostic request for constructor proprietary diagnostic signals. Change-Id: I96c714640d6ecfa25dfc9942974057c1797eb0e1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Get decoding diagnostic request from decoding thread of can_bus_tRomain Forlot4-31/+101
Decoding divided in 2 subfunctions dedicated to decode either pure CAN messages or diagnostic (obd2) message. About now, a diagnostic request has a name then it will be pushed on the event_queue as a SimpleMessage. Without name full details of diagnostic response will be pushed as diagnostic response. This behavior follows the one from OpenXC. Change-Id: I255f3f6487fa9511ea47c74606014995a7b0f720 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Change the way to check signal type making prefix_Romain Forlot2-1/+3
attribute as static with a static class method which will check that the beginning of string argument matches the prefix. Change-Id: Idb129c7179391da61447996560957b2791aa9383 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: set to microsecond frequency check of diag requestRomain Forlot1-5/+0
Change-Id: I871ff68afd7f398d4c7d3a550c8926c1f7e67cb3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16fix: test for opened CAN socket.Romain Forlot1-5/+5
Change-Id: If9e3a0511c7ccc703817069a56bd38d7e64ebb09 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Default value about thread state set at false.Romain Forlot3-13/+4
Change-Id: I1934aa4d9a9d945a32d8e369cf0f36b1e06d3f34 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: wrong location to make the increment because we useRomain Forlot1-1/+1
the device after so... This was total crap ! Change-Id: I9bb43c3f75c613a5927f342b3c574871c0eb65bb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Make diagnostic manager initialization processus.Romain Forlot2-8/+8
It is initiliazed with by default the first CAN bus device in the CAN bus device list from CAN bus manager. The object is instancied at configuration_t object first invokation and after all CAN buses has been initialized then the diag manager is initialized too. Change-Id: I4894f2c62f575676c34efec3608b97de8c5326e1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16We doesn't modify member once getted, we can use const returnRomain Forlot2-4/+10
and const method. Change-Id: I0f7465af74b1c9a546af45a0d1eea33c93537e0c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Manage prefix on CAN and OBD2 prefix. Searching signalsRomain Forlot3-2/+16
is made on generic_name (without prefix) and returned vector of string is filled with name with prefix. Then you can process on them based upon their name differently. OBD2 signals will generated recurring request on diagnostic manager and decoding will not be handled the same way too. Change-Id: I2c5239ef49661941a0a748debe0bd536b2954b3a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Instead of a global pointer, config is now a Singleton.Romain Forlot1-2/+2
Change-Id: I0cfc34f330c531ba5f070542a1cb723be4bcc70a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Also initialize the id_ renamed address_ member. This memberRomain Forlot3-7/+6
is mapped to the address node from json Change-Id: Ied13067723552c2396337a9f85fe5e1418ba8caf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Adding needed getter for diagnostic manager. UsefulRomain Forlot2-0/+7
to determine if both object use the same CAN bus device Change-Id: I97dbf807198a420c305c8fbbd2cb4bfcdda4c294 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: include statement with wrong path.Romain Forlot5-14/+14
And minor fixes. Change-Id: Ica55c0708edd86d0aa37e7117b3c3fad551a0167 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16separation to a new file of can_message_set_tLoïc Collignon3-21/+84
Change-Id: If21021d8905d40d443d4432faeb38f8a3275697c Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2017-03-16Change FrequencyClock struct to class and rename it.Romain Forlot3-4/+4
Change-Id: I1076ad90e14815f3d0ab71ca9fa359d1d3c1748d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: wrong tested variable for socket.Romain Forlot1-2/+3
Change-Id: Ice2325441474f1a075140e13dfffa0261106dff7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16C Header firstRomain Forlot1-1/+1
Change-Id: Ief8c66e99c689a362b645ad3b918d8b342ada59a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Add necessary to be able to initialize diagnostic manager shims.Romain Forlot2-6/+6
We have to conform to functions signatures from isotp-c to have it working. Change-Id: I429def66f54e53277e87aa99e66292cdb47c1c5f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: bugs in class due to the wrapping of C socketRomain Forlot2-7/+8
into a class. Added missing include and adjust methods signature. Change-Id: Id016b452e0b641a14482c288e4713acae941ee1d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16typoRomain Forlot1-1/+1
Change-Id: I62d9e858409b464dd69ebfae76ca73097fae560e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: include path (where I think to fix them...)Romain Forlot1-6/+7
Change-Id: Ib44693efc9347fc4fdf40a1748725d5191303199 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Move some functions to configuration class.Romain Forlot2-25/+0
Change-Id: I87b1b6961206ae3848cf6aca367698218fe1523e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Create getter/setter needed for can_signal_t class.Romain Forlot3-12/+117
Change-Id: I8253fcbe7edb6673d9f6bcf85d6109800a4cf6e8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: used new created classes.Romain Forlot1-1/+1
Change-Id: Ib0188ac952f64b3bc2203c0310a21de380c75854 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Added a static method to get used by Diagnostic managerRomain Forlot2-0/+32
that respect the requested signature. Change-Id: Id10215597d65ecaf280fe6252d78bc74a306958e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>