adaptationlayer/tsy/nokiatsy_dll/internal/test/nokiatsy_test_tool/misc/src/miscblocks.cpp
changeset 4 510c70acdbf6
parent 3 1972d8c2e329
child 5 8ccc39f9d787
equal deleted inserted replaced
3:1972d8c2e329 4:510c70acdbf6
     1 /*
       
     2 * Copyright (c) 2002-2007 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 the License "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:   Specific class for Miscellaneous tests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32svr.h>
       
    21 #include <stifparser.h>
       
    22 #include <stiftestinterface.h>
       
    23 #include "misc.h"
       
    24 // CONSTANTS
       
    25 const TPtrC BooleanFlag[] =
       
    26   {
       
    27   _L("EFalse"),
       
    28   _L("ETrue")
       
    29   };
       
    30 
       
    31 _LIT8( KLine, "---------------------------------" );
       
    32 
       
    33 // local functions
       
    34 
       
    35 static TInt GetSecurityCode(CStifItemParser& aItem, RMobilePhone::TMobilePhoneSecurityCode &aSecurityCode)
       
    36     {
       
    37      //  security code enum
       
    38     TPtrC string;
       
    39     TInt ret(aItem.GetNextString(string));
       
    40     if (KErrNone == ret)
       
    41         {
       
    42         if (string == _L("ESecurityCodePin1"))
       
    43             {
       
    44             aSecurityCode = RMobilePhone::ESecurityCodePin1;
       
    45             }
       
    46         else if (string == _L("ESecurityCodePin2"))
       
    47             {
       
    48             aSecurityCode = RMobilePhone::ESecurityCodePin2;
       
    49             }
       
    50         else if (string == _L("ESecurityCodePuk1"))
       
    51             {
       
    52             aSecurityCode = RMobilePhone::ESecurityCodePuk1;
       
    53             }
       
    54         else if (string == _L("ESecurityCodePuk2"))
       
    55             {
       
    56             aSecurityCode = RMobilePhone::ESecurityCodePuk2;
       
    57             }
       
    58         else if (string == _L("ESecurityCodePhonePassword"))
       
    59             {
       
    60             aSecurityCode = RMobilePhone::ESecurityCodePhonePassword;
       
    61             }
       
    62         else if (string == _L("ESecurityCodeSPC"))
       
    63             {
       
    64             aSecurityCode = RMobilePhone::ESecurityCodeSPC;
       
    65             }
       
    66         else if (string == _L("ESecurityHiddenKey"))
       
    67             {
       
    68             aSecurityCode = RMobilePhone::ESecurityHiddenKey;
       
    69             }
       
    70         else if (string == _L("ESecurityUSIMAppPin"))
       
    71             {
       
    72             aSecurityCode = RMobilePhone::ESecurityUSIMAppPin;
       
    73             }
       
    74         else if (string == _L("ESecuritySecondUSIMAppPin"))
       
    75             {
       
    76             aSecurityCode = RMobilePhone::ESecuritySecondUSIMAppPin;
       
    77             }
       
    78         else if (string == _L("ESecurityUniversalPin"))
       
    79             {
       
    80             aSecurityCode = RMobilePhone::ESecurityUniversalPin;
       
    81             }
       
    82         else if (string == _L("ESecurityUniversalPuk"))
       
    83             {
       
    84             aSecurityCode = RMobilePhone::ESecurityUniversalPuk;
       
    85             }
       
    86         else
       
    87            {
       
    88            ret = KErrArgument;
       
    89            }
       
    90         }
       
    91     return ret;
       
    92     }
       
    93 
       
    94 // ============================ MEMBER FUNCTIONS ===============================
       
    95 // -----------------------------------------------------------------------------
       
    96 // CMisc::Delete
       
    97 // Delete here all resources allocated and opened from test methods.
       
    98 // Called from destructor.
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 void CMisc::Delete()
       
   102     {
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CMisc::RunMethodL
       
   107 // Run specified method. Contains also table of test mothods and their names.
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 TInt CMisc::RunMethodL(
       
   111     CStifItemParser& aItem )
       
   112     {
       
   113    _LIT8 (KLog, "Misc: RunMethodL" );
       
   114    iMiscLog->Log((TDesC8)KLog);
       
   115 
       
   116     static TStifFunctionInfo const KFunctions[] =
       
   117         {
       
   118         // Copy this line for every implemented function.
       
   119         // First string is the function name used in TestScripter script file.
       
   120         // Second is the actual implementation member function.
       
   121         ENTRY( "MobilePhoneNotifyBatteryInfoChange", CMisc::MobilePhoneNotifyBatteryInfoChange),
       
   122         ENTRY( "SetACLStatus", CMisc::SetACLStatus),
       
   123         ENTRY( "GetACLStatus", CMisc::GetACLStatus),
       
   124         ENTRY( "WriteACLEntry", CMisc::WriteACLEntryL),
       
   125         ENTRY( "DeleteACLEntry", CMisc::DeleteACLEntry),
       
   126         ENTRY( "VerifySecurityCode", CMisc::VerifySecurityCodeL),
       
   127         ENTRY( "EnumerateAPNEntries", CMisc::EnumerateAPNEntries),
       
   128         ENTRY( "GetAPNName", CMisc::GetAPNname),
       
   129         ENTRY( "SetAlwaysOnModeSelection", CMisc::SetAlwaysOnModeSelectionL),
       
   130         ENTRY( "HandleSpecifiedRequests", CCore::HandleSpecifiedRequests),
       
   131         ENTRY( "InitializeIPCRequestTable", CCore::InitializeIPCRequestTable),
       
   132         ENTRY( "SetExpectedCompleteIPC", CCore::SetExpectedCompleteIPC),
       
   133         ENTRY( "RunIscTestCase", CCore::RunIscTestCase),
       
   134         ENTRY( "SyncIscTestCase",CCore::SyncIscTestCase),
       
   135 
       
   136         };
       
   137 
       
   138     const TInt count = sizeof( KFunctions ) /
       
   139                         sizeof( TStifFunctionInfo );
       
   140     return RunInternalL( KFunctions, count, aItem );
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CMisc::MobilePhoneNotifyBatteryInfoChange
       
   145 // Start test case
       
   146 // (other items were commented in a header).
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 TInt CMisc::MobilePhoneNotifyBatteryInfoChange( CStifItemParser& aItem )
       
   150     {
       
   151     TInt ret ( KErrNone );
       
   152     TPtrC status;
       
   153     TInt chargeLevel( 0 );
       
   154 
       
   155     aItem.GetNextString ( status );
       
   156     aItem.GetNextInt ( chargeLevel );
       
   157 
       
   158     if ( _L("EPowerStatusUnknown") == status )
       
   159         {
       
   160         iBatteryInfo.iStatus = RMobilePhone::EPowerStatusUnknown;
       
   161         }
       
   162     else if ( _L("EBatteryConnectedButExternallyPowered") == status )
       
   163         {
       
   164         iBatteryInfo.iStatus = RMobilePhone::EBatteryConnectedButExternallyPowered;
       
   165         }
       
   166     else
       
   167         {
       
   168         _LIT8(KNotSupp, "CMisc::MobilePhoneNotifyBatteryInfoChange / selected status not supported");
       
   169         iMiscLog->Log((TDesC8)KNotSupp);
       
   170         ret = KErrNotSupported;
       
   171         }
       
   172 
       
   173     iBatteryInfo.iChargeLevel = chargeLevel;
       
   174 
       
   175     return ret;
       
   176     }
       
   177 
       
   178 // -----------------------------------------------------------------------------
       
   179 // CMisc::CompleteMobilePhoneNotifyBatteryInfoChange
       
   180 // Completion method (end testcase)
       
   181 // (other items were commented in a header).
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 void CMisc::CompleteMobilePhoneNotifyBatteryInfoChange
       
   185         (
       
   186         CMmDataPackage* aDataPackage, // aDataPackage
       
   187         TInt aResult                  // Completion result value
       
   188         )
       
   189     {
       
   190     iMiscLog->Log(_L("CMisc::CompleteMobilePhoneNotifyBatteryInfoChange"));
       
   191 
       
   192     _LIT8(KResult, "CompleteMobilePhoneNotifyBatteryInfoChange request complete with aResult %d" );
       
   193     iMiscLog->Log((TDesC8)KResult, aResult);
       
   194 
       
   195     if ( KErrNone == aResult )
       
   196         {
       
   197         // unpack data...
       
   198         RMobilePhone::TMobilePhoneBatteryInfoV1* batteryInfo = NULL;
       
   199         aDataPackage->UnPackData(&batteryInfo);
       
   200 
       
   201         if ( ( batteryInfo->iStatus != iBatteryInfo.iStatus ) ||
       
   202              ( batteryInfo->iChargeLevel != iBatteryInfo.iChargeLevel ) )
       
   203             {
       
   204             aResult = KErrGeneral;
       
   205             }
       
   206         _LIT8(KFmt, "Values from Complete: Status=%d, ChargeLevel=%d");
       
   207         iMiscLog->Log(KFmt, batteryInfo->iStatus, batteryInfo->iChargeLevel);
       
   208         _LIT8(KExpected, "Expected values: Status=%d, ChargeLevel=%d");
       
   209         iMiscLog->Log(KExpected, iBatteryInfo.iStatus, iBatteryInfo.iChargeLevel);
       
   210         }
       
   211 
       
   212     Signal( aResult );
       
   213     }
       
   214 
       
   215 
       
   216 // -----------------------------------------------------------------------------
       
   217 // CMisc::SetACLStatus
       
   218 // Start test case
       
   219 // (other items were commented in a header).
       
   220 // -----------------------------------------------------------------------------
       
   221 //
       
   222 TInt CMisc::SetACLStatus( CStifItemParser& aItem)
       
   223     {
       
   224     //need to verify PIN2 first
       
   225 
       
   226     // Print to UI
       
   227     TestModuleIf().Printf( 0, _L("CMisc::SetACLStatus"), _L("In EMobilePhoneSetAPNControlListServiceStatus") );
       
   228     // Print to log file
       
   229     iMiscLog->Log(_L("CMisc::SetACLStatus EMobilePhoneSetAPNControlListServiceStatus"));
       
   230 
       
   231     TInt ret ( KErrNone );
       
   232     TPtrC string;
       
   233     RMobilePhone::TAPNControlListServiceStatus status;
       
   234 
       
   235     aItem.GetNextString(string);
       
   236 
       
   237     if (KErrNone == ret)
       
   238         {
       
   239         if (string == _L("EAclStatusDisabled"))
       
   240             {
       
   241             status = RMobilePhone::EAPNControlListServiceDisabled;
       
   242             }
       
   243         else if (string == _L("EAclStatusEnabled"))
       
   244             {
       
   245             status = RMobilePhone::EAPNControlListServiceEnabled;
       
   246             }
       
   247         else
       
   248            {
       
   249            _LIT8(KNotSupp, "CMisc::SetACLStatus / selected status not supported");
       
   250            iMiscLog->Log((TDesC8)KNotSupp);
       
   251            ret = KErrArgument;
       
   252            }
       
   253         }
       
   254 
       
   255     // call NTSY
       
   256     if (KErrNone == ret)
       
   257         {
       
   258         CMmDataPackage package;
       
   259         package.PackData( &status );
       
   260         ret = HandleRequestL(EMobilePhoneSetAPNControlListServiceStatus, &package );
       
   261         }
       
   262 
       
   263     return ret;
       
   264     }
       
   265 
       
   266 // -----------------------------------------------------------------------------
       
   267 // CMisc::CompleteSetACLStatus
       
   268 // Completion method (end testcase)
       
   269 // (other items were commented in a header).
       
   270 // -----------------------------------------------------------------------------
       
   271 //
       
   272 void CMisc::CompleteSetACLStatus
       
   273         (
       
   274         CMmDataPackage* /*aDataPackage*/, // empty
       
   275         TInt aResult    // //Completion result value
       
   276         )
       
   277     {
       
   278     iMiscLog->Log(_L8("CMisc::CompleteSetACLStatus aResult=%d"),TInt(aResult));
       
   279 
       
   280     Signal( aResult );
       
   281     }
       
   282 
       
   283 
       
   284 // -----------------------------------------------------------------------------
       
   285 // CMisc::GetACLStatus
       
   286 // Start test case
       
   287 // (other items were commented in a header).
       
   288 // -----------------------------------------------------------------------------
       
   289 //
       
   290 TInt CMisc::GetACLStatus( CStifItemParser& aItem )
       
   291     {
       
   292 
       
   293     iMiscLog->Log(_L("CMisc::GetACLStatus EMobilePhoneGetAPNControlListServiceStatus"));
       
   294 
       
   295     TInt ret ( KErrNone );
       
   296     TPtrC status;
       
   297 
       
   298     aItem.GetNextString ( status );
       
   299 
       
   300     if ( _L("EAPNControlListServiceDisabled") == status )
       
   301         {
       
   302         iACLStatus = RMobilePhone::EAPNControlListServiceDisabled;
       
   303         }
       
   304     else
       
   305         {
       
   306         _LIT8(KNotSupp, "CMisc::GetACLStatus / selected status not supported");
       
   307         iMiscLog->Log((TDesC8)KNotSupp);
       
   308         ret = KErrNotSupported;
       
   309         }
       
   310 
       
   311     // call NTSY
       
   312     if (KErrNone == ret)
       
   313         {
       
   314         CMmDataPackage package;
       
   315         //package.PackData( &status );
       
   316         TInt ret = HandleRequestL(EMobilePhoneGetAPNControlListServiceStatus, &package );
       
   317         }
       
   318 
       
   319     return ret;
       
   320     }
       
   321 
       
   322 // -----------------------------------------------------------------------------
       
   323 // CMisc::CompleteGetACLStatus
       
   324 // Completion method (end testcase)
       
   325 // (other items were commented in a header).
       
   326 // -----------------------------------------------------------------------------
       
   327 //
       
   328 void CMisc::CompleteGetACLStatus
       
   329         (
       
   330         CMmDataPackage* aDataPackage, // aDataPackage
       
   331         TInt aResult                  // Completion result value
       
   332         )
       
   333     {
       
   334     iMiscLog->Log(_L8("CMisc::CompleteGetACLStatus aResult=%d"),TInt(aResult));
       
   335 
       
   336     _LIT8(KResultOk, "CompleteGetACLStatus request complete" );
       
   337     iMiscLog->Log((TDesC8)KResultOk);
       
   338     if ( KErrNone == aResult )
       
   339         {
       
   340         RMobilePhone::TAPNControlListServiceStatus ACLstatus;
       
   341         aDataPackage->UnPackData(ACLstatus);
       
   342 
       
   343         if ( ACLstatus != iACLStatus )
       
   344             {
       
   345             aResult = KErrGeneral;
       
   346             }
       
   347         iMiscLog->Log(_L8("CMisc::CompleteGetACLStatus ACL status = %d"),TInt(ACLstatus));
       
   348         iMiscLog->Log(_L8("CMisc::Expected ACL status = %d"),TInt(iACLStatus));
       
   349         }
       
   350 
       
   351     Signal( aResult );
       
   352     }
       
   353 
       
   354 
       
   355 // -----------------------------------------------------------------------------
       
   356 // CMisc::DeleteACLEntry
       
   357 // Start test case
       
   358 // (other items were commented in a header).
       
   359 // -----------------------------------------------------------------------------
       
   360 //
       
   361 TInt CMisc::DeleteACLEntry( CStifItemParser& aItem )
       
   362     {
       
   363 
       
   364     // Print to UI
       
   365     TestModuleIf().Printf( 0, _L("CMisc::DeleteACLEntry"), _L("In EMobilePhoneDeleteAPNName") );
       
   366     // Print to log file
       
   367     iMiscLog->Log(_L("CMisc::DeleteACLEntry EMobilePhoneDeleteAPNName"));
       
   368 
       
   369     TUint index;
       
   370     TInt ret(aItem.GetNextInt(index));
       
   371     // test case running...
       
   372 
       
   373     // call NTSY
       
   374     CMmDataPackage package;
       
   375 
       
   376     if( KErrNone == ret)
       
   377         {
       
   378         //TODO: package.PackData( &status );
       
   379         package.PackData( &index );
       
   380         ret = HandleRequestL(EMobilePhoneDeleteAPNName, &package );
       
   381         }
       
   382 
       
   383     return ret;
       
   384     }
       
   385 
       
   386 // -----------------------------------------------------------------------------
       
   387 // CMisc::CompleteDeleteACLEntry
       
   388 // Completion method (end testcase)
       
   389 // (other items were commented in a header).
       
   390 // -----------------------------------------------------------------------------
       
   391 //
       
   392 void CMisc::CompleteDeleteACLEntry
       
   393         (
       
   394         TInt aResult                  // Completion result value
       
   395         )
       
   396     {
       
   397     iMiscLog->Log(_L8("CMisc::CompleteDeleteACLEntry ACL aResult = %d"),TInt(aResult));
       
   398     Signal( aResult );
       
   399     }
       
   400 
       
   401 
       
   402 // -----------------------------------------------------------------------------
       
   403 // CMisc::WriteACLEntryL
       
   404 // Start test case
       
   405 // (other items were commented in a header).
       
   406 // -----------------------------------------------------------------------------
       
   407 //
       
   408 TInt CMisc::WriteACLEntryL( CStifItemParser& aItem )
       
   409     {
       
   410 
       
   411     // Print to UI
       
   412     TestModuleIf().Printf( 0, _L("CMisc::WriteACLEntryL"), _L("In EMobilePhoneAppendAPNName") );
       
   413     // Print to log file
       
   414     iMiscLog->Log(_L("CMisc::WriteACLEntryL EMobilePhoneAppendAPNName"));
       
   415 
       
   416     TInt ret = 0;
       
   417 
       
   418     TPtrC string;
       
   419     ret = aItem.GetNextString(string);
       
   420 
       
   421     RMobilePhone::TAPNEntryV3 data;
       
   422     data.iApn.Append( string );
       
   423 
       
   424     // call NTSY
       
   425     CMmDataPackage package;
       
   426     //package data
       
   427     package.PackData( &data );
       
   428 
       
   429     ret = HandleRequestL(EMobilePhoneAppendAPNName, &package );
       
   430     return ret;
       
   431     }
       
   432 
       
   433 
       
   434 // -----------------------------------------------------------------------------
       
   435 // CMisc::CompleteWriteACLEntry
       
   436 // Completion method (end testcase)
       
   437 // (other items were commented in a header).
       
   438 // -----------------------------------------------------------------------------
       
   439 //
       
   440 void CMisc::CompleteWriteACLEntry
       
   441         (
       
   442         TInt aResult                  // Completion result value
       
   443         )
       
   444     {
       
   445     iMiscLog->Log(_L8("CMisc::CompleteWriteACLEntry ACL aResult = %d"),TInt(aResult));
       
   446     Signal( aResult );
       
   447     }
       
   448 
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // CMisc::EnumerateAPNEntries
       
   452 // Start test case
       
   453 // (other items were commented in a header).
       
   454 // -----------------------------------------------------------------------------
       
   455 //
       
   456 TInt CMisc::EnumerateAPNEntries( CStifItemParser& aItem )
       
   457     {
       
   458 
       
   459     // Print to UI
       
   460     TestModuleIf().Printf( 0, _L("Misc"), _L("In EMobilePhoneEnumerateAPNEntries") );
       
   461     // Print to log file
       
   462     iMiscLog->Log(_L("EMobilePhoneEnumerateAPNEntries"));
       
   463 
       
   464     TUint entries;
       
   465     aItem.GetNextInt(entries);
       
   466     iAPNEntries = entries;
       
   467   // call NTSY
       
   468     CMmDataPackage package;
       
   469     //TODO: package.PackData( &status );
       
   470     TInt ret = HandleRequestL(EMobilePhoneEnumerateAPNEntries, &package );
       
   471     return ret;
       
   472     }
       
   473 
       
   474 
       
   475 // -----------------------------------------------------------------------------
       
   476 // CMisc::CompleteEnumerateAPNEntries
       
   477 // Completion method (end testcase)
       
   478 // (other items were commented in a header).
       
   479 // -----------------------------------------------------------------------------
       
   480 //
       
   481 void CMisc::CompleteEnumerateAPNEntries
       
   482         (
       
   483         CMmDataPackage* aDataPackage, // aDataPackage
       
   484         TInt aResult                  // Completion result value
       
   485         )
       
   486     {
       
   487     iMiscLog->Log(_L8("CMisc::CompleteEnumerateAPNEntries aResult = %d"),TInt(aResult));
       
   488 
       
   489     if ( KErrNone == aResult )
       
   490         {
       
   491         TUint32* apnEntries( NULL );
       
   492         aDataPackage->UnPackData( &apnEntries );
       
   493         iMiscLog->Log(_L8("CMisc::CompleteEnumerateAPNEntries apnEntries = %d"),TInt(*apnEntries));
       
   494         // If iAPNEntries is 0 the return value is not checked (used during HW
       
   495         // testing and that's why test person don't have to set right value to phone)
       
   496         if ( ( 0 != iAPNEntries ) &&
       
   497              ( iAPNEntries != *apnEntries ) )
       
   498             {
       
   499             aResult = KErrGeneral;
       
   500             }
       
   501         }
       
   502 
       
   503     Signal( aResult );
       
   504 
       
   505     }
       
   506 
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // CMisc::GetAPNname
       
   510 // Start test case
       
   511 // (other items were commented in a header).
       
   512 // -----------------------------------------------------------------------------
       
   513 //
       
   514 TInt CMisc::GetAPNname( CStifItemParser& aItem )
       
   515     {
       
   516 
       
   517     // Print to UI
       
   518     TestModuleIf().Printf( 0, _L("Misc"), _L("In EMobilePhoneGetAPNname") );
       
   519     // Print to log file
       
   520     iMiscLog->Log(_L("EMobilePhoneGetAPNname"));
       
   521 
       
   522     //TUint32* index = 0;
       
   523     TUint index;
       
   524     aItem.GetNextInt(index);
       
   525 
       
   526     TPtrC apnName;
       
   527     aItem.GetNextString ( apnName );
       
   528     iAPNEntryName.iApn.Zero();
       
   529     if ( _L("") != apnName )
       
   530       {
       
   531       iAPNEntryName.iApn.Append( apnName );
       
   532       }
       
   533 
       
   534     CMmDataPackage package;
       
   535     package.PackData( &index );
       
   536 
       
   537     TInt ret = HandleRequestL(EMobilePhoneGetAPNname, &package );
       
   538     return ret;
       
   539     }
       
   540 
       
   541 
       
   542 // -----------------------------------------------------------------------------
       
   543 // CMisc::CompleteGetAPNname
       
   544 // Completion method (end testcase)
       
   545 // (other items were commented in a header).
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 void CMisc::CompleteGetAPNname
       
   549         (
       
   550         CMmDataPackage* aDataPackage, // aDataPackage
       
   551         TInt aResult                  // Completion result value
       
   552         )
       
   553     {
       
   554     iMiscLog->Log(_L8("CMisc::CompleteGetAPNname aResult = %d"),TInt(aResult));
       
   555 
       
   556     if ( KErrNone == aResult )
       
   557         {
       
   558         // APN Entry
       
   559         RMobilePhone::TAPNEntryV3* apnEntryName( NULL );
       
   560         // Unpack data
       
   561         aDataPackage->UnPackData( &apnEntryName );
       
   562         TBuf8<100> dontcare;
       
   563         dontcare.Zero();
       
   564 
       
   565         if ( ( dontcare != iAPNEntryName.iApn ) &&
       
   566              (  iAPNEntryName.iApn != apnEntryName->iApn ) )
       
   567             {
       
   568             aResult = KErrGeneral;
       
   569             }
       
   570         iMiscLog->Log(_L8("CMisc::CompleteGetAPNname apnEntryName = %S"), &apnEntryName->iApn);
       
   571       }
       
   572     Signal( aResult );
       
   573     }
       
   574 
       
   575 // -----------------------------------------------------------------------------
       
   576 // CMisc::VerifySecurityCodeL
       
   577 // -----------------------------------------------------------------------------
       
   578 //
       
   579 TInt CMisc::VerifySecurityCodeL( CStifItemParser& aItem )
       
   580     {
       
   581     iMiscLog->Log(_L8("CMisc::VerifySecurityCodeL"));
       
   582 
       
   583     TInt ret(KErrNone);
       
   584     TPtrC string;
       
   585 
       
   586     RMobilePhone::TMobilePhoneSecurityCode type;
       
   587     RMobilePhone::TCodeAndUnblockCode codes;
       
   588 
       
   589     // 1st parameter: security code type
       
   590     ret = GetSecurityCode(aItem, type);
       
   591 
       
   592     // 2nd parameter code
       
   593     if (KErrNone == ret)
       
   594         {
       
   595         ret = aItem.GetNextString(string);
       
   596         if (KErrNone == ret)
       
   597             {
       
   598             codes.iCode.Copy(string);
       
   599             }
       
   600         }
       
   601 
       
   602     // 3rd parameter: unblock code
       
   603     if (KErrNone == ret)
       
   604         {
       
   605         ret = aItem.GetNextString(string);
       
   606         if (KErrNone == ret)
       
   607             {
       
   608             codes.iUnblockCode.Copy(string);
       
   609             }
       
   610         }
       
   611 
       
   612     if ( KErrNone == ret)
       
   613         {
       
   614         CMmDataPackage package;
       
   615         package.PackData(&type, &codes);
       
   616         ret = HandleRequestL ( EMobilePhoneVerifySecurityCode, &package );
       
   617         }
       
   618 
       
   619     return ret;
       
   620     }
       
   621 
       
   622 // -----------------------------------------------------------------------------
       
   623 // CMisc::CompleteVerifySecurityCode
       
   624 // -----------------------------------------------------------------------------
       
   625 //
       
   626 void CMisc::CompleteVerifySecurityCode(TInt aErr, CMmDataPackage& /*aData*/ )
       
   627     {
       
   628     iMiscLog->Log(_L8("CSecurity::CompleteVerifySecurityCode, err = %d"), aErr);
       
   629     iMiscLog->Log(_L8("CSecurity::CompleteVerifySecurityCode"));
       
   630     Signal(aErr);
       
   631     }
       
   632 
       
   633 
       
   634 // -----------------------------------------------------------------------------
       
   635 // CMisc::SetAlwaysOnModeSelection
       
   636 // SetAlwaysOnModeSelection method function.
       
   637 // -----------------------------------------------------------------------------
       
   638 //
       
   639 TInt CMisc::SetAlwaysOnModeSelectionL( CStifItemParser& aItem )
       
   640     {
       
   641     _LIT8(KSetAlwaysOnModeSelection, "CMisc::SetAlwaysOnModeSelection");
       
   642     iMiscLog->Log((TDesC8)KSetAlwaysOnModeSelection);
       
   643 
       
   644     TInt ret( KErrNotFound );
       
   645     TBool selection = ETrue;
       
   646     TPtrC string;
       
   647     aItem.GetNextString ( string );
       
   648 
       
   649     // Set Always On Mode
       
   650     if ( _L("HPLMN") == string )
       
   651         {
       
   652         iMiscLog->Log( _L("HPLMN.") );
       
   653         iAlwaysOnMode = RMmCustomAPI::EAlwaysModeHPLMN;
       
   654         }
       
   655     else if ( _L("VPLMN") == string )
       
   656         {
       
   657         iMiscLog->Log( _L("VPLMN.") );
       
   658         iAlwaysOnMode = RMmCustomAPI::EAlwaysModeVPLMN;
       
   659         }
       
   660     else if ( _L("Active") == string )
       
   661         {
       
   662         iMiscLog->Log( _L("Active.") );
       
   663         iAlwaysOnMode = RMmCustomAPI::EAlwaysModeBoth;
       
   664         }
       
   665     else if ( _L("NotActive") == string )
       
   666         {
       
   667         iMiscLog->Log( _L("NotActive.") );
       
   668         iAlwaysOnMode = RMmCustomAPI::EAlwaysModeNeither;
       
   669         }
       
   670     else
       
   671         {
       
   672         selection = EFalse;
       
   673         iMiscLog->Log( _L("Set Always on Mode not possible: %d"), ret );
       
   674         }
       
   675 
       
   676     if ( selection )
       
   677         {
       
   678         
       
   679         CMmDataPackage dataPackage;
       
   680         dataPackage.PackData(&iAlwaysOnMode);
       
   681         
       
   682         ret = HandleRequestL( ECustomSetAlwaysOnMode,
       
   683                                &dataPackage );
       
   684         
       
   685         
       
   686         if ( KErrNone == ret )
       
   687         
       
   688             {
       
   689             _LIT8( KSendOk, "Set AlwaysOnMode request send ok" );
       
   690             iMiscLog->Log((TDesC8)KSendOk );
       
   691             }
       
   692         else
       
   693             {
       
   694             _LIT8( KSendFailed, "Set AlwaysOnMode request send failed: %d" );
       
   695             iMiscLog->Log((TDesC8)KSendFailed, ret );
       
   696             }
       
   697         }
       
   698     else
       
   699         {
       
   700         ret = KErrNotSupported;
       
   701         }
       
   702     
       
   703     return ret;
       
   704 
       
   705     }
       
   706 
       
   707 // -----------------------------------------------------------------------------
       
   708 // CMisc::CompleteSetAlwaysOnModeSelection
       
   709 // Complete SetNetworkSelection method function.
       
   710 // -----------------------------------------------------------------------------
       
   711 //
       
   712 void CMisc::CompleteSetAlwaysOnModeSelection
       
   713     (
       
   714     TInt aResult
       
   715     )
       
   716   {
       
   717   _LIT8( KResult, "CMisc::CompleteSetAlwaysOnModeSelection result: %d" );
       
   718   iMiscLog->Log((TDesC8)KResult, aResult );
       
   719 
       
   720   _LIT8( KResultComplete, "iSetAlwaysOnModeOngoing Completed" );
       
   721   iMiscLog->Log((TDesC8)KResultComplete );
       
   722 
       
   723   Signal( aResult );
       
   724   }
       
   725 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   726 // None
       
   727 //  End of File