telephonyserver/etelsimtoolkit/tetel/Te_EtelSat/TE_EtelSatfns.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2002-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 //
       
    15 
       
    16 #include "Te_EtelSatTestStepBase.h"
       
    17 #include "TE_EtelSatfns.h"
       
    18 
       
    19 CTestSatFns::CTestSatFns()
       
    20 /** Each test step initialises it's own name
       
    21 */
       
    22 	{
       
    23 	// store the name of this test case
       
    24 	// this is the name that is used by the script file
       
    25 	SetTestStepName(_L("TestSatFns"));
       
    26 	}
       
    27 
       
    28 enum TVerdict CTestSatFns::doTestStepL()
       
    29     {
       
    30 	INFO_PRINTF1(_L("************************"));
       
    31 	INFO_PRINTF1(_L("Test RSat Functionality"));
       
    32 	INFO_PRINTF1(_L("************************"));
       
    33 
       
    34 	RPhone phone;
       
    35 	TInt ret=phone.Open(iTelServer,DSATTSY_PHONE_NAME);
       
    36 
       
    37 	TEST(ret==KErrNone);
       
    38 
       
    39 	RSat sat;
       
    40 	ret=sat.Open(phone);
       
    41     TEST(ret==KErrNone);
       
    42 	
       
    43 	// local variables used throughout the sat tests
       
    44 	TRequestStatus reqStatus;
       
    45 	iTestCount=1;
       
    46 
       
    47 	//Test delegation of capability policy checking
       
    48 	RTestSat testSat;
       
    49 	ret=testSat.Open(phone);
       
    50 	TEST(ret==KErrNone);
       
    51 
       
    52 	INFO_PRINTF2(_L("Test %d - Test delegation of capability policy checking"),iTestCount++);
       
    53  
       
    54 	//Test calling CustomIPC1. Should return KErrNone
       
    55     ret = testSat.TestCustomIPC1();  
       
    56     TEST(ret==KErrNone);
       
    57 	testSat.Close();
       
    58 
       
    59 	// Session Start
       
    60 	sat.NotifyProactiveSimSessionStart(reqStatus);
       
    61 	User::WaitForRequest(reqStatus);
       
    62 	TEST(reqStatus.Int()==KErrNone);
       
    63 	INFO_PRINTF2(_L("Test %d - RSat::NotifyProactiveSimSessionStart passed"),iTestCount++);
       
    64 
       
    65 	sat.NotifyProactiveSimSessionStart(reqStatus);
       
    66 	sat.CancelAsyncRequest(ESatNotifyProactiveSimSessionStart);
       
    67 	User::WaitForRequest(reqStatus);
       
    68 	TEST(reqStatus.Int()==KErrCancel);
       
    69 	INFO_PRINTF2(_L("Test %d - RSat::NotifyProactiveSimSessionStartCancel passed"),iTestCount++);
       
    70 
       
    71 	// Session End
       
    72 	sat.NotifyProactiveSimSessionEnd(reqStatus);
       
    73 	User::WaitForRequest(reqStatus);
       
    74 	TEST(reqStatus.Int()==KErrNone);
       
    75 	INFO_PRINTF2(_L("Test %d - RSat::NotifyProactiveSimSessionEnd passed"),iTestCount++);
       
    76 
       
    77 	sat.NotifyProactiveSimSessionEnd(reqStatus);
       
    78 	sat.CancelAsyncRequest(ESatNotifyProactiveSimSessionEnd);
       
    79 	User::WaitForRequest(reqStatus);
       
    80 	TEST(reqStatus.Int()==KErrCancel);
       
    81 	INFO_PRINTF2(_L("Test %d - RSat::NotifyProactiveSimSessionEndCancel passed"),iTestCount++);
       
    82 
       
    83 	// Get Icon
       
    84 	RSat::TIcon icon;
       
    85 	sat.GetIcon(reqStatus,1,icon); 
       
    86 	User::WaitForRequest(reqStatus);
       
    87 	TEST(reqStatus.Int()==KErrNone);
       
    88 	TEST(icon==DSATTSY_ICON_EF1);
       
    89 	INFO_PRINTF2(_L("Test %d - RSat::GetIcon passed"),iTestCount++);
       
    90 
       
    91 	sat.GetIcon(reqStatus,2,icon); 
       
    92 	User::WaitForRequest(reqStatus);
       
    93 	TEST(reqStatus.Int()==KErrNone);
       
    94 	TEST(icon==DSATTSY_ICON_EF2);
       
    95 	INFO_PRINTF2(_L("Test %d - RSat::GetIcon passed"),iTestCount++);
       
    96 
       
    97 	sat.GetIcon(reqStatus,1,icon);
       
    98 	sat.CancelAsyncRequest(ESatGetIcon);
       
    99 	User::WaitForRequest(reqStatus);
       
   100 	TEST(reqStatus.Int()==KErrCancel);
       
   101 	INFO_PRINTF2(_L("Test %d - RSat::GetIconCancel passed"),iTestCount++);
       
   102 
       
   103 	// Get Image Instance
       
   104 	// The Client should have read the icon EF before reading the image instance.
       
   105 	// The contents of the icon EF indicate the size of the image instance,
       
   106 	// the Client should use this information to allocate a buffer size that it requires
       
   107 	// and pass a reference to is as a TDes8&
       
   108 
       
   109 	TBuf8<12> instance;
       
   110 	RSat::TInstanceInfoV3 instanceInfo;
       
   111 
       
   112 	// first test
       
   113 	instanceInfo.iInstanceNumber=DSATTSY_INSTANCE_NUMBER1;
       
   114 	instanceInfo.iLength=DSATTSY_INSTANCE_LENGTH1;
       
   115 	instanceInfo.iOffset=DSATTSY_INSTANCE_OFFSET1;
       
   116 	instanceInfo.iCoding=DSATTSY_INSTANCE_CODING_BASIC;
       
   117 	instanceInfo.iImgWidth=DSATTSY_INSTANCE_WIDTH_1;
       
   118 	instanceInfo.iImgHeight=DSATTSY_INSTANCE_HEIGHT_1;
       
   119 	instanceInfo.iFileId=DSATTSY_INSTANCE_FILE_ID_1;
       
   120 		
       
   121 	RSat::TInstanceInfoV3Pckg instanceInfoPackage1(instanceInfo);
       
   122 	
       
   123 	sat.GetImageInstance(reqStatus, instanceInfoPackage1, instance);
       
   124 	User::WaitForRequest(reqStatus);
       
   125 	TEST(reqStatus.Int()==KErrNone);
       
   126 	TEST(instance==DSATTSY_IMG_INSTANCE1);
       
   127 	INFO_PRINTF2(_L("Test %d - RSat::GetImageInstance passed"),iTestCount++);
       
   128 
       
   129 	// second test 
       
   130 	instanceInfo.iInstanceNumber=DSATTSY_INSTANCE_NUMBER2;
       
   131 	instanceInfo.iLength=DSATTSY_INSTANCE_LENGTH2;
       
   132 	instanceInfo.iOffset=DSATTSY_INSTANCE_OFFSET2;
       
   133 	instanceInfo.iCoding=DSATTSY_INSTANCE_CODING_COLOUR;
       
   134 	instanceInfo.iImgWidth=DSATTSY_INSTANCE_WIDTH_2;
       
   135 	instanceInfo.iImgHeight=DSATTSY_INSTANCE_HEIGHT_2;
       
   136 	instanceInfo.iFileId=DSATTSY_INSTANCE_FILE_ID_2;
       
   137 	
       
   138 	RSat::TInstanceInfoV3Pckg instanceInfoPackage2(instanceInfo);
       
   139 
       
   140 	sat.GetImageInstance(reqStatus,instanceInfoPackage2,instance);
       
   141 	User::WaitForRequest(reqStatus);
       
   142 	TEST(reqStatus.Int()==KErrNone);
       
   143 	TEST(instance==DSATTSY_IMG_INSTANCE2);
       
   144 	INFO_PRINTF2(_L("Test %d - RSat::GetImageInstance passed"),iTestCount++);
       
   145 
       
   146 	// cancel test
       
   147 	sat.GetImageInstance(reqStatus,instanceInfoPackage1,instance);
       
   148 	sat.CancelAsyncRequest(ESatGetImageInstance);
       
   149 	User::WaitForRequest(reqStatus);
       
   150 	TEST(reqStatus.Int()==KErrCancel);
       
   151 	INFO_PRINTF2(_L("Test %d - RSat::GetImageInstanceCancel passed"),iTestCount++);
       
   152 
       
   153 	// GetClut
       
   154 	// The size of the clut should be known at this point (it is defined in the image instance)
       
   155 	// The Client allocates a buffer of the required size.
       
   156 	TBuf8<5> clut;
       
   157 	sat.GetClut(reqStatus, DSATTSY_INSTANCE_NUMBER1, DSATTSY_CLUT_OFFSET, clut);
       
   158 	User::WaitForRequest(reqStatus);
       
   159 	TEST(reqStatus.Int()==KErrNone);
       
   160 	TEST(clut==DSATTSY_CLUT1);
       
   161 	INFO_PRINTF2(_L("Test %d - RSat::GetClut passed"),iTestCount++);
       
   162 
       
   163 	sat.GetClut(reqStatus,DSATTSY_INSTANCE_NUMBER1, DSATTSY_CLUT_OFFSET, clut);
       
   164 	sat.CancelAsyncRequest(ESatGetClut);
       
   165 	User::WaitForRequest(reqStatus);
       
   166 	TEST(reqStatus.Int()==KErrCancel);
       
   167 	INFO_PRINTF2(_L("Test %d - RSat::GetClutCancel passed"),iTestCount++);
       
   168 
       
   169 	//Client Ready Indication
       
   170 	TEST(sat.UsatClientReadyIndication()==KErrNone);
       
   171 	
       
   172 	//Client notification of TSy completing handling of a PCmd 
       
   173 	RSat::TPCmd pcmd;
       
   174 	sat.NotifyTsyStateUpdated(reqStatus, pcmd);
       
   175 	User::WaitForRequest(reqStatus);
       
   176 	TEST(reqStatus==KErrNone);
       
   177 	TEST(pcmd==DSATTSY_SENDSS);
       
   178 	
       
   179 	//test cancel
       
   180 	sat.NotifyTsyStateUpdated(reqStatus, pcmd);
       
   181 	sat.CancelAsyncRequest(ESatNotifyTsyStateUpdated);
       
   182 	User::WaitForRequest(reqStatus);
       
   183 	TEST(reqStatus==KErrCancel);
       
   184 	INFO_PRINTF2(_L("Test %d - RSat::NotifyTsyStateUpdated passed"),iTestCount++);	
       
   185 
       
   186 	// End of RSat tests.
       
   187 	sat.Close();
       
   188 	phone.Close();
       
   189 
       
   190 	return TestStepResult();
       
   191 
       
   192 	}