sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/testpinnotifierplugin.cpp
branchRCL_3
changeset 22 8cb079868133
parent 21 ccb4f6b3db21
equal deleted inserted replaced
21:ccb4f6b3db21 22:8cb079868133
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19  @internalComponent - Internal Symbian test code 
    19  @internalComponent - Internal Symbian test code 
    20 */
    20 */
    21 
    21 
    22 #include "testpinnotifierplugin.h"
    22 #include "testpinnotifierplugin.h"
    23 #include <ssm/ssmuiproviderdll.h>
    23 #include <ssm/ssmuiproviderdll.h>
    24 #include <eikdialg.h>
    24 #include <techview/eikdialg.h>
    25 #include <testpinnotifier.rsg>
    25 #include <testpinnotifier.rsg>
    26 #include <bautils.h>
    26 #include <bautils.h>
    27 #include <eikenv.h>
    27 #include <eikenv.h>
    28 #include <uikon.hrh>
    28 #include <uikon.hrh>
    29 #include <ecom/implementationproxy.h>
    29 #include <ecom/implementationproxy.h>
    30 #include <eikseced.h>
    30 #include <techview/eikseced.h>
    31 #include <e32property.h>
    31 #include <e32property.h>
    32 
    32 
    33 const TUint KCustomcmdServerPropertyKey = 0x0012AC;
    33 const TUint KCustomcmdServerPropertyKey = 0x0012AC;
    34 const TUid KCustomcmdServerSID={0x2000D75B};				// tcustomcmd_server SID = KSsmServerName SID (changed in tcustomcmd_server.mmp file)
    34 const TUid KCustomcmdServerSID={0x2000D75B};				// tcustomcmd_server SID = KSsmServerName SID (changed in tcustomcmd_server.mmp file)
    35 
    35 
    36 _LIT(KPinNotifierResFileNameAndPath,"\\resource\\apps\\testpinnotifier.rsc");
    36 _LIT(KPinNotifierResFileNameAndPath,"\\resource\\apps\\testpinnotifier.rsc");
    37 _LIT(KPinNotifierTitle,"Security Check");
    37 _LIT(KPinNotifierTitle,"Security Check");
    38 
    38 
       
    39 //Hardcoding security pin code.
       
    40 _LIT(KPinCode,","); 
    39 
    41 
    40 CArrayPtr<MEikSrvNotifierBase2>* NotifierArrayL()
    42 CArrayPtr<MEikSrvNotifierBase2>* NotifierArrayL()
    41 	{
    43 	{
    42 	CArrayPtrFlat<MEikSrvNotifierBase2>* subjects=new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(10);
    44 	CArrayPtrFlat<MEikSrvNotifierBase2>* subjects=new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(10);
    43 	CleanupStack::PushL(subjects);
    45 	CleanupStack::PushL(subjects);
    65 	delete this;
    67 	delete this;
    66 	}
    68 	}
    67 
    69 
    68 CSecurityPinNotifier::TNotifierInfo CSecurityPinNotifier::RegisterL()
    70 CSecurityPinNotifier::TNotifierInfo CSecurityPinNotifier::RegisterL()
    69 	{
    71 	{
    70 	const TUid KSecurityPinNotifierUid = {0x2000E667};
    72 	iInfo.iUid = CSsmUiSpecific::SecurityPinNotifierUid();
    71 	iInfo.iUid = KSecurityPinNotifierUid;
    73 	iInfo.iChannel = CSsmUiSpecific::ScreenOutputChannelUid();
    72 
       
    73 	const TUid KScreenOutputChannel = {0x10009D48};	
       
    74 	iInfo.iChannel = KScreenOutputChannel;
       
    75 
       
    76 	iInfo.iPriority = ENotifierPriorityVHigh;
    74 	iInfo.iPriority = ENotifierPriorityVHigh;
    77 	return iInfo;
    75 	return iInfo;
    78 	}
    76 	}
    79 
    77 
    80 CSecurityPinNotifier::TNotifierInfo CSecurityPinNotifier::Info() const
    78 CSecurityPinNotifier::TNotifierInfo CSecurityPinNotifier::Info() const
   160 	{
   158 	{
   161 	TPckgBuf<TInt> securityResultBuffer;
   159 	TPckgBuf<TInt> securityResultBuffer;
   162 	securityResultBuffer = KErrGeneral; 
   160 	securityResultBuffer = KErrGeneral; 
   163 	if (iMessage != RMessagePtr2())
   161 	if (iMessage != RMessagePtr2())
   164 		{
   162 		{
   165    		securityResultBuffer = KErrNone;
   163    		TBuf<5> newPINValueVerify;
       
   164 
       
   165    		//Get pinter for the secret editor control
       
   166    		CEikSecretEditor* pinEditor = static_cast<CEikSecretEditor*>(Control(0));
       
   167    		pinEditor->GetText(newPINValueVerify);
       
   168 
       
   169 		//Verify the entered pin number
       
   170 		if(0 == newPINValueVerify.Compare(KPinCode))
       
   171 			{
       
   172 			securityResultBuffer = KErrNone;
       
   173 			}
       
   174 
       
   175 		pinEditor->Reset();	
   166 		iMessage.Write(iReplySlot,securityResultBuffer);
   176 		iMessage.Write(iReplySlot,securityResultBuffer);
   167 		iMessage.Complete(KErrNone);	
   177 		iMessage.Complete(KErrNone);	
   168 		// Set this swp to indicate to stop the active schaduler
   178 		// Set this swp to indicate to stop the active schaduler
   169 		const TInt KSwpValForOnOkStopScheduler = 88;
   179 		const TInt KSwpValForOnOkStopScheduler = 88;
   170  		TInt err = RProperty::Set(KCustomcmdServerSID, KCustomcmdServerPropertyKey, KSwpValForOnOkStopScheduler);
   180  		TInt err = RProperty::Set(KCustomcmdServerSID, KCustomcmdServerPropertyKey, KSwpValForOnOkStopScheduler);