Garmin Fleet Management Controller  2.19.0
Logger Class Reference

Log writer. More...

#include <Logger.h>

Static Public Member Functions

static void clearLog ()
 Empties the packet log. More...
 
static void closeLog ()
 Close the log file. More...
 
static bool isLogOpen ()
 Returns true if the log file is open. More...
 
static void logRawData (Packet *aPacket, bool aIsTx=true)
 Logs the raw data of the packet passed in to a file. More...
 

Static Public Attributes

static const char * LOG_FILE = "fmi_pc_app.log"
 The log file that this Logger writes to. More...
 

Private Member Functions

 Logger ()
 Construct a new Logger. More...
 
virtual ~Logger ()
 Destructor. More...
 

Static Private Attributes

static std::wofstream mLogFile
 File stream that the packet log is written to. More...
 
static SYSTEMTIME mLogStartTime
 Time when the packet log was started/cleared; used to compute offsets. More...
 

Detailed Description

Log writer.

The logger writes the packet log.

Definition at line 24 of file Logger.h.

Constructor & Destructor Documentation

Logger::Logger ( )
private

Construct a new Logger.

virtual Logger::~Logger ( )
privatevirtual

Destructor.

Member Function Documentation

void Logger::clearLog ( )
static

Empties the packet log.

Closes and reopens the log file (removing any existing data), writes a start time entry with the current time, and sends a notification message that the log has changed.

Definition at line 83 of file Logger.cpp.

References EVENT_LOG_PACKET, LOG_FILE, mLogFile, mLogStartTime, and Event::post().

Referenced by SerialPort::initSerialPort(), TcpIpPort::initTcpPort(), CLogViewerDlg::OnBnClickedClearLog(), and CFmiPcAppDlg::OnFileClearPacketLog().

void Logger::closeLog ( )
static

Close the log file.

Definition at line 102 of file Logger.cpp.

References mLogFile.

Referenced by CFmiApplication::~CFmiApplication().

bool Logger::isLogOpen ( )
static

Returns true if the log file is open.

Definition at line 111 of file Logger.cpp.

References mLogFile.

Referenced by SerialPort::initSerialPort(), and TcpIpPort::initTcpPort().

void Logger::logRawData ( Packet aPacket,
bool  aIsTx = true 
)
static

Logs the raw data of the packet passed in to a file.

Parameters
aPacketThe packet to log
aIsTxIf true, this packet was transmitted (if false, this packet was received)

Definition at line 31 of file Logger.cpp.

References EVENT_LOG_PACKET, Packet::getRawBytes(), Packet::getRawSize(), max_uint_val, mLogStartTime, and Event::post().

Referenced by GarminLinkLayer::getPacketFromFifo(), and GarminLinkLayer::tx().

Member Data Documentation

const char * Logger::LOG_FILE = "fmi_pc_app.log"
static
std::wofstream Logger::mLogFile
staticprivate

File stream that the packet log is written to.

Definition at line 52 of file Logger.h.

Referenced by clearLog(), closeLog(), and isLogOpen().

SYSTEMTIME Logger::mLogStartTime
staticprivate

Time when the packet log was started/cleared; used to compute offsets.

Definition at line 49 of file Logger.h.

Referenced by clearLog(), and logRawData().


The documentation for this class was generated from the following files: