|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Object to monitor the ETel cell information containing |
|
15 // timing advance needed by SUPL to perform enhanced cell-ID. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 @deprecated |
|
23 */ |
|
24 |
|
25 |
|
26 #include "suplnetworkinfohandler.h" |
|
27 #include <e32base.h> |
|
28 #include <etelmm.h> |
|
29 #include "supldevloggermacros.h" |
|
30 |
|
31 /** |
|
32 */ |
|
33 CSuplCellInfoHandler::CSuplCellInfoHandler(MSuplNetworkInfoObserver& aObserver, const RMobilePhone& aCellPhone) : |
|
34 CActive(EPriorityStandard), |
|
35 iObserver(aObserver), |
|
36 iCellPhone(aCellPhone), |
|
37 iCellInfoPckg(iCellInfo), |
|
38 iMonitoring(EFalse) |
|
39 { |
|
40 SUPLLOG(ELogP1, "CSuplCellInfoHandler::CSuplCellInfoHandler() Begin\n"); |
|
41 CActiveScheduler::Add(this); |
|
42 SUPLLOG(ELogP1, "CSuplCellInfoHandler::CSuplCellInfoHandler() End\n"); |
|
43 } |
|
44 |
|
45 /** |
|
46 */ |
|
47 CSuplCellInfoHandler::~CSuplCellInfoHandler() |
|
48 { |
|
49 SUPLLOG(ELogP1, "CSuplCellInfoHandler::~CSuplCellInfoHandler() Begin\n"); |
|
50 Cancel(); |
|
51 SUPLLOG(ELogP1, "CSuplCellInfoHandler::~CSuplCellInfoHandler() End\n"); |
|
52 } |
|
53 |
|
54 /** |
|
55 */ |
|
56 CSuplCellInfoHandler* CSuplCellInfoHandler::NewL(MSuplNetworkInfoObserver& aObserver, const RMobilePhone& aCellPhone) |
|
57 { |
|
58 SUPLLOG(ELogP1, "CSuplCellInfoHandler::NewL() Begin\n"); |
|
59 CSuplCellInfoHandler* self = new (ELeave) CSuplCellInfoHandler(aObserver, aCellPhone); |
|
60 CleanupStack::PushL(self); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop(self); |
|
63 SUPLLOG(ELogP1, "CSuplCellInfoHandler::NewL() End\n"); |
|
64 return self; |
|
65 } |
|
66 |
|
67 /** |
|
68 */ |
|
69 void CSuplCellInfoHandler::ConstructL() |
|
70 { |
|
71 SUPLLOG(ELogP1, "CSuplCellInfoHandler::ConstructL() Begin\n"); |
|
72 SUPLLOG(ELogP1, "CSuplCellInfoHandler::ConstructL() End\n"); |
|
73 } |
|
74 |
|
75 /** |
|
76 */ |
|
77 void CSuplCellInfoHandler::StartGettingCellInfo() |
|
78 { |
|
79 SUPLLOG(ELogP1, "CSuplCellInfoHandler::StartGettingCellInfo() Begin\n"); |
|
80 // Get the cell info |
|
81 iCellPhone.GetCellInfo(iStatus, iCellInfoPckg); |
|
82 SetActive(); |
|
83 SUPLLOG(ELogP1, "CSuplCellInfoHandler::StartGettingCellInfo() End\n"); |
|
84 } |
|
85 |
|
86 /** |
|
87 */ |
|
88 void CSuplCellInfoHandler::RunL() |
|
89 { |
|
90 SUPLLOG(ELogP1, "CSuplCellInfoHandler::RunL() Begin\n"); |
|
91 User::LeaveIfError(iStatus.Int()); |
|
92 |
|
93 if (!iMonitoring) |
|
94 { |
|
95 iObserver.CellInfoResults(iCellInfo); |
|
96 MonitorCellInfoChange(); |
|
97 iMonitoring = ETrue; |
|
98 } |
|
99 else |
|
100 { |
|
101 iObserver.CellInfoResults(iCellInfo); |
|
102 MonitorCellInfoChange(); //Keep monitoring |
|
103 } |
|
104 SUPLLOG(ELogP1, "CSuplCellInfoHandler::RunL() End\n"); |
|
105 } |
|
106 |
|
107 /** |
|
108 */ |
|
109 void CSuplCellInfoHandler::DoCancel() |
|
110 { |
|
111 SUPLLOG(ELogP1, "CSuplCellInfoHandler::DoCancel() Begin\n"); |
|
112 //Check to see what stage we in are to find out what to cancel |
|
113 if(!iMonitoring) |
|
114 { |
|
115 iCellPhone.CancelAsyncRequest(EMobilePhoneGetCellInfo); |
|
116 } |
|
117 else |
|
118 { |
|
119 iCellPhone.CancelAsyncRequest(EMobilePhoneNotifyCellInfoChange); |
|
120 } |
|
121 SUPLLOG(ELogP1, "CSuplCellInfoHandler::DoCancel() End\n"); |
|
122 } |
|
123 |
|
124 /** |
|
125 */ |
|
126 TInt CSuplCellInfoHandler::RunError(TInt /*aError*/) |
|
127 { |
|
128 SUPLLOG(ELogP1, "CSuplCellInfoHandler::DoCancel() Begin\n"); |
|
129 SUPLLOG(ELogP1, "CSuplCellInfoHandler::DoCancel() End\n"); |
|
130 return KErrNone; |
|
131 } |
|
132 |
|
133 |
|
134 /** Asychronous request to obtain notifications |
|
135 of change in the cell info data |
|
136 */ |
|
137 void CSuplCellInfoHandler::MonitorCellInfoChange() |
|
138 { |
|
139 SUPLLOG(ELogP1, "CSuplCellInfoHandler::MonitorCellInfoChange() Begin\n"); |
|
140 iCellPhone.NotifyCellInfoChange(iStatus, iCellInfoPckg); |
|
141 SetActive(); |
|
142 SUPLLOG(ELogP1, "CSuplCellInfoHandler::MonitorCellInfoChange() End\n"); |
|
143 } |
|
144 |