sysstatemgmt/systemstateplugins/adptplugin/src/miscadaptationref.cpp
changeset 45 c6215323ad55
parent 0 4e1aa6a622a0
child 61 8cb079868133
equal deleted inserted replaced
44:2c28af138640 45:c6215323ad55
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description: This adaptation plugin implementation is for test/reference purposes.   
       
    14 // The loading of this plugin is controlled through test macro defined in the iby file "ssmcompatibility.iby".
       
    15 // If the macro "TEST_SSM_MACRO" is not defined, original plugins are loaded and this plugin is not loaded.
       
    16 // If the test P & S key is set in the test code, the calls are routed to the reference or dummy implementations.
       
    17 // Else the actual plugins are loaded and the calls are routed to the actual implementations.
       
    18 // The test P & S key which it looks for is KMiscPluginPropertyKey(0x2000E658)
    14 //
    19 //
    15 
    20 
       
    21 #include "ssmdebug.h"
    16 #include "miscadaptationref.h"
    22 #include "miscadaptationref.h"
    17 #include <ssm/startupadaptationcommands.h>
    23 #include <ssm/startupadaptationcommands.h>
       
    24 #include <e32property.h> 
    18 
    25 
    19 _LIT(KTestCmdSecurityCheckTestFile, "c:\\cmdsecuritychecktest\\pinchecksecuritycaseno.txt");
    26 _LIT(KTestCmdSecurityCheckTestFile, "c:\\cmdsecuritychecktest\\pinchecksecuritycaseno.txt");
    20 
    27 
       
    28 const TUint32 KMiscPluginPropertyKey = 0x2000E658;
       
    29 const TUid KPropertyCategory={0x2000D75B};              // tcustomcmd_server SID = KSsmServerName SID (changed in tcustomcmd_server.mmp file)
    21 /**
    30 /**
    22  Function to create new Misc Adaptation Plugin. Used for a collection of activities.
    31  Function to create new Misc Adaptation Plugin. Used for a collection of activities.
    23 
    32 
    24  @return	new instance of MEmergencyCallRfAdaptation for Miscellaneous Adaptations.
    33  @return	new instance of MEmergencyCallRfAdaptation for Miscellaneous Adaptations.
    25 
    34 
    40 	}
    49 	}
    41 
    50 
    42 CMiscAdaptationRef::~CMiscAdaptationRef()
    51 CMiscAdaptationRef::~CMiscAdaptationRef()
    43 	{
    52 	{
    44 	iFs.Close();
    53 	iFs.Close();
       
    54 	iSaaMiscAdaptationLib.Close();
    45 	}
    55 	}
    46 
    56 
    47 CMiscAdaptationRef::CMiscAdaptationRef()
    57 CMiscAdaptationRef::CMiscAdaptationRef()
    48 	{
    58 	{
    49 	}
    59 	}
    50 
    60 
    51 void CMiscAdaptationRef::ConstructL()
    61 void CMiscAdaptationRef::ConstructL()
    52 	{
    62 	{
       
    63 	DEBUGPRINT1A("Loading Actual plugins");
       
    64     _LIT(KSaaMiscAdaptationDLL, "saamiscadaptation.dll");
       
    65     User::LeaveIfError(iSaaMiscAdaptationLib.Load(KSaaMiscAdaptationDLL));
       
    66     iSaaMiscAdaptationDll = (MMiscAdaptation *)(iSaaMiscAdaptationLib.Lookup(1)());   
       
    67     
    53 	iTestCaseNum = 1;
    68 	iTestCaseNum = 1;
    54 	User::LeaveIfError(iFs.Connect());
    69 	User::LeaveIfError(iFs.Connect());
    55 	}
    70 	}
    56 
    71 
    57 /** 
    72 /** 
    58  Deletes and frees memory allocated.
    73  Deletes and frees memory allocated.
    59 */
    74 */
    60 void CMiscAdaptationRef::Release()
    75 void CMiscAdaptationRef::Release()
    61 	{
    76 	{
       
    77 	if(!IsTestPsKeyDefined())
       
    78 	    {
       
    79 	    DEBUGPRINT1A("Release :: Calling Actual plugins functions (saamiscadaptation.dll)");
       
    80 	    iSaaMiscAdaptationDll->Release();
       
    81 	    }
    62 	delete this;
    82 	delete this;
    63 	}
    83 	}
    64 
    84 
    65 /**
    85 /**
    66  Get the start-up mode from the Cooperating System.
    86  Get the start-up mode from the Cooperating System.
    67  Reference implementation completes with KErrNone as a cooperating system does not exist on Techview/H4 hrp.
    87  Reference implementation completes the request with KErrNone. This is required for automated testing.
       
    88  Actual plugins return expected values and this can be verified by manual testing
    68 
    89 
    69  @param aModePckg should contain start-up of the Cooperating System on completion
    90  @param aModePckg should contain start-up of the Cooperating System on completion
    70  @param aStatus to complete when the operation has finished
    91  @param aStatus to complete when the operation has finished
    71 
    92 
    72  @see TRequestStatus
    93  @see TRequestStatus
    73 */
    94 */
    74 void CMiscAdaptationRef::GetGlobalStartupMode(TDes8& /*aModePckg*/, TRequestStatus& aStatus)
    95 void CMiscAdaptationRef::GetGlobalStartupMode(TDes8& aModePckg, TRequestStatus& aStatus)
    75 	{
    96 	{
    76 	aStatus = KRequestPending;
    97 	if(!IsTestPsKeyDefined())
    77 	TRequestStatus* status = &aStatus;
    98 	    {
    78 	User::RequestComplete(status, KErrNone);
    99 	    DEBUGPRINT1A("GetGlobalStartupMode :: Calling Actual plugins functions (saamiscadaptation.dll)");
       
   100         iSaaMiscAdaptationDll->GetGlobalStartupMode(aModePckg,aStatus);
       
   101 	    }
       
   102 	else
       
   103 	    {
       
   104 	    DEBUGPRINT1A("GetGlobalStartupMode :: Calling ref plugins functions (miscadaptationref.dll)");
       
   105         aStatus = KRequestPending;
       
   106         TRequestStatus* status = &aStatus;
       
   107         User::RequestComplete(status, KErrNone);        
       
   108 	    }
    79 	}
   109 	}
    80 
   110 
    81 /**
   111 /**
    82  Prepare language codes stored in the SIM in preferred language lists. The next call should be GetSimLanguagesL()
   112  Prepare language codes stored in the SIM in preferred language lists. The next call should be GetSimLanguagesL()
    83  Reference implementation completes with KErrNotSupported as SIM support is not available on Techview/H4 hrp.
   113  Reference implementation completes with KErrNotSupported. This is required for automated testing.
    84 
   114  Actual plugins return expected values and this can be verified by manual testing
       
   115  
    85  @param aPriority priority for which the language lists need to be prepared
   116  @param aPriority priority for which the language lists need to be prepared
    86  @param aSizePckg on return contains the size of the buffer, which a client should allocate and pass as one of the parameters (TInt aCount) to GetSimLanguagesL()
   117  @param aSizePckg on return contains the size of the buffer, which a client should allocate and pass as one of the parameters (TInt aCount) to GetSimLanguagesL()
    87  @param aStatus to complete when the operation has finished
   118  @param aStatus to complete when the operation has finished
    88 
   119 
    89  @see TSsmLanguageListPriority
   120  @see TSsmLanguageListPriority
    90  @see TRequestStatus
   121  @see TRequestStatus
    91  @see GetSimLanguagesL
   122  @see GetSimLanguagesL
    92 */
   123 */
    93 void CMiscAdaptationRef::PrepareSimLanguages(TSsmLanguageListPriority /*aPriority*/, TDes8& /*aSizePckg*/, TRequestStatus& aStatus)
   124 void CMiscAdaptationRef::PrepareSimLanguages(TSsmLanguageListPriority aPriority, TDes8& aSizePckg, TRequestStatus& aStatus)
    94 	{
   125 	{
    95 	aStatus = KRequestPending;
   126 	if(!IsTestPsKeyDefined())
    96 	TRequestStatus* status = &aStatus;
   127         {
    97 	// No support for SIM on H4hrp/Techview.
   128         DEBUGPRINT1A("PrepareSimLanguages :: Calling Actual plugins functions (saamiscadaptation.dll)");
    98 	User::RequestComplete(status, KErrNotSupported);
   129         iSaaMiscAdaptationDll->PrepareSimLanguages(aPriority,aSizePckg,aStatus);
       
   130         }
       
   131     else
       
   132         {
       
   133         DEBUGPRINT1A("PrepareSimLanguages :: Calling ref plugins functions (miscadaptationref.dll)");
       
   134         aStatus = KRequestPending;
       
   135         TRequestStatus* status = &aStatus;
       
   136         // No support for SIM on H4hrp/Techview.
       
   137         User::RequestComplete(status, KErrNotSupported);
       
   138         }
    99 	}
   139 	}
   100 
   140 
   101 /**
   141 /**
   102  Get language codes stored in the SIM in preferred language lists. PrepareSimLanguages() call should precede this call.
   142  Get language codes stored in the SIM in preferred language lists. PrepareSimLanguages() call should precede this call.
   103  Reference implementation completes with KErrNotSupported as SIM support is not available on Techview/H4 hrp.
   143  Reference implementation completes with KErrNotSupported.  This is required for automated testing.
   104 
   144  Actual plugins return expected values and this can be verified by manual testing
       
   145  
   105  @param aBuf should contain the language lists on completion
   146  @param aBuf should contain the language lists on completion
   106  @param aCount to contain the count of the languages
   147  @param aCount to contain the count of the languages
   107 
   148 
   108  @see PrepareSimLanguages
   149  @see PrepareSimLanguages
   109 */
   150 */
   110 void CMiscAdaptationRef::GetSimLanguagesL(CBufBase* /*aBuf*/, TInt /*aCount*/)
   151 void CMiscAdaptationRef::GetSimLanguagesL(CBufBase* aBuf, TInt aCount)
   111 	{
   152 	{
   112 	User::Leave(KErrNotSupported);
   153 	if(!IsTestPsKeyDefined())
   113 	}
   154         {
   114 
   155         DEBUGPRINT1A("GetSimLanguagesL :: Calling Actual plugins functions (saamiscadaptation.dll)");
   115 void CMiscAdaptationRef::GetHiddenReset(TDes8& /*aHiddenResetPckg*/, TRequestStatus& aStatus)
   156         iSaaMiscAdaptationDll->GetSimLanguagesL(aBuf,aCount);
   116 	{
   157         }
   117 	aStatus = KRequestPending;
   158     else
   118 	TRequestStatus* status = &aStatus;
   159         {
   119 	// No support for Reset in HRP/Techview.
   160         DEBUGPRINT1A("GetSimLanguagesL :: Calling ref plugins functions (miscadaptationref.dll)");
   120 	User::RequestComplete(status, KErrNotSupported);
   161         User::Leave(KErrNotSupported);
       
   162         }	
       
   163 	}
       
   164 
       
   165 void CMiscAdaptationRef::GetHiddenReset(TDes8& aHiddenResetPckg, TRequestStatus& aStatus)
       
   166 	{
       
   167 	if(!IsTestPsKeyDefined())
       
   168         {
       
   169         DEBUGPRINT1A("GetHiddenReset :: Calling Actual plugins functions (saamiscadaptation.dll)");
       
   170         iSaaMiscAdaptationDll->GetHiddenReset(aHiddenResetPckg,aStatus);
       
   171         }
       
   172     else
       
   173         {
       
   174         DEBUGPRINT1A("GetHiddenReset :: Calling ref plugins functions (miscadaptationref.dll)");
       
   175         aStatus = KRequestPending;
       
   176         TRequestStatus* status = &aStatus;
       
   177         // No support for Reset in HRP/Techview.
       
   178         User::RequestComplete(status, KErrNotSupported);        
       
   179         }
   121 	}
   180 	}
   122 
   181 
   123 
   182 
   124 /**
   183 /**
   125   Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to Cancel.
   184   Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to Cancel.
   126   On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled.
   185   On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled.
   127 */
   186 */
   128 void CMiscAdaptationRef::Cancel()
   187 void CMiscAdaptationRef::Cancel()
   129 	{
   188 	{
       
   189 	if(!IsTestPsKeyDefined())
       
   190         {
       
   191         DEBUGPRINT1A("Cancel :: Calling Actual plugins functions (saamiscadaptation.dll)");
       
   192         iSaaMiscAdaptationDll->Cancel();
       
   193         }
   130 	}
   194 	}
   131 
   195 
   132 /**
   196 /**
   133  Request the next security state.
   197  Request the next security state.
   134  Techview/H4hrp does not support SIM operations so a reference implementation would always return 'KErrNotSupported'.
   198  Reference implementation would always return 'KErrNotSupported'.  This is required for automated testing.
       
   199  Actual plugins return expected values and this can be verified by manual testing
       
   200   
   135  The function is modified to suit testing needs for PinCheck Security Command.
   201  The function is modified to suit testing needs for PinCheck Security Command.
   136  A real implementation is intended to differ a lot based on the runtime changes/events on the device.
   202  A real implementation is intended to differ a lot based on the runtime changes/events on the device.
   137  
   203  
   138  Each switch case represents a PIN Check security plug-in functionality in different status are as follows..
   204  Each switch case represents a PIN Check security plug-in functionality in different status are as follows..
   139  
   205  
   153 
   219 
   154  @see TRequestStatus
   220  @see TRequestStatus
   155 */
   221 */
   156 void CMiscAdaptationRef::SecurityStateChange(TInt aState, TDes8& aResponsePckg, TRequestStatus& aStatus)
   222 void CMiscAdaptationRef::SecurityStateChange(TInt aState, TDes8& aResponsePckg, TRequestStatus& aStatus)
   157 	{
   223 	{
   158 	aStatus = KRequestPending;
   224 	if(!IsTestPsKeyDefined())
   159 	TRequestStatus* status = &aStatus;
   225         {
   160 	StartupAdaptation::TSecurityStateInfo info = StartupAdaptation::EYes;
   226         DEBUGPRINT1A("SecurityStateChange:: Calling Actual plugins functions (saamiscadaptation.dll)");
   161 	
   227         iSaaMiscAdaptationDll->SecurityStateChange(aState,aResponsePckg,aStatus);
   162 	//Read Test case number from the file 
   228         }
   163 	TInt err = iFile.Open(iFs, KTestCmdSecurityCheckTestFile, EFileRead);
   229     else
   164 	if (err == KErrNone)
   230         {
   165 		{
   231         DEBUGPRINT1A("SecurityStateChange:: Calling ref plugins functions (miscadaptationref.dll)");
   166 		TRAP(err,iTestCaseNum = iFile.ReadInt32L());
   232         aStatus = KRequestPending;
   167 		iFile.Close();
   233         TRequestStatus* status = &aStatus;
   168 		if(err)
   234         StartupAdaptation::TSecurityStateInfo info = StartupAdaptation::EYes;
   169 			{
   235         
   170 			RDebug::Printf("Error while reading tst case number from the file pinchecksecuritycaseno.txt");
   236         //Read Test case number from the file 
   171 			User::RequestComplete(status, err);
   237         TInt err = iFile.Open(iFs, KTestCmdSecurityCheckTestFile, EFileRead);
   172 			return;
   238         if (err == KErrNone)
   173 			}
   239             {
   174 		}	
   240             TRAP(err,iTestCaseNum = iFile.ReadInt32L());
   175 	switch(iTestCaseNum)
   241             iFile.Close();
   176 		{
   242             if(err)
   177 		case EPINCHECK01:
   243                 {
   178 			switch(aState)
   244                 RDebug::Printf("Error while reading tst case number from the file pinchecksecuritycaseno.txt");
   179 			{
   245                 User::RequestComplete(status, err);
   180 			case StartupAdaptation::ESIMPresent:
   246                 return;
   181 				info = StartupAdaptation::EYes;
   247                 }
   182 				break;
   248             }   
   183             case StartupAdaptation::ESIMInvalid:
   249         switch(iTestCaseNum)
   184                 info = StartupAdaptation::ENo;
   250             {
   185                 break;
   251             case EPINCHECK01:
   186 			case StartupAdaptation::ESIMRejected:
   252                 switch(aState)
   187 				info = StartupAdaptation::ENo;
   253                 {
   188 				break;
   254                 case StartupAdaptation::ESIMPresent:
   189 			case StartupAdaptation::ESIMBlocked:
   255                     info = StartupAdaptation::EYes;
   190 				info = StartupAdaptation::ENo;
   256                     break;
   191 				break;
   257                 case StartupAdaptation::ESIMInvalid:
   192 			case StartupAdaptation::EPINRequired:
   258                     info = StartupAdaptation::ENo;
   193 				info = StartupAdaptation::EPIN1Required;
   259                     break;
   194 				break;
   260                 case StartupAdaptation::ESIMRejected:
   195 			case StartupAdaptation::ESIMLock:
   261                     info = StartupAdaptation::ENo;
   196 				info = StartupAdaptation::ESimLockOk;
   262                     break;
   197 				break;
   263                 case StartupAdaptation::ESIMBlocked:
   198 			case StartupAdaptation::ESecurityCheckOK:
   264                     info = StartupAdaptation::ENo;
   199 				info = StartupAdaptation::EYes;	
   265                     break;
   200 				break;	
   266                 case StartupAdaptation::EPINRequired:
   201 			case StartupAdaptation::ESecurityCheckFailed:
   267                     info = StartupAdaptation::EPIN1Required;
   202 				info = StartupAdaptation::EYes;
   268                     break;
   203 				break;	
   269                 case StartupAdaptation::ESIMLock:
   204 			default:
   270                     info = StartupAdaptation::ESimLockOk;
   205 				break;
   271                     break;
   206 			}
   272                 case StartupAdaptation::ESecurityCheckOK:
   207 			break;
   273                     info = StartupAdaptation::EYes; 
   208 		case EPINCHECK02:
   274                     break;  
   209 			switch(aState)
   275                 case StartupAdaptation::ESecurityCheckFailed:
   210 			{
   276                     info = StartupAdaptation::EYes;
   211 			case StartupAdaptation::ESIMPresent:
   277                     break;  
   212 				info = StartupAdaptation::EYes;
   278                 default:
   213 				break;
   279                     break;
   214             case StartupAdaptation::ESIMInvalid:
   280                 }
   215                 info = StartupAdaptation::ENo;
   281                 break;
   216                 break;
   282             case EPINCHECK02:
   217 			case StartupAdaptation::ESIMRejected:
   283                 switch(aState)
   218 				info = StartupAdaptation::EYes;
   284                 {
   219 				break;
   285                 case StartupAdaptation::ESIMPresent:
   220 			case StartupAdaptation::ESecurityCheckFailed:
   286                     info = StartupAdaptation::EYes;
   221 				info = StartupAdaptation::EYes;
   287                     break;
   222 				break;	
   288                 case StartupAdaptation::ESIMInvalid:
   223 			default:
   289                     info = StartupAdaptation::ENo;
   224 			break;
   290                     break;
   225 			}
   291                 case StartupAdaptation::ESIMRejected:
   226 			break;
   292                     info = StartupAdaptation::EYes;
   227 		case EPINCHECK03:
   293                     break;
   228 			switch(aState)
   294                 case StartupAdaptation::ESecurityCheckFailed:
   229 			{
   295                     info = StartupAdaptation::EYes;
   230 			case StartupAdaptation::ESIMPresent:
   296                     break;  
   231 				info = StartupAdaptation::EYes;
   297                 default:
   232 				break;
   298                 break;
   233             case StartupAdaptation::ESIMInvalid:
   299                 }
   234                 info = StartupAdaptation::ENo;
   300                 break;
   235                 break;
   301             case EPINCHECK03:
   236 			case StartupAdaptation::ESIMRejected:
   302                 switch(aState)
   237 				info = StartupAdaptation::ENo;
   303                 {
   238 				break;
   304                 case StartupAdaptation::ESIMPresent:
   239 			case StartupAdaptation::ESIMBlocked:
   305                     info = StartupAdaptation::EYes;
   240 				info = StartupAdaptation::EPUK1Required;
   306                     break;
   241 				break;	
   307                 case StartupAdaptation::ESIMInvalid:
   242 			case StartupAdaptation::ESIMLock:
   308                     info = StartupAdaptation::ENo;
   243 				info = StartupAdaptation::ESimLockOk;
   309                     break;
   244 				break;
   310                 case StartupAdaptation::ESIMRejected:
   245 			case StartupAdaptation::ESecurityCheckOK:
   311                     info = StartupAdaptation::ENo;
   246 				info = StartupAdaptation::EYes;	
   312                     break;
   247 				break;	
   313                 case StartupAdaptation::ESIMBlocked:
   248 			case StartupAdaptation::ESecurityCheckFailed:
   314                     info = StartupAdaptation::EPUK1Required;
   249 				info = StartupAdaptation::EYes;
   315                     break;  
   250 				break;	
   316                 case StartupAdaptation::ESIMLock:
   251 			default:
   317                     info = StartupAdaptation::ESimLockOk;
   252 				break;
   318                     break;
   253 			}
   319                 case StartupAdaptation::ESecurityCheckOK:
   254 			break;
   320                     info = StartupAdaptation::EYes; 
   255 		case EPINCHECK04:
   321                     break;  
   256 			switch(aState)
   322                 case StartupAdaptation::ESecurityCheckFailed:
   257 			{
   323                     info = StartupAdaptation::EYes;
   258 			case StartupAdaptation::ESIMPresent:
   324                     break;  
   259 				info = StartupAdaptation::EYes;
   325                 default:
   260 				break;
   326                     break;
   261             case StartupAdaptation::ESIMInvalid:
   327                 }
   262                 info = StartupAdaptation::ENo;
   328                 break;
   263                 break;
   329             case EPINCHECK04:
   264 			case StartupAdaptation::ESIMRejected:
   330                 switch(aState)
   265 				info = StartupAdaptation::ENo;
   331                 {
   266 				break;
   332                 case StartupAdaptation::ESIMPresent:
   267 			case StartupAdaptation::ESIMBlocked:
   333                     info = StartupAdaptation::EYes;
   268 				info = StartupAdaptation::EPUK1Required;
   334                     break;
   269 				break;	
   335                 case StartupAdaptation::ESIMInvalid:
   270 			case StartupAdaptation::ESIMLock:
   336                     info = StartupAdaptation::ENo;
   271 				info = StartupAdaptation::ESimLockOk;
   337                     break;
   272 				break;
   338                 case StartupAdaptation::ESIMRejected:
   273 			case StartupAdaptation::ESecurityCheckOK:
   339                     info = StartupAdaptation::ENo;
   274 				info = StartupAdaptation::EYes;	
   340                     break;
   275 				break;	
   341                 case StartupAdaptation::ESIMBlocked:
   276 			case StartupAdaptation::ESecurityCheckFailed:
   342                     info = StartupAdaptation::EPUK1Required;
   277 				info = StartupAdaptation::EYes;
   343                     break;  
   278 				break;	
   344                 case StartupAdaptation::ESIMLock:
   279 			default:
   345                     info = StartupAdaptation::ESimLockOk;
   280 				break;
   346                     break;
   281 			}	
   347                 case StartupAdaptation::ESecurityCheckOK:
   282 			break;
   348                     info = StartupAdaptation::EYes; 
   283 		case EPINCHECK05:
   349                     break;  
   284 			switch(aState)
   350                 case StartupAdaptation::ESecurityCheckFailed:
   285 			{
   351                     info = StartupAdaptation::EYes;
   286 			case StartupAdaptation::ESIMPresent:
   352                     break;  
   287 				info = StartupAdaptation::EYes;
   353                 default:
   288 				break;
   354                     break;
   289             case StartupAdaptation::ESIMInvalid:
   355                 }   
   290                 info = StartupAdaptation::ENo;
   356                 break;
   291                 break;
   357             case EPINCHECK05:
   292 			case StartupAdaptation::ESIMRejected:
   358                 switch(aState)
   293 				info = StartupAdaptation::ENo;
   359                 {
   294 				break;
   360                 case StartupAdaptation::ESIMPresent:
   295 			case StartupAdaptation::ESIMBlocked:
   361                     info = StartupAdaptation::EYes;
   296 				info = StartupAdaptation::EUPUKRequired;
   362                     break;
   297 				break;	
   363                 case StartupAdaptation::ESIMInvalid:
   298 			case StartupAdaptation::ESIMLock:
   364                     info = StartupAdaptation::ENo;
   299 				info = StartupAdaptation::ESimLockRestrictionOn;
   365                     break;
   300 				break;
   366                 case StartupAdaptation::ESIMRejected:
   301 			case StartupAdaptation::ESecurityCheckOK:
   367                     info = StartupAdaptation::ENo;
   302 				info = StartupAdaptation::EYes;	
   368                     break;
   303 				break;	
   369                 case StartupAdaptation::ESIMBlocked:
   304 			case StartupAdaptation::ESecurityCheckFailed:
   370                     info = StartupAdaptation::EUPUKRequired;
   305 				info = StartupAdaptation::EYes;
   371                     break;  
   306 				break;	
   372                 case StartupAdaptation::ESIMLock:
   307 			default:
   373                     info = StartupAdaptation::ESimLockRestrictionOn;
   308 				break;	
   374                     break;
   309 			}	
   375                 case StartupAdaptation::ESecurityCheckOK:
   310 			break;
   376                     info = StartupAdaptation::EYes; 
   311 		case EPINCHECK06:
   377                     break;  
   312 			switch(aState)
   378                 case StartupAdaptation::ESecurityCheckFailed:
   313 			{
   379                     info = StartupAdaptation::EYes;
   314 			case StartupAdaptation::ESIMPresent:
   380                     break;  
   315 				info = StartupAdaptation::EYes;
   381                 default:
   316 				break;
   382                     break;  
   317             case StartupAdaptation::ESIMInvalid:
   383                 }   
   318                 info = StartupAdaptation::ENo;
   384                 break;
   319                 break;
   385             case EPINCHECK06:
   320 			case StartupAdaptation::ESIMRejected:
   386                 switch(aState)
   321 				info = StartupAdaptation::ENo;
   387                 {
   322 				break;
   388                 case StartupAdaptation::ESIMPresent:
   323 			case StartupAdaptation::ESIMBlocked:
   389                     info = StartupAdaptation::EYes;
   324 				info = StartupAdaptation::EUPUKRequired;
   390                     break;
   325 				break;	
   391                 case StartupAdaptation::ESIMInvalid:
   326 			case StartupAdaptation::ESIMLock:
   392                     info = StartupAdaptation::ENo;
   327 				info = StartupAdaptation::ESimLockRestrictionPending;
   393                     break;
   328 				break;
   394                 case StartupAdaptation::ESIMRejected:
   329 			case StartupAdaptation::ESecurityCheckOK:
   395                     info = StartupAdaptation::ENo;
   330 				info = StartupAdaptation::EYes;	
   396                     break;
   331 				break;	
   397                 case StartupAdaptation::ESIMBlocked:
   332 			case StartupAdaptation::ESecurityCheckFailed:
   398                     info = StartupAdaptation::EUPUKRequired;
   333 				info = StartupAdaptation::EYes;	
   399                     break;  
   334 				break;	
   400                 case StartupAdaptation::ESIMLock:
   335 			default:
   401                     info = StartupAdaptation::ESimLockRestrictionPending;
   336 				break;	
   402                     break;
   337 			}
   403                 case StartupAdaptation::ESecurityCheckOK:
   338 			break;
   404                     info = StartupAdaptation::EYes; 
   339 		case EPINCHECK07:
   405                     break;  
   340 			switch(aState)
   406                 case StartupAdaptation::ESecurityCheckFailed:
   341 			{
   407                     info = StartupAdaptation::EYes; 
   342 			case StartupAdaptation::ESIMPresent:
   408                     break;  
   343 				info = StartupAdaptation::EYes;
   409                 default:
   344 				break;
   410                     break;  
   345             case StartupAdaptation::ESIMInvalid:
   411                 }
   346                 info = StartupAdaptation::ENo;
   412                 break;
   347                 break;
   413             case EPINCHECK07:
   348 			case StartupAdaptation::ESIMRejected:
   414                 switch(aState)
   349 				info = StartupAdaptation::ENo;
   415                 {
   350 				break;
   416                 case StartupAdaptation::ESIMPresent:
   351 			case StartupAdaptation::ESIMBlocked:
   417                     info = StartupAdaptation::EYes;
   352 				info = StartupAdaptation::EUPUKRequired;
   418                     break;
   353 				break;	
   419                 case StartupAdaptation::ESIMInvalid:
   354 			case StartupAdaptation::ESIMLock:
   420                     info = StartupAdaptation::ENo;
   355 				info = StartupAdaptation::ESimLockRestricted;
   421                     break;
   356 				break;
   422                 case StartupAdaptation::ESIMRejected:
   357 			case StartupAdaptation::ESecurityCheckOK:
   423                     info = StartupAdaptation::ENo;
   358 				info = StartupAdaptation::EYes;	
   424                     break;
   359 				break;	
   425                 case StartupAdaptation::ESIMBlocked:
   360 			case StartupAdaptation::ESecurityCheckFailed:
   426                     info = StartupAdaptation::EUPUKRequired;
   361 				info = StartupAdaptation::EYes;	
   427                     break;  
   362 				break;	
   428                 case StartupAdaptation::ESIMLock:
   363 			default:
   429                     info = StartupAdaptation::ESimLockRestricted;
   364 				break;	
   430                     break;
   365 			}
   431                 case StartupAdaptation::ESecurityCheckOK:
   366 			break;
   432                     info = StartupAdaptation::EYes; 
   367 		case EPINCHECK08:
   433                     break;  
   368 		switch(aState)
   434                 case StartupAdaptation::ESecurityCheckFailed:
   369 			{
   435                     info = StartupAdaptation::EYes; 
   370 			case StartupAdaptation::ESIMPresent:
   436                     break;  
   371 				info = StartupAdaptation::EYes;
   437                 default:
   372 				break;
   438                     break;  
   373 			case StartupAdaptation::ESIMInvalid:
   439                 }
   374 			    info = StartupAdaptation::ENo;
   440                 break;
   375 			    break;
   441             case EPINCHECK08:
   376 			case StartupAdaptation::ESIMRejected:
   442             switch(aState)
   377 				info = StartupAdaptation::ENo;
   443                 {
   378 				break;
   444                 case StartupAdaptation::ESIMPresent:
   379 			case StartupAdaptation::ESIMBlocked:
   445                     info = StartupAdaptation::EYes;
   380 				info = StartupAdaptation::ENo;
   446                     break;
   381 				break;
   447                 case StartupAdaptation::ESIMInvalid:
   382 			case StartupAdaptation::EPINRequired:
   448                     info = StartupAdaptation::ENo;
   383 				info = StartupAdaptation::EPIN1Required;
   449                     break;
   384 				break;
   450                 case StartupAdaptation::ESIMRejected:
   385 			case StartupAdaptation::ESIMLock:
   451                     info = StartupAdaptation::ENo;
   386 				info = StartupAdaptation::ESimLockOk;
   452                     break;
   387 				break;
   453                 case StartupAdaptation::ESIMBlocked:
   388 			case StartupAdaptation::ESecurityCheckOK:
   454                     info = StartupAdaptation::ENo;
   389 				info = StartupAdaptation::EYes;	
   455                     break;
   390 				break;	
   456                 case StartupAdaptation::EPINRequired:
   391 			case StartupAdaptation::ESecurityCheckFailed:
   457                     info = StartupAdaptation::EPIN1Required;
   392 				info = StartupAdaptation::EYes;	
   458                     break;
   393 				break;	
   459                 case StartupAdaptation::ESIMLock:
   394 			default:
   460                     info = StartupAdaptation::ESimLockOk;
   395 				break;
   461                     break;
   396 			}	
   462                 case StartupAdaptation::ESecurityCheckOK:
   397 			break;	
   463                     info = StartupAdaptation::EYes; 
   398 		default:
   464                     break;  
   399 			break;
   465                 case StartupAdaptation::ESecurityCheckFailed:
   400 		}
   466                     info = StartupAdaptation::EYes; 
   401 	TPckgBuf<StartupAdaptation::TSecurityStateInfo> securityStateInfoResult(info);
   467                     break;  
   402 	aResponsePckg = securityStateInfoResult;	
   468                 default:
   403 	User::RequestComplete(status, KErrNone);
   469                     break;
   404 	}
   470                 }   
   405 
   471                 break;  
       
   472             default:
       
   473                 break;
       
   474             }
       
   475         TPckgBuf<StartupAdaptation::TSecurityStateInfo> securityStateInfoResult(info);
       
   476         aResponsePckg = securityStateInfoResult;    
       
   477         User::RequestComplete(status, KErrNone);
       
   478         }
       
   479 	}
       
   480 
       
   481 /**
       
   482     Helper function to check for P&S Key
       
   483 */
       
   484 TBool CMiscAdaptationRef::IsTestPsKeyDefined()
       
   485     {
       
   486     TBool testPsKeyDefined = EFalse;
       
   487     TInt result = RProperty::Get(KPropertyCategory, KMiscPluginPropertyKey, testPsKeyDefined);
       
   488     DEBUGPRINT3(_L("KMiscPluginPropertyKey %d Error %d"), testPsKeyDefined, result);
       
   489     if ((KErrNone != result) && (KErrNotFound != result))
       
   490         {
       
   491         //Could not retrieve property value. Tests might fail 
       
   492         DEBUGPRINT1A("IsTestPsKeyDefined ERROR :: Could not retrieve property value)");
       
   493         }
       
   494     return testPsKeyDefined;
       
   495     }
       
   496