blob: da97fd10a222977411118f79d931d3c213b36a08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* CXorayaLogPlugin.h
*
* Created on: 25.10.2011
* Author: Eisenhauer
*/
#ifndef CXORAYALOGPLUGIN_H_
#define CXORAYALOGPLUGIN_H_
#include <boost/thread.hpp>
#include <x2e/sys/Mutex.hpp>
#include "bounded_buffer.hpp"
#include "global.h"
#include "plugin_api.h"
#define nLOG_MSG_BUFFER_SIZE 8192
#define nINT_BUFF_SIZE 4096
#define nLOGFILENAME_LENGTH 256
class IInterfaceManager;
class IPluginExecutor;
class CXorayaLogPlugin: public IPlugin {
public:
CXorayaLogPlugin();
virtual ~CXorayaLogPlugin();
virtual void vRun();
virtual tpstCanTxMessage pxGetCanTxMessage( const uint32_t u32MsgIndex )
{
return NULL;
}
virtual uint32_t u32GetNumOfCanTxMessages( void )
{
return 0;
}
virtual bool boIsLogger( void ) { return true; }
virtual bool boAutoload( void ) { return true; }
virtual int32_t i32GetCanInterfaceHandle( void );
virtual tenRetCodes enGetLog(const char*, char*);
virtual void vInit(void* pvExecutor, void* pvIfMan, int32_t i32Interface,uint32_t u32PluginId);
void vStopIOThread();
void vStop();
virtual void vLogMessage(const tstLogMessage& stLogMessage);
private:
IInterfaceManager* m_pxIfMan;
IPluginExecutor* m_pxExec;
uint32_t m_u32PluginId;
bool m_boStopIOThread;
x2e::Mutex m_xStopIOFlagMutex;
x2e::Mutex m_xLogBufferMutex;
int m_iFd;
char m_acLogBuffer[nINT_BUFF_SIZE];
char m_acLogfileName[nLOGFILENAME_LENGTH];
uint32_t m_u32LogMsgBufferCounter;
bounded_buffer<tstLogMessage> m_xLogMsgBuffer;
boost::function<void()> m_fctThreadProc;
boost::thread m_xIoThread;
void vIoThreadProc();
void vInitLogfile();
tenRetCodes enRotateLogfile();
};
#endif /* CXORAYALOGPLUGIN_H_ */
|