aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-06-07Fix: exception unsubscribe all at startRomain Forlot1-1/+1
When unsubscribing but no diagnostic subscription made there is an exception when cleaning empty requests vector. Change-Id: I40bdd01969fd1a1c6fecb0a438c46d0df584de83 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-02Remove pointer generator that make memory leaks.Romain Forlot1-5/+5
Only have 1 place where to generate a pointer from a DiagnosticRequest is in low-can-cb.cpp when subscribing. Else now using reference instead of raw pointer. Change-Id: I7fd2f3d30afa90017b945e6b711922036123b6d3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-02Get diag manager's socket into subscription objRomain Forlot1-80/+6
Subscription index map is the socket ID which implies the following: - All diagnostic messages subscriptions are stored into a vector holding diagnostic_message and there is 1 socket for all like the diag manager did. - Reworked workflow to open a BCM socket and adding an RX filter more flexible. - Separated methods to handle on_no_clients event. - Cleaning diagnostic manager code to remove all unneeded stuff now. - Embed diagnostic response in VehicleMessage decoded message to be able transmits the PID in event push thread. This is needed by to correctly handle case when there is no clients subscribed to an AFB event. Else we can't find the diagnostic message to remove from low_can_subscription vector. Change-Id: Iab13fd556cda3c69827bcd67f3a23a03cb6a2cf2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Better handling of duplicate non recurring requestRomain Forlot1-1/+2
Change-Id: Ib6015d5dac66751622f3e287429475b6b708c3d5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Delete pointer and content, possible memory leakRomain Forlot1-0/+5
Change-Id: I21e65bcaaa444c03bbc634f1d437e6ff363623b6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Fix: Frequency filter doesn't apply on diagnosticRomain Forlot1-5/+5
As socket isn't managed by low_can_susbcription yet, create_rx_filter was just using signal frequency setting. Now, it take the frequency asked in argument if provided. Change-Id: If44458b2b0e34df44337670dd9a5b2b58324bfbe Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01FormatRomain Forlot1-1/+0
Change-Id: Ib3f8f0c8cbffaf7b5d1acb8c4541526dad03a9c9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Rename method to have same everywhereRomain Forlot1-2/+2
Change-Id: I80ceeada376d46f2cfcac259ed86239cc74ea05c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Renaming configuration to applicationRomain Forlot1-4/+4
It is more accurate to name it application because all its members aren't modifiable at runtime (without talking of last_value_ member and few others). Change-Id: Ica0d33dfd9c26cfdea019c2f41ed07777fb36d39 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-24Close diagnostic manager socket if there isn't any requestsRomain Forlot1-3/+19
No need to listen diagnostic responses if there isn't any subscriptions. Change-Id: I7fa48dbc3e8fb1847b8186337fe2813625894406 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-24Fix memory leaksRomain Forlot1-0/+2
Change-Id: I4a33b6d5f1f3b73af113aff62b024329b0ed5288 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-23Static code review fixes.Romain Forlot1-6/+4
Several style errors and mistakes mostly on constructor and passing arguments as ref. Change-Id: I2ca921d6aa70b9074392bb7779ade35bebf7bd8d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-22Logical bus name mapped to device name using conf file.Romain Forlot1-3/+9
Store CAN device map without prefixed section name and add methods to get the mapped device name. Change-Id: I03ebc175c67b2251016863b0d69a45a816a81d25 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Added timestamp to received CAN messagesRomain Forlot1-1/+2
and store into frequency_clock_t. Change-Id: If209070298bd9df49297fdcbed554770e1bc0e4a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Make and use a single function to read incoming CAN messagesRomain Forlot1-11/+1
Change-Id: I5d3f2a8628ace464ad25989346cc76682c591bd8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Cleaning unused code diagnostic parts.Romain Forlot1-38/+1
Change-Id: I5df50557132ebe593818a7aa4644b8a0161c51a5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Fix: be able to receive new response from OBD2 requests.Romain Forlot1-1/+1
Change-Id: Iab309e313f63beb4b56bc824ece1b3a5e42ae508 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Fix: CAN message transmitted filled of zero.Romain Forlot1-0/+1
can_dlc field was set to 0 and is evaluated so BCM assumes there is no data to transmit. It is mandatory to set it. Change-Id: I1e29ff4248a49212d3fee22c3a0cc77f5b699fd7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Fix: listening on broadcast CAN ID.Romain Forlot1-1/+1
Wrong test about CAN ID, it isn't the response ID that is passed as argument but the broadcast. Little mistake... Change-Id: I2622c23356802c3108dbf8e6ede07456294834ee Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Implement canceling with BCM socket leads to close it.Romain Forlot1-17/+1
Change-Id: Ibcc1419caba7e1b04dbe652a6c60c393f14a8145 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Adding also diagnostic request to systemd event loopRomain Forlot1-4/+18
As for CAN signal, monitoring diagnostic request messages is now handled by systemD io event loop. Socket reading is common for all OBD2 signals and handled by the diagnostic manager. systemd callback function lies in binding callback which in turns call read_socket method of diagnostic manager. Processing is little bit different from classic CAN messages so it is a separate callback function. Lot of cleaning to do now... Change-Id: I4d2ada0beb5d3348736dfdf3c56a7cb875a1c6c7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19There is no more need having pointer on socket deviceRomain Forlot1-1/+5
Return bus name string. Change-Id: I0e7f4171c3d1052cb6425cd5b93e5a593d7d277f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Simplify testing name size...Romain Forlot1-1/+1
Change-Id: I3daa11b329f2e38efba5a52c2106bddd3b759f86 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Reworking diagnostic manager to use BCM sockets.Romain Forlot1-97/+110
Use 2 sockets: - TX sockets on active_diagnostic_request class as we need X sockets using the same CAN ID "7DF" with different timing settings - RX socket on diagnostic_manager object as we need to read the same CAN ID and process them the same way, there isn't so much need to split them. Change-Id: I7338fd751a033a1d0e8912ee554e2c72c43961c3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-04Follow the moving binding and configuration files.Romain Forlot1-1/+1
Change include statement to refer the correct new path to the files. Also change CMakeLists.txt. Change-Id: I66a0bccab02e9fce10072a275a6580d61b4ddfbe Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-24Misc: Cleanup, typo, formating and comments update.Romain Forlot1-6/+1
Change-Id: Icac565b9a3a80dc05a1a3470a35e223c8c564347 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-22Improve logging messagesRomain Forlot1-19/+19
Added for all log messages function name at beginning using __FUNCTION__ macro. Change-Id: Ia0f476ca81b9f79c6d49b425c0520894c59797ea Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-21Move all signals search functions into new signals_manager_t objectRomain Forlot1-3/+4
Create a class from signals lookup and find standalone function and gather all find function into it. There is now only 1 function to find either CAN signals or diagnostic messages, results are returned using an ad-hoc struct containing vector of one or the other type pointers. This object also hold subscribed_signals map with events, so this class is a singleton. Change-Id: I3584c6a91201e6904edc6aeac0abfa1785bdeccc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-14Change directory architecture to use 2 separated projects.Romain Forlot1-0/+618
Each projects, binder and generator, has to be compiled separatly. CAN-binder will host high and low level binding CAN-config-generator only the generator used for low level binding. build.sh script just launch both build in their respective dir. Change-Id: Ic77932660fcca507b23a631d4e4e790f608880ae Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>