added --lograwdatafile and --lograwdatasize options similar to --dumpfile/--dumpsize for logging received/sent bytes to a dedicated text file, extracted dump/raw file handling to a separate class, switched to an interface instead of a method for dumping/logging raw data, changed default dump file name to /tmp/ebusd_dump.bin, use "s_" for static variables, formatting

This commit is contained in:
john30
2016-12-04 17:21:47 +01:00
parent 14fd6c9a13
commit cdbcb4664d
9 changed files with 416 additions and 224 deletions
+14 -1
View File
@@ -22,6 +22,7 @@
#include "message.h"
#include "network.h"
#include "bushandler.h"
#include "rotatefile.h"
/** \file mainloop.h */
@@ -30,7 +31,7 @@ using namespace std;
/**
* The main loop handling requests from connected clients.
*/
class MainLoop : public Thread
class MainLoop : public Thread, DeviceListener
{
public:
@@ -64,6 +65,9 @@ public:
*/
void addMessage(NetMessage* message) { m_netQueue.push(message); }
// @copydoc
virtual void notifyDeviceData(const unsigned char byte, bool received);
private:
/** the @a Device instance. */
@@ -72,6 +76,15 @@ private:
/** the number of reconnects requested from the @a Device. */
unsigned int m_reconnectCount;
/** the @a RotateFile for writing sent/received bytes in log format, or NULL. */
RotateFile* m_logRawFile;
/** whether raw logging to @p logNotice is enabled (only relevant if m_logRawFile is NULL). */
bool m_logRawEnabled;
/** the @a RotateFile for dumping received data, or NULL. */
RotateFile* m_dumpFile;
/** the @a MessageMap instance. */
MessageMap* m_messages;