adaptationlayer/tsy/nokiatsy_dll/internal/test/nokiatsy_test_tool/misc/src/misc.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 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <stiftestinterface.h>
       
    23 #include "misc.h"
       
    24 
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CMisc::CMisc
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CMisc::CMisc(
       
    36     CTestModuleIf& aTestModuleIf )
       
    37     :CCore( aTestModuleIf )
       
    38     {
       
    39     // Initial values
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CNWE::ConstructL
       
    44 // Symbian 2nd phase constructor can leave.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void CMisc::ConstructL()
       
    48     {
       
    49 #if ( NCP_COMMON_S60_VERSION_SUPPORT == S60_VERSION_32 )
       
    50     BaseConstructL();
       
    51 #else
       
    52     BaseConstructL( this );
       
    53 #endif
       
    54 
       
    55     iMiscLog = CStifLogger::NewL( KMiscLogPath,
       
    56                           KMiscLogFile,
       
    57                           CStifLogger::ETxt,
       
    58                           CStifLogger::EFile,
       
    59                           EFalse );
       
    60 
       
    61      // This sets object type to baseclass to make possible to callback while
       
    62     // notification sequence
       
    63   //CCore::SetObjectType( CCore::EMisc, this);
       
    64 
       
    65     _LIT8(KMisc, "CMisc: ConstructL");
       
    66     iMiscLog->Log((TDesC8)KMisc );
       
    67 
       
    68     InitializeIscControlL(KIscControlTestCaseFile);
       
    69 
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CNWE::NewL
       
    74 // Two-phased constructor.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CMisc* CMisc::NewL(
       
    78     CTestModuleIf& aTestModuleIf )
       
    79     {
       
    80     CMisc* self = new (ELeave) CMisc( aTestModuleIf );
       
    81 
       
    82     CleanupStack::PushL((CScriptBase*)self );
       
    83     self->ConstructL();
       
    84     CleanupStack::Pop( self );
       
    85 
       
    86     return self;
       
    87 
       
    88     }
       
    89 
       
    90 // Destructor
       
    91 CMisc::~CMisc()
       
    92     {
       
    93     // Delete resources allocated from test methods
       
    94     Delete();
       
    95 
       
    96     delete iMiscLog;
       
    97     iLog = 0;
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CCore::RouteCompletion
       
   102 // Completes a request or notification via the specific Tsy object, based on
       
   103 // IPC number and data package
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 EXPORT_C void CMisc::RouteCompletion
       
   107         (
       
   108         TInt aIpc,
       
   109         CMmDataPackage* aDataPackage,
       
   110         TInt aResult
       
   111         )
       
   112     {
       
   113 
       
   114     // Process the ISI msg according to IPC requested.
       
   115     _LIT8(KResult, "CMisc::RouteCompletion result: %d IPC: %d");
       
   116     iMiscLog->Log((TDesC8)KResult, aResult, aIpc );
       
   117 
       
   118     TBool isIPCHandled = EFalse;
       
   119     switch(aIpc)
       
   120         {
       
   121         case EMobilePhoneNotifyBatteryInfoChange:
       
   122             if ( 0 == iSavedIPCNameForComparison.Compare
       
   123                     ( _L( "EMobilePhoneNotifyBatteryInfoChange" ) ) )
       
   124                 {
       
   125                 CompleteMobilePhoneNotifyBatteryInfoChange(aDataPackage, aResult );
       
   126                 CCore::GetNextExpectedCompleteIPC();
       
   127                 isIPCHandled = ETrue;
       
   128                 }
       
   129             break;
       
   130 
       
   131         case EMobilePhoneSetAPNControlListServiceStatus:
       
   132             {
       
   133             if ( 0 == iSavedIPCNameForComparison.Compare
       
   134                     ( _L( "EMobilePhoneSetAPNControlListServiceStatus" ) ) )
       
   135                 {
       
   136                 CompleteSetACLStatus(aDataPackage, aResult );
       
   137                 CCore::GetNextExpectedCompleteIPC();
       
   138                 isIPCHandled = ETrue;
       
   139                 }
       
   140             break;
       
   141             }
       
   142 
       
   143 
       
   144         case EMobilePhoneGetAPNControlListServiceStatus:
       
   145             {
       
   146             if ( 0 == iSavedIPCNameForComparison.Compare
       
   147                     ( _L( "EMobilePhoneGetAPNControlListServiceStatus" ) ) )
       
   148                 {
       
   149                 CompleteGetACLStatus(aDataPackage, aResult );
       
   150                 CCore::GetNextExpectedCompleteIPC();
       
   151                 isIPCHandled = ETrue;
       
   152                 }
       
   153             break;
       
   154             }
       
   155 
       
   156         case EMobilePhoneDeleteAPNName:
       
   157             if ( 0 == iSavedIPCNameForComparison.Compare
       
   158                     ( _L( "EMobilePhoneDeleteAPNName" ) ) )
       
   159                 {
       
   160                 CompleteDeleteACLEntry( aResult );
       
   161                 CCore::GetNextExpectedCompleteIPC();
       
   162                 isIPCHandled = ETrue;
       
   163                 }
       
   164             
       
   165             break;
       
   166 
       
   167         case EMobilePhoneAppendAPNName:
       
   168             if ( 0 == iSavedIPCNameForComparison.Compare
       
   169                     ( _L( "EMobilePhoneAppendAPNName" ) ) )
       
   170                 {
       
   171                 CompleteWriteACLEntry( aResult );
       
   172                 CCore::GetNextExpectedCompleteIPC();
       
   173                 isIPCHandled = ETrue;
       
   174                 }
       
   175             break;
       
   176 
       
   177         case EMobilePhoneEnumerateAPNEntries:
       
   178             if ( 0 == iSavedIPCNameForComparison.Compare
       
   179                     ( _L( "EMobilePhoneEnumerateAPNEntries" ) ) )
       
   180                 {
       
   181                 CompleteEnumerateAPNEntries( aDataPackage, aResult );
       
   182                 CCore::GetNextExpectedCompleteIPC();
       
   183                 isIPCHandled = ETrue;
       
   184                 }
       
   185             break;
       
   186 
       
   187         case EMobilePhoneGetAPNname:
       
   188             if ( 0 == iSavedIPCNameForComparison.Compare
       
   189                     ( _L( "EMobilePhoneGetAPNname" ) ) )
       
   190                 {
       
   191                 CompleteGetAPNname(aDataPackage, aResult);
       
   192                 CCore::GetNextExpectedCompleteIPC();
       
   193                 isIPCHandled = ETrue;
       
   194                 }
       
   195             break;
       
   196 
       
   197         case ECustomSetAlwaysOnMode:
       
   198             if ( 0 == iSavedIPCNameForComparison.Compare
       
   199                     ( _L( "ECustomSetAlwaysOnMode" ) ) )
       
   200                 {
       
   201                 CompleteSetAlwaysOnModeSelection ( aResult );
       
   202                 CCore::GetNextExpectedCompleteIPC();
       
   203                 isIPCHandled = ETrue;
       
   204                 }
       
   205             
       
   206             break;
       
   207 
       
   208         default:
       
   209             {
       
   210             _LIT8(KDefault, "CMisc::RouteCompletion default");
       
   211             iMiscLog->Log((TDesC8)KDefault );
       
   212             break;
       
   213             }
       
   214         }
       
   215         // Check whether the IPC received should had been exactly the expected one.
       
   216         // If not the KErrGeneral is set.
       
   217         if( ( iNextIPCMustBeSameAsNextExpected ) &&
       
   218             ( !isIPCHandled ) )
       
   219             {
       
   220             aResult = KErrUnknown;
       
   221             Signal( aResult );
       
   222             }
       
   223     }
       
   224 
       
   225 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   226 
       
   227 // -----------------------------------------------------------------------------
       
   228 // LibEntryL is a polymorphic Dll entry point.
       
   229 // Returns: CScriptBase: New CScriptBase derived object
       
   230 // -----------------------------------------------------------------------------
       
   231 //
       
   232 EXPORT_C CScriptBase* LibEntryL(
       
   233     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   234     {
       
   235 
       
   236     return ( CScriptBase* ) CMisc::NewL( aTestModuleIf );
       
   237 
       
   238     }
       
   239 
       
   240 //  End of File