bluetoothengine/btnotif/src/BTNPBAPPinNotifier.cpp
changeset 0 f63038272f30
child 6 6a29d5ad0713
child 26 b78e66e88238
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     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     else if ( AutoLockOnL() )
       
    96         {
       
    97         // The phone is locked, access denied.
       
    98         //
       
    99         CompleteMessage(KErrCancel);
       
   100         return;
       
   101         }
       
   102         
       
   103     iMessage = aMessage;
       
   104     iReplySlot = aReplySlot;
       
   105 
       
   106     ShowNoteCompleteMessageL();
       
   107 
       
   108     FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::GetParamsL() completed"));
       
   109     }
       
   110 
       
   111 // ----------------------------------------------------------
       
   112 // CBTPBAPPinNotifier::ShowNoteCompleteMessageL
       
   113 // Ask user response and return it to caller.
       
   114 // ----------------------------------------------------------
       
   115 //
       
   116 void CBTPBAPPinNotifier::ShowNoteCompleteMessageL()
       
   117     {
       
   118     FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ShowNoteCompleteMessageL()"));
       
   119 
       
   120     TBuf<KBTObexPasskeyMaxLength> pbapPasskey;    // Unicode buffer
       
   121 		
       
   122     TInt keypress = iNotifUiUtil->ShowTextInputQueryL( pbapPasskey, 
       
   123             R_BT_OBEX_PASSKEY_QUERY, ECmdShowBtOpenCoverNote );
       
   124 	
       
   125     if( keypress ) // OK pressed
       
   126         {        
       
   127         TPbapAuthNotifierResponsePckg  pbapPasskeyResponse;
       
   128         pbapPasskeyResponse().SetPassword(pbapPasskey);        
       
   129         CompleteMessage(pbapPasskeyResponse, KErrNone);
       
   130         }
       
   131     else  // Cancel pressed
       
   132         {
       
   133         CompleteMessage(KErrCancel);
       
   134         }
       
   135 
       
   136     FLOG(_L("[BTNOTIF]\t CBTPBAPPinNotifier::ShowNoteCompleteMessageL() completed"));
       
   137     }
       
   138 
       
   139 // End of File