authenticationservices/authenticationserver/source/server/trainingmgr.h
changeset 29 ece3df019add
equal deleted inserted replaced
19:cd501b96611d 29:ece3df019add
       
     1 /*
       
     2 * Copyright (c) 2005-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 the License "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 * CTrainingmgr - Auth Server helper class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @internalComponent
       
    23  @released
       
    24 */
       
    25 #ifndef TRAININGMGR_H
       
    26 #define TRAININGMGR_H
       
    27 
       
    28 #include <e32cmn.h>
       
    29 
       
    30 #include "authrepository.h"
       
    31 #include "authdb.h"
       
    32 #include "pluginmgr.h"
       
    33 
       
    34 namespace AuthServer
       
    35 {
       
    36 
       
    37 /** 
       
    38  * This AO handles the training of plugins for identities.  
       
    39  **/
       
    40 class CTrainingMgr : public CActive
       
    41 	{
       
    42 public:
       
    43   
       
    44 	CTrainingMgr(CPluginMgr&      aPluginMgr,
       
    45 				 CAuthDb2&        aAuthDb,
       
    46 				 CAuthRepository& aAuthRepository);
       
    47     
       
    48     ~CTrainingMgr();
       
    49     
       
    50 	void RegisterIdentityL(const RMessage2& aMessage,
       
    51 						  TIdentityId aId,
       
    52 						  CProtectionKey& aProtKey);
       
    53 	
       
    54 	TBool RegisterFirstIdentityL(TIdentityId aId,
       
    55 								CProtectionKey& aProtKey);
       
    56 	
       
    57 
       
    58 	void TrainPluginL(const RMessage2& aMessage,
       
    59 					 CProtectionKey& aProtKey);
       
    60 
       
    61 
       
    62 	TBool IsBusy() const;
       
    63 	
       
    64 	void RunL();  
       
    65 
       
    66 	void DoCancel(); 
       
    67 	
       
    68 private:
       
    69 	
       
    70 	enum TState
       
    71 		{
       
    72 		EIdle,
       
    73 		ERegistrationFirstStep,
       
    74 		ERegistering,
       
    75 		ERegistrationDone,
       
    76 		ETrainingDone,
       
    77 		};
       
    78 
       
    79 	CTransientKeyInfo* CreateKeyInfoLC();
       
    80 	
       
    81 	TBool AddIdentityL();
       
    82 	TBool AddTrainingResultL();
       
    83 	void  DoRegistrationStepL();
       
    84 	void  WriteResultToMsgL();
       
    85 	void  Complete();
       
    86 	void  Cleanup();
       
    87 	TInt RunError(TInt aError);
       
    88 
       
    89 	TState           iState;
       
    90 	const RMessage2* iMessage;
       
    91 	CPluginMgr*      iPluginMgr;
       
    92 	CAuthDb2*        iAuthDb;
       
    93 	TInt             iCurrentPluginIdx;
       
    94 	TPluginId        iCurrentPlugin;
       
    95 	TIdentityId      iIdentity;
       
    96 	HBufC8*          iResult;
       
    97 	HBufC*           iDescription;
       
    98 	CProtectionKey*  iProtKey;
       
    99 	CAuthRepository& iAuthRepository;
       
   100 };
       
   101 }
       
   102 #endif //  TRAININGMGR_H