<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Probably best to split this off as a separate eMail thread.<div class=""><br class=""></div><div class="">I think the implementation would be relatively simple.</div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">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.</li><ul class=""><li class="">The constructor should be passed the vfs file path to log to. It should fopen the m_log file to that.</li><li class="">The destructor should fclose the m_log file.</li></ul><li class="">Create a canlog_crtd class, derived from canlog, that supports Log() to log to m_log in CRTD format.</li><li class="">Optionally create other canlog_* classes, for other logging formats that we want to support.</li><li class="">Add a canlog* m_log member variable in canbus.</li><ul class=""><li class="">Initialise m_log to NULL in the constructor.</li><li class="">In the destructor, if m_log is not null, delete it’s object and set it to NULL.</li><li class="">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).</li></ul><li class="">In can::IncomingFrame, log incoming CAN messages with m_log->Log(), in the same way as m_trace is handled.</li><li class="">In canbus::Write, log outgoing CAN messages with m_log->Log(), in the same way as m_trace is handled.</li></ul><div><br class=""></div><div>Volunteer?</div><div><br class=""></div><div>Regards, Mark.</div><div><br class=""><blockquote type="cite" class=""><div class="">On 10 Jan 2018, at 8:07 AM, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net" class="">mark@webb-johnson.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 24px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">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.</span></div></blockquote></div><br class=""></div></body></html>