diff -r 63be7eb3fc78 -r f28ada11abbf hotspotfw/hsbrowser/inc/am_debug.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspotfw/hsbrowser/inc/am_debug.inl Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2007 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: Debug utilities +* +*/ + + + +const TUint KPrintLineLength = 200; +const TUint KPrintHexPerLine = 8; + +// ----------------------------------------------------------------------------- +// Debug::PrintBuffer +// ----------------------------------------------------------------------------- +// +inline void Debug::PrintBuffer( TUint aLength, const TUint8* aData ) + { + TBuf line; + TUint idx( 0 ); + for ( ; idx < aLength; ++idx ) + { + if ( idx && !( idx % KPrintHexPerLine ) ) + { + RDebug::Print( line ); + line.Zero(); + } + line.AppendFormat( _L( "%02X " ), aData[idx] ); + } + RDebug::Print( line ); + } + +// ----------------------------------------------------------------------------- +// Debug::PrintString +// ----------------------------------------------------------------------------- +// +inline void Debug::PrintString( const TDesC& aString, TUint aLength, const TUint8* aData ) + { + TBuf line; + + line.Append( aString ); + + TPtrC8 buf8( aData, aLength ); + + TBuf buf16; + buf16.Copy( buf8 ); + + line.Append( buf16 ); + + RDebug::Print( line ); + } + +// ----------------------------------------------------------------------------- +// Debug::PrintTimestamp +// ----------------------------------------------------------------------------- +// +inline void Debug::PrintTimestamp( const TDesC& aString ) + { + TBuf line; + TTime time; + time.HomeTime(); + + time.FormatL( line, _L( "%H:%T:%S:%C" ) ); + line.Append( _L( " " ) ); + line.Append( aString ); + + RDebug::Print( line ); + }