locationtriggering/tsrc/lbtengine_test/CellbasedtriggerOperations/src/CellbasedtriggerOperations.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     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 "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:     Test module to implement Cell based triggering test cases
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <Stiftestinterface.h>
       
    25 #include "CellbasedtriggerOperations.h"
       
    26 #include <SettingServerClient.h>
       
    27 
       
    28 // EXTERNAL DATA STRUCTURES
       
    29 //extern  ?external_data;
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 //extern ?external_function( ?arg_type,?arg_type );
       
    33 
       
    34 // CONSTANTS
       
    35 //const ?type ?constant_var = ?constant;
       
    36 
       
    37 // MACROS
       
    38 //#define ?macro ?macro_def
       
    39 
       
    40 // LOCAL CONSTANTS AND MACROS
       
    41 //const ?type ?constant_var = ?constant;
       
    42 //#define ?macro_name ?macro_def
       
    43 
       
    44 // MODULE DATA STRUCTURES
       
    45 //enum ?declaration
       
    46 //typedef ?declaration
       
    47 
       
    48 // LOCAL FUNCTION PROTOTYPES
       
    49 //?type ?function_name( ?arg_type, ?arg_type );
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 //class ?FORWARD_CLASSNAME;
       
    53 
       
    54 // ============================= LOCAL FUNCTIONS ===============================
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // ?function_name ?description.
       
    58 // ?description
       
    59 // Returns: ?value_1: ?description
       
    60 //          ?value_n: ?description_line1
       
    61 //                    ?description_line2
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 /*
       
    65 ?type ?function_name(
       
    66     ?arg_type arg,  // ?description
       
    67     ?arg_type arg)  // ?description
       
    68     {
       
    69 
       
    70     ?code  // ?comment
       
    71 
       
    72     // ?comment
       
    73     ?code
       
    74     }
       
    75 */
       
    76 
       
    77 // ============================ MEMBER FUNCTIONS ===============================
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CCellbasedtriggerOperations::CCellbasedtriggerOperations
       
    81 // C++ default constructor can NOT contain any code, that
       
    82 // might leave.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CCellbasedtriggerOperations::CCellbasedtriggerOperations( 
       
    86     CTestModuleIf& aTestModuleIf ):
       
    87         CScriptBase( aTestModuleIf )
       
    88     {
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CCellbasedtriggerOperations::ConstructL
       
    93 // Symbian 2nd phase constructor can leave.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CCellbasedtriggerOperations::ConstructL()
       
    97     {
       
    98     //Read logger settings to check whether test case name is to be
       
    99     //appended to log file name.
       
   100     RSettingServer settingServer;
       
   101     TInt ret = settingServer.Connect();
       
   102     if(ret != KErrNone)
       
   103         {
       
   104         User::Leave(ret);
       
   105         }
       
   106     // Struct to StifLogger settigs.
       
   107     TLoggerSettings loggerSettings; 
       
   108     // Parse StifLogger defaults from STIF initialization file.
       
   109     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   110     if(ret != KErrNone)
       
   111         {
       
   112         User::Leave(ret);
       
   113         } 
       
   114     // Close Setting server session
       
   115     settingServer.Close();
       
   116 
       
   117     TFileName logFileName;
       
   118     
       
   119     if(loggerSettings.iAddTestCaseTitle)
       
   120         {
       
   121         TName title;
       
   122         TestModuleIf().GetTestCaseTitleL(title);
       
   123         logFileName.Format(KCellbasedtriggerOperationsLogFileWithTitle, &title);
       
   124         }
       
   125     else
       
   126         {
       
   127         logFileName.Copy(KCellbasedtriggerOperationsLogFile);
       
   128         }
       
   129 
       
   130     iLog = CStifLogger::NewL( KCellbasedtriggerOperationsLogPath, 
       
   131                           logFileName,
       
   132                           CStifLogger::ETxt,
       
   133                           CStifLogger::EFile,
       
   134                           EFalse );
       
   135     
       
   136     SendTestClassVersion();
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CCellbasedtriggerOperations::NewL
       
   141 // Two-phased constructor.
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 CCellbasedtriggerOperations* CCellbasedtriggerOperations::NewL( 
       
   145     CTestModuleIf& aTestModuleIf )
       
   146     {
       
   147     CCellbasedtriggerOperations* self = new (ELeave) CCellbasedtriggerOperations( aTestModuleIf );
       
   148 
       
   149     CleanupStack::PushL( self );
       
   150     self->ConstructL();
       
   151     CleanupStack::Pop();
       
   152 
       
   153     return self;
       
   154 
       
   155     }
       
   156 
       
   157 // Destructor
       
   158 CCellbasedtriggerOperations::~CCellbasedtriggerOperations()
       
   159     { 
       
   160 
       
   161     // Delete resources allocated from test methods
       
   162     Delete();
       
   163 
       
   164     // Delete logger
       
   165     delete iLog; 
       
   166 
       
   167     }
       
   168 
       
   169 //-----------------------------------------------------------------------------
       
   170 // CCellbasedtriggerOperations::SendTestClassVersion
       
   171 // Method used to send version of test class
       
   172 //-----------------------------------------------------------------------------
       
   173 //
       
   174 void CCellbasedtriggerOperations::SendTestClassVersion()
       
   175 	{
       
   176 	TVersion moduleVersion;
       
   177 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   178 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   179 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   180 	
       
   181 	TFileName moduleName;
       
   182 	moduleName = _L("CellbasedtriggerOperations.dll");
       
   183 
       
   184 	TBool newVersionOfMethod = ETrue;
       
   185 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   186 	}
       
   187 
       
   188 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // LibEntryL is a polymorphic Dll entry point.
       
   192 // Returns: CScriptBase: New CScriptBase derived object
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 EXPORT_C CScriptBase* LibEntryL( 
       
   196     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   197     {
       
   198 
       
   199     return ( CScriptBase* ) CCellbasedtriggerOperations::NewL( aTestModuleIf );
       
   200 
       
   201     }
       
   202 
       
   203 
       
   204 //  End of File