diff -r 000000000000 -r 1e05558e2206 usbclasses/usbphoneasmodem/classimplementation/atplugin/inc/atcmdpam_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbclasses/usbphoneasmodem/classimplementation/atplugin/inc/atcmdpam_debug.h Thu Dec 17 09:14:30 2009 +0200 @@ -0,0 +1,121 @@ +// Copyright (c) 2009 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: +// Define Debug API for phone as modem at extension plugin +// +// + +#ifndef ATCMDPAM_DEBUG_H +#define ATCMDPAM_DEBUG_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CATCommand; + +#ifdef ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES +#define DebugMsg( msg ) CATCmdPAMDebug::NoteL( msg ); +#else // !ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES +#define DebugMsg( msg ) +#endif // ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES + +#ifdef ATCMDPAM_DEBUG_TRACES + +NONSHARABLE_CLASS( TOverflowTruncate ) : public TDes16Overflow + { + public: + virtual void Overflow( TDes16& aDes ); + }; + +NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow + { + public: + virtual void Overflow( TDes8& aDes ); + }; + + + +class CATCmdPAMDebug + : public CBase + { + public: +#ifdef ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES + /** + * Debug message + * @param aNote Message + */ + static void NoteL( TPtrC aNote ); +#endif // ATCMDPAM_DEBUG_INFORMATION_NOTE_MESSAGES + + /** + * Log AT command / response with flogger + * @param aCmd + */ + static void ATLog( CATCommand& aCmd ); + +#ifndef ATCMDPAM_DEBUG_NOFLOGGER + /** + * Debug print + * @param aFmt.,, Print content + */ + static void Print( TRefByValue aFmt,... ); + + /** + * Debug print8 + * @param aFmt.,, Print content + */ + static void Print8( TRefByValue aFmt,... ); +#endif // !ATCMDPAM_DEBUG_NOFLOGGER + }; +#endif // ATCMDPAM_DEBUG_TRACES + +#ifdef ATCMDPAM_DEBUG_TRACES +#define ATDEBUG( f ) { f; } +#ifndef ATCMDPAM_DEBUG_NOFLOGGER +#define DebugPrint CATCmdPAMDebug::Print +#define DebugPrint8 CATCmdPAMDebug::Print8 +#define ATLog CATCmdPAMDebug::ATLog +#else // ATCMDPAM_DEBUG_NOFLOGGER +#define DebugPrint (void) +#define DebugPrint8 (void) +#define ATLog RDebug::Print +#endif // !ATCMDPAM_DEBUG_NOFLOGGER +TText* DEBUG_STR( TDes* aStr ); +TText16* DEBUG_STR( TDes16& aStr ); +TText* DEBUG_STR( TPtr aStr ); +TText* DEBUG_STR( HBufC* aStr ); +TText* DEBUG_STR( TDesC* aStr ); +TText* DEBUG_STR( const TDes& aStr ); +TText* DEBUG_STR( const TPtrC& aStr ); +TText* DEBUG_STR( const TDesC& aStr ); +TText8* DEBUG_STR( const TDes8& aStr ); +TText8* DEBUG_STR( const TDesC8& aStr ); +TText8* DEBUG_STR( TDes8& aStr ); +void DEBUG_BUF( TDes aBuf, TRefByValue aFmt,... ); +#else // !ATCMDPAM_DEBUG_TRACES +// Compiler preprosessor should ignore this line with it's content, therefore +// parameter format and function inline prefix are meaningless. Function parameters +// may not have operations build-in. +inline void DebugPrint( TRefByValue aFmt,... ) { (void) aFmt; }; +inline void DebugPrint8( TRefByValue aFmt,... ) { (void) aFmt; }; + +#define DEBUG_STR( str ) str +#define ATDEBUG( f ) +#endif // ATCMDPAM_DEBUG_TRACES + +#endif // ATCMDPAM_DEBUG_H + +// End of File