24
|
1 |
// Copyright (c) 1997-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 |
// Implements phone based(multimode) functionality such as getting
|
|
15 |
// signal, battery, network and network registration status inforamtion(and more).
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include "mSLOGGER.H"
|
|
20 |
#include "mPHONE.H"
|
|
21 |
#include "mSMSMESS.H"
|
|
22 |
#include "mPHBOOK.H"
|
|
23 |
#include "Mphbkcom.h"
|
|
24 |
#include "Mbattery.h"
|
|
25 |
#include "Msignal.h"
|
|
26 |
#include "mnetwork.h"
|
|
27 |
#include "NOTIFY.H"
|
|
28 |
#include <etslotnum.h>
|
|
29 |
#include "mimsi.h"
|
|
30 |
#include "Mownnum.h"
|
|
31 |
#include <etelmmcs.h>
|
|
32 |
#include "ATIO.H"
|
|
33 |
#include "monstore.h"
|
|
34 |
#include "gprs.h"
|
|
35 |
#include "TSYCONFG.H"
|
|
36 |
#include "ATINIT.H"
|
|
37 |
#include "etsvr_slots.h"
|
|
38 |
|
|
39 |
// This class is used when retreiving lists from the phone.
|
|
40 |
CListReadAllAttempt* CListReadAllAttempt::NewL(RMobilePhone::TClientId* aId, TTsyReqHandle aReqHandle)
|
|
41 |
{
|
|
42 |
CListReadAllAttempt* read=new(ELeave) CListReadAllAttempt(aId, aReqHandle);
|
|
43 |
CleanupStack::PushL(read);
|
|
44 |
read->ConstructL();
|
|
45 |
CleanupStack::Pop();
|
|
46 |
return read;
|
|
47 |
}
|
|
48 |
|
|
49 |
CListReadAllAttempt::CListReadAllAttempt(RMobilePhone::TClientId* aId, TTsyReqHandle aReqHandle)
|
|
50 |
:CBase()
|
|
51 |
{
|
|
52 |
iClient.iSessionHandle=aId->iSessionHandle;
|
|
53 |
iClient.iSubSessionHandle=aId->iSubSessionHandle;
|
|
54 |
iReqHandle=aReqHandle;
|
|
55 |
iListBuf = NULL;
|
|
56 |
}
|
|
57 |
|
|
58 |
void CListReadAllAttempt::ConstructL()
|
|
59 |
{
|
|
60 |
}
|
|
61 |
|
|
62 |
CListReadAllAttempt::~CListReadAllAttempt()
|
|
63 |
{
|
|
64 |
delete iListBuf;
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
void CPhoneMobile::ClosePhone(TAny* aObj)
|
|
69 |
//
|
|
70 |
// Utility func for cleanup stack
|
|
71 |
//
|
|
72 |
{
|
|
73 |
((CObject*)aObj)->Close();
|
|
74 |
}
|
|
75 |
|
|
76 |
//
|
|
77 |
// CPhoneMobile
|
|
78 |
//
|
|
79 |
CPhoneMobile* CPhoneMobile::NewL()
|
|
80 |
{
|
|
81 |
CPhoneMobile* phone=new(ELeave) CPhoneMobile();
|
|
82 |
TCleanupItem newPhoneClose(ClosePhone,phone);
|
|
83 |
CleanupStack::PushL(newPhoneClose);
|
|
84 |
phone->ConstructL();
|
|
85 |
CleanupStack::Pop();
|
|
86 |
return phone;
|
|
87 |
}
|
|
88 |
|
|
89 |
void CPhoneMobile::ConstructL()
|
|
90 |
//
|
|
91 |
// Creation of Global Params
|
|
92 |
//
|
|
93 |
{
|
|
94 |
CPhoneHayes::ConstructL();
|
|
95 |
}
|
|
96 |
|
|
97 |
CPhoneMobile::~CPhoneMobile()
|
|
98 |
//
|
|
99 |
{
|
|
100 |
if(iGetDetectedNetworks) // This prevents an Access Violation when CommDB is missing
|
|
101 |
iGetDetectedNetworks->ResetAndDestroy();
|
|
102 |
delete iGetDetectedNetworks;
|
|
103 |
delete iPhoneBookInfo;
|
|
104 |
delete iATBattery;
|
|
105 |
delete iATSignal;
|
|
106 |
delete iATNetworkInfo;
|
|
107 |
delete iATSubscriberId;
|
|
108 |
delete iATOwnNumbers;
|
|
109 |
delete iATDetectNetwork;
|
|
110 |
}
|
|
111 |
|
|
112 |
TInt CPhoneMobile::MultimodeInitL(TBool aExplicit)
|
|
113 |
|
|
114 |
{
|
|
115 |
if(aExplicit)
|
|
116 |
{
|
|
117 |
if( !iPhoneGlobals )
|
|
118 |
{
|
|
119 |
iPhoneGlobals = CPhoneGlobals::NewL(aExplicit);
|
|
120 |
iPhoneGlobals->iConfiguration->SetTableViewsL(iTableSettings);
|
|
121 |
}
|
|
122 |
}
|
|
123 |
|
|
124 |
CPhoneHayes::MultimodeInitL(aExplicit);
|
|
125 |
|
|
126 |
if(!iPhoneBookInfo)
|
|
127 |
iPhoneBookInfo=CATPhoneBookInfo::NewL(iIo,this,iInit,iPhoneGlobals);
|
|
128 |
|
|
129 |
if(!iATBattery)
|
|
130 |
iATBattery=CATGetBattery::NewL(iIo,this,iInit,iPhoneGlobals);
|
|
131 |
|
|
132 |
if(!iATSignal)
|
|
133 |
iATSignal=CATGetSignal::NewL(iIo,this,iInit,iPhoneGlobals);
|
|
134 |
|
|
135 |
if(!iATNetworkInfo)
|
|
136 |
iATNetworkInfo=CATNetworkInfo::NewL(iIo,this,iInit,iPhoneGlobals);
|
|
137 |
|
|
138 |
iPhoneGlobals->SetChangeOfNetworkPtr(iATNetworkInfo);
|
|
139 |
|
|
140 |
if(!iATSubscriberId)
|
|
141 |
iATSubscriberId=CATSubscriberId::NewL(iIo,this,iInit,iPhoneGlobals);
|
|
142 |
|
|
143 |
if(!iATOwnNumbers)
|
|
144 |
iATOwnNumbers=CATOwnNumbers::NewL(iIo,this,iInit,iPhoneGlobals);
|
|
145 |
|
|
146 |
if(!iATDetectNetwork)
|
|
147 |
iATDetectNetwork=CATDetectNetwork::NewL(iIo,this,iInit,iPhoneGlobals);
|
|
148 |
|
|
149 |
if(!iGetDetectedNetworks )
|
|
150 |
iGetDetectedNetworks = new(ELeave) CArrayPtrFlat<CListReadAllAttempt>(1);
|
|
151 |
|
|
152 |
return KErrNone;
|
|
153 |
}
|
|
154 |
|
|
155 |
TInt CPhoneMobile::ExplicitInitialisationL(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMMTableSettings* aSettings)
|
|
156 |
{
|
|
157 |
// If we haven't initialised iPhoneGlobals, do so here.
|
|
158 |
// Either way, call CPhoneHayes::ControlledInitialisation().
|
|
159 |
if (iPhoneGlobals == NULL)
|
|
160 |
{
|
|
161 |
iTableSettings=*aSettings;
|
|
162 |
MultimodeInitL(ETrue);
|
|
163 |
iPhoneGlobals->iConfiguration->GetRequestedTableViewsL();
|
|
164 |
CPhoneHayes::ControlledInitialisation(aTsyReqHandle);
|
|
165 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
166 |
}
|
|
167 |
else
|
|
168 |
{
|
|
169 |
CPhoneHayes::ControlledInitialisation(aTsyReqHandle);
|
|
170 |
}
|
|
171 |
|
|
172 |
return KErrNone;
|
|
173 |
}
|
|
174 |
|
|
175 |
|
|
176 |
TInt CPhoneMobile::ExplicitInitialisationCancel(const TTsyReqHandle aTsyReqHandle)
|
|
177 |
/** Cancel explicit initialisation
|
|
178 |
*
|
|
179 |
* @param aTsyReqHandle const pointer to the request ID
|
|
180 |
* @return error code. KErrCancel
|
|
181 |
*/
|
|
182 |
{
|
|
183 |
iInit->StopInit(aTsyReqHandle);
|
|
184 |
return KErrCancel;
|
|
185 |
}
|
|
186 |
|
|
187 |
TInt CPhoneMobile::ControlledInitialisation(const TTsyReqHandle aTsyReqHandle)
|
|
188 |
{
|
|
189 |
TInt ret = KErrNone;
|
|
190 |
|
|
191 |
if (iPhoneGlobals == NULL)
|
|
192 |
{
|
|
193 |
TRAP(ret, MultimodeInitL(EFalse));
|
|
194 |
}
|
|
195 |
|
|
196 |
if (ret == KErrNone)
|
|
197 |
{
|
|
198 |
CPhoneHayes::ControlledInitialisation(aTsyReqHandle);
|
|
199 |
}
|
|
200 |
|
|
201 |
return ret;
|
|
202 |
}
|
|
203 |
//
|
|
204 |
// Gsm extended functions
|
|
205 |
//
|
|
206 |
|
|
207 |
CTelObject::TReqMode CPhoneMobile::ReqModeL(const TInt aIpc)
|
|
208 |
{
|
|
209 |
//
|
|
210 |
// What's the request mode
|
|
211 |
//
|
|
212 |
CTelObject::TReqMode ret=0;
|
|
213 |
|
|
214 |
// we need to delay initialising the phone as we have not yet been given the IAP to use
|
|
215 |
if( iPhoneGlobals == NULL )
|
|
216 |
{
|
|
217 |
if(aIpc!=EMobilePhoneMMInitialise)
|
|
218 |
{
|
|
219 |
// original initialise()
|
|
220 |
MultimodeInitL(EFalse);
|
|
221 |
}
|
|
222 |
else
|
|
223 |
{
|
|
224 |
// initialiseMM() - temporarily hardwire IAP value (DEF036487)
|
|
225 |
iTableSettings.iLocId = KInternetAccessPoint;
|
|
226 |
MultimodeInitL(ETrue);
|
|
227 |
}
|
|
228 |
}
|
|
229 |
|
|
230 |
switch (aIpc)
|
|
231 |
{
|
|
232 |
|
|
233 |
case EMobilePhoneMMInitialise:
|
|
234 |
ret=KReqModeFlowControlObeyed | KReqModeMultipleCompletionEnabled;
|
|
235 |
break;
|
|
236 |
|
|
237 |
case EMobilePhoneNotifyCurrentNetworkChange:
|
|
238 |
case EMobilePhoneNotifyNetworkRegistrationStatusChange:
|
|
239 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
240 |
|
|
241 |
break;
|
|
242 |
|
|
243 |
case EMobilePhoneGetPhoneStoreInfo:
|
|
244 |
case EMobilePhoneGetSignalStrength:
|
|
245 |
case EMobilePhoneGetBatteryInfo:
|
|
246 |
case EMobilePhoneGetNetworkRegistrationStatus:
|
|
247 |
case EMobilePhoneGetSubscriberId:
|
|
248 |
case EMobilePhoneGetCurrentNetwork:
|
|
249 |
case EMobilePhoneGetDetectedNetworksPhase1:
|
|
250 |
ret=KReqModeFlowControlObeyed;
|
|
251 |
break;
|
|
252 |
|
|
253 |
case EMobilePhoneGetCurrentMode:
|
|
254 |
case EMobilePhoneGetPhoneId:
|
|
255 |
case EMobilePhoneGetBatteryCaps:
|
|
256 |
case EMobilePhoneGetSignalCaps:
|
|
257 |
case EMobilePhoneGetIdentityCaps:
|
|
258 |
case EMobilePhoneGetMultimodeCaps:
|
|
259 |
case EMobilePhoneGetNetworkCaps:
|
|
260 |
case EMobilePhoneGetDetectedNetworksPhase2:
|
|
261 |
ret=0;
|
|
262 |
break;
|
|
263 |
|
|
264 |
default:
|
|
265 |
ret=CPhoneBase::ReqModeL(aIpc);
|
|
266 |
break;
|
|
267 |
}
|
|
268 |
|
|
269 |
// Check if the data port is currently loaned. If it is and the requested IPC
|
|
270 |
// is flow controlled then block Etel calling the IPC by leaving with KErrInUse
|
|
271 |
if(iPhoneGlobals && (ret&KReqModeFlowControlObeyed) && iPhoneGlobals->iPhoneStatus.iDataPortLoaned)
|
|
272 |
{
|
|
273 |
LOGTEXT2(_L8("ReqModeL Leaving with KErrInUse as data port is loaned (aIpc=%d)"),aIpc);
|
|
274 |
User::Leave(KErrInUse);
|
|
275 |
}
|
|
276 |
|
|
277 |
return ret;
|
|
278 |
}
|
|
279 |
|
|
280 |
TInt CPhoneMobile::NumberOfSlotsL(const TInt aIpc)
|
|
281 |
{
|
|
282 |
// Return the number of slots (buffered in server)
|
|
283 |
// for any KReqRepostImmediately ipc calls in the above ReqModeL function
|
|
284 |
switch (aIpc)
|
|
285 |
{
|
|
286 |
case EMobilePhoneNotifyCurrentNetworkChange:
|
|
287 |
return (KSlotNotifyCurrentNetworkChange<4 ? 4 : KSlotNotifyCurrentNetworkChange);
|
|
288 |
|
|
289 |
case EMobilePhoneNotifyNetworkRegistrationStatusChange:
|
|
290 |
return KSlotNotifyNetworkRegistrationStatusChange;
|
|
291 |
|
|
292 |
default:
|
|
293 |
return CPhoneHayes::NumberOfSlotsL(aIpc);
|
|
294 |
}
|
|
295 |
}
|
|
296 |
|
|
297 |
TInt CPhoneMobile::RegisterNotification(const TInt /*aIpc*/)
|
|
298 |
{
|
|
299 |
return KErrNone;
|
|
300 |
}
|
|
301 |
|
|
302 |
TInt CPhoneMobile::DeregisterNotification(const TInt /*aIpc*/)
|
|
303 |
{
|
|
304 |
return KErrNone;
|
|
305 |
}
|
|
306 |
|
|
307 |
TInt CPhoneMobile::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
308 |
{
|
|
309 |
TInt ret=KErrNone;
|
|
310 |
// If an AT command class has been used to service a request, then try to cancel
|
|
311 |
// the sending of the AT command. If the AT command class is in an idle state
|
|
312 |
// the CancelCommand() function should do nothing.
|
|
313 |
switch (aIpc)
|
|
314 |
{
|
|
315 |
case EMobilePhoneMMInitialiseCancel:
|
|
316 |
ret= ExplicitInitialisationCancel(aTsyReqHandle);
|
|
317 |
break;
|
|
318 |
|
|
319 |
case EMobilePhoneNotifyNetworkRegistrationStatusChange:
|
|
320 |
ret=NotifyNetworkRegistrationStatusChangeCancel(aTsyReqHandle);
|
|
321 |
break;
|
|
322 |
|
|
323 |
case EMobilePhoneNotifyCurrentNetworkChange:
|
|
324 |
ret=NotifyCurrentNetworkChangeCancel(aTsyReqHandle);
|
|
325 |
break;
|
|
326 |
|
|
327 |
case EMobilePhoneGetSignalStrength:
|
|
328 |
iATSignal->CancelCommand(aTsyReqHandle);
|
|
329 |
break;
|
|
330 |
|
|
331 |
case EMobilePhoneGetBatteryInfo:
|
|
332 |
iATBattery->CancelCommand(aTsyReqHandle);
|
|
333 |
break;
|
|
334 |
|
|
335 |
case EMobilePhoneGetCurrentNetwork:
|
|
336 |
iATNetworkInfo->CancelCommand(aTsyReqHandle);
|
|
337 |
break;
|
|
338 |
|
|
339 |
case EMobilePhoneGetDetectedNetworksPhase1:
|
|
340 |
iATDetectNetwork->CancelCommand(aTsyReqHandle);
|
|
341 |
break;
|
|
342 |
|
|
343 |
case EMobilePhoneGetPhoneStoreInfo:
|
|
344 |
{
|
|
345 |
// Cancel both - as could be trying to get phonebook or own number store info
|
|
346 |
iATOwnNumbers->CancelCommand(aTsyReqHandle);
|
|
347 |
iPhoneBookInfo->CancelCommand(aTsyReqHandle);
|
|
348 |
}
|
|
349 |
break;
|
|
350 |
|
|
351 |
case EMobilePhoneGetSubscriberId:
|
|
352 |
iATSubscriberId->CancelCommand(aTsyReqHandle);
|
|
353 |
break;
|
|
354 |
|
|
355 |
case EMobilePhoneGetNetworkRegistrationStatus:
|
|
356 |
case EMobilePhoneGetCurrentMode:
|
|
357 |
case EMobilePhoneGetPhoneId:
|
|
358 |
// Can not cancel these requests because they are completed synchronously
|
|
359 |
break;
|
|
360 |
|
|
361 |
default:
|
|
362 |
ret=CPhoneBase::CancelService(aIpc,aTsyReqHandle);
|
|
363 |
}
|
|
364 |
|
|
365 |
return ret;
|
|
366 |
}
|
|
367 |
|
|
368 |
|
|
369 |
TInt CPhoneMobile::ExtFunc(const TTsyReqHandle aTsyReqHandle, const TInt aIpc, const TDataPackage& aPackage)
|
|
370 |
//
|
|
371 |
// Dispatch Function
|
|
372 |
//
|
|
373 |
{
|
|
374 |
// Prior to dispatch check that we're not setting up or in the middle of a data or fax call
|
|
375 |
if((iPhoneGlobals && iPhoneGlobals->iPhoneStatus.iPortAccess==EPortAccessDenied) || (iPhoneGlobals && iPhoneGlobals->iPhoneStatus.iMode == RPhone::EModeOnlineData))
|
|
376 |
{
|
|
377 |
LOGTEXT2(_L8("CPhoneMobile::ExtFunc (aIpc=%d)"),aIpc);
|
|
378 |
LOGTEXT(_L8("CPhoneMobile::ExtFunc\tPort Access Denied/Mode Online flag detected"));
|
|
379 |
|
|
380 |
switch(aIpc)
|
|
381 |
{
|
|
382 |
// These may interfere with the Fax, so error the request now...
|
|
383 |
case EMobilePhoneGetSignalStrength:
|
|
384 |
case EMobilePhoneGetBatteryInfo:
|
|
385 |
case EMobilePhoneGetCurrentNetwork:
|
|
386 |
case EMobilePhoneGetPhoneStoreInfo:
|
|
387 |
case EMobilePhoneGetNetworkRegistrationStatus:
|
|
388 |
case EMobilePhoneGetSubscriberId:
|
|
389 |
case EMobilePhoneGetDetectedNetworksPhase1:
|
|
390 |
LOGTEXT(_L8("CPhoneMobile::ExtFunc\tReturning KErrAccessDenied error"));
|
|
391 |
ReqCompleted(aTsyReqHandle, KErrAccessDenied);
|
|
392 |
return KErrNone; // Real error value returned in completion of clients request
|
|
393 |
default:
|
|
394 |
break;
|
|
395 |
}
|
|
396 |
}
|
|
397 |
|
|
398 |
//
|
|
399 |
// Asynchrous Requests
|
|
400 |
//
|
|
401 |
TAny* dataPtr1=aPackage.Ptr1();
|
|
402 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
403 |
TInt ret = KErrNone;
|
|
404 |
|
|
405 |
switch (aIpc)
|
|
406 |
{
|
|
407 |
case EMobilePhoneMMInitialise:
|
|
408 |
{
|
|
409 |
TRAP(ret,ExplicitInitialisationL(aTsyReqHandle, REINTERPRET_CAST(RMobilePhone::TMMTableSettings*, dataPtr1)));
|
|
410 |
return ret;
|
|
411 |
}
|
|
412 |
|
|
413 |
case EMobilePhoneGetBatteryCaps:
|
|
414 |
return GetBatteryCaps(aTsyReqHandle, REINTERPRET_CAST(TUint32*, dataPtr1));
|
|
415 |
|
|
416 |
case EMobilePhoneGetBatteryInfo:
|
|
417 |
return GetBatteryInfo(aTsyReqHandle, REINTERPRET_CAST(RMobilePhone::TMobilePhoneBatteryInfoV1*, dataPtr1));
|
|
418 |
|
|
419 |
case EMobilePhoneGetSignalStrength:
|
|
420 |
return GetSignalStrength(aTsyReqHandle, REINTERPRET_CAST(TInt32*,dataPtr1), REINTERPRET_CAST(TInt8*, dataPtr2));
|
|
421 |
|
|
422 |
case EMobilePhoneGetSignalCaps:
|
|
423 |
return GetSignalCaps(aTsyReqHandle, REINTERPRET_CAST(TUint32*, dataPtr1));
|
|
424 |
|
|
425 |
case EMobilePhoneGetPhoneId:
|
|
426 |
return GetPhoneId(aTsyReqHandle,REINTERPRET_CAST(RMobilePhone::TMobilePhoneIdentityV1*, dataPtr1));
|
|
427 |
|
|
428 |
case EMobilePhoneGetCurrentNetwork:
|
|
429 |
return GetCurrentNetwork(aTsyReqHandle, aPackage.Des1n(), REINTERPRET_CAST(RMobilePhone::TMobilePhoneLocationAreaV1* ,dataPtr2));
|
|
430 |
|
|
431 |
case EMobilePhoneNotifyCurrentNetworkChange:
|
|
432 |
return NotifyCurrentNetworkChange(aTsyReqHandle, aPackage.Des1n(), REINTERPRET_CAST(RMobilePhone::TMobilePhoneLocationAreaV1* ,dataPtr2));
|
|
433 |
|
|
434 |
case EMobilePhoneGetDetectedNetworksPhase1:
|
|
435 |
return GetDetectedNetworksPhase1(aTsyReqHandle, REINTERPRET_CAST(RMobilePhone::TClientId*, dataPtr1), REINTERPRET_CAST(TInt*, dataPtr2)); // Last argument is TDes8* aBufSiz
|
|
436 |
|
|
437 |
case EMobilePhoneGetDetectedNetworksPhase2:
|
|
438 |
return GetDetectedNetworksPhase2(aTsyReqHandle, REINTERPRET_CAST(RMobilePhone::TClientId*, dataPtr1), aPackage.Des2n());
|
|
439 |
|
|
440 |
case EMobilePhoneGetPhoneStoreInfo:
|
|
441 |
switch (aPackage.Type())
|
|
442 |
{
|
|
443 |
case TDataPackage::EPackage1n2u:
|
|
444 |
// Client has called the version of RMobilePhone::GetPhoneStoreInfo
|
|
445 |
// with 3 arguments.
|
|
446 |
return GetPhoneStoreInfo(aTsyReqHandle, aPackage.Des1n(), aPackage.Des2u());// Last parameter is "TDesC* aName"
|
|
447 |
case TDataPackage::EPackage1n2n:
|
|
448 |
// Client has called the version of RMobilePhone::GetPhoneStoreInfo
|
|
449 |
// with 4 arguments.
|
|
450 |
return GetPhoneStoreInfo(aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n());// Last parameter is RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg
|
|
451 |
default:
|
|
452 |
// No valid argument from RMobilePhone::GetPhoneStoreInfo found.
|
|
453 |
Panic(EUnexpectedState);
|
|
454 |
break;
|
|
455 |
} // switch (aPackage.Type())
|
|
456 |
|
|
457 |
|
|
458 |
|
|
459 |
case EMobilePhoneGetIdentityCaps:
|
|
460 |
return GetIdentityCaps(aTsyReqHandle, REINTERPRET_CAST(TUint32* ,dataPtr1));
|
|
461 |
|
|
462 |
case EMobilePhoneGetNetworkRegistrationStatus:
|
|
463 |
return GetNetworkRegistrationStatus(aTsyReqHandle,
|
|
464 |
REINTERPRET_CAST(RMobilePhone::TMobilePhoneRegistrationStatus*,dataPtr1));
|
|
465 |
|
|
466 |
case EMobilePhoneNotifyNetworkRegistrationStatusChange:
|
|
467 |
return NotifyNetworkRegistrationStatusChange(aTsyReqHandle,
|
|
468 |
REINTERPRET_CAST(RMobilePhone::TMobilePhoneRegistrationStatus*,dataPtr1));
|
|
469 |
|
|
470 |
case EMobilePhoneGetNetworkCaps:
|
|
471 |
return GetNetworkCaps(aTsyReqHandle, REINTERPRET_CAST(TUint32*, dataPtr1));
|
|
472 |
|
|
473 |
case EMobilePhoneGetCurrentMode:
|
|
474 |
return GetCurrentMode(aTsyReqHandle,REINTERPRET_CAST(RMobilePhone::TMobilePhoneNetworkMode*,dataPtr1));
|
|
475 |
|
|
476 |
case EMobilePhoneGetMultimodeCaps:
|
|
477 |
return GetMultimodeCaps(aTsyReqHandle, REINTERPRET_CAST(TUint32*,dataPtr1));
|
|
478 |
|
|
479 |
case EMobilePhoneGetSubscriberId:
|
|
480 |
return GetSubscriberId(aTsyReqHandle,
|
|
481 |
static_cast<RMobilePhone::TMobilePhoneSubscriberId*>(dataPtr1));
|
|
482 |
|
|
483 |
default:
|
|
484 |
LOGTEXT2(_L8("CPhoneMobile::ExtFunc\tunsupported request %d"), aIpc);
|
|
485 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
486 |
return KErrNone; // Real error value returned in completion of clients request
|
|
487 |
}
|
|
488 |
}
|
|
489 |
|
|
490 |
|
|
491 |
//
|
|
492 |
// Implemented Phone Functions
|
|
493 |
//
|
|
494 |
|
|
495 |
CTelObject* CPhoneMobile::OpenNewObjectL(TDes& /*aName*/)
|
|
496 |
{
|
|
497 |
|
|
498 |
User::Leave(KErrNotSupported);
|
|
499 |
return NULL;
|
|
500 |
}
|
|
501 |
|
|
502 |
|
|
503 |
CTelObject* CPhoneMobile::OpenNewObjectByNameL(const TDesC& aName)
|
|
504 |
/**
|
|
505 |
* Open a new line. Opens fax line even if phone does not support it, as that information
|
|
506 |
* may not be available (init sequence may not have reached that far.)
|
|
507 |
*/
|
|
508 |
{
|
|
509 |
|
|
510 |
if(!iPhoneGlobals)
|
|
511 |
{
|
|
512 |
MultimodeInitL(EFalse);
|
|
513 |
}
|
|
514 |
|
|
515 |
if (aName.Compare(KETelSmsMessaging)==KErrNone)
|
|
516 |
{
|
|
517 |
iSmsMessaging = CMobileSmsMessaging::NewL(iIo,iInit,iPhoneGlobals);
|
|
518 |
return iSmsMessaging;
|
|
519 |
}
|
|
520 |
|
|
521 |
if (!aName.CompareF(KPacketName))
|
|
522 |
{
|
|
523 |
iGprsService = CGprs::NewL(iIo, iInit, iPhoneGlobals);
|
|
524 |
return iGprsService;
|
|
525 |
}
|
|
526 |
|
|
527 |
// Check if the name specified is the own number store. If it is, create the store.
|
|
528 |
if (aName.Compare(KETelOwnNumberStore)==KErrNone)
|
|
529 |
{
|
|
530 |
CMobileONStore* ownNumberStore=CMobileONStore::NewL(iIo,iInit,iPhoneGlobals);
|
|
531 |
return ownNumberStore;
|
|
532 |
}
|
|
533 |
|
|
534 |
TStorageType storageType;
|
|
535 |
TBool supported;
|
|
536 |
// If the name is in the list of known phone book names check to see
|
|
537 |
// if it supported by the current modem/phone
|
|
538 |
if (IsListedPhoneBook(aName,storageType,supported))
|
|
539 |
{
|
|
540 |
if (supported && storageType.Length()>0)
|
|
541 |
{
|
|
542 |
CMobilePhonebookStore* phoneBook=CMobilePhonebookStore::NewL(iIo,iInit,iPhoneGlobals,storageType);
|
|
543 |
return phoneBook;
|
|
544 |
}
|
|
545 |
else
|
|
546 |
{
|
|
547 |
if (!supported)
|
|
548 |
User::Leave(KErrNotSupported);
|
|
549 |
else
|
|
550 |
User::Leave(KErrUnknown);
|
|
551 |
return NULL;
|
|
552 |
}
|
|
553 |
}
|
|
554 |
|
|
555 |
// Use base class to open a line object
|
|
556 |
return CPhoneHayes::OpenNewObjectByNameL(aName);;
|
|
557 |
}
|
|
558 |
|
|
559 |
|
|
560 |
TBool CPhoneMobile::IsListedPhoneBook(const TDesC& aName,TDes8& aStorageType,TBool& aSupported) const
|
|
561 |
/*
|
|
562 |
* Check whether aName is a valid phone book name. If it is then if supported by 07.07
|
|
563 |
* return the memory storage type (used by AT commands) in aStorageType and whether it
|
|
564 |
* is supported by the current ME in aSupported.
|
|
565 |
*/
|
|
566 |
{
|
|
567 |
|
|
568 |
aStorageType.SetLength(0);
|
|
569 |
const TUint flag=iPhoneGlobals->iPhoneStatus.iSupportedPhoneBookStorageFlag;
|
|
570 |
|
|
571 |
if (aName.CompareF(KETelMeAdnPhoneBook)==KErrNone)
|
|
572 |
{
|
|
573 |
aStorageType.Copy(KMEStorage);
|
|
574 |
aSupported=((flag&KPhoneBookMEStorage)!=0);
|
|
575 |
return ETrue;
|
|
576 |
}
|
|
577 |
if (aName.CompareF(KETelMeDialledPhoneBook)==KErrNone) //LAST_DIALLED_PHONEBOOK
|
|
578 |
{
|
|
579 |
aStorageType.Copy(KDCStorage);
|
|
580 |
aSupported=((flag&KPhoneBookLastDialledStorage)!=0);
|
|
581 |
return ETrue;
|
|
582 |
}
|
|
583 |
if (aName.CompareF(KETelMeMissedPhoneBook)==KErrNone)
|
|
584 |
{
|
|
585 |
aStorageType.Copy(KMCStorage);
|
|
586 |
aSupported=((flag&KPhoneBookMissedCallsStorage)!=0);
|
|
587 |
return ETrue;
|
|
588 |
}
|
|
589 |
if (aName.CompareF(KETelMeReceivedPhoneBook)==KErrNone)
|
|
590 |
{
|
|
591 |
aStorageType.Copy(KRCStorage);
|
|
592 |
aSupported=((flag&KPhoneBookReceivedCallsStorage)!=0);
|
|
593 |
return ETrue;
|
|
594 |
}
|
|
595 |
if (aName.CompareF(KETelCombinedAdnPhoneBook)==KErrNone)
|
|
596 |
{
|
|
597 |
aStorageType.Copy(KMTStorage);
|
|
598 |
aSupported=((flag&KPhoneBookMTStorage)!=0);
|
|
599 |
return ETrue;
|
|
600 |
}
|
|
601 |
if (aName.CompareF(KETelTaAdnPhoneBook)==KErrNone)
|
|
602 |
{
|
|
603 |
aStorageType.Copy(KTAStorage);
|
|
604 |
aSupported=((flag&KPhoneBookTAStorage)!=0);
|
|
605 |
return ETrue;
|
|
606 |
}
|
|
607 |
if (aName.CompareF(KETelIccAdnPhoneBook)==KErrNone)
|
|
608 |
{
|
|
609 |
aStorageType.Copy(KSMStorage);
|
|
610 |
aSupported=((flag&KPhoneBookSMStorage)!=0);
|
|
611 |
return ETrue;
|
|
612 |
}
|
|
613 |
if (aName.CompareF(KETelIccFdnPhoneBook)==KErrNone)
|
|
614 |
{
|
|
615 |
aStorageType.Copy(KFDStorage);
|
|
616 |
aSupported=((flag&KPhoneBookFDStorage)!=0);
|
|
617 |
return ETrue;
|
|
618 |
}
|
|
619 |
if (aName.CompareF(KETelIccLndPhoneBook)==KErrNone)
|
|
620 |
{
|
|
621 |
aStorageType.Copy(KLDStorage);
|
|
622 |
aSupported=((flag&KPhoneBookLDStorage)!=0);
|
|
623 |
return ETrue;
|
|
624 |
}
|
|
625 |
if (aName.CompareF(KETelOwnNumberStore)==KErrNone)
|
|
626 |
{
|
|
627 |
aStorageType.Copy(KONStorage);
|
|
628 |
aSupported=((flag&KPhoneBookOwnNumbersStorage)!=0);
|
|
629 |
return ETrue;
|
|
630 |
}
|
|
631 |
if (aName.CompareF(KETelEmergencyNumberStore)==KErrNone)
|
|
632 |
{
|
|
633 |
aStorageType.Copy(KENStorage);
|
|
634 |
aSupported=((flag&KPhoneBookEmergencyStorage)!=0);
|
|
635 |
return ETrue;
|
|
636 |
}
|
|
637 |
if (aName.CompareF(KETelIccSdnPhoneBook)==KErrNone)
|
|
638 |
{
|
|
639 |
aStorageType.Copy(KSNStorage);
|
|
640 |
aSupported=((flag&KPhoneBookServiceNumberStorage)!=0);
|
|
641 |
return ETrue;
|
|
642 |
}
|
|
643 |
return EFalse;
|
|
644 |
}
|
|
645 |
|
|
646 |
//
|
|
647 |
// Extended functions for Multimode
|
|
648 |
|
|
649 |
TInt CPhoneMobile::GetPhoneId(const TTsyReqHandle aTsyReqHandle,RMobilePhone::TMobilePhoneIdentityV1* aId)
|
|
650 |
/** Get Phone Identification
|
|
651 |
*
|
|
652 |
* This method gets information about the mobilephone using cashed information
|
|
653 |
* from the initialisation of the phone.
|
|
654 |
* @param aTsyReqHandle the request ID
|
|
655 |
* @param aId contains information of manufacturer, model, revision and serialnumber.
|
|
656 |
* @return error code. KErrNone
|
|
657 |
*/
|
|
658 |
|
|
659 |
{
|
|
660 |
aId->iManufacturer = iPhoneGlobals->iPhoneId.iManufacturer;
|
|
661 |
aId->iModel = iPhoneGlobals->iPhoneId.iModel;
|
|
662 |
aId->iRevision = iPhoneGlobals->iPhoneId.iRevision;
|
|
663 |
aId->iSerialNumber = iPhoneGlobals->iPhoneId.iSerialNumber;
|
|
664 |
ReqCompleted(aTsyReqHandle, KErrNone);
|
|
665 |
return KErrNone;
|
|
666 |
}
|
|
667 |
|
|
668 |
|
|
669 |
TInt CPhoneMobile::GetIdentityCaps(const TTsyReqHandle aTsyReqHandle, TUint32* aIdentityCaps)
|
|
670 |
/** Get identity capabilities
|
|
671 |
*
|
|
672 |
* This method gets information about the capabilities to retrieve information about
|
|
673 |
* the phone and subscriber. Information regarding manufacturer, phone model, revision
|
|
674 |
* of the phone, serialnumber of the phone and subscriber ID is retrieved during initialisation.
|
|
675 |
* Cashed information from the initialisation is used.
|
|
676 |
* @param aTsyReqHandle the request ID
|
|
677 |
* @param aIdentityCaps contains the capability information(capabilities to get manufacturer, phone model, revision of the phone, serialnumber of the phone and subscriber id)
|
|
678 |
* @return error code. KErrNone
|
|
679 |
*/
|
|
680 |
{
|
|
681 |
|
|
682 |
*aIdentityCaps = iPhoneGlobals->iPhoneIdCaps;
|
|
683 |
|
|
684 |
if (*aIdentityCaps == 0)
|
|
685 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
686 |
else
|
|
687 |
ReqCompleted(aTsyReqHandle, KErrNone);
|
|
688 |
|
|
689 |
return KErrNone;
|
|
690 |
}
|
|
691 |
|
|
692 |
|
|
693 |
TInt CPhoneMobile::GetSignalStrength(const TTsyReqHandle aTsyReqHandle,
|
|
694 |
TInt32* aSignalStrength, TInt8* aBar)
|
|
695 |
/** Signal Strength
|
|
696 |
*
|
|
697 |
* This method receivs a request from the server to get the signal strength.
|
|
698 |
* The the request is passed on to the CATGetSignal which gets the information
|
|
699 |
* from the MS using the AT command AT+CSQ.
|
|
700 |
* @param aTsyReqHandle the request ID
|
|
701 |
* @param aSignalStrength pointer to the signalstrength. Can take the values -113dB to -53dB and 99, where 99 means signal is "not known or not detectable".
|
|
702 |
* @param aBar pointer to the number of signal bars that are to be shown by the client. Can take the values (-1) to 5.
|
|
703 |
* @return error code. KErrNone
|
|
704 |
*/
|
|
705 |
|
|
706 |
{
|
|
707 |
LOGTEXT(_L8("MMTsy:\tCPhoneMobile::GetSignalStrength"));
|
|
708 |
if (!iPhoneGlobals->iSignalCaps)
|
|
709 |
// No signal strength capabilites - so error request
|
|
710 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
711 |
else
|
|
712 |
{
|
|
713 |
iSignalPtrs.iSignalStrength = aSignalStrength;
|
|
714 |
iSignalPtrs.iBar = aBar;
|
|
715 |
iATSignal->ExecuteCommand(aTsyReqHandle, &iSignalPtrs);
|
|
716 |
}
|
|
717 |
|
|
718 |
return KErrNone;
|
|
719 |
}// end of CPhoneMobile::GetSignalStrength
|
|
720 |
|
|
721 |
|
|
722 |
TInt CPhoneMobile::GetSignalCaps(const TTsyReqHandle aTsyReqHandle, TUint32* aSignalCaps)
|
|
723 |
/** Signal capabilities
|
|
724 |
*
|
|
725 |
* This method passes back the signal capabilities to the client. The information is
|
|
726 |
* extracted during the initialistaion and than cashed in the TSY for later use.
|
|
727 |
* @param aTsyReqHandle the request ID
|
|
728 |
* @param aCaps, pointer to the capabilities
|
|
729 |
* @return error code.
|
|
730 |
*/
|
|
731 |
|
|
732 |
{
|
|
733 |
//The signal capabilities are extracted during the initialisationsequence and saved in iPhoneGlobals->iSignalCaps.
|
|
734 |
*aSignalCaps=iPhoneGlobals->iSignalCaps;
|
|
735 |
|
|
736 |
if (*aSignalCaps == 0)
|
|
737 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
738 |
else
|
|
739 |
ReqCompleted(aTsyReqHandle, KErrNone);
|
|
740 |
|
|
741 |
return KErrNone;
|
|
742 |
}
|
|
743 |
|
|
744 |
|
|
745 |
TInt CPhoneMobile::GetMultimodeCaps(const TTsyReqHandle aTsyReqHandle, TUint32* aMultimodeCaps)
|
|
746 |
/** Get Multimode Capabilities
|
|
747 |
*
|
|
748 |
* This method returnes the multimode capabilities for the phone.
|
|
749 |
* This TSY always supports GSM (which is hard coded) and may support
|
|
750 |
* GPRS if the attached phone supports it.
|
|
751 |
* @param aTsyReqHandle the request ID
|
|
752 |
* @param aMultimodeCaps, Pointer to the multimode capability to return.
|
|
753 |
* @return error code. KErrNone
|
|
754 |
*/
|
|
755 |
{
|
|
756 |
// This TSY always supports GSM
|
|
757 |
*aMultimodeCaps = 0;
|
|
758 |
|
|
759 |
*aMultimodeCaps |= RMobilePhone::KCapsGsmSupported;
|
|
760 |
|
|
761 |
// The GPRS capability of the phone is determined by the class
|
|
762 |
// CATInit during the initialisation dialogue.
|
|
763 |
//
|
|
764 |
if (iPhoneGlobals->iGprsMaxNumContexts != 0)
|
|
765 |
{
|
|
766 |
*aMultimodeCaps |= RMobilePhone::KCapsGprsSupported;
|
|
767 |
}
|
|
768 |
|
|
769 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
770 |
return KErrNone;
|
|
771 |
}
|
|
772 |
|
|
773 |
|
|
774 |
TInt CPhoneMobile::GetPhoneStoreInfo(const TTsyReqHandle aTsyReqHandle, TDes8* aInfo,TDesC* aName)
|
|
775 |
/** Get phonestore information
|
|
776 |
*
|
|
777 |
* This method returns information about a store specified by aName in aInfo.
|
|
778 |
* This method only supports phonebooks and own number store. Other stores are
|
|
779 |
* either not supported by this TSY or opned from other subsessions.
|
|
780 |
* In the case when informtion about a phonebook the request is passed on to the
|
|
781 |
* CATPhopnebookInfo class which executes the AT command
|
|
782 |
|
|
783 |
* @param aTsyReqHandle const pointer to the request ID
|
|
784 |
* @param aInfo Pointer to the struct to contain the information about the specified store
|
|
785 |
* @param aName The name of the store to get information about.
|
|
786 |
* @return error code.
|
|
787 |
*/
|
|
788 |
|
|
789 |
{
|
|
790 |
LOGTEXT2(_L8("MMTsy:\tCPhoneMobile::GetPhoneStoreInfo aTsyReqHandle = %d"), aTsyReqHandle);
|
|
791 |
TStorageType storageType;
|
|
792 |
TBool supported;
|
|
793 |
|
|
794 |
TBool ret = IsListedPhoneBook(*aName, storageType, supported);
|
|
795 |
if (aName->CompareF(KETelOwnNumberStore)==KErrNone)
|
|
796 |
{
|
|
797 |
// Getting own number store inormation.
|
|
798 |
iATOwnNumbers->GetInfo(aTsyReqHandle,aInfo);
|
|
799 |
}
|
|
800 |
else if (ret && supported)
|
|
801 |
{
|
|
802 |
iPhoneBookInfo->SetStorageType(storageType);
|
|
803 |
iPhoneBookInfo->ExecuteCommand(aTsyReqHandle,aInfo);
|
|
804 |
}
|
|
805 |
else
|
|
806 |
{
|
|
807 |
LOGTEXT2(_L8("MMTsy:\tCPhoneMobile::GetPhoneStoreInfo aTsyReqHandle = %d ReqCompleted(KErrNotSupported)"), aTsyReqHandle);
|
|
808 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
809 |
}
|
|
810 |
|
|
811 |
return KErrNone;
|
|
812 |
}
|
|
813 |
|
|
814 |
TInt CPhoneMobile::GetPhoneStoreInfo(const TTsyReqHandle aTsyReqHandle, TDes8* aStoreNameIccType,TDes8* aInfo)
|
|
815 |
/** Get phonestore information
|
|
816 |
*
|
|
817 |
* This method returns information about a store specified by aName in aInfo.
|
|
818 |
* This method only supports phonebooks and own number store. Other stores are
|
|
819 |
* either not supported by this TSY or opened from other subsessions.
|
|
820 |
* In the case when informtion about a phonebook the request is passed on to the
|
|
821 |
* CATPhopnebookInfo class which executes the AT command
|
|
822 |
|
|
823 |
* @param aTsyReqHandle const pointer to the request ID
|
|
824 |
* @param aStoreNameIccType contains a RMobilePhone::TPhoneStoreNameAndIccType including the store name and Icc type.
|
|
825 |
* @param aInfo Pointer to the struct to contain the information about the specified store
|
|
826 |
* @return error code.
|
|
827 |
*/
|
|
828 |
|
|
829 |
{
|
|
830 |
LOGTEXT2(_L8("MMTsy:\tCPhoneMobile::GetPhoneStoreInfo aTsyReqHandle = %d"), aTsyReqHandle);
|
|
831 |
|
|
832 |
RMobilePhone::TPhoneStoreNameAndIccType* phoneStoreNameAndIccType =
|
|
833 |
reinterpret_cast<RMobilePhone::TPhoneStoreNameAndIccType*>
|
|
834 |
(const_cast<TUint8*>(aStoreNameIccType->Ptr()));
|
|
835 |
|
|
836 |
TDesC* mode = reinterpret_cast<TDesC*>(&phoneStoreNameAndIccType->iMode);
|
|
837 |
if (*mode != KEtelGsmPhoneBookType)
|
|
838 |
{
|
|
839 |
LOGTEXT2(_L8("MMTsy:\tCPhoneMobile::GetPhoneStoreInfo aTsyReqHandle = %d ReqCompleted(KErrNotSupported)"), aTsyReqHandle);
|
|
840 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
841 |
return KErrNone;
|
|
842 |
}
|
|
843 |
TDesC* storeName = reinterpret_cast<TDesC*>(&phoneStoreNameAndIccType->iStoreName);
|
|
844 |
|
|
845 |
TStorageType storageType;
|
|
846 |
TBool supported;
|
|
847 |
|
|
848 |
TBool ret = IsListedPhoneBook(*storeName, storageType, supported);
|
|
849 |
if (storeName->CompareF(KETelOwnNumberStore)==KErrNone)
|
|
850 |
{
|
|
851 |
// Getting own number store information.
|
|
852 |
iATOwnNumbers->GetInfo(aTsyReqHandle,aInfo);
|
|
853 |
}
|
|
854 |
else if (ret && supported)
|
|
855 |
{
|
|
856 |
iPhoneBookInfo->SetStorageType(storageType);
|
|
857 |
iPhoneBookInfo->ExecuteCommand(aTsyReqHandle,aInfo);
|
|
858 |
}
|
|
859 |
else
|
|
860 |
{
|
|
861 |
LOGTEXT2(_L8("MMTsy:\tCPhoneMobile::GetPhoneStoreInfo aTsyReqHandle = %d ReqCompleted(KErrNotSupported)"), aTsyReqHandle);
|
|
862 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
863 |
}
|
|
864 |
return KErrNone;
|
|
865 |
}
|
|
866 |
|
|
867 |
void CPhoneMobile::CurrentNetworkInfo(CATNetworkInfo::TTsyNetworkInfo* aNetworkInfo) const
|
|
868 |
{
|
|
869 |
iATNetworkInfo->GetCurrentNetworkInfo(aNetworkInfo);
|
|
870 |
}
|
|
871 |
|
|
872 |
|
|
873 |
TInt CPhoneMobile::GetCurrentNetwork(const TTsyReqHandle aTsyReqHandle, TDes8* aNetworkInfoPckg,
|
|
874 |
RMobilePhone::TMobilePhoneLocationAreaV1* aArea)
|
|
875 |
/** Get Current Network Info
|
|
876 |
*
|
|
877 |
* This method gets information about the current state of the network,
|
|
878 |
* such as network name(short and long), status and mode of the network etc.
|
|
879 |
* @param aTsyReqHandle the request ID
|
|
880 |
* @param aNetworkInfoPckg pointer to a packet of TMobilePhoneNetworkInfoV1Pckg type.
|
|
881 |
* @param aArea Pointer to a struct of the type TMobilePhoneLocationAreaV1.
|
|
882 |
* @return error code.
|
|
883 |
*/
|
|
884 |
{
|
|
885 |
LOGTEXT(_L8("MMTsy:\tCPhoneMobile::GetCurrentNetwork"));
|
|
886 |
|
|
887 |
RMobilePhone::TMobilePhoneNetworkInfoV1Pckg* networkPckg = static_cast<RMobilePhone::TMobilePhoneNetworkInfoV1Pckg*>(aNetworkInfoPckg);
|
|
888 |
// The networkPckg is finally unpacked to be set in CATNetworkInfo::GetCurrentNetworkInfo
|
|
889 |
|
|
890 |
// Check if retrieval of network information is supported.
|
|
891 |
if (iPhoneGlobals->iNetworkCaps & RMobilePhone::KCapsGetCurrentNetwork)
|
|
892 |
{
|
|
893 |
iPhoneGlobals->iNetworkMode = GetMode(); //Updating the network mode.
|
|
894 |
//This is then used in CATNetworkInfo::GetCurrentNetworkInfo.
|
|
895 |
iNetworkInfoPtrs.iNetworkInfoPckg = networkPckg;
|
|
896 |
iNetworkInfoPtrs.iArea = aArea;
|
|
897 |
|
|
898 |
// Need to read the network information
|
|
899 |
iATNetworkInfo->ExecuteCommand(aTsyReqHandle, &iNetworkInfoPtrs);
|
|
900 |
}
|
|
901 |
else
|
|
902 |
{
|
|
903 |
ReqCompleted(aTsyReqHandle,KErrNotSupported);
|
|
904 |
}
|
|
905 |
|
|
906 |
return KErrNone;
|
|
907 |
}
|
|
908 |
|
|
909 |
|
|
910 |
TInt CPhoneMobile::NotifyCurrentNetworkChange(const TTsyReqHandle aTsyReqHandle, TDes8* aNetworkInfoPckg,
|
|
911 |
RMobilePhone::TMobilePhoneLocationAreaV1* aArea)
|
|
912 |
/** Notification of Current Network change
|
|
913 |
*
|
|
914 |
* This method gets information about the current state of the network, such as network name(short and long),
|
|
915 |
* status and mode of the network etc, when the network changes.
|
|
916 |
* @param aTsyReqHandle the request ID
|
|
917 |
* @param aNetworkInfoPckg pointer to a packet of the type TMobilePhoneNetworkInfoV1Pckg.
|
|
918 |
* @param aArea Pointer to a struct of the type TMobilePhoneLocationAreaV1.
|
|
919 |
* @return error code.
|
|
920 |
*/
|
|
921 |
{
|
|
922 |
if (iPhoneGlobals->iNetworkCaps & RMobilePhone::KCapsNotifyCurrentNetwork) // Check if notification is supported.
|
|
923 |
{
|
|
924 |
RMobilePhone::TMobilePhoneNetworkInfoV1Pckg* networkPckg = static_cast<RMobilePhone::TMobilePhoneNetworkInfoV1Pckg*>(aNetworkInfoPckg);
|
|
925 |
CATNetworkInfo::TTsyNetworkInfo networkInfo; // Have to put the inforamtion in a struct to be able to pass it on in the TSY.
|
|
926 |
networkInfo.iNetworkInfoPckg = networkPckg;
|
|
927 |
networkInfo.iArea = aArea;
|
|
928 |
|
|
929 |
iPhoneGlobals->iNotificationStore->RegisterNotification(ECurrentNetwork,aTsyReqHandle,this, &networkInfo); // posting the notification request
|
|
930 |
}
|
|
931 |
else
|
|
932 |
ReqCompleted(aTsyReqHandle,KErrNotSupported);
|
|
933 |
|
|
934 |
return KErrNone;
|
|
935 |
}
|
|
936 |
|
|
937 |
|
|
938 |
TInt CPhoneMobile::NotifyCurrentNetworkChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
939 |
/** Notification of Current Network change Cancel
|
|
940 |
*
|
|
941 |
* This method cancels an outstanding NotifyCurrentNetworkChange request.
|
|
942 |
* @param aTsyReqHandle the request ID that belong to the request to be cancelled
|
|
943 |
* @return error code.
|
|
944 |
*/
|
|
945 |
{
|
|
946 |
if (iPhoneGlobals->iNetworkCaps & RMobilePhone::KCapsNotifyCurrentNetwork) // Check if notification is supported.
|
|
947 |
{
|
|
948 |
LOGTEXT(_L8("PhoneMM:\tCurrent Network Change Notification cancelled"));
|
|
949 |
iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
|
|
950 |
}
|
|
951 |
// else - Request not posted in the first place, so do nothing
|
|
952 |
|
|
953 |
return KErrNone;
|
|
954 |
}
|
|
955 |
|
|
956 |
|
|
957 |
TInt CPhoneMobile::GetNetworkCaps(const TTsyReqHandle aTsyReqHandle, TUint32* aNetworkCaps)
|
|
958 |
/** Get Multimode Capabilities
|
|
959 |
*
|
|
960 |
* This method returnes the network capabilities for the phone. The capabilities are
|
|
961 |
* extracted during the initialisation(ATINIT.cpp) using AT+CREG and AT+COPS.
|
|
962 |
* @param aTsyReqHandle the request ID
|
|
963 |
* @param aNetworkCaps, Pointer to the network capabilities.
|
|
964 |
* @return error code. KErrNone
|
|
965 |
*/
|
|
966 |
{
|
|
967 |
*aNetworkCaps = iPhoneGlobals->iNetworkCaps;
|
|
968 |
|
|
969 |
if (*aNetworkCaps == 0)
|
|
970 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
971 |
else
|
|
972 |
ReqCompleted(aTsyReqHandle, KErrNone);
|
|
973 |
return KErrNone;
|
|
974 |
}
|
|
975 |
|
|
976 |
|
|
977 |
RMobilePhone::TMobilePhoneRegistrationStatus CPhoneMobile::RegistrationStatus() const
|
|
978 |
{
|
|
979 |
return iPhoneGlobals->iPhoneStatus.iRegistrationStatus;
|
|
980 |
}
|
|
981 |
|
|
982 |
TInt CPhoneMobile::GetNetworkRegistrationStatus(const TTsyReqHandle aTsyReqHandle,
|
|
983 |
RMobilePhone::TMobilePhoneRegistrationStatus* aRegistrationStatus)
|
|
984 |
/** Network Registration Status
|
|
985 |
*
|
|
986 |
* Gives information about the network registration status
|
|
987 |
*(ENotRegisterdNotSearching, ERegisterdOnHomeNetwork, ENotRegisterdSearching, ERegistrationDenied,
|
|
988 |
* EUnknown or ERegisteredRoaming). The AT command +CREG is used to get this information.
|
|
989 |
* @param aTsyReqHandle the request ID
|
|
990 |
* @param aRegistrationStatus, pointer to be set to point to the registration status.
|
|
991 |
* @return error code. KErrNone
|
|
992 |
*/
|
|
993 |
{
|
|
994 |
*aRegistrationStatus = RegistrationStatus();
|
|
995 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
996 |
return KErrNone;
|
|
997 |
}
|
|
998 |
|
|
999 |
|
|
1000 |
TInt CPhoneMobile::NotifyNetworkRegistrationStatusChange(const TTsyReqHandle aTsyReqHandle,
|
|
1001 |
RMobilePhone::TMobilePhoneRegistrationStatus* aRegistrationStatus)
|
|
1002 |
/** Notify change of Network Registration Status
|
|
1003 |
*
|
|
1004 |
* @param aTsyReqHandle const pointer to the request ID
|
|
1005 |
* @param aRegistrationStatus, pointer to be set to point to the registartion status.
|
|
1006 |
* @return error code. KErrNone
|
|
1007 |
*/
|
|
1008 |
{
|
|
1009 |
if (iPhoneGlobals->iNetworkCaps & RMobilePhone::KCapsNotifyRegistrationStatus) // Check if notification is supported.
|
|
1010 |
{
|
|
1011 |
LOGTEXT(_L8("CPhoneMobile:\tNetwork Registration Status Change Notification loged"));
|
|
1012 |
iPhoneGlobals->iNotificationStore->RegisterNotification(ERegistrationStatus,aTsyReqHandle,this,aRegistrationStatus);
|
|
1013 |
return KErrNone;
|
|
1014 |
}
|
|
1015 |
|
|
1016 |
ReqCompleted(aTsyReqHandle,KErrNotSupported);
|
|
1017 |
return KErrNone;
|
|
1018 |
}
|
|
1019 |
|
|
1020 |
|
|
1021 |
TInt CPhoneMobile::NotifyNetworkRegistrationStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1022 |
/** Notify change of Network Registration Status Cancel
|
|
1023 |
*
|
|
1024 |
* @param aTsyReqHandle const pointer to the request ID
|
|
1025 |
* @return error code. KErrNone
|
|
1026 |
*/
|
|
1027 |
|
|
1028 |
{
|
|
1029 |
if (iPhoneGlobals->iNetworkCaps & RMobilePhone::KCapsNotifyRegistrationStatus) // Check if notification is supported.
|
|
1030 |
{
|
|
1031 |
LOGTEXT(_L8("CPhoneMobile:\tNetwork Registration Status Change Notification cancelled"));
|
|
1032 |
iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
|
|
1033 |
}
|
|
1034 |
// else - Request not posted in the first place, so do nothing
|
|
1035 |
|
|
1036 |
return KErrNone;
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
|
|
1040 |
TInt CPhoneMobile::GetCurrentMode(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneNetworkMode* aNetworkMode)
|
|
1041 |
/** Get Network Mode
|
|
1042 |
*
|
|
1043 |
* Gives information about the current network mode, such as ENetworkModeUnknown,ENetworkModeUnregistered or ENetworkModeGsm.
|
|
1044 |
* TDM, AMPS, UMTS, WCDMA is not supported by this TSY
|
|
1045 |
* @param aTsyReqHandle the request ID
|
|
1046 |
* @param aNetworkMode The networkmode to be returned(as above)
|
|
1047 |
* @return error code. KErrNone
|
|
1048 |
*/
|
|
1049 |
{
|
|
1050 |
if (iPhoneGlobals->iNetworkCaps & RMobilePhone::KCapsGetCurrentMode)
|
|
1051 |
{
|
|
1052 |
*aNetworkMode = GetMode(); //Calling local method to get the networkmode
|
|
1053 |
ReqCompleted(aTsyReqHandle, KErrNone);
|
|
1054 |
return KErrNone;
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
ReqCompleted(aTsyReqHandle,KErrNotSupported);
|
|
1058 |
return KErrNone;
|
|
1059 |
}
|
|
1060 |
|
|
1061 |
TInt CPhoneMobile::GetBatteryCaps(const TTsyReqHandle aTsyReqHandle, TUint32* aBatteryCaps)
|
|
1062 |
/** Battery Capabilities
|
|
1063 |
*
|
|
1064 |
* This method passes information about the battery capabilities back to the client.
|
|
1065 |
* @param aTsyReqHandle the request ID.
|
|
1066 |
* @param aBatteryCaps, passes back the battery capabilities.
|
|
1067 |
* @return error code.KErrNone
|
|
1068 |
*/
|
|
1069 |
{
|
|
1070 |
// The battery capabilities are extracted during the initialisation(ATINIT.CPP)
|
|
1071 |
// and stored in iPhoneGlobals->iBatteryCaps to be retrieved when needed.
|
|
1072 |
*aBatteryCaps=iPhoneGlobals->iBatteryCaps;
|
|
1073 |
|
|
1074 |
if (*aBatteryCaps == 0)
|
|
1075 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
1076 |
else
|
|
1077 |
ReqCompleted(aTsyReqHandle, KErrNone);
|
|
1078 |
|
|
1079 |
return KErrNone;
|
|
1080 |
}
|
|
1081 |
|
|
1082 |
|
|
1083 |
TInt CPhoneMobile::GetBatteryInfo(const TTsyReqHandle aTsyReqHandle,
|
|
1084 |
RMobilePhone::TMobilePhoneBatteryInfoV1* aBatteryInfo)
|
|
1085 |
/** Battery information
|
|
1086 |
*
|
|
1087 |
* This method passes a request from the etel server to get battery information from
|
|
1088 |
* the GSM phone on to the CATGetBattery class. CATGetBattery executes the AT command
|
|
1089 |
* AT+CBC to get battery information. The information reurned is status and precent of
|
|
1090 |
* capacity remaining.
|
|
1091 |
* @param aTsyReqHandle the request ID.
|
|
1092 |
* @param aBatteryInfo, pointer to a struct for infortmation about battery status and charge level.
|
|
1093 |
* @return error code.KErrNone
|
|
1094 |
*/
|
|
1095 |
|
|
1096 |
{
|
|
1097 |
if (!iPhoneGlobals->iBatteryCaps)
|
|
1098 |
// There are no battery capabilities - so error request
|
|
1099 |
ReqCompleted(aTsyReqHandle, KErrNotSupported);
|
|
1100 |
else
|
|
1101 |
iATBattery->ExecuteCommand(aTsyReqHandle, aBatteryInfo);
|
|
1102 |
|
|
1103 |
return KErrNone;
|
|
1104 |
}
|
|
1105 |
|
|
1106 |
|
|
1107 |
TInt CPhoneMobile::GetSubscriberId(TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneSubscriberId* aId)
|
|
1108 |
/** Get Subscriber Id
|
|
1109 |
*
|
|
1110 |
* This method passes the request for the IMSI number on to CATSubscriberId, if the capabilities
|
|
1111 |
* are right. The AT command AT+CIMI is used to retrieve the information from the phone.
|
|
1112 |
* @param aTsyReqHandle the request ID
|
|
1113 |
* @param aId,a pointer to the memory where the subscriber id should be stored.
|
|
1114 |
* @return error code.
|
|
1115 |
*/
|
|
1116 |
|
|
1117 |
{
|
|
1118 |
// Intialise the clients data in case they ignore our completion code
|
|
1119 |
// and use the ID we supplied them.
|
|
1120 |
aId->Zero();
|
|
1121 |
|
|
1122 |
if ((iPhoneGlobals->iPhoneIdCaps & RMobilePhone::KCapsGetSubscriberId) &&
|
|
1123 |
(iATSubscriberId->CachedValue(*aId)))
|
|
1124 |
{
|
|
1125 |
// The IMSI has already been retrieved and cached within iATSubscriberId
|
|
1126 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1127 |
}
|
|
1128 |
else if (iPhoneGlobals->iPhoneIdCaps & RMobilePhone::KCapsGetSubscriberId)
|
|
1129 |
{
|
|
1130 |
// Pass the request in to the CATSubscriberId class which executes AT+CIMI.
|
|
1131 |
iATSubscriberId->ExecuteCommand(aTsyReqHandle,aId);
|
|
1132 |
}
|
|
1133 |
else
|
|
1134 |
ReqCompleted(aTsyReqHandle,KErrNotSupported);
|
|
1135 |
|
|
1136 |
return KErrNone;
|
|
1137 |
}
|
|
1138 |
|
|
1139 |
|
|
1140 |
//*******************************************
|
|
1141 |
//* Get Detected Networks
|
|
1142 |
//*******************************************
|
|
1143 |
TInt CPhoneMobile::GetDetectedNetworksPhase1(const TTsyReqHandle aTsyReqHandle,
|
|
1144 |
RMobilePhone::TClientId* aClient,
|
|
1145 |
TInt* aBufSize)
|
|
1146 |
/** Get Detected Networks Phase 1
|
|
1147 |
*
|
|
1148 |
* If the GetDetectedNetworksPhase1L should leave this method takes care of that and
|
|
1149 |
* makes a premature ReqCompleted to the client.
|
|
1150 |
*
|
|
1151 |
* @param aTsyReqHandle the request ID
|
|
1152 |
* @param aClient The client sends down a handle that is saved together with the
|
|
1153 |
* list so the list can be returned to the right client in phase 2.
|
|
1154 |
* @param aBufSiz The size of the retrieved network lidt. The size is set in
|
|
1155 |
* @return error code.
|
|
1156 |
*/
|
|
1157 |
|
|
1158 |
{
|
|
1159 |
LOGTEXT(_L8("MMTsy::GetDetectedNetworksPhase1 called"));
|
|
1160 |
TInt ret=KErrNone;
|
|
1161 |
TInt leaveCode=KErrNone;
|
|
1162 |
TRAP(leaveCode, ret=GetDetectedNetworksPhase1L(aTsyReqHandle, aClient, aBufSize););
|
|
1163 |
if (leaveCode != KErrNone)
|
|
1164 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1165 |
return ret;
|
|
1166 |
}
|
|
1167 |
|
|
1168 |
|
|
1169 |
TInt CPhoneMobile::GetDetectedNetworksPhase1L(TTsyReqHandle aTsyReqHandle,
|
|
1170 |
RMobilePhone::TClientId* aClient,
|
|
1171 |
TInt* aBufSize)
|
|
1172 |
/** Get Detected Networks Phase 1
|
|
1173 |
*
|
|
1174 |
* Phase 1 retrieves the network list with help of AT+COPS=?,
|
|
1175 |
* the memory space needed to store the list is then calculated
|
|
1176 |
* and returned to the client.The returned list is saved to be
|
|
1177 |
* copied to the client in phase 2, when the client has alocated memory for it.
|
|
1178 |
* The actuall execution of the AT command (AT+COPS=?) is done in the CATDetectNetwork class.
|
|
1179 |
*
|
|
1180 |
* @param aTsyReqHandle const pointer to the request ID
|
|
1181 |
* @param aClient The client sends down a handle that is saved together with the
|
|
1182 |
* list so the list can be returned to the right client in phase 2.
|
|
1183 |
* @param aBufSize The size of the retrieved network. The size is set in CATDetectNetwork::ParseResponseL().
|
|
1184 |
* @return error code.
|
|
1185 |
*/
|
|
1186 |
{
|
|
1187 |
|
|
1188 |
LOGTEXT(_L8("CPhoneMobile::GetDetectedNetworksPhase1 called"));
|
|
1189 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(aClient,aTsyReqHandle);
|
|
1190 |
CleanupStack::PushL(read);
|
|
1191 |
|
|
1192 |
iNetworkListInfoPtrs.iBufSize = aBufSize;
|
|
1193 |
iNetworkListInfoPtrs.iBufPtr = &(read->iListBuf);
|
|
1194 |
iGetDetectedNetworks->AppendL(read);
|
|
1195 |
|
|
1196 |
iATDetectNetwork->ExecuteCommand(aTsyReqHandle, &iNetworkListInfoPtrs);
|
|
1197 |
|
|
1198 |
// pop the CListReadAllAttempt (read)
|
|
1199 |
CleanupStack::Pop();
|
|
1200 |
return KErrNone;
|
|
1201 |
}
|
|
1202 |
|
|
1203 |
|
|
1204 |
TInt CPhoneMobile::GetDetectedNetworksPhase2(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId* aClient, TDes8* aBuf)
|
|
1205 |
/** Get detected networks phase 2
|
|
1206 |
*
|
|
1207 |
* In this metod the list which was retrieved during phase 1 is copied to
|
|
1208 |
* the memory which the client has allocated for this purose.
|
|
1209 |
* @param aTsyReqHandle Const pointer to the request ID
|
|
1210 |
* @param aClient Handle to the client which list we are looking for.
|
|
1211 |
* @param aBuf Pointer to the memory that the etelmm has allocated.
|
|
1212 |
* @return error code.
|
|
1213 |
*/
|
|
1214 |
{
|
|
1215 |
|
|
1216 |
LOGTEXT(_L8("CPhoneMobile::GetDetectedNetworksPhase2 called"));
|
|
1217 |
CListReadAllAttempt* read=NULL;
|
|
1218 |
TInt numberOfLists = iGetDetectedNetworks->Count();
|
|
1219 |
|
|
1220 |
// Find the get detected network attempt from this client
|
|
1221 |
for (TInt i = 0; i < numberOfLists; ++i)
|
|
1222 |
{
|
|
1223 |
read = iGetDetectedNetworks->At(i);
|
|
1224 |
if ((read->iClient.iSessionHandle==aClient->iSessionHandle) &&
|
|
1225 |
(read->iClient.iSubSessionHandle==aClient->iSubSessionHandle))
|
|
1226 |
{
|
|
1227 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
1228 |
|
|
1229 |
aBuf->Copy(bufPtr); // Copy the streamed list to the client
|
|
1230 |
delete read;
|
|
1231 |
iGetDetectedNetworks->Delete(i);
|
|
1232 |
ReqCompleted(aTsyReqHandle,KErrNone); // Completes the retrieval of a network list succesfully.
|
|
1233 |
return KErrNone;
|
|
1234 |
}
|
|
1235 |
}
|
|
1236 |
|
|
1237 |
Panic(EIllegalEvent);
|
|
1238 |
return(KErrNotFound);
|
|
1239 |
}
|
|
1240 |
|
|
1241 |
|
|
1242 |
void CPhoneMobile::CompleteDetectedNetworksCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1243 |
/** CompleteDetectedNetworksCancel
|
|
1244 |
*
|
|
1245 |
* This method is called from the CATDetectNetworks class if a cancel is succesful
|
|
1246 |
* It cleans-up the client's stored request data
|
|
1247 |
* @param aTsyReqHandle Const pointer to the request ID
|
|
1248 |
* @return error code.
|
|
1249 |
*/
|
|
1250 |
{
|
|
1251 |
LOGTEXT(_L8("CPhoneMobile::GetDetectedNetworksCancel called"));
|
|
1252 |
// Remove the read all attempt from iGetDetectedNetworks
|
|
1253 |
CListReadAllAttempt* read=NULL;
|
|
1254 |
for (TInt i=0; i<iGetDetectedNetworks->Count(); ++i)
|
|
1255 |
{
|
|
1256 |
read = iGetDetectedNetworks->At(i);
|
|
1257 |
if (read->iReqHandle == aTsyReqHandle)
|
|
1258 |
{
|
|
1259 |
delete read;
|
|
1260 |
iGetDetectedNetworks->Delete(i);
|
|
1261 |
break;
|
|
1262 |
}
|
|
1263 |
}
|
|
1264 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1265 |
}
|
|
1266 |
|
|
1267 |
RMobilePhone::TMobilePhoneNetworkMode CPhoneMobile::GetMode()
|
|
1268 |
/**
|
|
1269 |
* This method returns the current networkmode.
|
|
1270 |
* GSM is the only type of network supported in this TSY.
|
|
1271 |
*/
|
|
1272 |
|
|
1273 |
{
|
|
1274 |
RMobilePhone::TMobilePhoneRegistrationStatus registrationstatus;
|
|
1275 |
registrationstatus = iPhoneGlobals->iPhoneStatus.iRegistrationStatus;
|
|
1276 |
|
|
1277 |
switch (registrationstatus)
|
|
1278 |
{
|
|
1279 |
case RMobilePhone::ERegistrationUnknown:
|
|
1280 |
return RMobilePhone::ENetworkModeUnknown;
|
|
1281 |
case RMobilePhone::ERegistrationDenied:
|
|
1282 |
case RMobilePhone::ENotRegisteredNoService:
|
|
1283 |
case RMobilePhone::ENotRegisteredEmergencyOnly:
|
|
1284 |
case RMobilePhone::ENotRegisteredSearching:
|
|
1285 |
return RMobilePhone::ENetworkModeUnregistered;
|
|
1286 |
case RMobilePhone::ERegisteredOnHomeNetwork:
|
|
1287 |
case RMobilePhone::ERegisteredRoaming:
|
|
1288 |
return RMobilePhone::ENetworkModeGsm;
|
|
1289 |
default:
|
|
1290 |
return RMobilePhone::ENetworkModeUnknown;
|
|
1291 |
}
|
|
1292 |
|
|
1293 |
}
|