summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can
AgeCommit message (Collapse)AuthorFilesLines
2017-05-19Make and use a single function to read incoming CAN messagesRomain Forlot2-11/+0
Change-Id: I5d3f2a8628ace464ad25989346cc76682c591bd8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Be able to return index or can bus name.Romain Forlot1-2/+4
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-19Remove can-bus-dev following RAW->BCM sockets migrationRomain Forlot5-352/+28
No needs to get RAW socket for now, so can_bus_dev_t class is useless and now removed from project. Change-Id: I37b3e187ef28ba393beae7a99da4f422f74a298e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Use common timer method to get BCM timeval values.Romain Forlot1-5/+3
Change-Id: I3c4364d6038bd60546726fba940f043f5abcb6d2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Use raw pointer to point on parent object.Romain Forlot5-10/+10
Shared pointer on value is a wrong way because once they is no more object refering to a parent then the pointer on it is destoyed. Not a big deal here but we better have to use raw pointer. Change-Id: I58deeb9e82c446ea135be87c11f405da54cc5bff Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Remove unused and useless members.Romain Forlot2-20/+0
These members was imported from OpenXC project which was in C so they need to know array size. As we use vector we doesn't need them anymore. We can retrieve count using size() vector method Change-Id: Iefd0266d400097ab2dae813aca196c8e3b9bc368 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Message definition can return ref instead of value.Romain Forlot2-2/+2
Little optimization that will pass a ref instead of a copy value. Change-Id: I62fbaaa2fb01cf809e60b592a3d91f06d7235205 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-19Fix: vector throw length error exception.Romain Forlot1-3/+4
Message set count members as to be changed because now useless... This is left part from OpenXC port. Change-Id: I3a3dc6091b49eabf0d17324634406bd7b0edafb2 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-11Resolv include circular dependencies.Romain Forlot3-3/+2
Change-Id: I038677d688c64e87ae86dd2af245f87f5c40e317 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-11Massive use of shared_ptr about signal and diag message. WIPRomain Forlot6-21/+21
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-10Use a tree instead of separated object lists. WIPRomain Forlot8-28/+138
Now we respect JSON description file, which is can_message_set contains can_message_definition which contains can_signals. Diagnostic messages aren't processed for now. Change-Id: I94aaf5eded14dd84395bd4fd749df58dee5f533e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10CleaningRomain Forlot1-6/+1
Change-Id: I23b862e748e13e7ba69743c8a9d3abb0be36c4bc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10CAN message will not be modified once read.Romain Forlot3-3/+3
So use const value Change-Id: I81f9a4766d71116e2f3a2af8785b1bd1c69e2c20 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10Don't trigger timeout monitoring on signal.Romain Forlot1-1/+1
Change-Id: Ib84c365207e32f71fc4cb7e350f99d147317fa08 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10Implement setting last_value at message definition level.Romain Forlot7-2/+20
In addition to signal last_values, now message last value is also set. Change-Id: I87c2be3e4e68073d7708b2ddf681889576337410 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10Keeping RAW sockets for compatibilityRomain Forlot2-56/+1
And reset can_reader to can_bus_dev_t like the old behavior because BCM sockets has been implemented at signals level not device. Change-Id: I715a19ff65bf9d7231c73b66c1ee95b3f41f8ed0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-10Fix: Avoid returning negative value that's stop watch socketRomain Forlot2-4/+2
Even if the frame read is wrong doesn't mean that socket is compromise only that communication on CAN bus is difficult, maybe temporary. On en EPOLL err code, or hangup, just close and restart the socket and reset the filter. Change-Id: I61f146fd269bb2524f09e1f2ed89d93e83166136 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05FormatRomain Forlot1-1/+1
Change-Id: I1c080f961f62a6816b0c36e960ae1ecbeb7fa00d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Get back to device dedicated raw_socketRomain Forlot3-2/+15
Change-Id: Ibec47106f8510e92a017fc08aeb2eeaeef2884e5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Improve granularity of BCM socket using one by signalRomain Forlot6-49/+58
Move create_rx_filter to can_signals and adding all accessories needed to works. Change-Id: I3636fe82ce5c2e43a4992b66ce89440ff709004a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Improve log message.Romain Forlot1-3/+3
Change-Id: I91155eda22a172efc88f72243c260480a2d1d4ce Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-05Separation between hat and callback binding partsRomain Forlot4-6/+4
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 Forlot6-6/+6
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-03typoRomain Forlot1-4/+4
Change-Id: Iaf68d463e9df4d6dda2a8508adf5395041d2ff7f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-05-03Keeping raw socket until diagnostic_manager is fully migratedRomain Forlot2-2/+10
Change-Id: I8cb170613c003bbdb39240eb809b8cefcad6cb35 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-29Fix: wrong include relative path.Romain Forlot1-1/+1
Change-Id: I4e6d1ce805d7e7fef66eac177f10fe5f163d79b5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Fix: write bcm message to socket.Romain Forlot1-2/+2
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-27Don't use heavy weapon to get some basic calculationRomain Forlot1-2/+1
Change-Id: Ibc820dea7efbc2d7a50671ce66804217c6707d56 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Fix: Add notifying decoding thread if there is new messages.Romain Forlot1-1/+3
Change-Id: If12617ae086d7023ff619799833cd1d4fd0fd413 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Check last value before send the event, if no change no event.Romain Forlot3-9/+20
Adding a boolean parameter similarly of existing function to know if we would send the event. Change-Id: I03ee17f656065e556fd2b72b160b140852b68dcc Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Create method to handle both CAN frames.Romain Forlot3-21/+103
Change-Id: Ie876614266fd2e7089754a8f917d25d316de4c98 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> Fix: wrong call since renaming of function to more generic name Change-Id: I2adebb855bc815ba6ab14a1002b17d9c9fb293fd Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Don't use FD frame with BCM socket. Seems not working...Romain Forlot1-2/+14
Change-Id: I4f1d5cd489011675cf55914647b57c7332dec1b9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Reworked reading CAN devices from BCM socket.Romain Forlot4-5/+62
Now reading thread hold in can_bus_t object instead of can_bus_dev_t and reading happens using select(). Change-Id: Ib8cc68c4484679168519f3c0fa485fedd1616c74 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Typo, rename, formatRomain Forlot3-8/+7
Change-Id: I8250ef78f0b540617bd249873250f62ad6361fdf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-27Renaming confusing member "address_" to "index_"Romain Forlot2-7/+8
Change-Id: I0ec6d74e9adb791f8bef44f76c74be8365cdf037 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-24Misc: Cleanup, typo, formating and comments update.Romain Forlot6-10/+7
Change-Id: Icac565b9a3a80dc05a1a3470a35e223c8c564347 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-24Create a received job for BCM Socket to handle filtering.Romain Forlot6-1/+48
Filter is created using can_signals description and send with appropriate BCM header structure. This is the simplest way to do, no temporal filtering for now is available. Change-Id: Iee49f011ba9316880735d2765c1c23a8b2d3c4d2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-24Rename and handling write on socket using stream instead of specific methodRomain Forlot1-12/+8
Created special struct to handle bcm messages with can_frame and canfd_frame. We can now just send both of them seamlessly. Change-Id: Ia84e9cf2ab1dd0716cb09f6bb342a208e54f8e06 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-22Use BCM socket as default cleaning up the old RAW socket code.Romain Forlot3-27/+6
Also use CAN FD frames by default. Change-Id: I5bad10e537653b1a96c2e3012d38dde8627d3caa Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-22Improve logging messagesRomain Forlot4-26/+26
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-11/+16
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-20Update commentsRomain Forlot1-2/+4
Change-Id: Ib21f810170308a16462ffe9c174448a86bf791d4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-20Remove timeout socket option.Romain Forlot1-2/+0
This will be handle by BCM socket Change-Id: Ie0348135fcc596ab21727846f3b47751664c9e11 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-20Separate socket configuration and openingRomain Forlot3-6/+10
Change-Id: I94cad718b516f24c5d1833e09df89f03e529f48a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-20Use same function to open BCM and RAW CAN socketsRomain Forlot3-6/+6
Using one a another socket type is made using a boolean. Change-Id: I0445c8550f289d1e0020f6496c638bc95e8db443 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-20Specializing socket class to CAN socket operations.Romain Forlot3-45/+19
Move all legacy opening RAW CAN socket operation to socket class. Each operations on a CAN socket has to be simple and made by the socket class. Simple BCM socket open operation is implemented. Future will be to open specialized BCM CAN sockets on demand. Change-Id: If285b97afb9871245ab1f13cd9f0401fbd9adf95 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-19Cleaning includeRomain Forlot1-3/+0
Change-Id: I6f90c87c164bc6ba70ee0889668f54f4972a8610 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-19Fix: temporary variable assigned to a reference leading to exceptionRomain Forlot1-1/+1
Change-Id: I6bf86a4c9fe832e4f7df192aca1ef25d79097e9c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-04-18Use a system INI configuration file to get devices mappingRomain Forlot2-75/+30
Instead of specifying a JSON configuration file with CAN devices name, it uses a mapping configuration file that map a high level device names to a real low level names. File path is to be specified into the generated source code which is /etc/dev-mapping.conf for now. Configuration file uses INI file format and is parsed using inih library cpp wrapper. Change-Id: Ibde104e76cd78a6cc86f6eec4f66c274b7567d43 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>