bluetoothengine/btnotif/src/BTNPBAPPinNotifier.cpp
branchRCL_3
changeset 22 613943a21004
parent 21 0ba996a9b75d
child 23 9386f31cc85b
equal deleted inserted replaced
21:0ba996a9b75d 22:613943a21004
     1 /*
       
     2 * Copyright (c) 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:  Declares PBAP PIN query notifier class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <StringLoader.h>       // Localisation stringloader
       
    21 #include <utf.h>                // Unicode character conversion utilities
       
    22 
       
    23 #include <BTNotif.rsg>          // own resources
       
    24 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    25 #include <btextnotifiers.h>
       
    26 #else
       
    27 #include <btextnotifiers.h>
       
    28 #include <btextnotifierspartner.h>
       
    29 #endif
       
    30 
       
    31 #include "btnpbappinnotifier.h" // own class definition
       
    32 #include "btNotifDebug.h"       // debugging macros
       
    33 
       
    34 #include <SecondaryDisplay/BTnotifSecondaryDisplayAPI.h>
       
    35 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // ----------------------------------------------------------
       
    39 // CBTObexPinNotifier::NewL
       
    40 // Two-phased constructor.
       
    41 // ----------------------------------------------------------
       
    42 //
       
    43 CBTPBAPPinNotifier* CBTPBAPPinNotifier::NewL()
       
    44     {
       
    45     CBTPBAPPinNotifier* self=new (ELeave) CBTPBAPPinNotifier();
       
    46     CleanupStack::PushL(self);
       
    47     self->ConstructL();
       
    48     CleanupStack::Pop();
       
    49     return self;
       
    50     }
       
    51 
       
    52 // ----------------------------------------------------------
       
    53 // CBTObexPinNotifier::CBTObexPinNotifier
       
    54 // C++ default constructor can NOT contain any code, that
       
    55 // might leave.
       
    56 // ----------------------------------------------------------
       
    57 //
       
    58 CBTPBAPPinNotifier::CBTPBAPPinNotifier()
       
    59     {
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------
       
    63 // Destructor
       
    64 // ----------------------------------------------------------
       
    65 //
       
    66 CBTPBAPPinNotifier::~CBTPBAPPinNotifier()
       
    67     {
       
    68     }
       
    69 
       
    70 // ----------------------------------------------------------
       
    71 // CBTPBAPPinNotifier::RegisterL
       
    72 // ----------------------------------------------------------
       
    73 //
       
    74 CBTPBAPPinNotifier::TNotifierInfo CBTPBAPPinNotifier::RegisterL()
       
    75     {
       
    76     iInfo.iUid=KPbapAuthNotifierUid;
       
    77     iInfo.iChannel=KBTObexPINChannel;
       
    78     iInfo.iPriority=ENotifierPriorityVHigh;
       
    79     return iInfo;
       
    80     }
       
    81 
       
    82 // ----------------------------------------------------------
       
    83 // CBTPBAPPinNotifier::GetParamsL
       
    84 // Initialize parameters. Jump to RunL as soon as possible.
       
    85 // ----------------------------------------------------------
       
    86 //
       
    87 void CBTPBAPPinNotifier::GetParamsL(const TDesC8& /* aBuffer */, TInt aReplySlot, const RMessagePtr2& aMessage)
       
    88     {
       
    89     FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::GetParamsL()"));
       
    90 
       
    91     if( !iMessage.IsNull())
       
    92         {
       
    93         User::Leave(KErrInUse);
       
    94         }
       
    95     
       
    96     iMessage = aMessage;
       
    97     iReplySlot = aReplySlot;
       
    98     
       
    99     if ( AutoLockOnL() )
       
   100         {
       
   101         // The phone is locked, access denied.
       
   102         //
       
   103         CompleteMessage(KErrCancel);
       
   104         return;
       
   105         }
       
   106 
       
   107     ShowNoteCompleteMessageL();
       
   108 
       
   109     FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::GetParamsL() completed"));
       
   110     }
       
   111 
       
   112 // ----------------------------------------------------------
       
   113 // CBTPBAPPinNotifier::ShowNoteCompleteMessageL
       
   114 // Ask user response and return it to caller.
       
   115 // ----------------------------------------------------------
       
   116 //
       
   117 void CBTPBAPPinNotifier::ShowNoteCompleteMessageL()
       
   118     {
       
   119     FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ShowNoteCompleteMessageL()"));
       
   120 
       
   121     TBuf<KBTObexPasskeyMaxLength> pbapPasskey;    // Unicode buffer
       
   122 		
       
   123     TInt keypress = iNotifUiUtil->ShowTextInputQueryL( pbapPasskey, 
       
   124             R_BT_OBEX_PASSKEY_QUERY, ECmdShowBtOpenCoverNote );
       
   125 	
       
   126     if( keypress ) // OK pressed
       
   127         {        
       
   128         TPbapAuthNotifierResponsePckg  pbapPasskeyResponse;
       
   129         pbapPasskeyResponse().SetPassword(pbapPasskey);        
       
   130         CompleteMessage(pbapPasskeyResponse, KErrNone);
       
   131         }
       
   132     else  // Cancel pressed
       
   133         {
       
   134         CompleteMessage(KErrCancel);
       
   135         }
       
   136 
       
   137     FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ShowNoteCompleteMessageL() completed"));
       
   138     }
       
   139 
       
   140 // End of File