supl/locationomasuplprotocolhandler/waplistener/src/epos_comasuplwaplistener.cpp
branchRCL_3
changeset 23 5944cae565c9
parent 0 667063e416a2
child 44 2b4ea9893b66
equal deleted inserted replaced
19:d6e4203b7ebe 23:5944cae565c9
   305 TBool COMASuplWapListener::CheckBinaryContentType(CPushMessage* aPushMsg)
   305 TBool COMASuplWapListener::CheckBinaryContentType(CPushMessage* aPushMsg)
   306 {
   306 {
   307 	TPtrC8 field;
   307 	TPtrC8 field;
   308 	TBool isHeaderPresent = aPushMsg->GetBinaryHeaderField(EHttpContentType, field);
   308 	TBool isHeaderPresent = aPushMsg->GetBinaryHeaderField(EHttpContentType, field);
   309 
   309 
   310     iTrace->Trace( _L( "Received Binary Content Type is:" ), KTraceFileName, __LINE__ );
   310 #ifdef _DEBUG
       
   311 	//Log the received message
       
   312 	iTrace->Trace( _L( "Received Binary Content Type is:" ), KTraceFileName, __LINE__ );
   311     PrintHex(field, __LINE__);
   313     PrintHex(field, __LINE__);
       
   314 #endif
       
   315 
   312 	if( isHeaderPresent )
   316 	if( isHeaderPresent )
   313 	{
   317 	{
   314 		    iTrace->Trace( _L( "Binary Content type present..." ), KTraceFileName, __LINE__ );
   318 		    iTrace->Trace( _L( "Binary Content type present..." ), KTraceFileName, __LINE__ );
   315 			TUint8 code = field[0];
   319 			TUint8 code = field[0];
   316 			
   320 			
   326 	}
   330 	}
   327 	return EFalse;
   331 	return EFalse;
   328 }
   332 }
   329 
   333 
   330 // -----------------------------------------------------------------------------
   334 // -----------------------------------------------------------------------------
   331 // COMASuplWapListener::CheckBinaryContentType
   335 // COMASuplWapListener::PrintHex
   332 // 
   336 // 
   333 // -----------------------------------------------------------------------------
   337 // -----------------------------------------------------------------------------
   334 //
   338 //
   335 void COMASuplWapListener::PrintHex(const TDesC8& aBuffer,TInt aLine)
   339 void COMASuplWapListener::PrintHex(const TDesC8& aBuffer,TInt aLine)
   336 	{
   340 	{
   337 			TBuf<256> buffer;
   341 			TBuf<256> buffer;
   338 			TBuf<2> buff;
   342 			TBuf<2> buff;
   339 			_LIT16(KFormat1,"%02x");
   343 			_LIT16(KFormat1,"%02x");
   340 			TInt len = aBuffer.Length();
   344 			TInt len = aBuffer.Length();
       
   345 			
       
   346 			//The buffer is usually larger than what can be logged in a single line in the log file.  As such this should only attempt
       
   347 			// to log 27 hex blocks to each log line.
       
   348 			const TInt KNumberOfBlocks = 27;
       
   349 			TInt blockNumber = KNumberOfBlocks;
       
   350 			
   341 			for(TInt i = 0 ; i <len; i++)
   351 			for(TInt i = 0 ; i <len; i++)
   342 				{
   352 				{
       
   353 					//Check to see if the buffer should be logged and then emptied
       
   354                     if(i == blockNumber)
       
   355                         {
       
   356                         //Trace the buffer as it currently is
       
   357                         iTrace->Trace(buffer, KTraceFileName, aLine);
       
   358                         //Reset the buffer for the next log line
       
   359                         buffer.Zero();
       
   360                         blockNumber += KNumberOfBlocks;
       
   361                         }
       
   362 					
   343 					buff.Zero();
   363 					buff.Zero();
   344 					buff.Format(KFormat1,aBuffer[i]);
   364 					buff.Format(KFormat1,aBuffer[i]);
   345 					buffer.Append(buff);	
   365 					buffer.Append(buff);	
   346 					buffer.Append(_L(" "));	
   366 					buffer.Append(_L(" "));	
   347 				}
   367 				}