sysstatemgmt/systemstatereferenceplugins/custcmd/inc/cmdsimsecuritycheck.h
changeset 0 4e1aa6a622a0
child 5 1a73e8f1b64d
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:
       
    15 * Name        : strtsecuritychecktask.h
       
    16 * Part of     : System Startup / Starter
       
    17 * Declaration of CStrtSecurityCheckTask class
       
    18 * Version     : %version: ou1s60rt#5.1.1 %
       
    19 * This material, including documentation and any related computer
       
    20 * programs, is protected by copyright controlled by Nokia.  All
       
    21 * rights are reserved.  Copying, including reproducing, storing,
       
    22 * adapting or translating, any or all of this material requires the
       
    23 * prior written consent of Nokia.  This material also contains
       
    24 * confidential information which may not be disclosed to others
       
    25 * without the prior written consent of Nokia.
       
    26 * Template version: 4.0
       
    27 * Nokia Core OS *
       
    28 * File renamed from strtsecuritychecktask.h to cmdsimsecuritycheck.h as part of Core OS transfer.
       
    29 *
       
    30 */
       
    31 
       
    32 
       
    33 
       
    34 
       
    35 /**
       
    36  @file
       
    37  @internalComponent
       
    38  @released
       
    39 */
       
    40 
       
    41 #ifndef __CMDSIMSECURITYCHECK_H__
       
    42 #define __CMDSIMSECURITYCHECK_H__
       
    43 
       
    44 #include <ssm/ssmcustomcommand.h>
       
    45 #include "ssmpanic.h"
       
    46 #include "ssmsecuritychecknotifier.h"
       
    47 #include "ssmuiproviderdll.h"
       
    48 #include <ssm/ssmsuscli.h>
       
    49 #include "securitynoteobserver.h"
       
    50 
       
    51 #include "strtsecuritynotetype.h"
       
    52 #include "strtsecuritystatus.h"
       
    53 #include "startupadaptationcommands.h"
       
    54 #include "starterprivatecrkeys.h"
       
    55 
       
    56 #include <e32std.h>
       
    57 #include <e32base.h>
       
    58 #include <ssm/ssmstatemanager.h>
       
    59 #include <ssm/ssmadaptationcli.h>
       
    60 
       
    61 typedef StartupAdaptation::TSecurityStateInfo TSecurityStateInfo;
       
    62 typedef StartupAdaptation::TSecurityState TSecurityState;
       
    63 
       
    64 NONSHARABLE_CLASS(CSsmSimStatusPSObserver) : public CActive
       
    65     {
       
    66 public:
       
    67 	static CSsmSimStatusPSObserver* NewL(TUid aCategory, TUint aKey);
       
    68     ~CSsmSimStatusPSObserver();
       
    69 
       
    70     void StartObserving(TRequestStatus& aStatus);
       
    71     TInt GetValue(TInt& aValue);
       
    72 	
       
    73 protected:
       
    74 	// from CActive
       
    75 	void DoCancel();
       
    76     void RunL();
       
    77 
       
    78 private:
       
    79 	CSsmSimStatusPSObserver(TUid aCategory, TUint aKey);
       
    80     void Complete(const TInt aErrorCode);
       
    81     void ConstructL();
       
    82 
       
    83 private:
       
    84     RProperty iProperty;
       
    85     TUid iCategory;
       
    86     TUint iKey;
       
    87     TRequestStatus* iClientStatus;
       
    88     };
       
    89 
       
    90 NONSHARABLE_CLASS (CCustomCmdSimSecurityCheck) : public CActive , public MSsmCustomCommand
       
    91 	{
       
    92 public:
       
    93 	static CCustomCmdSimSecurityCheck* NewL();
       
    94 
       
    95 	// from MSsmcustomCommand
       
    96 	TInt Initialize(CSsmCustomCommandEnv* aCmdEnv);
       
    97 	void Execute(const TDesC8& aParams, TRequestStatus& aStatus);
       
    98 	void Close();
       
    99 	void Release();
       
   100 	void ExecuteCancel();
       
   101 
       
   102 protected:
       
   103 	// from CActive
       
   104 	void RunL();
       
   105 	void DoCancel();
       
   106 	TInt RunError(TInt aError);
       
   107 
       
   108 protected:
       
   109 	void ConstructL();
       
   110 	void Cleanup(TInt aError);
       
   111 
       
   112 private:
       
   113 	CCustomCmdSimSecurityCheck();
       
   114 	~CCustomCmdSimSecurityCheck();
       
   115 
       
   116   	void StartStateChange(const TSecurityState aState, const TStrtSecurityNoteType aNoteType = ESecNoteNone);
       
   117 	void StateChangeL( const TInt aResultCode );
       
   118 	void CompleteClientRequest(TInt aReason);
       
   119 	void SecurityCheckL();
       
   120 	void DoSecurityCheck();
       
   121 
       
   122 	void HandleSIMPresent();
       
   123 	void HandleSIMInvalid();
       
   124     void HandleSIMRejected();
       
   125     void HandleSIMBlocked();
       
   126     void HandlePINRequired();
       
   127     void HandleSIMLessOfflineSupported();
       
   128     void HandleSIMLock();
       
   129     void HandlePINAsked();
       
   130     void HandlePUKAsked();
       
   131 
       
   132     void SetSecurityCheckOK();
       
   133     void StartSecurityNoteObserverL();
       
   134 
       
   135 	//Sim related
       
   136     void SimRemoved();
       
   137     void SimNotSupported();
       
   138     void SimReadable();
       
   139     void SimUsable();
       
   140 	void DoSimRemoved();
       
   141 	void DoSimNotSupported();
       
   142 	void DoSimReadable();
       
   143 	void DoSimUsable();
       
   144     void DoObserveSimStatusPS();
       
   145 
       
   146 	void DoExtendedSimOperations();
       
   147 
       
   148     TBool IsSimSupported();
       
   149 
       
   150     //Security Status
       
   151     void SetSecurityStatus(const TStrtSecurityStatus& aSecurityStatus);
       
   152     TStrtSecurityStatus SecurityStatus() const;
       
   153 
       
   154 private:
       
   155 	enum TSimSecuritySubState
       
   156 		{
       
   157 		ESecuritySubStateNone = 0,
       
   158 		ESecuritySubStateSimRemoved,
       
   159 		ESecuritySubStateSimNotSupported,
       
   160 		ESecuritySubStateSimReadable,
       
   161 		ESecuritySubStateSimUsable,
       
   162 		ESecuritySubStateSimStatusPSObserver
       
   163 		};
       
   164 
       
   165 private:
       
   166     TSecurityState iState;
       
   167 	RSsmMiscAdaptation iSsmMiscAdaptation;
       
   168     TSecurityStateInfo iSecurityStateInfo;
       
   169 	TStrtSecurityNoteType iNoteType;
       
   170 	TBool iStateChangePending;
       
   171 	CSsmSecurityCheckNotifier* iSsmSecurityCheckNotifier;
       
   172 	TUid iStartupPSUid;
       
   173 	TPckg<TSecurityStateInfo>* iSecurityStateInfoResult;
       
   174 	CSsmUiSpecific* iSsmUiSpecific;
       
   175 	RSsmStateManager iSsmStateManager;
       
   176 	RSsmSusCli iSsmSusCli;
       
   177 	CSecurityNoteObserver* iSecurityNoteObserver;
       
   178 	TSimSecuritySubState iSubState;
       
   179 	TRequestStatus* iExecuteRequest;
       
   180 	CSsmSimStatusPSObserver* iSimStatusPSObserver;
       
   181 #ifdef TEST_CUSTCMD_MACRO
       
   182 	friend class CCustomCmdTestSimSecurityCheck;
       
   183 #endif
       
   184 
       
   185 	};
       
   186 #endif // __CMDSIMSECURITYCHECK_H__