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 power mode setting notifier class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <BTNotif.rsg> // Own resources |
|
21 #include "btnpwrnotifier.h" // Own class definition |
|
22 #include "btNotifDebug.h" // Debugging macros |
|
23 #include <bt_subscribe.h> |
|
24 #include <secondarydisplay/BTnotifSecondaryDisplayAPI.h> |
|
25 |
|
26 |
|
27 // ================= MEMBER FUNCTIONS ======================= |
|
28 |
|
29 // ---------------------------------------------------------- |
|
30 // CBTPwrNotifier::NewL |
|
31 // Two-phased constructor. |
|
32 // ---------------------------------------------------------- |
|
33 // |
|
34 CBTPwrNotifier* CBTPwrNotifier::NewL() |
|
35 { |
|
36 CBTPwrNotifier* self=new (ELeave) CBTPwrNotifier(); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop(); |
|
40 return self; |
|
41 } |
|
42 |
|
43 // ---------------------------------------------------------- |
|
44 // CBTPwrNotifier::CBTPwrNotifier |
|
45 // C++ default constructor can NOT contain any code, that |
|
46 // might leave. |
|
47 // ---------------------------------------------------------- |
|
48 // |
|
49 CBTPwrNotifier::CBTPwrNotifier() |
|
50 { |
|
51 } |
|
52 |
|
53 // ---------------------------------------------------------- |
|
54 // Destructor |
|
55 // ---------------------------------------------------------- |
|
56 // |
|
57 CBTPwrNotifier::~CBTPwrNotifier() |
|
58 { |
|
59 } |
|
60 |
|
61 // ---------------------------------------------------------- |
|
62 // CBTPwrNotifier::RegisterL |
|
63 // Register notifier. |
|
64 // ---------------------------------------------------------- |
|
65 // |
|
66 CBTPwrNotifier::TNotifierInfo CBTPwrNotifier::RegisterL() |
|
67 { |
|
68 iInfo.iUid=KPowerModeSettingNotifierUid; |
|
69 iInfo.iChannel=KBTPowerModeChannel; |
|
70 iInfo.iPriority=ENotifierPriorityVHigh; |
|
71 return iInfo; |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------- |
|
75 // CBTPwrNotifier::GetParamsL |
|
76 // Initialize parameters. Jump to RunL as soon as possible. |
|
77 // ---------------------------------------------------------- |
|
78 // |
|
79 void CBTPwrNotifier::GetParamsL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage) |
|
80 { |
|
81 FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::GetParamsL()")); |
|
82 |
|
83 if( iReplySlot!=NULL || !iMessage.IsNull() ) |
|
84 User::Leave(KErrInUse); |
|
85 |
|
86 iMessage = aMessage; |
|
87 iReplySlot = aReplySlot; |
|
88 |
|
89 ShowNoteAndCompleteMessageL(); |
|
90 FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::GetParamsL() completed")); |
|
91 } |
|
92 |
|
93 // ---------------------------------------------------------- |
|
94 // CBTPwrNotifier::RunL |
|
95 // Ask user response and return it to caller. |
|
96 // ---------------------------------------------------------- |
|
97 // |
|
98 void CBTPwrNotifier::ShowNoteAndCompleteMessageL() |
|
99 { |
|
100 FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::ShowNoteAndCompleteMessageL()")); |
|
101 |
|
102 if ( !CheckAndSetPowerOnL() ) |
|
103 { |
|
104 CompleteMessage(KErrGeneral); |
|
105 return; |
|
106 } |
|
107 // TODO: Why do we show BT BUSY note from BT power notifier? |
|
108 //get connection amount |
|
109 TInt linkCount = 0; |
|
110 RProperty::Get(KPropertyUidBluetoothCategory, KPropertyKeyBluetoothGetPHYCount, linkCount); |
|
111 |
|
112 if (linkCount > 6) //support only piconet |
|
113 { |
|
114 iNotifUiUtil->ShowInfoNoteL( R_BT_BUSY_NOTE, ECmdShowBtBusyNote ); |
|
115 } |
|
116 CompleteMessage(ETrue, KErrNone ); |
|
117 FLOG(_L("[BTNOTIF]\t CBTPwrNotifier::ShowNoteAndCompleteMessageL() completed")); |
|
118 } |
|
119 |
|
120 // End of File |
|