sysstatemgmt/systemstateplugins/test/tintadptplugin/src/definetestps.cpp
branchRCL_3
changeset 22 8cb079868133
parent 21 ccb4f6b3db21
child 23 c26be94c8889
equal deleted inserted replaced
21:ccb4f6b3db21 22:8cb079868133
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description: This app is used to define the P & S keys required for activating the reference plugins.
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code
       
    20 */
       
    21 
       
    22 #include <eikstart.h> 
       
    23 #include <eikapp.h>
       
    24 #include <e32property.h>
       
    25 #include "definetestps.h"
       
    26 #include "ti_adaptationplugin_stepbase.h"
       
    27 
       
    28 
       
    29 /**
       
    30 Standard DLL entry point function.
       
    31 Creates and returns an instance of the CApaApplication-derived class.
       
    32 @return an instance of the CApaApplication-derived class
       
    33 */
       
    34 TInt E32Main()
       
    35 	{
       
    36 	return EikStart::RunApplication( CTestApplication::NewApplication );
       
    37 	}
       
    38 
       
    39 CTestApplication::CTestApplication()
       
    40 	{
       
    41 	}
       
    42 
       
    43 CTestApplication::~CTestApplication()
       
    44 	{
       
    45  	}
       
    46 		
       
    47 /**
       
    48 @return The application's UID 
       
    49 */
       
    50 TUid CTestApplication::AppDllUid() const
       
    51 	{
       
    52 	const TUid dll = {0x200315B2};
       
    53 	return dll;
       
    54 	}
       
    55 
       
    56 /**
       
    57 @return CTestApplication or NULL if KErrNoMemory
       
    58 */
       
    59 CApaApplication* CTestApplication::NewApplication()
       
    60 	{
       
    61 	// As the framework has at this point not started up enough, and therefore the TRAP-harness and 
       
    62 	// exception handlers aren’t available yet, this factory function is a non-leaving function and 
       
    63 	// can't use the new(Eleave) operator.
       
    64 	return new CTestApplication();
       
    65 	}
       
    66 	
       
    67 /**
       
    68 Called by the UI framework at application start-up to create an instance of the document class.
       
    69 @leave	KErrNoMemory
       
    70 @return A CTestDocument
       
    71 */
       
    72 CApaDocument* CTestApplication::CreateDocumentL()
       
    73 	{
       
    74 	return CTestDocument::NewL(*this);
       
    75 	}
       
    76 
       
    77 CTestDocument::CTestDocument(CEikApplication& aApp) : CEikDocument(aApp)
       
    78 	{
       
    79 	}
       
    80 
       
    81 CTestDocument::~CTestDocument()
       
    82 	{
       
    83 	}
       
    84 
       
    85 /**
       
    86 Factory function for this class
       
    87 @return a new CEndTaskTestDocument instance.
       
    88 */
       
    89 CTestDocument* CTestDocument::NewL(CEikApplication& aApp)
       
    90 	{
       
    91 	return new(ELeave) CTestDocument(aApp);
       
    92 	}
       
    93 
       
    94 
       
    95 /**
       
    96 Called by the UI framework to construct the application UI class. 
       
    97 Note that the app UI's ConstructL() is called by the UI framework.
       
    98 */
       
    99 CEikAppUi* CTestDocument::CreateAppUiL()
       
   100 	{
       
   101 	return new(ELeave) CTestAppUi();
       
   102 	}
       
   103 
       
   104 CTestAppUi::CTestAppUi()
       
   105 	{
       
   106 	}
       
   107 
       
   108 CTestAppUi::~CTestAppUi()
       
   109 	{
       
   110 	}
       
   111 
       
   112 void CTestAppUi::ConstructL()
       
   113 	{
       
   114 	//This appplication is used to define the property for using dummy plugins. Uid3 of the application should be 
       
   115 	//same as the SSM's Secure Id. 
       
   116 	
       
   117 	
       
   118 	//Define the property for using Dummy plugins.
       
   119 	TInt result = KErrNone;
       
   120 	result = RProperty::Define(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey, RProperty::EInt);
       
   121 	if ((KErrNone != result) && (KErrAlreadyExists !=result))
       
   122         {
       
   123         User::Leave(result);            
       
   124         }
       
   125 	
       
   126 	
       
   127 	result = RProperty::Define(KPropertyCategory, KStateAdaptationPluginPropertyKey, RProperty::EInt);
       
   128 	if ((KErrNone != result) && (KErrAlreadyExists !=result))
       
   129         {
       
   130         User::Leave(result);            
       
   131         }	
       
   132 	
       
   133     result = RProperty::Define(KPropertyCategory, KRtcAdaptationPluginPropertyKey, RProperty::EInt);
       
   134 	if ((KErrNone != result) && (KErrAlreadyExists !=result))
       
   135         {
       
   136         User::Leave(result);            
       
   137         }    
       
   138 
       
   139     result = RProperty::Define(KPropertyCategory, KSimPluginPropertyKey, RProperty::EInt);
       
   140 	if ((KErrNone != result) && (KErrAlreadyExists !=result))
       
   141         {
       
   142         User::Leave(result);            
       
   143         }   
       
   144 
       
   145     result = RProperty::Define(KPropertyCategory, KMiscPluginPropertyKey, RProperty::EInt);
       
   146 	if ((KErrNone != result) && (KErrAlreadyExists !=result))
       
   147         {
       
   148         User::Leave(result);            
       
   149         }
       
   150 	
       
   151 	RProcess::Rendezvous(KErrNone);
       
   152 	// Complete the UI framework's construction of the App UI.
       
   153 	BaseConstructL(CEikAppUi::ENoAppResourceFile);
       
   154 	}