supl/locationomasuplprotocolhandler/waplistener/src/epos_comasuplwaplistener.cpp
changeset 22 4c4ed41530db
parent 0 667063e416a2
--- a/supl/locationomasuplprotocolhandler/waplistener/src/epos_comasuplwaplistener.cpp	Mon May 03 12:54:42 2010 +0300
+++ b/supl/locationomasuplprotocolhandler/waplistener/src/epos_comasuplwaplistener.cpp	Fri May 14 16:17:02 2010 +0300
@@ -307,8 +307,12 @@
 	TPtrC8 field;
 	TBool isHeaderPresent = aPushMsg->GetBinaryHeaderField(EHttpContentType, field);
 
+#ifdef _DEBUG
+	//Log the received message
     iTrace->Trace( _L( "Received Binary Content Type is:" ), KTraceFileName, __LINE__ );
     PrintHex(field, __LINE__);
+#endif
+
 	if( isHeaderPresent )
 	{
 		    iTrace->Trace( _L( "Binary Content type present..." ), KTraceFileName, __LINE__ );
@@ -328,7 +332,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// COMASuplWapListener::CheckBinaryContentType
+// COMASuplWapListener::PrintHex
 // 
 // -----------------------------------------------------------------------------
 //
@@ -338,8 +342,24 @@
 			TBuf<2> buff;
 			_LIT16(KFormat1,"%02x");
 			TInt len = aBuffer.Length();
+			
+			//The buffer is usually larger than what can be logged in a single line in the log file.  As such this should only attempt
+			// to log 27 hex blocks to each log line.
+			const TInt KNumberOfBlocks = 27;
+			TInt blockNumber = KNumberOfBlocks;
+			
 			for(TInt i = 0 ; i <len; i++)
 				{
+					//Check to see if the buffer should be logged and then emptied
+                    if(i == blockNumber)
+                        {
+                        //Trace the buffer as it currently is
+                        iTrace->Trace(buffer, KTraceFileName, aLine);
+                        //Reset the buffer for the next log line
+                        buffer.Zero();
+                        blockNumber += KNumberOfBlocks;
+                        }
+					
 					buff.Zero();
 					buff.Format(KFormat1,aBuffer[i]);
 					buffer.Append(buff);