summaryrefslogtreecommitdiffstats
path: root/src/diagnostic/diagnostic-manager.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-04-11Handle project new architecture using new CMakeFileRomain Forlot1-618/+0
Change-Id: I672a9b49d9d5a3953ba6dccaafbbd738839f64a6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> # Conflicts: # low-can-binding/libs/bitfield-c # low-can-binding/libs/isotp-c # low-can-binding/libs/openxc-message-format
2017-04-11Fix: wrong period operation without unit multiplicatorRomain Forlot1-1/+1
Possible divsion by 0. Don't know if it is good to keep different time unit instead having one unit for project... Change-Id: I73cfc1ab72d3420d337f10a9b79bdf305a3a2bc7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Handle simultaneous subscription to diagnostic messages.Romain Forlot1-6/+13
Delay new recurring requests if there are already existing in flight and cleanup active request to correctly set in_flight_ flag to false else new request can't be launched as there is always an old one considered running... Modify a little bit DEBUG message and cleanup useless code. Change-Id: I39f865bbc6d00188d3cddd1d81437b9e3ca51269 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Fix: unsubscription to diagnostic messages.Romain Forlot1-1/+1
Unsubscriptions weren't managed anymore since we handle supported flag in diagnostic messages. Now it's back, unsubscription against appfw is done as well as canceling recurring active diagnostic request. Change-Id: I22ebba771646624cb323e72dd7bf21027b6c6ba7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Get recurring requests suspend proof.Romain Forlot1-2/+2
Change to CLOCK_BOOTTIME instead of CLOCK_MONOTONIC Change-Id: Iaa1a65a80e3aaa8e622ea1e3eb4b6a36b4dcd225 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Improve detail in DEBUG message at recurring request submissionRomain Forlot1-3/+7
Change-Id: I93d0cbcae8e2cdf1144ffd981c93a109682c1685 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Erase compilation WARNING.Romain Forlot1-3/+3
Useless tests and type cast about numbers. Change-Id: I6fe13b7dfec8529520730f83e83d2dd3da3a674c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Fix: wrong pointer validity check...Romain Forlot1-1/+1
Change-Id: Ia47159fb18797681fb1dd132be5173e167d8850b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-11Fix: don't clean recurring request except if forcedRomain Forlot1-4/+3
Change-Id: I669fc1f0b078e151dfb0cbb17c3d626bb43930d2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-23Comments.Romain Forlot1-1/+2
Point to branch v1.0 instead of master Change-Id: I70b6b0e35dbbdd78840fda893c6028b2e3975afc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-23Max in flight requests set to 8Romain Forlot1-0/+10
Change-Id: If2acf83a0f01741c90cab15e10188b2aeffd88b3
2017-03-23Send diag request only if not other one with some id runningRomain Forlot1-19/+19
Fix: elapsed function return that do not compute elapsed_time at first time Fix: reworked should_send() to get it work with our scheduling workflow Reschedule trying to send request if recurring even it is in flight. Change-Id: Idce54cb9bf62616c891a8a25a6c478f931350bc7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-20Make error goes back to the subscribed clients when unsupported.Romain Forlot1-0/+1
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/+14
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-1/+1
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-4/+4
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-16Diagnostic requests will occur depending on their frequency.Romain Forlot1-1/+1
Hardcoded offset was for testing purpose, now we can use frequency offset. Change-Id: I920e61cd8f587ead9c77aec158edb4dee28b927d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Wrong error handling when fire diagnostic request.Romain Forlot1-6/+4
As returned code was negative value the sd_event_source stopped considering that was an error. If statement was to check that sd_event_set_enabled was ok, so unref and return wasn't at the right location... Change-Id: I91cc943c20af80a31b4f66f5714ccef93c0fdbd2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Include cleaningRomain Forlot1-1/+0
Change-Id: I5df96540400b833e684001f8fc5fa33ff1892bae Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Adding missing doxygen comments.Romain Forlot1-49/+189
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/+11
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-0/+1
Change-Id: I1e43b0aeaff738db11695e77fee23e8c9809f0c1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Finalization of decoding part of diagnostic messages.Romain Forlot1-32/+84
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-16Simplification of checking Diagnostic response.Romain Forlot1-23/+15
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-16Revert accessing CAN device with a map indexing on dev nameRomain Forlot1-7/+7
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 shims_logger function to get full details.Romain Forlot1-3/+8
Change-Id: I752db65cb3fbca4d33b932f3a0c597adfaf79903 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Get recurring requests works.Romain Forlot1-38/+33
Implements event_loop logic. Change-Id: Ia5ac32820a0421bbcb69d8b0dd3bea2b7b582444 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Simplification of diagnostic manager. Delete uneeded vectorRomain Forlot1-39/+20
Control size manually, don't rely on STL container. Change-Id: Iede2f9b233c5b8a6dc77c9b146ffc92da8e7a989 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Less control before process the CAN message.Romain Forlot1-6/+5
Change-Id: I341d29d217b2a92652e9985d8c93829e0211bddc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Implement regular event launching using systemd event loopRomain Forlot1-11/+16
Regular events is made launch a timerfd event from binder event loop and then in the event handler, reschedule next launch in the future based upon the signal frequency. Change-Id: I0b1e84eb2135474f4bcc5ee256ba513eea4035a6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Move diagnostic requests scheduling to diagnostic managerRomain Forlot1-1/+22
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-16Fix: Initialization and entries flowRomain Forlot1-8/+11
between diagnostic manager vector. Change-Id: I9ea196b5dc5bbf2dd4509080a9a58d754fa42b6c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Get decoding diagnostic request from decoding thread of can_bus_tRomain Forlot1-0/+57
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 method returned value. Needed with send_request()Romain Forlot1-8/+6
method to retrieve the active_diagnostic_request. Change-Id: Icfba704e40be211021dc81ec18fa3602d736afdb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Implemente way to send diagnostic request when subscribed.Romain Forlot1-0/+54
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-16Make diagnostic manager initialization processus.Romain Forlot1-27/+34
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-16Instead of a global pointer, config is now a Singleton.Romain Forlot1-1/+1
Change-Id: I0cfc34f330c531ba5f070542a1cb723be4bcc70a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Keep raw pointer for now as we have to move them around vector.Romain Forlot1-43/+57
Change-Id: I8a518540b54552d60c6fd1054a0fc41dda5400b4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Finalize the class active_diag... to get it compile.Romain Forlot1-5/+5
Fix subsequents bugs into the other depending class diagnostic manager Change-Id: I8920c489fc15a61a36ff29d58aab59c2e6388f85 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Adding requests to diagnostic manager implemented.Romain Forlot1-10/+204
Needed overload of operator and constructor set for active_diagnostic_message_t class. Without we can't make the basic operation needed by the manager. Get rid of original raw pointer on "entry" which avoid some tests. It miss the acceptance filters implementations for now. Change-Id: I1ca61ff843c13255af6d9a60ce72a8b8bc9d1c18 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Fix: include statement with wrong path.Romain Forlot1-2/+5
And minor fixes. Change-Id: Ica55c0708edd86d0aa37e7117b3c3fad551a0167 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Added constructor to get vector initialized with defaultRomain Forlot1-1/+3
objects initialized that can be grabed after at runtime. Don't know the impact on performance for now about maximum limit. Change-Id: I220614d479b8254ae0efda66380e96434bcbfbb2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Add necessary to be able to initialize diagnostic manager shims.Romain Forlot1-2/+13
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-16Changing to a raw pointer can_bus_dev member and addRomain Forlot1-1/+4
a default constructor. It is needed to initialize configuration_t correctly as it allocate a diagnostic manager but do not initialize it unless it is needed later. There is no need to initialize it if we do not send and receive diagnostic requests. Change-Id: I3d52d1ea92454e7b065479a2f0dd54a291ddd991 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Respect the signature requested by uds-c lib.Romain Forlot1-1/+1
Change-Id: I7d7a96b45323f698e884c4db289370eec199d990 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-03-16Introducing diagnostic manager class.Romain Forlot1-0/+43
It will hold communication through uds-c lib allowing to communication with diagnostic protocol obd2. It is attached to can_bus_dev_t class 'cause it must regularly send CAN message through it. Change-Id: I2d9d8dfaca10e9865bf82b0ae83e65490ca982f8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>