vtengines/videoteleng/Src/Extensions/cvtengrecord2file.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Videoteleng  Record to file extension 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "cvtengrecord2file.h"
       
    21 #include    "VtEngPanic.h"
       
    22 #include    "CVtEngSettings.h"
       
    23 #include    "VtEngUtils.h"
       
    24 #include 	"cvtengr2ftoneplayer.h"
       
    25 
       
    26 #include    <CVtLogger.h>
       
    27 
       
    28 // LOCAL CONSTANTS AND MACROS
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ==============================
       
    31 
       
    32 // ----------------------------------------------------------------------------
       
    33 // CVtEngRecord2File::CVtEngRecord2File
       
    34 // C++ constructor can NOT contain any code, that
       
    35 // might leave.
       
    36 // ----------------------------------------------------------------------------
       
    37 //
       
    38 CVtEngRecord2File::CVtEngRecord2File():
       
    39                         CVtEngExtensionBase( 
       
    40                         KVtEngExtensionRecord2File )
       
    41     {
       
    42     }
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // CVtEngRecord2File::ConstructL
       
    46 // Symbian 2nd phase constructor can leave.
       
    47 // ----------------------------------------------------------------------------
       
    48 //
       
    49 void CVtEngRecord2File::ConstructL()
       
    50     {
       
    51     __VTPRINTENTER( "CVtEngRecord2File.ConstructL" )
       
    52 	
       
    53 	iTonePlayer = CVtEngR2FTonePlayer::NewL();
       
    54     __VTPRINTEXIT( "CVtEngRecord2File.ConstructL" )
       
    55     }
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // CVtEngRecord2File::NewL
       
    59 // Two-phased constructor.
       
    60 // ----------------------------------------------------------------------------
       
    61 //
       
    62 CVtEngRecord2File* CVtEngRecord2File::NewL()
       
    63     {
       
    64     CVtEngRecord2File* self = new( ELeave ) CVtEngRecord2File;
       
    65     CleanupStack::PushL( self );
       
    66     self->ConstructL();
       
    67     CleanupStack::Pop();
       
    68     return self;
       
    69     }
       
    70 
       
    71 // ----------------------------------------------------------------------------
       
    72 // CVtEngRecord2File::~CVtEngRecord2File
       
    73 // Destructor. Cannot leave.
       
    74 // ----------------------------------------------------------------------------
       
    75 //
       
    76 CVtEngRecord2File::~CVtEngRecord2File()
       
    77     {
       
    78     
       
    79     __VTPRINTENTER( "CVtEngRecord2File.~" )
       
    80     if ( iTonePlayer )
       
    81         {
       
    82         iTonePlayer->StopSound();
       
    83         delete iTonePlayer;
       
    84         }
       
    85     __VTPRINTEXIT( "CVtEngRecord2File.~" )
       
    86     }
       
    87 // ----------------------------------------------------------------------------
       
    88 // CVtEngRecord2File::GetInterface
       
    89 // 
       
    90 // ----------------------------------------------------------------------------
       
    91 //    
       
    92 TAny* CVtEngRecord2File::GetInterface() 
       
    93     {
       
    94     __VTPRINTENTER( "CVtEngRecord2File.GetInterface")
       
    95     // Cast first as API MVtEngRecord2File* class
       
    96     // and after that to TAny*
       
    97     __VTPRINTEXIT( "CVtEngRecord2File.GetInterface" )  
       
    98     return reinterpret_cast< TAny* >( ( MVtEngRecord2File* ) this );
       
    99 
       
   100     }
       
   101 
       
   102 // ----------------------------------------------------------------------------
       
   103 // CVtEngRecord2File::HandleL
       
   104 // 
       
   105 // ----------------------------------------------------------------------------
       
   106 //    
       
   107 TBool CVtEngRecord2File::HandleL( CVtEngOperation* aOp )
       
   108     {
       
   109     __VTPRINTENTER( "CVtEngRecord2File.HandleL" )
       
   110     const TVtEngCommandId id( aOp->Command() );
       
   111     __VTPRINT2( DEBUG_GEN, "CVtEngRecord2File.HandleL CMD ID[%d] ", id )
       
   112     
       
   113     // Check which command and call
       
   114     // active provider with operation params    
       
   115     switch ( id )
       
   116         {
       
   117         case KVtEngStartRecord:    
       
   118             {          
       
   119             
       
   120             iTonePlayer->PlaySound( CVtEngR2FTonePlayer::EVtR2FVideoStartSoundId ); 
       
   121             break;
       
   122             }
       
   123         case KVtEngStopRecord:    
       
   124             {          
       
   125             
       
   126             iTonePlayer->PlaySound( CVtEngR2FTonePlayer::EVtR2FVideoStopSoundId ); 
       
   127             break;
       
   128             }
       
   129         //Not supported command    
       
   130         default:
       
   131             __VTPRINTEXITR( 
       
   132             "CVtEngRecord2File.HandleL NOT SUPPORTED CMD[%d]", id )
       
   133             return EFalse;
       
   134         }
       
   135     __VTPRINTEXIT( "CVtEngRecord2File.HandleL" )  
       
   136     return ETrue;
       
   137     }        
       
   138 
       
   139 // ----------------------------------------------------------------------------
       
   140 // CVtEngRecord2File::ValidateCommand
       
   141 // 
       
   142 // ----------------------------------------------------------------------------
       
   143 
       
   144 TBool CVtEngRecord2File::ValidateCommand( 
       
   145 	const TVtEngCommandId aCommandId )
       
   146     {
       
   147     __VTPRINTENTER( "CVtEngRecord2File.ValidateCommand" )
       
   148     
       
   149     // local or hw support 
       
   150     // set as False
       
   151     TBool support = EFalse;
       
   152     
       
   153     // Check which command and check if
       
   154     // if provider and local variation supports
       
   155      __VTPRINT2( DEBUG_GEN, 
       
   156      	"CVtEngRecord2File.ValidateCommand CMD ID[%d] ", aCommandId ) 	
       
   157     switch ( aCommandId )
       
   158         {
       
   159         case KVtEngStartRecord:
       
   160 	        {
       
   161 	        support = ETrue;
       
   162             break;
       
   163 	        }
       
   164         
       
   165         case KVtEngStopRecord:
       
   166 	        {
       
   167 	        support = ETrue;
       
   168             break;
       
   169 	        }
       
   170         // Not supported command    
       
   171         default:
       
   172         	{
       
   173             __VTPRINT2( DEBUG_GEN, 
       
   174             	"CVtEngRecord2File.ValidateCommand NOT SUPPORTED CMD[%d]",
       
   175             	 aCommandId)
       
   176             support = EFalse;	 
       
   177         	}
       
   178         }
       
   179     __VTPRINTEXITR( "CVtEngRecord2File.ValidateCommand return value[%d]",
       
   180     	support)                   
       
   181     return support; 
       
   182     }          
       
   183     
       
   184 // ----------------------------------------------------------------------------
       
   185 // CVtEngRecord2File::IsTonePlaySupported
       
   186 // FOR TESTING PURPOSES REMOVE!
       
   187 // ----------------------------------------------------------------------------            
       
   188 
       
   189 TInt CVtEngRecord2File::IsTonePlaySupported( TBool& aSupported) const
       
   190 	{
       
   191 	if (iTonePlayer)
       
   192 		{
       
   193 		aSupported = ETrue;
       
   194 		}
       
   195 	else
       
   196 		{
       
   197 		aSupported = EFalse;
       
   198 		}
       
   199 	__VTPRINT2( DEBUG_GEN, "CVtEngRecord2File.IsTonePlaySupported bool[%d] ", (TInt)aSupported ) 		
       
   200 	return KErrNone;	
       
   201 	}
       
   202 
       
   203 //  End of File