ImagePrint/ImagePrintEngine/DeviceProtocols/btprotocol/src/cbtpasswordquery.cpp
branchGCC_SURGE
changeset 25 59ea2209bb67
parent 23 08cc4cc059d4
parent 15 a92d00fca574
equal deleted inserted replaced
23:08cc4cc059d4 25:59ea2209bb67
     1 /*
       
     2 * Copyright (c) 2004-2007 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 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <avkon.hrh>
       
    20 
       
    21 #include "cbtpasswordquery.h"
       
    22 
       
    23 CBtPasswordQuery::CBtPasswordQuery( MConfirmationNotify& aNotify ) : CActive( CActive::EPriorityStandard),
       
    24 																	 iNotify (aNotify)
       
    25 	{
       
    26 	CActiveScheduler::Add( this );
       
    27 	}
       
    28 
       
    29 CBtPasswordQuery::~CBtPasswordQuery()
       
    30 	{
       
    31 	Cancel();
       
    32 	iNotifier.Close();
       
    33 	}
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ==============================
       
    36 
       
    37 // ----------------------------------------------------------------------------
       
    38 // CBtPasswordQuery::NewL()
       
    39 // Symbian two-phased constructor.
       
    40 // ----------------------------------------------------------------------------
       
    41 //
       
    42 CBtPasswordQuery* CBtPasswordQuery::NewL( MConfirmationNotify& aNotify )  
       
    43 	{
       
    44 	CBtPasswordQuery* self = CBtPasswordQuery::NewLC( aNotify );
       
    45     CleanupStack::Pop( self );
       
    46     return self;
       
    47 	}
       
    48 
       
    49 // ----------------------------------------------------------------------------
       
    50 // CBtPasswordQuery::NewLC()
       
    51 // Symbian two-phased constructor.
       
    52 // ----------------------------------------------------------------------------
       
    53 //
       
    54 CBtPasswordQuery* CBtPasswordQuery::NewLC( MConfirmationNotify& aNotify )
       
    55     {
       
    56     CBtPasswordQuery* self;
       
    57     self = new ( ELeave ) CBtPasswordQuery( aNotify );
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     return self;
       
    61    	}
       
    62 
       
    63 // ----------------------------------------------------------------------------
       
    64 // CBtPasswordQuery::ConstructL()
       
    65 // Perform second phase construction of this object.
       
    66 // ----------------------------------------------------------------------------
       
    67 //
       
    68 void CBtPasswordQuery::ConstructL()
       
    69     {
       
    70     	
       
    71     }
       
    72 
       
    73 void CBtPasswordQuery::StartActiveObjectL()
       
    74 	{
       
    75 	
       
    76     //RNotifier notifier;
       
    77     User::LeaveIfError(iNotifier.Connect());
       
    78 	
       
    79     // start asynchronic notifier -> prompt user passsword
       
    80     iNotifier.StartNotifierAndGetResponse(iStatus, KBTObexPasskeyQueryNotifierUid, iPckg, iResultPckg);
       
    81     
       
    82 	// Start active object and set iStatus = KRequestPending
       
    83 	SetActive();	
       
    84 	}
       
    85 
       
    86 void CBtPasswordQuery::RunL()
       
    87 	{
       
    88     if( iStatus.Int() == KErrNone || iStatus.Int() == KErrCancel)
       
    89         {
       
    90       	iNotifier.CancelNotifier( KPowerModeSettingNotifierUid );
       
    91         // close connection to the notify server  
       
    92 		iNotifier.Close();
       
    93 		iNotify.PasswordQueryCompleteL( iResultPckg );
       
    94 		}
       
    95 	}
       
    96 
       
    97 void CBtPasswordQuery::RunError()
       
    98 	{
       
    99 	
       
   100 	}
       
   101 
       
   102 void CBtPasswordQuery::DoCancel()
       
   103 	{
       
   104   	iNotifier.CancelNotifier( KPowerModeSettingNotifierUid );
       
   105 		
       
   106 	}
       
   107 
       
   108 // End of File