Mark, I'll add the logging support along with the TX queue. Regards, Michael Am 10.01.2018 um 01:27 schrieb Mark Webb-Johnson:
Probably best to split this off as a separate eMail thread.
I think the implementation would be relatively simple.
* Create a canlog class with a FILE* m_log member variable, and a virtual function Log() that is called with a direction (tx/rx) and frame to log. o The constructor should be passed the vfs file path to log to. It should fopen the m_log file to that. o The destructor should fclose the m_log file. * Create a canlog_crtd class, derived from canlog, that supports Log() to log to m_log in CRTD format. * Optionally create other canlog_* classes, for other logging formats that we want to support. * Add a canlog* m_log member variable in canbus. o Initialise m_log to NULL in the constructor. o In the destructor, if m_log is not null, delete it’s object and set it to NULL. o Have a command ‘can log’ like ‘can trace’ that specifies a vfs file path (remember to check it with OvmsConfig ProtectedPath) and logging format. It will then ’new’ a canlog_* style object (depending on logging format). * In can::IncomingFrame, log incoming CAN messages with m_log->Log(), in the same way as m_trace is handled. * In canbus::Write, log outgoing CAN messages with m_log->Log(), in the same way as m_trace is handled.
Volunteer?
Regards, Mark.
On 10 Jan 2018, at 8:07 AM, Mark Webb-Johnson <mark@webb-johnson.net <mailto:mark@webb-johnson.net>> wrote:
Now SD CARD support is coming, anybody want to step forward and extend components/can to support CAN bus logging to a file (in crtd format, or perhaps support one or two popular formats)? Implementation would be in class canbus, very similar to m_trace; just need to have a FILE* m_log and appropriate commands / logging of packet write/read in the same place that trace does it.
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
-- Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal Fon 02333 / 833 5735 * Handy 0176 / 206 989 26