localconnectivityservice/lcstylustap/tsrc/LcStylusTapTest/src/LcStylusTapTestBlocks.cpp
branchRCL_3
changeset 39 4096754ee773
parent 38 3dcb815346df
child 40 52a167391590
equal deleted inserted replaced
38:3dcb815346df 39:4096754ee773
     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:  Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // [INCLUDE FILES] - do not remove
       
    22 #include <e32svr.h>
       
    23 #include <StifParser.h>
       
    24 #include <Stiftestinterface.h>
       
    25 #include <avkon.hrh>
       
    26 //tests headers
       
    27 #include "LcStylusTapTest.h"
       
    28 
       
    29 // EXTERNAL DATA STRUCTURES
       
    30 //extern  ?external_data;
       
    31 
       
    32 // EXTERNAL FUNCTION PROTOTYPES  
       
    33 //extern ?external_function( ?arg_type,?arg_type );
       
    34 
       
    35 // CONSTANTS
       
    36 //const ?type ?constant_var = ?constant;
       
    37 _LIT(KBlueTooth, "Bluetooth");
       
    38 _LIT(KUSB, "USB");
       
    39 _LIT(KIRDA, "Infrared");
       
    40 
       
    41 // MACROS
       
    42 //#define ?macro ?macro_def
       
    43 
       
    44 // LOCAL CONSTANTS AND MACROS
       
    45 //const ?type ?constant_var = ?constant;
       
    46 //#define ?macro_name ?macro_def
       
    47 
       
    48 // MODULE DATA STRUCTURES
       
    49 //enum ?declaration
       
    50 //typedef ?declaration
       
    51 
       
    52 // LOCAL FUNCTION PROTOTYPES
       
    53 //?type ?function_name( ?arg_type, ?arg_type );
       
    54 
       
    55 // FORWARD DECLARATIONS
       
    56 //class ?FORWARD_CLASSNAME;
       
    57 
       
    58 // ============================= LOCAL FUNCTIONS ===============================
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // ?function_name ?description.
       
    62 // ?description
       
    63 // Returns: ?value_1: ?description
       
    64 //          ?value_n: ?description_line1
       
    65 //                    ?description_line2
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 /*
       
    69 ?type ?function_name(
       
    70     ?arg_type arg,  // ?description
       
    71     ?arg_type arg)  // ?description
       
    72     {
       
    73 
       
    74     ?code  // ?comment
       
    75 
       
    76     // ?comment
       
    77     ?code
       
    78     }
       
    79 */
       
    80 
       
    81 // ============================ MEMBER FUNCTIONS ===============================
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CLcStylusTapTest::Delete
       
    85 // Delete here all resources allocated and opened from test methods. 
       
    86 // Called from destructor. 
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void CLcStylusTapTest::Delete() 
       
    90     {
       
    91     
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CLcStylusTapTest::RunMethodL
       
    96 // Run specified method. Contains also table of test mothods and their names.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TInt CLcStylusTapTest::RunMethodL( 
       
   100     CStifItemParser& aItem ) 
       
   101     {
       
   102 
       
   103     static TStifFunctionInfo const KFunctions[] =
       
   104         {  
       
   105         //ADD NEW ENTRY HERE
       
   106         // [test cases entries] - Do not remove
       
   107 		ENTRY( "ExecuteApiTestBlock", CLcStylusTapTest::ExecuteApiTestBlock ),
       
   108         ENTRY( "ExecuteModuleTestBlock", CLcStylusTapTest::ExecuteModuleTestBlock ),
       
   109         ENTRY( "ExecuteBranchTestBlock", CLcStylusTapTest::ExecuteBranchTestBlock ),
       
   110         };
       
   111 
       
   112     const TInt count = sizeof( KFunctions ) / 
       
   113                         sizeof( TStifFunctionInfo );
       
   114 
       
   115     return RunInternalL( KFunctions, count, aItem );
       
   116 
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CLcStylusTapTest::GetTestBlockParamsL
       
   121 // -----------------------------------------------------------------------------
       
   122 
       
   123 void CLcStylusTapTest::GetTestBlockParamsL( CStifItemParser& aItem )
       
   124     {
       
   125     STIF_LOG( ">>> GetTestBlockParamsL" );
       
   126     
       
   127     // Add new test block branches below, get all required test parameters    
       
   128     if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
       
   129         {              
       
   130         User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );        
       
   131         User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
       
   132         User::LeaveIfError( aItem.GetNextInt( iTestBlockParams.iTestIntOption1 ) );        
       
   133         User::LeaveIfError( aItem.GetNextChar( iTestBlockParams.iTestCharOption1 ) );        
       
   134         }
       
   135     else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateLcStylusTap" ) ) )
       
   136 		{              
       
   137 		User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );       
       
   138         User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
       
   139 		}
       
   140     else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "TextTapTest" ) ) )
       
   141 		{              
       
   142 		User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );       
       
   143         User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
       
   144 		}
       
   145     else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CallHandleIndicatorTap" ) ) )
       
   146 		{              
       
   147 		User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );      
       
   148         User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
       
   149 		}
       
   150     else//
       
   151         {
       
   152         STIF_LOG( "Test type: not found" );
       
   153         User::Leave( KErrNotFound );
       
   154         }
       
   155     STIF_LOG( "<<< GetTestBlockParamsL" );
       
   156     }
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // CLcStylusTapTest::ExecuteApiTestBlock
       
   160 // -----------------------------------------------------------------------------
       
   161 
       
   162 TInt CLcStylusTapTest::ExecuteApiTestBlock( CStifItemParser& aItem )
       
   163     {
       
   164 	STIF_LOG( ">>>ExecuteApiTestBlock" );
       
   165 	
       
   166 	TInt res;
       
   167     TLcStylusTapTestResult testResult = ETestCaseFailed;
       
   168 	
       
   169     TRAP( res, DoExecuteApiTestBlockL( aItem, testResult ) );
       
   170     if ( res != KErrNone )
       
   171         {
       
   172         STIF_LOG1( "DoExecuteApiTestBlockL error: %d", res );
       
   173         return res;
       
   174         }
       
   175     
       
   176     STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
       
   177     STIF_LOG( "Test case passed" );
       
   178 	STIF_LOG( "<<<ExecuteApiTestBlock" );
       
   179 	
       
   180     return KErrNone;
       
   181     }
       
   182 	
       
   183 	
       
   184 void CLcStylusTapTest::DoExecuteApiTestBlockL( CStifItemParser& aItem, TLcStylusTapTestResult& aTestResult )
       
   185     {
       
   186 	STIF_LOG( ">>>DoExecuteApiTestBlockL" );
       
   187 
       
   188 	User::LeaveIfError( aItem.GetString( _L( "ExecuteApiTestBlock" ), iTestBlockParams.iTestBlockName ) );
       
   189 	STIF_LOG1( "Api test type: %S", &iTestBlockParams.iTestBlockName );
       
   190 	
       
   191 	GetTestBlockParamsL( aItem );
       
   192 	
       
   193 	// Add new API test block branches with optional test parameters here	
       
   194     if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
       
   195         {      
       
   196         ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, 
       
   197                 iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
       
   198         }	
       
   199     else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateLcStylusTap" ) ) )
       
   200         {      
       
   201         CreateLcStylusTapTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
       
   202         }
       
   203     else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "TextTapTest" ) ) )
       
   204         {      
       
   205         TextTapTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
       
   206         }
       
   207     else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CallHandleIndicatorTap" ) ) )
       
   208         {      
       
   209         CallHandleIndicatorTapTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
       
   210         }
       
   211     else
       
   212         {
       
   213         STIF_LOG( "Test type: not found" );
       
   214         User::Leave( KErrNotFound );
       
   215         }
       
   216 	
       
   217 	STIF_LOG( "<<<DoExecuteApiTestBlockL" );
       
   218     }
       
   219 	
       
   220 // -----------------------------------------------------------------------------
       
   221 // CLcStylusTapTest::ExecuteModuleTestBlock
       
   222 // -----------------------------------------------------------------------------	
       
   223 
       
   224 TInt CLcStylusTapTest::ExecuteModuleTestBlock( CStifItemParser& aItem )
       
   225     {
       
   226 	STIF_LOG( "[STIF_LOG] >>>ExecuteModuleTestBlock" );
       
   227 	
       
   228     TInt res;
       
   229     TLcStylusTapTestResult testResult;
       
   230     
       
   231     TRAP( res, DoExecuteModuleTestBlockL( aItem, testResult ) );
       
   232     if ( res != KErrNone )
       
   233         {
       
   234         STIF_LOG1( "DoExecuteModuleTestBlockL error: %d", res );
       
   235         return res;
       
   236         }
       
   237     
       
   238     STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
       
   239     STIF_LOG( "[STIF_LOG] Test case passed" );
       
   240 	STIF_LOG( "[STIF_LOG] <<<ExecuteModuleTestBlock" );
       
   241     return KErrNone;
       
   242     }	
       
   243 	
       
   244 	
       
   245 void CLcStylusTapTest::DoExecuteModuleTestBlockL( CStifItemParser& aItem, TLcStylusTapTestResult& aTestResult )
       
   246     {
       
   247 	STIF_LOG( "[STIF_LOG] >>>DoExecuteModuleTestBlockL" );
       
   248 	
       
   249     User::LeaveIfError( aItem.GetString( _L( "ExecuteModuleTestBlock" ), iTestBlockParams.iTestBlockName ) );
       
   250     STIF_LOG1( "Module test type: %S", &iTestBlockParams.iTestBlockName );
       
   251     
       
   252     GetTestBlockParamsL( aItem );
       
   253     
       
   254     // Add new module test block branches with optional test parameters here   
       
   255     if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
       
   256         {      
       
   257         ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, 
       
   258                 iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
       
   259         }
       
   260     else
       
   261         {
       
   262         STIF_LOG( "Test type: not found" );
       
   263         User::Leave( KErrNotFound );
       
   264         }
       
   265     
       
   266 	STIF_LOG( "[STIF_LOG] <<<DoExecuteModuleTestBlockL" );
       
   267     }
       
   268 	
       
   269 // -----------------------------------------------------------------------------
       
   270 // CLcStylusTapTest::ExecuteBranchTestBlock
       
   271 // -----------------------------------------------------------------------------
       
   272 	
       
   273 TInt CLcStylusTapTest::ExecuteBranchTestBlock( CStifItemParser& aItem )
       
   274     {
       
   275 	STIF_LOG( "[STIF_LOG] >>>ExecuteBranchTestBlock" );
       
   276 	
       
   277     TInt res;
       
   278     TLcStylusTapTestResult testResult;
       
   279     
       
   280     TRAP( res, DoExecuteBranchTestBlockL( aItem, testResult ) );
       
   281     if ( res != KErrNone )
       
   282         {
       
   283         STIF_LOG1( "DoExecuteBranchTestBlockL error: %d", res );
       
   284         return res;
       
   285         }   
       
   286     
       
   287     STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
       
   288     STIF_LOG( "[STIF_LOG] Test case passed" );
       
   289 	STIF_LOG( "[STIF_LOG] <<<ExecuteBranchTestBlock" );
       
   290     return KErrNone;
       
   291     }
       
   292 
       
   293 	
       
   294 void CLcStylusTapTest::DoExecuteBranchTestBlockL( CStifItemParser& aItem, TLcStylusTapTestResult& aTestResult )
       
   295     {
       
   296 	STIF_LOG( "[STIF_LOG] >>>DoExecuteBranchTestBlockL" );
       
   297 	
       
   298     User::LeaveIfError( aItem.GetString( _L( "ExecuteBranchTestBlock" ), iTestBlockParams.iTestBlockName ) );
       
   299     STIF_LOG1( "Branch test type: %S", &iTestBlockParams.iTestBlockName );
       
   300     
       
   301     GetTestBlockParamsL( aItem );
       
   302     
       
   303     // Add new branch test block branches with optional test parameters here   
       
   304     if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
       
   305         {      
       
   306         ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, 
       
   307                 iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
       
   308         }
       
   309     else
       
   310         {
       
   311         STIF_LOG( "Test type: not found" );
       
   312         User::Leave( KErrNotFound );
       
   313         }
       
   314     
       
   315 	STIF_LOG( "[STIF_LOG] <<<DoExecuteBranchTestBlockL" );
       
   316     }
       
   317 
       
   318 // Add test block methods implementation here
       
   319 // -----------------------------------------------------------------------------
       
   320 // CLcStylusTapTest::ExampleTestL
       
   321 // -----------------------------------------------------------------------------
       
   322 
       
   323 void CLcStylusTapTest::ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption, 
       
   324         TInt aTestIntOption, TInt aTestCharOption, TLcStylusTapTestResult& aTestResult )
       
   325     {
       
   326     STIF_LOG( ">>>ExampleTestL" );
       
   327     
       
   328     if ( !aTestOption.Compare( _L( "API" ) ) )
       
   329         {
       
   330         STIF_LOG1( "Api test option: %S", &aTestOption );
       
   331         STIF_LOG1( "Api test sub-option: %S", &aTestSubOption );
       
   332         STIF_LOG1( "Api test int option: %d", aTestIntOption );
       
   333         STIF_LOG1( "Api test char option: %c", aTestCharOption );
       
   334         }
       
   335     else if ( !aTestOption.Compare( _L( "MODULE" ) ) )
       
   336         {
       
   337         STIF_LOG1( "Module test option: %S", &aTestOption );
       
   338         STIF_LOG1( "Module test sub-option: %S", &aTestSubOption );
       
   339         STIF_LOG1( "Module test int option: %d", aTestIntOption );
       
   340         STIF_LOG1( "Module test char option: %c", aTestCharOption );
       
   341         }
       
   342     else if ( !aTestOption.Compare( _L( "BRANCH" ) ) )
       
   343         {
       
   344         STIF_LOG1( "Branch test option: %S", &aTestOption );
       
   345         STIF_LOG1( "Branch test sub-option: %S", &aTestSubOption );
       
   346         STIF_LOG1( "Branch test int option: %d", aTestIntOption );
       
   347         STIF_LOG1( "Branch test char option: %c", aTestCharOption );
       
   348         }
       
   349     else
       
   350         {
       
   351         STIF_LOG( "Invalid test parameter" );
       
   352         User::Leave( KErrNotFound );
       
   353         }
       
   354     
       
   355     aTestResult = ETestCasePassed;
       
   356     
       
   357     STIF_LOG( "<<<ExampleTestL" );
       
   358     }
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // CLcStylusTapTest::CreateLcStylusTapTestL
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 void CLcStylusTapTest::CreateLcStylusTapTestL( TPtrC aTestOption, TPtrC aTestSubOption, TLcStylusTapTestResult& aTestResult )
       
   365     {
       
   366     STIF_LOG( ">>>CreateLcStylusTapL" );    	
       
   367     
       
   368     delete iLcStylusTap;
       
   369     iLcStylusTap = NULL;
       
   370     
       
   371     if( !aTestSubOption.Compare(_L( "BT" )) )
       
   372 		{
       
   373 		GetPluginImplementation(EAknIndicatorBluetoothModuleOnVisible);
       
   374 		STIF_LOG1( "CreateLcStylusTapL BT result: %d", iLcStylusTap ? 1 : 0 );
       
   375 		}
       
   376     else if( !aTestSubOption.Compare(_L( "USB" )) )
       
   377 		{
       
   378 		GetPluginImplementation(EAknIndicatorUSBConnection);
       
   379 		STIF_LOG1( "CreateLcStylusTapL USB result: %d", iLcStylusTap ? 1 : 0 );
       
   380 		}
       
   381     else if( !aTestSubOption.Compare(_L( "IRDA" )) )
       
   382 		{
       
   383 		GetPluginImplementation(EAknIndicatorIrActive);
       
   384 		STIF_LOG1( "CreateLcStylusTapL IR result: %d", iLcStylusTap ? 1 : 0 );
       
   385 		}
       
   386     else if( !aTestSubOption.Compare(_L( "USBMEM" )) )
       
   387 		{
       
   388 		GetPluginImplementation(EAknIndicatorUSBMemConnected);
       
   389 		STIF_LOG1( "CreateLcStylusTapL USB result: %d", iLcStylusTap ? 1 : 0 );
       
   390 		}
       
   391     else
       
   392     	{}
       
   393     
       
   394     if(!iLcStylusTap)
       
   395     	{
       
   396     	STIF_LOG( "Error iLcStylusTap == NULL" );
       
   397 		return;
       
   398     	}	
       
   399     
       
   400     DestroyImplementation();
       
   401     
       
   402     aTestResult = ETestCasePassed;
       
   403     
       
   404     STIF_LOG( "<<<CreateLcStylusTapL" );
       
   405     }
       
   406 
       
   407 // -----------------------------------------------------------------------------
       
   408 // CLcStylusTapTest::TextTapTestL
       
   409 // -----------------------------------------------------------------------------
       
   410 //
       
   411 void CLcStylusTapTest::TextTapTestL( TPtrC aTestOption, TPtrC aTestSubOption, TLcStylusTapTestResult& aTestResult )
       
   412 	{
       
   413 	STIF_LOG(">>CLcStylusTapTest::TextTapTestL");
       
   414 	
       
   415 	HBufC* Media = NULL;
       
   416 	delete iLcStylusTap;
       
   417 	iLcStylusTap = NULL;
       
   418 	
       
   419     if( !aTestSubOption.Compare(_L( "BT" )) )
       
   420 		{
       
   421 		GetPluginImplementation(EAknIndicatorBluetoothModuleOnVisible);
       
   422 		if(iLcStylusTap)
       
   423 			{			
       
   424 			Media = iLcStylusTap->TextL(EAknIndicatorBluetoothModuleOnVisible, iTextType);
       
   425 			STIF_LOG1( "CheckTextResult err: %d", CheckTextResult(EAknIndicatorBluetoothModuleOnVisible, Media) );
       
   426 			STIF_LOG1( "TextL: %S, OK", Media );
       
   427 			}
       
   428 		}
       
   429     else if( !aTestSubOption.Compare(_L( "USB" )) )
       
   430 		{
       
   431 		GetPluginImplementation(EAknIndicatorUSBConnection);
       
   432 		if(iLcStylusTap)
       
   433 			{			
       
   434 			Media = iLcStylusTap->TextL(EAknIndicatorUSBConnection, iTextType);
       
   435 			STIF_LOG1( "TextL: %S, OK", Media );
       
   436 			STIF_LOG1( "CheckTextResult err: %d", CheckTextResult(EAknIndicatorUSBConnection, Media) );
       
   437 			}
       
   438 		}
       
   439     else if( !aTestSubOption.Compare(_L( "USBMEM" )) )
       
   440 		{
       
   441 		GetPluginImplementation(EAknIndicatorUSBMemConnected);
       
   442 		if(iLcStylusTap)
       
   443 			{			
       
   444 			Media = iLcStylusTap->TextL(EAknIndicatorUSBMemConnected, iTextType);
       
   445 			STIF_LOG1( "TextL: %S no checked", Media );
       
   446 			//STIF_LOG1( "CheckTextResult err: %d", CheckTextResult(EAknIndicatorUSBMemConnected, Media) );
       
   447 			}
       
   448 		}
       
   449     else if( !aTestSubOption.Compare(_L( "USBMEM_loc" )) )
       
   450 		{
       
   451 		GetPluginImplementation(EAknIndicatorUSBMemConnected);
       
   452 		if(iLcStylusTap)
       
   453 			{			
       
   454 			Media = iLcStylusTap->TextL(EAknIndicatorUSBMemConnected, iTextType);
       
   455 			STIF_LOG1( "CheckTextResult err: %d", CheckTextResult(EAknIndicatorUSBMemConnected, Media) );
       
   456 			STIF_LOG1( "TextL: %S, OK", Media );
       
   457 			}
       
   458 		}
       
   459     else
       
   460         User::LeaveIfError(KErrNotFound);
       
   461 
       
   462     DestroyImplementation();
       
   463     
       
   464     aTestResult = ETestCasePassed;
       
   465     
       
   466 	STIF_LOG("<<CallHandleIndicatorTapL::TextTapTestL");
       
   467 	}
       
   468 	
       
   469 // -----------------------------------------------------------------------------
       
   470 // CLcStylusTapTest::CallHandleIndicatorTapTestL
       
   471 // -----------------------------------------------------------------------------
       
   472 //
       
   473 void CLcStylusTapTest::CallHandleIndicatorTapTestL( TPtrC aTestOption, TPtrC aTestSubOption, TLcStylusTapTestResult& aTestResult )
       
   474 	{
       
   475 	STIF_LOG(">>CLcStylusTapTest::CallHandleIndicatorTapL");
       
   476 	
       
   477     if( !aTestSubOption.Compare(_L( "BT" )) )
       
   478 		{
       
   479 		GetPluginImplementation(EAknIndicatorBluetoothModuleOnVisible);
       
   480 		if(iLcStylusTap)
       
   481 			{
       
   482 			iLcStylusTap->HandleIndicatorTapL(EAknIndicatorBluetoothModuleOnVisible);
       
   483 			STIF_LOG("HandleIndicatorTapL OK");
       
   484 			}
       
   485 		}
       
   486     else if( !aTestSubOption.Compare(_L( "USB" )) )
       
   487 		{
       
   488 		GetPluginImplementation(EAknIndicatorUSBConnection);
       
   489 		if(iLcStylusTap)
       
   490 			{
       
   491 			iLcStylusTap->HandleIndicatorTapL(EAknIndicatorUSBConnection);
       
   492 			STIF_LOG("HandleIndicatorTapL OK");
       
   493 			}
       
   494 		}
       
   495     else if( !aTestSubOption.Compare(_L( "USBMEM" )) )
       
   496 		{
       
   497 		GetPluginImplementation(EAknIndicatorUSBMemConnected);
       
   498 		if(iLcStylusTap)
       
   499 			{
       
   500 			iLcStylusTap->HandleIndicatorTapL(EAknIndicatorUSBMemConnected);
       
   501 			STIF_LOG("HandleIndicatorTapL OK");
       
   502 			}
       
   503 		}
       
   504     else if( !aTestSubOption.Compare(_L( "IRDA" )) )
       
   505 		{
       
   506 		GetPluginImplementation(EAknIndicatorIrActive);
       
   507 		if(iLcStylusTap)
       
   508 			{
       
   509 			iLcStylusTap->HandleIndicatorTapL(EAknIndicatorIrActive);
       
   510 			STIF_LOG("HandleIndicatorTapL OK");
       
   511 			}
       
   512 		}
       
   513     else
       
   514         User::LeaveIfError(KErrNotFound);
       
   515 
       
   516     DestroyImplementation();
       
   517     
       
   518     aTestResult = ETestCasePassed;
       
   519        	
       
   520 	STIF_LOG(">>CLcStylusTapTest::CallHandleIndicatorTapL");
       
   521 	}
       
   522 
       
   523 // Other operaton functions
       
   524 // -----------------------------------------------------------------------------
       
   525 // CLcStylusTapTest::GetPluginImplementation
       
   526 // returns CLcStylusTap pointer
       
   527 // -----------------------------------------------------------------------------
       
   528 //
       
   529 TBool CLcStylusTapTest::GetPluginImplementation(TInt aValue)
       
   530 	{
       
   531 	STIF_LOG( ">>CLcStylusTapTest::GetPluginImplementation" );
       
   532 	
       
   533 		
       
   534 	const TUid uidInterfacetobepop = TUid::Uid(KAknIndicatorPluginInterfaceUid);	  	
       
   535 	TRAPD(err, REComSession::ListImplementationsL(uidInterfacetobepop, iImplementations));
       
   536 	STIF_LOG1( "REComSession::ListImplementationsL err: %d", err );
       
   537 	if(err != KErrNone)
       
   538 		User::LeaveIfError(err);
       
   539 	 
       
   540 	delete iLcStylusTap;
       
   541 	iLcStylusTap = NULL;
       
   542 	//HBufC* Media = NULL;
       
   543 		
       
   544 	TUid btimpluid = {KImplUIDBTIndicatorsPlugin};
       
   545 	TUid usbimpluid = {KImplUIDUSBIndicatorsPlugin};
       
   546 	TUid irimpluid = {KImplUIDIRIndicatorsPlugin};
       
   547 	TUid usbMemImp = {0x20026FC4};//usb_mem
       
   548 	
       
   549 	switch (aValue)
       
   550 		{
       
   551 		case EAknIndicatorBluetooth://12
       
   552 		case EAknIndicatorBluetoothVisible:
       
   553 		case EAknIndicatorBluetoothModuleOn:
       
   554 		case EAknIndicatorBluetoothModuleOnVisible://55
       
   555 			iLcStylusTap = REINTERPRET_CAST(CLcStylusTap*, REComSession::CreateImplementationL(btimpluid, iDtor_Key) );   
       
   556 			break;
       
   557 		case EAknIndicatorUSBConnection:      //28  
       
   558 			iLcStylusTap = REINTERPRET_CAST(CLcStylusTap*, REComSession::CreateImplementationL(usbimpluid, iDtor_Key) );   
       
   559 			break;
       
   560 		case EAknIndicatorIrActive:   
       
   561 			iLcStylusTap = REINTERPRET_CAST(CLcStylusTap*, REComSession::CreateImplementationL(irimpluid, iDtor_Key) );   
       
   562 			break;
       
   563 		case EAknIndicatorUSBMemConnected:
       
   564         case EAknIndicatorUSBMemActive:      
       
   565 			iLcStylusTap = REINTERPRET_CAST(CLcStylusTap*, REComSession::CreateImplementationL(usbMemImp, iDtor_Key) );   
       
   566 			break;		        
       
   567 		default:         
       
   568 			STIF_LOG( "GetPluginImplementation ERROR!" ); 
       
   569 			User::LeaveIfError(KErrNotFound);
       
   570 			break;
       
   571 		}
       
   572 	   
       
   573 	STIF_LOG1( "iLcStylusTap: %d", iLcStylusTap ? 1 : 0 );  
       
   574 	    
       
   575     return ETrue;
       
   576 	}
       
   577 
       
   578 
       
   579 // -----------------------------------------------------------------------------
       
   580 // CLcStylusTapTest::CheckTextResult
       
   581 // -------------------------------------------
       
   582 //
       
   583 TInt CLcStylusTapTest::CheckTextResult(TInt aValue, HBufC* &aMedia)
       
   584 	{
       
   585 	TInt err = KErrNone;
       
   586 	
       
   587 	if(!aMedia)
       
   588 		{		
       
   589 		User::Leave(KErrNotFound);
       
   590 		}
       
   591 	
       
   592 	switch(aValue)
       
   593 		{
       
   594 		case EAknIndicatorBluetooth://12
       
   595 		case EAknIndicatorBluetoothVisible:
       
   596 		case EAknIndicatorBluetoothModuleOn:
       
   597 		case EAknIndicatorBluetoothModuleOnVisible://55
       
   598 			if(aMedia->Compare(KBlueTooth())!= 0 || iTextType != CAknIndicatorPlugin::EAknIndicatorPluginLinkText)
       
   599 				err = KErrNotFound;
       
   600 			break;
       
   601 		case EAknIndicatorUSBConnection: 
       
   602 			if(aMedia->Compare(KUSB())!= 0 || iTextType != CAknIndicatorPlugin::EAknIndicatorPluginLinkText)
       
   603 				err = KErrNotFound;
       
   604 			break;
       
   605 		case EAknIndicatorIrActive:
       
   606 			if(aMedia->Compare(KIRDA())!= 0 || iTextType != CAknIndicatorPlugin::EAknIndicatorPluginLinkText)
       
   607 				err = KErrNotFound;
       
   608 			break;
       
   609 		default:
       
   610 			err = KErrNotFound;
       
   611 			break;
       
   612 		}
       
   613 	
       
   614 	if(err == KErrNotFound)
       
   615 		{
       
   616 		delete aMedia;
       
   617 		aMedia = NULL;
       
   618 		User::LeaveIfError(KErrNotFound); // Did not match that should
       
   619 		}
       
   620 	
       
   621 	STIF_LOG("CallHandleIndicatorTapL::CompareMedia OK");
       
   622 	
       
   623 	return err;
       
   624 	}
       
   625 // -----------------------------------------------------------------------------
       
   626 // CLcStylusTapTest::DestroyImplementation
       
   627 // destroy plugin implementation
       
   628 // -------------------------------------------
       
   629 //
       
   630 void CLcStylusTapTest::DestroyImplementation()
       
   631 	{
       
   632 	STIF_LOG( ">>CLcStylusTapTest::DestroyImplementation" );
       
   633     
       
   634     if(iLcStylusTap)
       
   635     	{
       
   636     	delete iLcStylusTap;
       
   637     	iLcStylusTap = NULL;
       
   638     	}
       
   639 
       
   640    	iImplementations.ResetAndDestroy();
       
   641    	iImplementations.Close();   	
       
   642    	
       
   643     REComSession::DestroyedImplementation(iDtor_Key);
       
   644     
       
   645     STIF_LOG("<<CLcStylusTapTest::DestroyImplementation");
       
   646 	}
       
   647 
       
   648 
       
   649 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   650 // None
       
   651 
       
   652 //  [End of File] - Do not remove