summaryrefslogtreecommitdiffstats
path: root/src/low-can-binding.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-03-20Make error goes back to the subscribed clients when unsupported.Romain Forlot1-1/+0
Change-Id: Ic864803c8dffdab3cc9bf5bf281ce032600a732f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-20Fix: Avoid segfault if diagnostic bus isn't correctly set.Romain Forlot1-5/+7
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-19Fix bad handling unsupported OBD2 messages subscription.Romain Forlot1-2/+3
Testing supported boolean wrong and gave a null pointer to a function that doesn't check the pointer validity. Change-Id: I49e88a68f266546dbd257b0fdade860cead1322d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-17Comments fixes, typo and formating.Romain Forlot1-22/+20
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-16Include cleaningRomain Forlot1-0/+1
Change-Id: I5df96540400b833e684001f8fc5fa33ff1892bae Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Adding missing doxygen comments.Romain Forlot1-2/+2
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-16Implement check of supported diagnostic PID.Romain Forlot1-1/+6
Supported boolean member about diagnostic messages is now used. When a response is received, completed but not successful, then set the diagnostic message as not supported and clean the request from the queue. Subscription remains for now, not cool but will be fix soon. Change-Id: Ia5dc78d4a770f80f144724f4df6eabd2ffd4b8cc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Improve commentsRomain Forlot1-2/+2
Change-Id: I1e43b0aeaff738db11695e77fee23e8c9809f0c1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Make unsubscription works with diagnostic message too.Romain Forlot1-11/+20
Now unsubscription really make unsubscription and stop polling diagnostic request. Change-Id: I31830c7af97506e1231fb5f1244c350520a2df29 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Follow rename operation in CMakeLists.txtRomain Forlot1-1/+1
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-16Rename class and 1:1 map to JSON description fileRomain Forlot1-5/+5
Added decoder and callback member that will be set by generator and taken at submission to be used later, storing them into an active diagnostic request instance, when response CAN message comes in. Change-Id: I9ded05de3bb28ec55e4e007d72d0e1924141a6a6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Revert accessing CAN device with a map indexing on dev nameRomain Forlot1-1/+1
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-16Improve logging messages and change string conversion to charRomain Forlot1-5/+5
for the needed case. They were some inversion between needs of char variable and string. Fix: don't add diagnostic request if it is an unsubscrition operation. Change-Id: I1acedc413e7c5fe57da86812faf8d3c83d13c405 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Move diagnostic requests scheduling to diagnostic managerRomain Forlot1-7/+0
while adding the request. It is more logic to make that here than in the subscription operation. Change-Id: I19b29bc11c5fb6e5828a0bf189fac1333b0199ed Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Enabling recurrent check of diagnostic requests.Romain Forlot1-0/+1
Change-Id: I16aff65c5ce22faac78e3f1d99ce7b33941c007c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Improve Doxygen comments and formating.Romain Forlot1-3/+3
Change-Id: Ia39e78aca00a49c7cee5e42d26ba1ef2b49d3709 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: return before initialization of diagnostic manager.Romain Forlot1-4/+2
Change-Id: I8485dec1ec5bb5dbea7edf4d9ac3a7d800b567b2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Move member from obd2_signals_t class toRomain Forlot1-4/+5
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-16Change the way to check signal type making prefix_Romain Forlot1-3/+1
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-1/+3
Change-Id: I871ff68afd7f398d4c7d3a550c8926c1f7e67cb3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Keep subscription to signal simplier without doublingRomain Forlot1-45/+8
functions dedicated to different signal type as they aren't so much difference between. Change-Id: Ic2090c2d755136183dfc08a9b84efa3388d3747b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Missing include header and code reordering and cleaning.Romain Forlot1-0/+2
Change-Id: I37b2b2b439bb72d2230d606b9ddd52c3eb08ea8f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Implemente way to send diagnostic request when subscribed.Romain Forlot1-3/+56
When subscribed, the signal is added to recurring request list of diagnostic manager and an event is added to the systemd event loop with timer set using frequency parameter from the requested signal. Change-Id: I4d604c498047d7744c090b7f03fce0f2b427fd01 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Use of signals prefix to be able to distinguish type ofRomain Forlot1-0/+4
messages to be processed. For now, processing prefix is hardcoded but idea is to process them dynamically if possible. To be studied. Change-Id: Iac0c96228fc5f53e3c637e54350188ff3de6d57f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Make diagnostic manager initialization processus.Romain Forlot1-1/+5
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 Forlot1-0/+1
and const method. Change-Id: I0f7465af74b1c9a546af45a0d1eea33c93537e0c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Instead of a global pointer, config is now a Singleton.Romain Forlot1-4/+1
Change-Id: I0cfc34f330c531ba5f070542a1cb723be4bcc70a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Change all old struct name to the new class.Romain Forlot1-2/+2
Change-Id: I8aa4430117c401182ef458a06a2aeb08957db1bb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Move "config" variable as global.Romain Forlot1-0/+1
Change-Id: I1760dce5ef5836c9392837f4a196382ee88dabd8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> Conflicts: src/configuration.hpp
2017-03-16Fix: wrong assignement of can_bus_t object.Romain Forlot1-1/+1
Fix: const function added by mistake. Change-Id: I69dc19922c9e48fc073f1a3e00dd243188110971 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Miss removed header file includeRomain Forlot1-0/+5
Change-Id: Iea45260ff78fadced7c9eb3ccefbc05341be25e4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Make a global variable to a configuration object.Romain Forlot1-4/+4
With afb interface, it will be the last global variable needed as it regroup all needed stuff to other class and functions. Change-Id: I3d82b6f748ff22a9a975d15ab9df51f63005737f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Added a warning that it is an example codeRomain Forlot1-5/+1
Change-Id: Ib66e49960a348896020fba56f7d98910623af83f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Beginning of work of get central configuration objectRomain Forlot1-11/+5
that will be used by the binding to access generated elements. It will hold generated structure/objects and make a resume to the binding configuration. Idea is to have an object that can be inherited in the generated code to extend its functionnalities or change some of its behoviors. Change-Id: If2ce5cbe2eb98a74a8e3f13000ee02855674216f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: typo, and dirty fix to get compiled ftm.Romain Forlot1-2/+4
Change-Id: I74042051346a0f0f4de7152e2a668c041edaebde Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: typoRomain Forlot1-1/+1
Change-Id: I882595f4a0f28c60b12f8c6ed0bff11a80af29af Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Finalize new directories organization.Romain Forlot1-6/+6
Change include statements and CMakeLists.txt accordingly to the new layout. Change-Id: Ief0821f7f6636b072cf26c7d8d8fcc16fe43ab01 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Beginning of work on obd2 object andRomain Forlot1-9/+9
files reorganization. Change-Id: Idaa7ad05c45d734ce771506fd6e41f1a09a6ac66 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-06Change way to find signals to make it a little bit more generic.Romain Forlot1-48/+26
Now we have basically 3 functions : - one for subscription which return signal name into a vector - one to find from CanSignal vector - a last to find from Obd2Pid vector Name of some function has been changed. May be reworked later. Change-Id: Ie72969fd20503fc1f9291958dc2ac5d827a6be59 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-03change all genericName to generic_name. Now allRomain Forlot1-6/+6
objects use the same variable name Change-Id: I8a232bc8fd7e580bd8088e6b2ae7a90666ef9c62 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-02Fix: multiple subscription and maintain subscribed_signals coherenceRomain Forlot1-13/+28
across usage. - Transmission of a reference instead of copy. - Don't use anymore iterator on subscribed_signals map Change-Id: I5e5b7b0bb8598be3bb0ec59c29418ee937ddcc9e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-01Fix: subscription and improve code readabiltyRomain Forlot1-16/+12
There was probleme between char and string conversion. Also, I get rid of iterator and use direct access using operator[]. Change-Id: I235ef0dd3ef9d9cebb624491d86383392e9eb8d8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-28Fix: can bus object life is now expanded and don'tRomain Forlot1-3/+5
die prematuraly. can_bus_handler object is now a pointer living forever. can_bus_dev_t object is now stored as a shared pointer into a variable member into can_bus_t. So everyone survive now. Change-Id: I52768dd7fe3c203a5f679f59afd1bcf330f3af35 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-28Re-arranging objects splitting all objects overRomain Forlot1-1/+2
separated files. Change-Id: Ifbdb2ea08704324e505a48ba3124df6f2af63c6b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-27Fix: wrong conf file name specifiedRomain Forlot1-3/+3
Comestic change about binding description and prefix Change-Id: Iffb3e0d13a81461db0f1300674c4fef3a6bde34f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-27In class mutex and condition variable except for subscribed_signals mapRomain Forlot1-1/+1
For now... Change-Id: I133deb39fcd0660064b3b3c2a52f86ad37cb29c2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-24Improve mutex lock logic.Romain Forlot1-15/+5
- Use of bracket instead of unlock method - Change some mutex lock scope. - Added subscribed_signals map object mutex to manipulate it safely. Change-Id: I770c0b5701db6b1151511f7360ec31ae6dcc1de9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-24Remove socket read management by systemd eventRomain Forlot1-28/+0
loop and use classic thread with a blocking read Change-Id: Iac5428009b57c727bb32bd4893bc3fe282ba35c7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-24Improve subscription/unsubscription operation.Romain Forlot1-32/+44
Break operations into 2 new functions to improve readability and added some comments too. Change-Id: I405622ef17787cb39d8d2b2530a2d6572ce4e366 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-02-24Fix mutex about can_frame. Wrong location aboutRomain Forlot1-2/+4
can frame mutex and adding around can socket init. Change-Id: I90c2200abf517ad4a9660c99a3ca02e52e069374 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>