summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils
AgeCommit message (Collapse)AuthorFilesLines
2017-06-09Migration to AFB Binding V2Romain Forlot5-15/+15
No more binder interface needed to use logging macros and others stuff like make_event or any other calls Change-Id: Iaee60697373bc8a0e67518e924b36b5389533e68 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-09Comments, Cleanup, formatRomain Forlot4-1/+11
Change-Id: I9f032cc232e77ce73e889a1656f1ad86cfdec774 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-07Add some useful DEBUG information for read framesRomain Forlot1-2/+3
Change-Id: I026111942b4b8486b46f56d5fc92fcebde4dc91f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-07Separate low_can_subscription class from callbacksRomain Forlot1-1/+1
Change-Id: I682cacca1af53f898ac4c428f823562c50e7cce4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-02Get diag manager's socket into subscription objRomain Forlot1-8/+3
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-01Fix warning compileRomain Forlot1-3/+6
Change-Id: Id0f088f030c0a23b4347c4886a3d756538cbb651 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Methods to ease access to DynamicField membersRomain Forlot2-0/+23
Change-Id: I8974827340e3faf60a511900cbdcf117ce43fb53 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Close socket by default when destroying objectRomain Forlot1-1/+4
As socket is back to only movable, only one copy of a socket can be present at a time, so when the object is destroyed we have to close the socket too. Change-Id: Id64bb53919ce7c24476c26ba9a8520affa3f6273 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Initializing all struct by default to avoid errorsRomain Forlot1-1/+3
Change-Id: I54eab7da7e5819f633a5612abe46d44550068aab Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01FormatRomain Forlot1-0/+1
Change-Id: Ibbd48a1c0fe0e7567cbf3f5f1c6919e542883924 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Left over renaming variableRomain Forlot1-3/+3
Following change from configuration_t to application_t some variable name doesn't correspond now : conf -> app Change-Id: I56c3a83113777a43af9024a9bc9b53f705b60b0f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Use UDS PID has key to record subscriptionsRomain Forlot1-1/+6
can_signal_t use socket number but has for OBD2 diagnostic request there is only 1 socket to listen all response then we use PID has key to find the subscription later on the processing. Change-Id: I5f0554e1a4ac43e1046d9b7b7f9bb00d3a753562 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Simplify processing eventRomain Forlot2-3/+3
Set afb_event into subscription object then there is no more std::pair used t access it, better use a method from low_can_subscription_t class Change-Id: Ic0772d97c18ca8899821cf3ce175166bbe0be660 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Retrieve signal last value and timestamp at once.Romain Forlot2-0/+6
Change-Id: I8401030ece94b5e397b6d2b71b29ff4e435d1486 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Consider using char* as well as string.Romain Forlot2-1/+25
Change-Id: I08aba32f1273c7be305ceacf121e42fddfca173e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Reworked subscription to integrate filtering.Romain Forlot3-3/+5
- Creation of an object which old the subscription context (filter, signal) : low_can_subscription_t - Move socket from can_signal_t to this new object. - Adding a member to can_message_t to transport subscription_id to be able to retrieve it with all the context through running. Change-Id: I87be8cd6c3c93a81040357920d8c081a316800c3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Return const structures.Romain Forlot2-15/+37
These structures doesn't not have to change after. Change-Id: I0cc83136c7ee4e5f5cd9c04bf717814e141f98c5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Remake socketcan only movableRomain Forlot2-9/+2
Change-Id: If81e2a18c0beec392a98f8b835c7a5d154360500 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-06-01Renaming configuration to applicationRomain Forlot3-8/+8
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-24Be able to copy active diagnostic request objects with their socketRomain Forlot2-0/+7
Implement socket copy assignment operator on socketcan base class. Change-Id: I75a2d3b96275b7ab83372d74ff7fe0a0b0535dc7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-23Static code review fixes.Romain Forlot3-5/+5
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-1/+1
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 Forlot4-7/+22
and store into frequency_clock_t. Change-Id: If209070298bd9df49297fdcbed554770e1bc0e4a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Change method name to signify that it is an aggregate.Romain Forlot1-2/+2
As can_message_definitions got the exact same name but the one from can_message_set is an aggregate of all can_message_definition. So it is clearer using a different name. Change-Id: Ieb9e4d3291f3dc460eb352d8b8fe5a7cf479e687 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Finish config parser retrieving device mapping.Romain Forlot2-1/+8
Change-Id: Ia43f9c0edf09ff9a1c009f198bdad10a6b44b249 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Be able to return index or can bus name.Romain Forlot3-7/+7
Use a vector of string pair that map index on vector and pair map logical bus name with linux device name. Change-Id: I627e6f715f7466d835d8729e21d9e4198111c1fb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Fix: compile conversion warningRomain Forlot1-1/+1
Change-Id: I174c546afb6b21df431e0a61677292d43af8f0ca Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Better suited method.Romain Forlot2-2/+2
Change-Id: I287e445c6f1c372a852752911d032a70654aa082 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Fix: wrong calculation doesn't match method name.Romain Forlot1-2/+2
Multiplication was a very specific needs for diagnostic manager when using systemd event loop timer. Now it is the right period that is calculated and multiplication is done into the right place. Cleaner. Change-Id: Ie3dffe8daa0fa9bd9bde408e62a8d7a06a333a25 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Make sure that frequency is at a valid value (>0)Romain Forlot1-1/+4
Else we got infinite value if 0 and negative value doesn't make sense here. Change-Id: Id65f0aa94cae32f1fea2c5c80028e328e6958a13 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19New function used to set timer in bcm_head msg.Romain Forlot2-0/+14
As there will be more bcm socket and more need to set its timer values. May be there is a better method to separate integer and decimal parts from a float value. Change-Id: I0cd992dfde5fe8257b17b5b610482f5f5e09aa8c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19There is no more need having pointer on socket deviceRomain Forlot1-1/+4
Return bus name string. Change-Id: I0e7f4171c3d1052cb6425cd5b93e5a593d7d277f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Fix: wrong arguments signature. Deleted by mistake...Romain Forlot1-2/+2
Change-Id: Ib31483663a90c8dad129f59372e1ced3a79c7403 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19FormatRomain Forlot1-1/+0
Change-Id: Idc49593fdc1a039c6a03626115e4156a629e4e65 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-11Massive use of shared_ptr about signal and diag message. WIPRomain Forlot1-14/+14
Vector of shared_ptr is made to shared ownership about object around project. This is the default returned value by getter methods when lookup and manipulating them. Change-Id: Id37947bb5994b629f4bf3faecc5ffac81c55e1e6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10Fix: circular include for socket classes.Romain Forlot3-1/+2
Change-Id: Ibcd71f585246172c191b67b45e3b2763f7722958 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10Make non blocking BCM socket.Romain Forlot1-0/+3
Needed because we use systemd event loop that recommend that. Change-Id: Ia3faf35fe80a973f7a7b1c81f6a8adf96705394b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10Move reading input stream to specialized socket class.Romain Forlot6-26/+49
We always read the same object so how to fill it is the job of specialized class not a generic method can do that. Change-Id: Ia262871cec6b7ed3341eb314d5ed6641b8da61e6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Avoid returning infinity value.Romain Forlot1-1/+1
Change-Id: I89d227e48add0c7fc8a4ca577023995b269e6f13 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Don't destroy socket by default as they will always be open.Romain Forlot6-33/+9
Now derivated class use constructor from base class and we don't destroy socket when a socket object is over since it may be copied before. So closing them is in charge of dev, well me... Change-Id: I0440119017a3e56bb83d0194a6908dc3e2b8f745 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Improve log message.Romain Forlot1-1/+1
Change-Id: I91155eda22a172efc88f72243c260480a2d1d4ce Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Separation between hat and callback binding partsRomain Forlot3-3/+3
As well as handling reading signals BCM socket using systemd event loop. Change-Id: I1e121635ec5db489b2bcb88a3101e716bf8883d5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-04Follow the moving binding and configuration files.Romain Forlot4-5/+5
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-05-03Fix: constructor and include file missing.Romain Forlot6-38/+24
Copy constructors are allowed since socket will never be closed during binding runs. Change-Id: Ie33e4b7e885d45e1ffeb980400df00ae2a97e45d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-03Derivate socketcan to multiple child depending upon socket CAN type.Romain Forlot6-54/+237
Use to initialize raw, bcm and later isotp socket. Now we should have, 1 BCM socket by signal to make filter on them. 1 raw socket by devices is kept to use diagnostic manager as is. Change-Id: Icb2daddf67039479f72bc487d53971adc9aba638 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-03Use the private method instead of direct C syscall.Romain Forlot1-1/+1
Change-Id: I1c0e04e38fec92dee167720c3128a7493d4cf9b2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-02Fix: wrong include local header pathRomain Forlot1-1/+1
Change-Id: I1878e26a519a8e2708cfbfd59c6dd95e968d4028 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27clean left include file after modification that isn't needed anymoreRomain Forlot1-1/+0
Change-Id: Ie63c962cfe191cca71c5927eafa72a3ab69befac Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Fix: write bcm message to socket.Romain Forlot2-22/+17
Just allowing message with 1 frame avoiding to handle dynamic sized array... This close the door for multiplexed msg for now... Let's see later and move on Change-Id: I3626d4b6634b3f119826603e64713d63e994918e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Finish to read stream and fill the destination object.Romain Forlot1-4/+5
Use AFB log system Change-Id: I5aa727ce7f9db5b6f18df5957f31f37d9af88d20 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>