hotspotfw/hsbrowser/inc/am_debug.inl
changeset 0 56b72877c1cb
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Debug utilities
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 const TUint KPrintLineLength = 200;
       
    21 const TUint KPrintHexPerLine = 8;
       
    22 
       
    23 // -----------------------------------------------------------------------------
       
    24 // Debug::PrintBuffer
       
    25 // -----------------------------------------------------------------------------
       
    26 //
       
    27 inline void Debug::PrintBuffer( TUint aLength, const TUint8* aData )
       
    28     {
       
    29     TBuf<KPrintLineLength> line;
       
    30     TUint idx( 0 );
       
    31     for ( ; idx < aLength; ++idx )
       
    32         {
       
    33         if ( idx && !( idx % KPrintHexPerLine ) )
       
    34             {
       
    35             RDebug::Print( line );
       
    36             line.Zero();
       
    37             }
       
    38         line.AppendFormat( _L( "%02X " ), aData[idx] );
       
    39         }
       
    40     RDebug::Print( line );
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // Debug::PrintString
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 inline void Debug::PrintString( const TDesC& aString, TUint aLength, const TUint8* aData )
       
    48     {
       
    49     TBuf<KPrintLineLength> line;
       
    50 
       
    51     line.Append( aString );
       
    52     
       
    53     TPtrC8 buf8( aData, aLength );
       
    54     
       
    55     TBuf<KPrintLineLength> buf16;
       
    56     buf16.Copy( buf8 );
       
    57 
       
    58     line.Append( buf16 );
       
    59     
       
    60     RDebug::Print( line );
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // Debug::PrintTimestamp
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 inline void Debug::PrintTimestamp( const TDesC& aString )
       
    68     {
       
    69     TBuf<KPrintLineLength> line;
       
    70     TTime time;
       
    71     time.HomeTime();
       
    72     
       
    73     time.FormatL( line, _L( "%H:%T:%S:%C" ) );
       
    74     line.Append( _L( " " ) );
       
    75     line.Append( aString );
       
    76     
       
    77     RDebug::Print( line );
       
    78     }