cbsatplugin/atmisccmdplugin/src/securitycodeverifier.cpp
branchRCL_3
changeset 16 b23265fb36da
equal deleted inserted replaced
14:f7fbeaeb166a 16:b23265fb36da
       
     1 /*
       
     2  * Copyright (c) 2010 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  * Initial Contributors:
       
     9  * Nokia Corporation - initial contribution.
       
    10  *
       
    11  * Contributors:
       
    12  * Description :
       
    13  *
       
    14  */
       
    15 
       
    16 #include "securitycodeverifier.h"
       
    17 
       
    18 #include "clckcommandhandler.h"
       
    19 #include "debug.h"
       
    20 
       
    21 /**
       
    22  * AO class for verifing security codes
       
    23  */
       
    24 CSecurityCodeVerifier* CSecurityCodeVerifier::NewL(CCLCKCommandHandler* aCLCKHandler, RMobilePhone& aPhone)
       
    25     {
       
    26     TRACE_FUNC_ENTRY
       
    27     CSecurityCodeVerifier* self = new(ELeave) CSecurityCodeVerifier(aCLCKHandler, aPhone);
       
    28     TRACE_FUNC_EXIT
       
    29     return self;
       
    30     }
       
    31       
       
    32 CSecurityCodeVerifier::CSecurityCodeVerifier(CCLCKCommandHandler* aCLCKHandler, RMobilePhone& aPhone) :
       
    33     CActive(EPriorityNormal),
       
    34     iCLCKHandler(aCLCKHandler),
       
    35     iPhone(aPhone)
       
    36     {
       
    37     TRACE_FUNC_ENTRY
       
    38     CActiveScheduler::Add(this);
       
    39     TRACE_FUNC_EXIT
       
    40     }
       
    41 
       
    42 CSecurityCodeVerifier::~CSecurityCodeVerifier()
       
    43     {
       
    44     Cancel();
       
    45     }
       
    46 
       
    47 void CSecurityCodeVerifier::Start(TDesC8& aPassword, RMobilePhone::TMobilePhoneSecurityCode& aSecurityCode)
       
    48     {
       
    49     TRACE_FUNC_ENTRY
       
    50     RMobilePhone::TMobilePassword code;
       
    51     code.Copy(aPassword);
       
    52 
       
    53     iPhone.VerifySecurityCode(iStatus, aSecurityCode, code, code);
       
    54     SetActive();
       
    55     TRACE_FUNC_EXIT
       
    56     }
       
    57 
       
    58 void CSecurityCodeVerifier::RunL()
       
    59     {
       
    60     TRACE_FUNC_ENTRY    
       
    61     Trace(KDebugPrintD, "iStatus.Int(): ", iStatus.Int());
       
    62     iCLCKHandler->HandlePasswordVerification(iStatus.Int());
       
    63     TRACE_FUNC_EXIT
       
    64     }
       
    65 
       
    66 void CSecurityCodeVerifier::DoCancel()
       
    67     {
       
    68     TRACE_FUNC_ENTRY
       
    69     iPhone.CancelAsyncRequest(EMobilePhoneNotifySecurityEvent);
       
    70     TRACE_FUNC_EXIT
       
    71     }