|
1 /* |
|
2 * Copyright (c) 2007-2008 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 |
|
20 #include <mmtsy_names.h> |
|
21 |
|
22 #include "vccgsmnotifications.h" |
|
23 #include "rubydebug.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 // --------------------------------------------------------------------------- |
|
27 // C++ constructor |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CVccGsmNotifications::CVccGsmNotifications( RMobilePhone& aPhone ) |
|
31 : CActive( EPriorityStandard ), |
|
32 iPhone( aPhone ) |
|
33 { |
|
34 CActiveScheduler::Add( this ); |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // Symbian constructor. |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 void CVccGsmNotifications::ConstructL() |
|
42 { |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // Symbian constructor. |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CVccGsmNotifications* CVccGsmNotifications::NewL( RMobilePhone& aPhone ) |
|
50 { |
|
51 CVccGsmNotifications* self = new(ELeave) CVccGsmNotifications( aPhone ); |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop( self ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // C++ destructor. |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CVccGsmNotifications::~CVccGsmNotifications() |
|
63 { |
|
64 iObserver = 0; |
|
65 Cancel(); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // Activates notifications |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void CVccGsmNotifications::ActivateNotifications( MVccGsmNotifications* aObserver, |
|
73 TInt32 aLow, TInt32 aHigh ) |
|
74 { |
|
75 RUBY_DEBUG_BLOCK( "CVccGsmNotifications::ActivateNotifications" ); |
|
76 RUBY_DEBUG2( " -aLow = %d aHigh = %d", aLow, aHigh ); |
|
77 |
|
78 iLow = aLow; |
|
79 iHigh = aHigh; |
|
80 iObserver = aObserver; |
|
81 Cancel(); |
|
82 iPhone.NotifySignalStrengthChange( iStatus, iStrength, iBar ); |
|
83 RUBY_DEBUG0( " -call SetActive()" ); |
|
84 SetActive(); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // Cancels notifications |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CVccGsmNotifications::CancelNotifications() |
|
92 { |
|
93 RUBY_DEBUG_BLOCK( "CVccGsmNotifications::CancelNotifications" ); |
|
94 iObserver = NULL; |
|
95 Cancel(); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // RunL |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CVccGsmNotifications::RunL() |
|
103 { |
|
104 RUBY_DEBUG_BLOCK( "CVccGsmNotifications::RunL" ); |
|
105 RUBY_DEBUG2( " -iObserver=%x iStrength=%d", iObserver, iStrength ); |
|
106 RUBY_DEBUG2( " -iLow = %d iHigh = %d", iLow, iHigh ); |
|
107 |
|
108 iObserver->GsmStrengthChanged( iStrength ); |
|
109 iPhone.NotifySignalStrengthChange( iStatus, iStrength, iBar ); |
|
110 SetActive(); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // Cancel |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CVccGsmNotifications::DoCancel() |
|
118 { |
|
119 RUBY_DEBUG_BLOCK( "CVccGsmNotifications::DoCancel" ); |
|
120 iPhone.CancelAsyncRequest( EMobilePhoneNotifySignalStrengthChange ); |
|
121 } |
|
122 |