usbclasses/usbphoneasmodem/classimplementation/atplugin/inc/atcmdpam_debug.h
changeset 35 9d8b04ca6939
child 63 ef2686f7597e
equal deleted inserted replaced
34:7858bc6ead78 35:9d8b04ca6939
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Define Debug API for phone as modem at extension plugin
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef ATCMDPAM_DEBUG_H
       
    19 #define ATCMDPAM_DEBUG_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <e32svr.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CATCommand;
       
    28 
       
    29 #ifdef ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES
       
    30 #define DebugMsg( msg ) CATCmdPAMDebug::NoteL( msg );
       
    31 #else // !ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES
       
    32 #define DebugMsg( msg )
       
    33 #endif // ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES
       
    34 
       
    35 #ifdef ATCMDPAM_DEBUG_TRACES
       
    36 
       
    37 NONSHARABLE_CLASS( TOverflowTruncate ) : public TDes16Overflow
       
    38     {
       
    39     public:
       
    40 	    virtual void Overflow( TDes16& aDes );
       
    41 	};
       
    42 
       
    43 NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow
       
    44     {
       
    45     public:
       
    46 	    virtual void Overflow( TDes8& aDes );
       
    47 	};
       
    48 
       
    49 
       
    50 
       
    51 class CATCmdPAMDebug 
       
    52     : public CBase
       
    53     {
       
    54     public:
       
    55 #ifdef ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES
       
    56 		/**
       
    57         * Debug message
       
    58         * @param aNote Message
       
    59         */
       
    60         static void NoteL( TPtrC aNote );
       
    61 #endif // ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES
       
    62 
       
    63 		/**
       
    64         * Log AT command / response with flogger
       
    65         * @param aCmd
       
    66         */
       
    67         static void ATLog( CATCommand& aCmd );
       
    68 
       
    69 #ifndef ATCMDPAM_DEBUG_NOFLOGGER
       
    70 		/**
       
    71         * Debug print
       
    72         * @param aFmt.,, Print content
       
    73         */
       
    74         static void Print( TRefByValue<const TDesC> aFmt,... );
       
    75 
       
    76 		/**
       
    77         * Debug print8
       
    78         * @param aFmt.,, Print content
       
    79         */
       
    80         static void Print8( TRefByValue<const TDesC8> aFmt,... );
       
    81 #endif // !ATCMDPAM_DEBUG_NOFLOGGER
       
    82     };
       
    83 #endif // ATCMDPAM_DEBUG_TRACES
       
    84 
       
    85 #ifdef ATCMDPAM_DEBUG_TRACES
       
    86 #define ATDEBUG( f ) { f; }
       
    87 #ifndef ATCMDPAM_DEBUG_NOFLOGGER
       
    88 #define DebugPrint CATCmdPAMDebug::Print
       
    89 #define DebugPrint8 CATCmdPAMDebug::Print8
       
    90 #define ATLog CATCmdPAMDebug::ATLog
       
    91 #else // ATCMDPAM_DEBUG_NOFLOGGER
       
    92 #define DebugPrint (void)
       
    93 #define DebugPrint8 (void)
       
    94 #define ATLog RDebug::Print
       
    95 #endif // !ATCMDPAM_DEBUG_NOFLOGGER
       
    96 TText* DEBUG_STR( TDes* aStr );
       
    97 TText16* DEBUG_STR( TDes16& aStr );
       
    98 TText* DEBUG_STR( TPtr aStr );
       
    99 TText* DEBUG_STR( HBufC* aStr );
       
   100 TText* DEBUG_STR( TDesC* aStr );
       
   101 TText* DEBUG_STR( const TDes& aStr );
       
   102 TText* DEBUG_STR( const TPtrC& aStr );
       
   103 TText* DEBUG_STR( const TDesC& aStr );
       
   104 TText8* DEBUG_STR( const TDes8& aStr );
       
   105 TText8* DEBUG_STR( const TDesC8& aStr );
       
   106 TText8* DEBUG_STR( TDes8& aStr );
       
   107 void DEBUG_BUF( TDes aBuf, TRefByValue<const TDesC> aFmt,... );
       
   108 #else // !ATCMDPAM_DEBUG_TRACES
       
   109 // Compiler preprosessor should ignore this line with it's content, therefore
       
   110 // parameter format and function inline prefix are meaningless. Function parameters
       
   111 // may not have operations build-in.
       
   112 inline void DebugPrint( TRefByValue<const TDesC> aFmt,... ) { (void) aFmt; };
       
   113 inline void DebugPrint8( TRefByValue<const TDesC8> aFmt,... ) { (void) aFmt; };
       
   114 
       
   115 #define DEBUG_STR( str ) str
       
   116 #define ATDEBUG( f )
       
   117 #endif // ATCMDPAM_DEBUG_TRACES
       
   118 
       
   119 #endif // ATCMDPAM_DEBUG_H
       
   120 
       
   121 // End of File