testexecfw/stf/stffw/logger/STFLogger/src/STFLoggerOverFlow.cpp
changeset 2 8bb370ba6d1d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/stf/stffw/logger/STFLogger/src/STFLoggerOverFlow.cpp	Fri Apr 09 10:46:28 2010 +0800
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ * 
+ * Description: This module contains implementation of 
+ * TDesLoggerOverflowHandler class member functions.
+ *
+ */
+
+// INCLUDE FILES
+#include <e32std.h>
+#include "STFLoggerOverFlow.h"
+#include "LoggerTracing.h"
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDesLoggerOverflowHandler
+
+ Method: TDesLoggerOverflowHandler
+
+ Description: Default constructor
+
+ Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object
+ TInt aOverFlowSource: in: Over flow source
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+TDesSTFLoggerOverflowHandler::TDesSTFLoggerOverflowHandler(
+        RSTFLogger* aLogger, TInt aOverFlowSource)
+    {
+    iLogger = aLogger;
+    iOverFlowSource = aOverFlowSource;
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDesLoggerOverflowHandler
+
+ Method: Overflow
+
+ Description: Simple overflow handling(16 bit)
+
+ Parameters: TDes16 &aDes: in: Reference to over flow data
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+void TDesSTFLoggerOverflowHandler::Overflow(TDes16& aDes)
+    {
+    __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) );
+
+    // If overflow
+    TInt len(0);
+    len = aDes.Length();
+
+    // const TInt to TInt avoiding warnings
+    TInt maxLogData = KMaxLogData;
+    TInt maxTestFileName = KMaxFileName;
+
+    // Overflow: Log() without aStyle or Log() with aStyle
+    if ((iOverFlowSource == 1 || iOverFlowSource == 2) && maxLogData > 60)
+        {
+        // Log overflow info if info is in allowed limits
+        aDes[len - 2] = 13; // 13 or '\' in Symbian OS
+        aDes[len - 1] = 10; // 10 or 'n' in Symbian OS
+        // ~60
+        iLogger->Log(0,
+                _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!"));
+        }
+    // Overflow: WriteDelimiter()
+    if (iOverFlowSource == 3 && maxLogData > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ));
+        }
+    // Overflow: StartHtmlPage()
+    if (iOverFlowSource == 4 && maxTestFileName > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ));
+        }
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDes8OverflowHandler
+
+ Method: TDes8LoggerOverflowHandler
+
+ Description: Default constructor
+
+ Parameters: CStifLoggerBase* aLogger: in: Pointer to CStifLoggerBase object
+ TInt aOverFlowSource: in: Over flow source
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+TDes8STFLoggerOverflowHandler::TDes8STFLoggerOverflowHandler(
+        RSTFLogger* aLogger, TInt aOverFlowSource)
+    {
+    iLogger = aLogger;
+    iOverFlowSource = aOverFlowSource;
+
+    }
+
+/*
+ -------------------------------------------------------------------------------
+
+ Class: TDes8LoggerOverflowHandler
+
+ Method: Overflow
+
+ Description: Simple overflow handling(8 bit)
+
+ Parameters: TDes8 &aDes: in: Reference to over flow data
+
+ Return Values: None
+
+ Errors/Exceptions: None
+
+ Status: Approved
+
+ -------------------------------------------------------------------------------
+ */
+void TDes8STFLoggerOverflowHandler::Overflow(TDes8& aDes)
+    {
+    __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) );
+
+    // If overflow
+    TInt len(0);
+    len = aDes.Length();
+
+    // const TInt to TInt avoiding warnings
+    TInt maxLogData = KMaxLogData;
+    TInt maxTestFileName = KMaxFileName;
+
+    // Overflow: Log() without aStyle or Log() with aStyle
+    if ((iOverFlowSource == 1 || iOverFlowSource == 2) && maxLogData > 60)
+        {
+        // Log overflow info if info is in allowed limits
+        aDes[len - 2] = 13; // 13 or '\' in Symbian OS
+        aDes[len - 1] = 10; // 10 or 'n' in Symbian OS
+        // ~60
+        iLogger->Log(0,
+                _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!"));
+        }
+    // Overflow: WriteDelimiter()
+    if (iOverFlowSource == 3 && maxLogData > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ));
+        }
+    // Overflow: StartHtmlPage()
+    if (iOverFlowSource == 4 && maxTestFileName > 70)
+        {
+        // Log overflow info if info is in allowed limits, ~70
+        iLogger->Log(
+                0,
+                _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ));
+        }
+
+    }
+
+//  End of File