omadm/omadmappui/tsrc/src/ui_dmuiBlocks.cpp
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Implementation of DM UI test component
       
    15 * 	This is part of omadmappui test application.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // [INCLUDE FILES] - do not remove
       
    23 #include <e32svr.h>
       
    24 #include <W32STD.H> 
       
    25 #include <COEMAIN.H> 
       
    26 #include <APGCLI.H> 
       
    27 #include <APGTASK.H> 
       
    28 #include <StifParser.h>
       
    29 #include <Stiftestinterface.h>
       
    30 #include "ui_dmui.h"
       
    31 
       
    32 // EXTERNAL DATA STRUCTURES
       
    33 //extern  ?external_data;
       
    34 
       
    35 // EXTERNAL FUNCTION PROTOTYPES  
       
    36 //extern ?external_function( ?arg_type,?arg_type );
       
    37 
       
    38 // CONSTANTS
       
    39 //const ?type ?constant_var = ?constant;
       
    40 
       
    41 // MACROS
       
    42 //#define ?macro ?macro_def
       
    43 
       
    44 // LOCAL CONSTANTS AND MACROS
       
    45 //const ?type ?constant_var = ?constant;
       
    46 //#define ?macro_name ?macro_def
       
    47 
       
    48 // MODULE DATA STRUCTURES
       
    49 //enum ?declaration
       
    50 //typedef ?declaration
       
    51 
       
    52 // LOCAL FUNCTION PROTOTYPES
       
    53 //?type ?function_name( ?arg_type, ?arg_type );
       
    54 
       
    55 // FORWARD DECLARATIONS
       
    56 //class ?FORWARD_CLASSNAME;
       
    57 
       
    58 // ============================= LOCAL FUNCTIONS ===============================
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // ?function_name ?description.
       
    62 // ?description
       
    63 // Returns: ?value_1: ?description
       
    64 //          ?value_n: ?description_line1
       
    65 //                    ?description_line2
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 /*
       
    69 ?type ?function_name(
       
    70     ?arg_type arg,  // ?description
       
    71     ?arg_type arg)  // ?description
       
    72     {
       
    73 
       
    74     ?code  // ?comment
       
    75 
       
    76     // ?comment
       
    77     ?code
       
    78     }
       
    79 */
       
    80 
       
    81 // ============================ MEMBER FUNCTIONS ===============================
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // Cui_dmui::Delete
       
    85 // Delete here all resources allocated and opened from test methods. 
       
    86 // Called from destructor. 
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void Cui_dmui::Delete() 
       
    90     {
       
    91 
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // Cui_dmui::RunMethodL
       
    96 // Run specified method. Contains also table of test mothods and their names.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TInt Cui_dmui::RunMethodL( 
       
   100     CStifItemParser& aItem ) 
       
   101     {
       
   102 
       
   103     static TStifFunctionInfo const KFunctions[] =
       
   104         {  
       
   105         // Copy this line for every implemented function.
       
   106         // First string is the function name used in TestScripter script file.
       
   107         // Second is the actual implementation member function. 
       
   108         ENTRY( "Example", Cui_dmui::ExampleL ),
       
   109         //ADD NEW ENTRY HERE
       
   110         // [test cases entries] - Do not remove
       
   111 
       
   112         };
       
   113 
       
   114     const TInt count = sizeof( KFunctions ) / 
       
   115                         sizeof( TStifFunctionInfo );
       
   116 
       
   117     return RunInternalL( KFunctions, count, aItem );
       
   118 
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // Cui_dmui::ExampleL
       
   123 // Example test method function.
       
   124 // (other items were commented in a header).
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TInt Cui_dmui::ExampleL( CStifItemParser& aItem )
       
   128     {
       
   129 
       
   130     // Print to UI
       
   131 
       
   132     /*
       
   133     TestModuleIf().Printf( 0, Kui_dmui, KExample );
       
   134     // Print to log file
       
   135     iLog->Log( KExample );
       
   136 
       
   137     TInt i = 0;
       
   138     TPtrC string;
       
   139     _LIT( KParam, "Param[%i]: %S" );
       
   140     while ( aItem.GetNextString ( string ) == KErrNone )
       
   141         {
       
   142         TestModuleIf().Printf( i, Kui_dmui, 
       
   143                                 KParam, i, &string );
       
   144         i++;
       
   145         }
       
   146 */
       
   147 
       
   148 RDebug::Print( _L("stiff "));
       
   149 	                                                
       
   150 const TUid KDeviceManagerUid = {0x101F6DE5};        // Device manager application 
       
   151 RWsSession sess = CCoeEnv::Static()->WsSession();
       
   152 RDebug::Print( 
       
   153 	     _L("stiff after sess"));
       
   154     RApaLsSession apaLsSession;        
       
   155   
       
   156     TApaTaskList appList( sess );
       
   157     TApaTask bring = appList.FindApp( KDeviceManagerUid );
       
   158 RDebug::Print( 
       
   159 	     _L("stiff after app list"));
       
   160     if ( bring.Exists() )
       
   161         {
       
   162         	RDebug::Print( 
       
   163 	     _L("stiff 1 exists"));
       
   164         bring.BringToForeground();
       
   165         }
       
   166     else
       
   167         {
       
   168         	RDebug::Print( 
       
   169 	     _L("stiff 1 new app launch"));
       
   170         if( !apaLsSession.Handle() )
       
   171             {
       
   172             User::LeaveIfError(apaLsSession.Connect());
       
   173             RDebug::Print( 
       
   174 	     _L("stiff 1 new app launch connect"));
       
   175             }
       
   176         CleanupClosePushL( apaLsSession );
       
   177         TThreadId thread;
       
   178         RDebug::Print( 
       
   179 	     _L("stiff 1 new app thread creation"));
       
   180 	     TInt t = apaLsSession.StartDocument(KNullDesC, KDeviceManagerUid, thread);
       
   181 	     TBuf <20> err;
       
   182 	     err.Num(t);
       
   183 	     err.Append(_L("err"));
       
   184 	     RDebug::Print(err );
       
   185         User::LeaveIfError( t );
       
   186          RDebug::Print( 
       
   187 	     _L("stiff 1 new app thread created"));
       
   188         CleanupStack::PopAndDestroy( &apaLsSession );  
       
   189         RDebug::Print( 
       
   190 	     _L("stiff 1 new destroy app ls session"));
       
   191           TApaTaskList appList( CCoeEnv::Static()->WsSession());
       
   192     TApaTask bring = appList.FindApp( KDeviceManagerUid );
       
   193 
       
   194     /*if ( bring.Exists() )
       
   195         {
       
   196         	RDebug::Print( 
       
   197 	     _L("stiff 1 app send to bg"));
       
   198 	     User::After(3000000);
       
   199         bring.SendToBackground();
       
   200         //bring.BringToForeground();
       
   201         //bring.SendToBackground();
       
   202         }*/
       
   203       }
       
   204       RDebug::Print( 
       
   205 	     _L("stiff 1 return ke errnone"));
       
   206     return KErrNone;
       
   207 
       
   208     }
       
   209 
       
   210 
       
   211 TInt Cui_dmui::LaunchserverviewL( CStifItemParser& aItem )
       
   212     {
       
   213 
       
   214        return KErrNone;
       
   215 
       
   216     }
       
   217 // -----------------------------------------------------------------------------
       
   218 // Cui_dmui::?member_function
       
   219 // ?implementation_description
       
   220 // (other items were commented in a header).
       
   221 // -----------------------------------------------------------------------------
       
   222 //
       
   223 /*
       
   224 TInt Cui_dmui::?member_function(
       
   225    CItemParser& aItem )
       
   226    {
       
   227 
       
   228    ?code
       
   229 
       
   230    }
       
   231 */
       
   232 
       
   233 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   234 // None
       
   235 
       
   236 //  [End of File] - Do not remove