usbuis/usbui/tsrc/USBUiApiTest/inc/USBUiApiTest.h
changeset 2 468cfcb53fd1
parent 1 705ec7b86991
child 3 47c263f7e521
equal deleted inserted replaced
1:705ec7b86991 2:468cfcb53fd1
     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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef USBUIAPITEST_H
       
    21 #define USBUIAPITEST_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <StifLogger.h>
       
    25 #include <TestScripterInternal.h>
       
    26 #include <StifTestModule.h>
       
    27 #include <TestclassAssert.h>
       
    28 
       
    29 #include "coreapplicationuisdomainpskeys.h"
       
    30 #include <SettingsInternalCRKeys.h>
       
    31 #include <centralrepository.h>
       
    32 #include <apgcli.h>
       
    33 #include <apacmdln.h>
       
    34 #include <UsbWatcherInternalCRKeys.h>
       
    35 #include <usbpersonalityids.h>
       
    36 
       
    37 #include "USBClassChangeUI.h"
       
    38 
       
    39 // CONSTANTS
       
    40 _LIT( KUsbAppFileName, "usbclasschangeui" );
       
    41 
       
    42 // MACROS
       
    43 //#define ?macro ?macro_def
       
    44 #define TEST_CLASS_VERSION_MAJOR 0
       
    45 #define TEST_CLASS_VERSION_MINOR 0
       
    46 #define TEST_CLASS_VERSION_BUILD 0
       
    47 
       
    48 #ifdef STIF_LOG
       
    49 #undef STIF_LOG
       
    50 #endif
       
    51 
       
    52 #define STIF_LOG( s )\
       
    53     {\
       
    54     TBuf<KMaxLogData> traceBuf;\
       
    55     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    56     traceBuf.Append( _L( s ) );\
       
    57     iLog->Log( _L( s ) );\
       
    58     RDebug::Print( traceBuf );\
       
    59     }
       
    60 
       
    61 #define STIF_LOG1( s, v ) \
       
    62     {\
       
    63     TBuf<KMaxLogData> traceBuf;\
       
    64     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    65     traceBuf.Append( _L( s ) );\
       
    66     iLog->Log( _L( s ), v );\
       
    67     RDebug::Print( traceBuf, v );\
       
    68     }
       
    69 
       
    70 #define STIF_LOG2( s, v1, v2 ) \
       
    71     {\
       
    72     TBuf<KMaxLogData> traceBuf;\
       
    73     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    74     traceBuf.Append( _L( s ) );\
       
    75     iLog->Log( _L( s ), v1, v2 );\
       
    76     RDebug::Print( traceBuf, v1, v2 );\
       
    77     }
       
    78 
       
    79 #define STIF_LOG3( s, v1, v2, v3 ) \
       
    80     {\
       
    81     TBuf<KMaxLogData> traceBuf;\
       
    82     traceBuf.Append( _L( "[STIF_LOG] " ) );\
       
    83     traceBuf.Append( _L( s ) );\
       
    84     iLog->Log( _L( s ), v1, v2, v3 );\
       
    85     RDebug::Print( traceBuf, v1, v2, v3 );\
       
    86     }
       
    87 
       
    88 
       
    89 // Logging path
       
    90 #ifndef ATS
       
    91 _LIT( KUSBUiApiTestLogPath, "\\logs\\testframework\\usb\\" );
       
    92 #else
       
    93 _LIT( KUSBUiApiTestLogPath, "e:\\testing\\stiflogs\\" ); 
       
    94 #endif
       
    95 // Log file
       
    96 _LIT( KUSBUiApiTestLogFile, "USBUiApiTest.txt" ); 
       
    97 _LIT( KUSBUiApiTestLogFileWithTitle, "USBUiApiTest_[%S].txt" );
       
    98 
       
    99 // FUNCTION PROTOTYPES
       
   100 //?type ?function_name(?arg_list);
       
   101 
       
   102 // FORWARD DECLARATIONS
       
   103 //class ?FORWARD_CLASSNAME;
       
   104 class CUSBUiApiTest;
       
   105 
       
   106 // DATA TYPES
       
   107 //enum ?declaration
       
   108 enum TUSBAppTestOption
       
   109     {
       
   110     EAppCancelled = 0,
       
   111     EAskOnConnectionSettingChanged,//1
       
   112     EUsbConnectionModeSettingChanged//2
       
   113     };
       
   114 //typedef ?declaration
       
   115 //extern ?data_type;
       
   116 
       
   117 // CLASS DECLARATION
       
   118 
       
   119 /**
       
   120 *  CUSBUiApiTest test class for STIF Test Framework TestScripter.
       
   121 *  ?other_description_lines
       
   122 *
       
   123 *  @lib ?library
       
   124 *  @since ?Series60_version
       
   125 */
       
   126 NONSHARABLE_CLASS(CUSBUiApiTest) : public CScriptBase
       
   127     {
       
   128     public:  // Constructors and destructor
       
   129 
       
   130         /**
       
   131         * Two-phased constructor.
       
   132         */
       
   133         static CUSBUiApiTest* NewL( CTestModuleIf& aTestModuleIf );
       
   134 
       
   135         /**
       
   136         * Destructor.
       
   137         */
       
   138         virtual ~CUSBUiApiTest();
       
   139 
       
   140     public: // New functions
       
   141 
       
   142         /**
       
   143         * ?member_description.
       
   144         * @since ?Series60_version
       
   145         * @param ?arg1 ?description
       
   146         * @return ?description
       
   147         */
       
   148         //?type ?member_function( ?type ?arg1 );
       
   149 
       
   150     public: // Functions from base classes
       
   151 
       
   152         /**
       
   153         * From CScriptBase Runs a script line.
       
   154         * @since ?Series60_version
       
   155         * @param aItem Script line containing method name and parameters
       
   156         * @return Symbian OS error code
       
   157         */
       
   158         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   159 
       
   160     protected:  // New functions
       
   161 
       
   162         /**
       
   163         * ?member_description.
       
   164         * @since ?Series60_version
       
   165         * @param ?arg1 ?description
       
   166         * @return ?description
       
   167         */
       
   168         //?type ?member_function( ?type ?arg1 );
       
   169 
       
   170     protected:  // Functions from base classes
       
   171 
       
   172         /**
       
   173         * From ?base_class ?member_description
       
   174         */
       
   175         //?type ?member_function();
       
   176 
       
   177     private:
       
   178 
       
   179         /**
       
   180         * C++ default constructor.
       
   181         */
       
   182         CUSBUiApiTest( CTestModuleIf& aTestModuleIf );
       
   183 
       
   184         /**
       
   185         * By default Symbian 2nd phase constructor is private.
       
   186         */
       
   187         void ConstructL();
       
   188 
       
   189         // Prohibit copy constructor if not deriving from CBase.
       
   190         // ?classname( const ?classname& );
       
   191         // Prohibit assigment operator if not deriving from CBase.
       
   192         // ?classname& operator=( const ?classname& );
       
   193 
       
   194         /**
       
   195         * Frees all resources allocated from test methods.
       
   196         * @since ?Series60_version
       
   197         */
       
   198         void Delete();
       
   199 
       
   200         /**
       
   201         * Test methods are listed below. 
       
   202         */
       
   203 
       
   204         virtual TInt LaunchUsbUiApp( CStifItemParser& aItem );
       
   205         virtual TInt FinishTest( CStifItemParser& aItem );
       
   206         
       
   207         /**
       
   208          * Method used to log version of test class
       
   209          */
       
   210         void SendTestClassVersion();
       
   211 
       
   212         //ADD NEW METHOD DEC HERE
       
   213         //[TestMethods] - Do not remove
       
   214         TInt GetTestOption( TPtrC aOptionString, TUSBAppTestOption& aOption );
       
   215         TInt GetAskOnConnectionOptionFromString( TPtrC aOptionString, TInt& aOption );
       
   216         TInt GetUsbPersonalityOptionFromString( TPtrC aOptionString, TInt& aOption );
       
   217         TBool IsUsbAppRunning();
       
   218         TInt GetUsbSettings( TInt& aUsbPersinalityId, TInt& aAskOnConnectionSetting );
       
   219         TInt SetUsbSettings( TInt aUsbPersinalityId, TInt aAskOnConnectionSetting );
       
   220 
       
   221         TInt TurnLightsOn( CStifItemParser& aItem );   
       
   222 
       
   223     public:     // Data
       
   224         // ?one_line_short_description_of_data
       
   225         //?data_declaration;
       
   226 
       
   227     protected:  // Data
       
   228         // ?one_line_short_description_of_data
       
   229         //?data_declaration;
       
   230 
       
   231     private:    // Data
       
   232         
       
   233         RApaLsSession iApaLsSession;
       
   234         
       
   235         CApaCommandLine *iCommandLine;
       
   236         CRepository *iRepository;
       
   237         
       
   238         TSecureId iUsbAppSecureId;
       
   239         TInt iAskOnConnectionSettingBackup;
       
   240         TInt iUsbPersonalityBackup;
       
   241         TInt iTestAskOnConnectionSetting;
       
   242         TInt iTestUsbPersonality;
       
   243 
       
   244     public:     // Friend classes
       
   245         //?friend_class_declaration;
       
   246     protected:  // Friend classes
       
   247         //?friend_class_declaration;
       
   248     private:    // Friend classes
       
   249         //?friend_class_declaration;
       
   250 
       
   251     };
       
   252 
       
   253 #endif      // USBUIAPITEST_H
       
   254 
       
   255 // End of File