24
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Sony Ericsson Mobile Communications AB
|
|
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 |
* Sony Ericsson Mobile Communications AB - initial contribution.
|
|
11 |
* Nokia Corporation - additional changes.
|
|
12 |
*
|
|
13 |
* Contributors:
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
* Code for CTelephonyFunctions class, used by CTelephony class.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
/**
|
|
22 |
@file
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include <e32def.h>
|
|
26 |
#include "TelephonyFunctions.h"
|
|
27 |
#include "TelephonyActPhone.h"
|
|
28 |
|
|
29 |
CTelephony::TEtelISVType::TEtelISVType()
|
|
30 |
{
|
|
31 |
iVersionId=KEtelISVV1;
|
|
32 |
}
|
|
33 |
|
|
34 |
TInt CTelephonyFunctions::GetPhoneIdL(TRequestStatus& aRequestStatus, TDes8& aDes)
|
|
35 |
/**
|
|
36 |
Initiate async request to retrieve the phone identifier.
|
|
37 |
*/
|
|
38 |
{
|
|
39 |
if(IsRequestPending(EGetPhoneId)!=EFalse)
|
|
40 |
{
|
|
41 |
return KErrInUse;
|
|
42 |
}
|
|
43 |
else
|
|
44 |
{
|
|
45 |
SetRequestPending(CTelephonyFunctions::EGetPhoneId, ETrue);
|
|
46 |
}
|
|
47 |
|
|
48 |
iReqStatusTable[EGetPhoneId] = &aRequestStatus;
|
|
49 |
|
|
50 |
if(!iGetPhoneId)
|
|
51 |
{
|
|
52 |
iGetPhoneId = CGetPhoneIdAct::NewL(this);
|
|
53 |
}
|
|
54 |
|
|
55 |
iGetPhoneId->GetPhoneId(aDes);
|
|
56 |
|
|
57 |
return KErrNone;
|
|
58 |
}
|
|
59 |
|
|
60 |
TInt CTelephonyFunctions::GetSubscriberIdL(TRequestStatus& aRequestStatus, TDes8& aDes)
|
|
61 |
/**
|
|
62 |
Initiate async request to retrieve the subscriber Id.
|
|
63 |
*/
|
|
64 |
{
|
|
65 |
if(IsRequestPending(EGetSubscriberId)!=EFalse)
|
|
66 |
{
|
|
67 |
return KErrInUse;
|
|
68 |
}
|
|
69 |
else
|
|
70 |
{
|
|
71 |
SetRequestPending(CTelephonyFunctions::EGetSubscriberId, ETrue);
|
|
72 |
}
|
|
73 |
|
|
74 |
iReqStatusTable[EGetSubscriberId] = &aRequestStatus;
|
|
75 |
|
|
76 |
if(!iGetSubscriberId)
|
|
77 |
{
|
|
78 |
iGetSubscriberId = CGetSubscriberIdAct::NewL(this);
|
|
79 |
}
|
|
80 |
|
|
81 |
iGetSubscriberId->GetSubscriberId(aDes);
|
|
82 |
|
|
83 |
return KErrNone;
|
|
84 |
}
|
|
85 |
|
|
86 |
TInt CTelephonyFunctions::GetIndicatorL(TRequestStatus& aRequestStatus, TDes8& aDes)
|
|
87 |
/**
|
|
88 |
Initiate async request to retrieve the phones indicators.
|
|
89 |
*/
|
|
90 |
{
|
|
91 |
if(IsRequestPending(EGetIndicator)!=EFalse)
|
|
92 |
{
|
|
93 |
return KErrInUse;
|
|
94 |
}
|
|
95 |
else
|
|
96 |
{
|
|
97 |
SetRequestPending(CTelephonyFunctions::EGetIndicator, ETrue);
|
|
98 |
}
|
|
99 |
|
|
100 |
iReqStatusTable[EGetIndicator] = &aRequestStatus;
|
|
101 |
|
|
102 |
if(!iGetIndicator)
|
|
103 |
{
|
|
104 |
iGetIndicator = CGetIndicatorAct::NewL(this);
|
|
105 |
}
|
|
106 |
|
|
107 |
iGetIndicator->GetIndicator(aDes);
|
|
108 |
|
|
109 |
return KErrNone;
|
|
110 |
}
|
|
111 |
|
|
112 |
TInt CTelephonyFunctions::GetBatteryInfoL(TRequestStatus& aRequestStatus, TDes8& aDes)
|
|
113 |
/**
|
|
114 |
Initiate async request to retrieve the battery information.
|
|
115 |
*/
|
|
116 |
{
|
|
117 |
if(IsRequestPending(EGetBatteryInfo)!=EFalse)
|
|
118 |
{
|
|
119 |
return KErrInUse;
|
|
120 |
}
|
|
121 |
else
|
|
122 |
{
|
|
123 |
SetRequestPending(CTelephonyFunctions::EGetBatteryInfo, ETrue);
|
|
124 |
}
|
|
125 |
|
|
126 |
iReqStatusTable[EGetBatteryInfo] = &aRequestStatus;
|
|
127 |
|
|
128 |
if(!iGetBatteryInfo)
|
|
129 |
{
|
|
130 |
iGetBatteryInfo = CGetBatteryInfoAct::NewL(this);
|
|
131 |
}
|
|
132 |
|
|
133 |
iGetBatteryInfo->GetBatteryInfo(aDes);
|
|
134 |
|
|
135 |
return KErrNone;
|
|
136 |
}
|
|
137 |
|
|
138 |
TInt CTelephonyFunctions::GetSignalStrengthL(TRequestStatus& aRequestStatus, TDes8& aDes)
|
|
139 |
/**
|
|
140 |
Initiate async request to retrieve the signal strength.
|
|
141 |
*/
|
|
142 |
{
|
|
143 |
if(IsRequestPending(EGetSignalStrength)!=EFalse)
|
|
144 |
{
|
|
145 |
return KErrInUse;
|
|
146 |
}
|
|
147 |
else
|
|
148 |
{
|
|
149 |
SetRequestPending(CTelephonyFunctions::EGetSignalStrength, ETrue);
|
|
150 |
}
|
|
151 |
|
|
152 |
if(IsFlightModeOn())
|
|
153 |
{
|
|
154 |
return KErrAccessDenied;
|
|
155 |
}
|
|
156 |
|
|
157 |
iReqStatusTable[EGetSignalStrength] = &aRequestStatus;
|
|
158 |
|
|
159 |
if(!iGetSignalStrength)
|
|
160 |
{
|
|
161 |
iGetSignalStrength = CGetSignalStrengthAct::NewL(this);
|
|
162 |
}
|
|
163 |
|
|
164 |
iGetSignalStrength->GetSignalStrength(aDes);
|
|
165 |
|
|
166 |
return KErrNone;
|
|
167 |
}
|
|
168 |
|
|
169 |
TInt CTelephonyFunctions::GetLockInfoL(TRequestStatus& aRequestStatus, const CTelephony::TIccLock& aLock, TDes8& aDes)
|
|
170 |
/**
|
|
171 |
Initiate async request to retrieve the ICC lock information.
|
|
172 |
*/
|
|
173 |
{
|
|
174 |
if(IsRequestPending(EGetIccLockInfo)!=EFalse)
|
|
175 |
{
|
|
176 |
return KErrInUse;
|
|
177 |
}
|
|
178 |
else
|
|
179 |
{
|
|
180 |
SetRequestPending(CTelephonyFunctions::EGetIccLockInfo, ETrue);
|
|
181 |
}
|
|
182 |
|
|
183 |
iReqStatusTable[EGetIccLockInfo] = &aRequestStatus;
|
|
184 |
|
|
185 |
if(!iGetIccLockInfo)
|
|
186 |
{
|
|
187 |
iGetIccLockInfo = CGetIccLockInfoAct::NewL(this);
|
|
188 |
}
|
|
189 |
|
|
190 |
iGetIccLockInfo->GetIccLockInfo(aLock, aDes);
|
|
191 |
|
|
192 |
return KErrNone;
|
|
193 |
}
|
|
194 |
|
|
195 |
TInt CTelephonyFunctions::SendDTMFTonesL(TRequestStatus& aRequestStatus, const TDesC& aTones)
|
|
196 |
/**
|
|
197 |
Initiate async request to transmit DTMF tones.
|
|
198 |
*/
|
|
199 |
{
|
|
200 |
if(IsRequestPending(ESendDTMFTones)!=EFalse)
|
|
201 |
{
|
|
202 |
return KErrInUse;
|
|
203 |
}
|
|
204 |
else
|
|
205 |
{
|
|
206 |
SetRequestPending(CTelephonyFunctions::ESendDTMFTones, ETrue);
|
|
207 |
}
|
|
208 |
|
|
209 |
if(IsFlightModeOn())
|
|
210 |
{
|
|
211 |
return KErrAccessDenied;
|
|
212 |
}
|
|
213 |
|
|
214 |
iReqStatusTable[ESendDTMFTones] = &aRequestStatus;
|
|
215 |
|
|
216 |
if(!iSendDTMFTones)
|
|
217 |
{
|
|
218 |
iSendDTMFTones = CSendDTMFTonesAct::NewL(this);
|
|
219 |
}
|
|
220 |
|
|
221 |
iSendDTMFTones->SendDTMFTones(aTones);
|
|
222 |
|
|
223 |
return KErrNone;
|
|
224 |
}
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
TInt CTelephonyFunctions::GetFlightMode(TRequestStatus& aRequestStatus, TDes8& aDes)
|
|
229 |
/**
|
|
230 |
Initiate async request to retrieve the current flight mode status.
|
|
231 |
*/
|
|
232 |
{
|
|
233 |
TRequestStatus* reqStatusPtr = &aRequestStatus;
|
|
234 |
|
|
235 |
if(IsRequestPending(EGetFlightMode)!=EFalse)
|
|
236 |
{
|
|
237 |
return KErrInUse;
|
|
238 |
}
|
|
239 |
else
|
|
240 |
{
|
|
241 |
SetRequestPending(CTelephonyFunctions::EGetFlightMode, ETrue);
|
|
242 |
}
|
|
243 |
|
|
244 |
iReqStatusTable[EGetFlightMode] = &aRequestStatus;
|
|
245 |
|
|
246 |
CTelephony::TFlightModeV1& flightModeV1 = reinterpret_cast<CTelephony::TFlightModeV1&>
|
|
247 |
( const_cast<TUint8&> ( *aDes.Ptr() ) );
|
|
248 |
|
|
249 |
TInt newPhonePowerState;
|
|
250 |
if (iPhonePowerProperty.Get(newPhonePowerState) != KErrNone)
|
|
251 |
User::RequestComplete(reqStatusPtr, KErrAccessDenied);
|
|
252 |
|
|
253 |
if(newPhonePowerState==ESAPhoneOn)
|
|
254 |
{
|
|
255 |
flightModeV1.iFlightModeStatus=CTelephony::EFlightModeOff;
|
|
256 |
User::RequestComplete(reqStatusPtr, KErrNone);
|
|
257 |
}
|
|
258 |
else
|
|
259 |
{
|
|
260 |
flightModeV1.iFlightModeStatus=CTelephony::EFlightModeOn;
|
|
261 |
User::RequestComplete(reqStatusPtr, KErrNone);
|
|
262 |
}
|
|
263 |
|
|
264 |
SetRequestPending(CTelephonyFunctions::EGetFlightMode, EFalse);
|
|
265 |
return KErrNone;
|
|
266 |
}
|