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