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 |
//
|
|
15 |
|
|
16 |
#include <commsdattypesv1_1.h>
|
|
17 |
#include "PHONE.H"
|
|
18 |
#include "LINE.H"
|
|
19 |
#include "CALL.H"
|
|
20 |
#include "NOTIFY.H"
|
|
21 |
#include "mSLOGGER.H"
|
|
22 |
#include "ATINIT.H"
|
|
23 |
#include "ATERROR.H"
|
|
24 |
#include "mPHBOOK.H"
|
|
25 |
#include "mnetwork.h"
|
|
26 |
#include "ATIO.H"
|
|
27 |
#include "Matstd.h" // for KXXStorage constants
|
|
28 |
#include "et_struct.h"
|
|
29 |
|
|
30 |
#if defined (__WINS__)
|
|
31 |
_LIT(KPDDName,"ECDRV");
|
|
32 |
_LIT(KLDDName,"ECOMM");
|
|
33 |
#else
|
|
34 |
_LIT(KPDDName,"EUART1");
|
|
35 |
#if defined (PDD2_NAME)
|
|
36 |
_LIT(KPDD2Name,"EUART2");
|
|
37 |
#endif
|
|
38 |
_LIT(KLDDName,"ECOMM");
|
|
39 |
#endif
|
|
40 |
|
|
41 |
|
|
42 |
//
|
|
43 |
// CPhoneGlobals
|
|
44 |
//
|
|
45 |
CPhoneGlobals* CPhoneGlobals::NewL(TBool aExplicit)
|
|
46 |
{
|
|
47 |
CPhoneGlobals* self = new(ELeave)CPhoneGlobals();
|
|
48 |
CleanupStack::PushL(self);
|
|
49 |
self->ConstructL(aExplicit);
|
|
50 |
CleanupStack::Pop();
|
|
51 |
return self;
|
|
52 |
}
|
|
53 |
|
|
54 |
void CPhoneGlobals::ConstructL(TBool aExplicit)
|
|
55 |
{
|
|
56 |
iPhoneStatus.iModemDetected = RPhone::EDetectedUnknown;
|
|
57 |
iPhoneStatus.iDataAndFaxFlags = RPhone::KCapsUnknown;
|
|
58 |
iPhoneStatus.iWaitForCarrierTime = KDefaultSecondsToWaitForCarrier;
|
|
59 |
iPhoneStatus.iRegistrationStatus = RMobilePhone::ERegistrationUnknown;
|
|
60 |
iConfiguration=CTsyConfig::NewL(aExplicit);
|
|
61 |
iNotificationStore=CNotifications::NewL();
|
|
62 |
}
|
|
63 |
|
|
64 |
CPhoneGlobals::~CPhoneGlobals()
|
|
65 |
{
|
|
66 |
delete iConfiguration;
|
|
67 |
delete iNotificationStore;
|
|
68 |
}
|
|
69 |
|
|
70 |
TBool CPhoneGlobals::IsWriteAccess(TStorageType aStorageType)
|
|
71 |
{
|
|
72 |
if ((aStorageType.Compare(KMEStorage)==KErrNone) ||
|
|
73 |
(aStorageType.Compare(KSMStorage)==KErrNone) ||
|
|
74 |
(aStorageType.CompareF(KTAStorage)==KErrNone))
|
|
75 |
return ETrue;
|
|
76 |
else
|
|
77 |
return EFalse;
|
|
78 |
}
|
|
79 |
|
|
80 |
|
|
81 |
void CPhoneGlobals::CheckForChangeOfNetwork()
|
|
82 |
//
|
|
83 |
// Changes in network registration may imply a change of operator, which involves issuing
|
|
84 |
// more AT commands.
|
|
85 |
//
|
|
86 |
{
|
|
87 |
if (iATNetworkInfo && iPhoneStatus.iNetworkChanged &&
|
|
88 |
((iPhoneStatus.iMode==RPhone::EModeIdle)||
|
|
89 |
(iPhoneStatus.iMode==RPhone::EModeOnlineCommand)))
|
|
90 |
{
|
|
91 |
LOGTEXT(_L8("CPhoneGlobals: Update CurrentNetworkInfo"));
|
|
92 |
iATNetworkInfo->CheckOperator();
|
|
93 |
}
|
|
94 |
}
|
|
95 |
|
|
96 |
//
|
|
97 |
// Character set conversion between the ME encoding (see +CSCS) and Unicode
|
|
98 |
//
|
|
99 |
// TO DO: Add appropriate use of CHARCONV converters
|
|
100 |
// "GSM" => KCharacterSetIdentifierSms7Bit
|
|
101 |
// "IRA" => KCharacterSetIdentifierAscii
|
|
102 |
// "8859-1" => KCharacterSetISO88591
|
|
103 |
|
|
104 |
TInt CPhoneGlobals::ConvertFromUnicode(TDes8& aMEString, const TDesC16& aUnicode) const
|
|
105 |
{
|
|
106 |
aMEString.Copy(aUnicode);
|
|
107 |
return KErrNone;
|
|
108 |
}
|
|
109 |
|
|
110 |
TInt CPhoneGlobals::ConvertToUnicode(TDes16& aUnicode, const TDesC8& aMEString) const
|
|
111 |
{
|
|
112 |
aUnicode.Copy(aMEString);
|
|
113 |
return KErrNone;
|
|
114 |
}
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
//
|
|
119 |
// CPhoneHayes
|
|
120 |
//
|
|
121 |
void CPhoneHayes::ClosePhone(TAny* aObj)
|
|
122 |
//
|
|
123 |
// Utility func for cleanup stack
|
|
124 |
//
|
|
125 |
{
|
|
126 |
((CObject*)aObj)->Close();
|
|
127 |
}
|
|
128 |
|
|
129 |
CPhoneHayes* CPhoneHayes::NewL()
|
|
130 |
{
|
|
131 |
CPhoneHayes* phone=new(ELeave) CPhoneHayes();
|
|
132 |
TCleanupItem newPhoneHayesClose(ClosePhone,phone);
|
|
133 |
CleanupStack::PushL(newPhoneHayesClose);
|
|
134 |
phone->ConstructL();
|
|
135 |
CleanupStack::Pop();
|
|
136 |
return phone;
|
|
137 |
}
|
|
138 |
|
|
139 |
void CPhoneHayes::ConstructL()
|
|
140 |
//
|
|
141 |
// Creation of Global Params
|
|
142 |
//
|
|
143 |
{
|
|
144 |
LOGTEXTREL(_L8("---------- New Log ----------")); // Added this to keep log looking like it used to
|
|
145 |
|
|
146 |
// Add description of component build to log flie
|
|
147 |
#if defined(__WINS__)
|
|
148 |
LOGTEXTREL(_L8("Platform: WINS"));
|
|
149 |
#elif defined(__MARM_ARMI__)
|
|
150 |
LOGTEXTREL(_L8("Platform: ARMI"));
|
|
151 |
#elif defined(__MARM_ARM4__)
|
|
152 |
LOGTEXTREL(_L8("Platform: ARM4"));
|
|
153 |
#elif defined(__MARM_THUMB__)
|
|
154 |
LOGTEXTREL(_L8("Platform: THUMB"));
|
|
155 |
#else
|
|
156 |
LOGTEXTREL(_L8("Platform: unknown"));
|
|
157 |
#endif
|
|
158 |
#if defined (_DEBUG)
|
|
159 |
LOGTEXTREL(_L8("Variant: DEBUG"));
|
|
160 |
#else
|
|
161 |
LOGTEXTREL(_L8("Variant: RELEASE"));
|
|
162 |
#endif
|
|
163 |
|
|
164 |
LOGTEXT(_L8("--- CPhoneHayes::ConstructL() ---"));
|
|
165 |
|
|
166 |
LOGTEXT(_L8("Loading Serial drivers"));
|
|
167 |
|
|
168 |
TInt r=User::LoadPhysicalDevice(KPDDName);
|
|
169 |
if (r!=KErrNone && r!=KErrAlreadyExists)
|
|
170 |
User::Leave(r);
|
|
171 |
#if defined (PDD2_NAME)
|
|
172 |
r=User::LoadPhysicalDevice(KPDD2Name);
|
|
173 |
if (r!=KErrNone && r!=KErrAlreadyExists)
|
|
174 |
User::Leave(r);
|
|
175 |
#endif
|
|
176 |
r=User::LoadLogicalDevice(KLDDName);
|
|
177 |
if (r!=KErrNone && r!=KErrAlreadyExists)
|
|
178 |
User::Leave(r);
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
iDefaultDataLineInfo.iStatus = RCall::EStatusUnknown;
|
|
183 |
iDefaultDataLineInfo.iLineCapsFlags = ( RLine::KCapsData|RLine::KCapsEventIncomingCall);
|
|
184 |
iDefaultDataLineInfo.iName = KDataLineName;
|
|
185 |
iDefaultFaxLineInfo.iStatus = RCall::EStatusUnknown;
|
|
186 |
iDefaultFaxLineInfo.iLineCapsFlags = ( RLine::KCapsFax|RLine::KCapsEventIncomingCall);
|
|
187 |
iDefaultFaxLineInfo.iName = KFaxLineName;
|
|
188 |
iDefaultVoiceLineInfo.iStatus = RCall::EStatusUnknown;
|
|
189 |
iDefaultVoiceLineInfo.iLineCapsFlags = (RLine::KCapsVoice|RLine::KCapsEventIncomingCall);
|
|
190 |
iDefaultVoiceLineInfo.iName = KVoiceLineName;
|
|
191 |
iSizeOfMemberData = new(ELeave) CArrayFixFlat<TInt>(1);
|
|
192 |
}
|
|
193 |
|
|
194 |
CPhoneHayes::~CPhoneHayes()
|
|
195 |
//
|
|
196 |
// iIo must be deleted after pointers to objects which used it
|
|
197 |
//
|
|
198 |
{
|
|
199 |
LOGTEXT(_L8("Entered CPhoneHayes destructor"));
|
|
200 |
if (iPhoneGlobals != NULL)
|
|
201 |
iPhoneGlobals->iNotificationStore->RemoveClientFromLastEvents(this);
|
|
202 |
delete iInit;
|
|
203 |
delete iErrorHandler;
|
|
204 |
delete iWaitForCall;
|
|
205 |
delete iPhoneGlobals;
|
|
206 |
if (iSizeOfMemberData!=NULL)
|
|
207 |
iSizeOfMemberData->Reset();
|
|
208 |
delete iSizeOfMemberData;
|
|
209 |
if (iIo!=NULL)
|
|
210 |
{
|
|
211 |
iIo->Cancel();
|
|
212 |
iIo->Disconnect();
|
|
213 |
delete iIo;
|
|
214 |
}
|
|
215 |
LOGTEXT(_L8("--- CPhoneHayes::~CPhoneHayes() ---"));
|
|
216 |
}
|
|
217 |
|
|
218 |
|
|
219 |
TInt CPhoneHayes::MultimodeInitL(TBool aExplicit)
|
|
220 |
{
|
|
221 |
TFileName csy;
|
|
222 |
TName port;
|
|
223 |
|
|
224 |
if(!aExplicit && !iPhoneGlobals)
|
|
225 |
{
|
|
226 |
iPhoneGlobals = CPhoneGlobals::NewL(aExplicit);
|
|
227 |
}
|
|
228 |
|
|
229 |
LOGTEXT(_L8("Getting CSY from CommDB"));
|
|
230 |
(void)User::LeaveIfError(iPhoneGlobals->iConfiguration->ConfigModemString(TPtrC(KCDTypeNameCsyName),csy));
|
|
231 |
|
|
232 |
LOGTEXT(_L8("Getting PORT from CommDB"));
|
|
233 |
(void)User::LeaveIfError(iPhoneGlobals->iConfiguration->ConfigModemString(TPtrC(KCDTypeNamePortName),port));
|
|
234 |
|
|
235 |
if(!iIo)
|
|
236 |
iIo=CATIO::NewL(csy,port,iPhoneGlobals->iPhoneStatus.iPortAccess);
|
|
237 |
|
|
238 |
if(!iWaitForCall)
|
|
239 |
iWaitForCall=CATWaitForCall::NewL(iIo,this,iPhoneGlobals);
|
|
240 |
|
|
241 |
if(!iErrorHandler)
|
|
242 |
iErrorHandler = CATErrorHandler::NewL(iPhoneGlobals,iWaitForCall);
|
|
243 |
|
|
244 |
iIo->SetErrorHandler(iErrorHandler);
|
|
245 |
|
|
246 |
if(!iInit)
|
|
247 |
iInit=CATInit::NewL(iIo,this,iPhoneGlobals);
|
|
248 |
|
|
249 |
FlowControlSuspend();
|
|
250 |
iInit->SpecialStart();
|
|
251 |
|
|
252 |
return KErrNone;
|
|
253 |
}
|
|
254 |
|
|
255 |
TInt CPhoneHayes::ExtFunc(const TTsyReqHandle,const TInt, const TDataPackage&)
|
|
256 |
//
|
|
257 |
// Extensions aren't supported in this TSY
|
|
258 |
//
|
|
259 |
{
|
|
260 |
return KErrNotSupported;
|
|
261 |
}
|
|
262 |
|
|
263 |
TInt CPhoneHayes::CheckAndSetRegistrationParams(const TInt /*aIpc*/,const TDes8* /*aDes1*/,const TDes8* /*aDes2*/)
|
|
264 |
{
|
|
265 |
return KErrNotSupported;
|
|
266 |
}
|
|
267 |
|
|
268 |
//
|
|
269 |
// Implemented Phone Functions
|
|
270 |
//
|
|
271 |
CTelObject* CPhoneHayes::OpenNewObjectByNameL(const TDesC& aName)
|
|
272 |
//
|
|
273 |
// Open a new line. Opens fax line even if phone does not support it, as that information
|
|
274 |
// may not be available (init sequence may not have reached that far.)
|
|
275 |
//
|
|
276 |
{
|
|
277 |
if (!aName.CompareF(KDataLineName))
|
|
278 |
{
|
|
279 |
__ASSERT_ALWAYS(iDataLine==NULL,Panic(ELineAlreadyExists));
|
|
280 |
iDataLine=CLineMobileData::NewL(iIo,iInit,iPhoneGlobals,aName);
|
|
281 |
if (iPhoneGlobals->iPhoneStatus.iLineStatus == RCall::EStatusUnknown)
|
|
282 |
iPhoneGlobals->iPhoneStatus.iLineStatus = RCall::EStatusIdle;
|
|
283 |
return iDataLine;
|
|
284 |
}
|
|
285 |
|
|
286 |
else if (!aName.CompareF(KVoiceLineName)) //Added for Java Demo 4.4.99
|
|
287 |
{
|
|
288 |
__ASSERT_ALWAYS(iVoiceLine==NULL,Panic(ELineAlreadyExists));
|
|
289 |
iVoiceLine=CLineMobileVoice::NewL(iIo,iInit,iPhoneGlobals,aName);
|
|
290 |
if (iPhoneGlobals->iPhoneStatus.iLineStatus == RCall::EStatusUnknown)
|
|
291 |
iPhoneGlobals->iPhoneStatus.iLineStatus = RCall::EStatusIdle;
|
|
292 |
return iVoiceLine;
|
|
293 |
}
|
|
294 |
else
|
|
295 |
{
|
|
296 |
User::Leave(KErrNotFound);
|
|
297 |
return NULL;
|
|
298 |
}
|
|
299 |
}
|
|
300 |
|
|
301 |
CTelObject* CPhoneHayes::OpenNewObjectL(TDes&)
|
|
302 |
{
|
|
303 |
User::Leave(KErrNotSupported);
|
|
304 |
return NULL;
|
|
305 |
}
|
|
306 |
|
|
307 |
CTelObject::TReqMode CPhoneHayes::ReqModeL(const TInt aIpc)
|
|
308 |
{
|
|
309 |
TReqMode reqMode = CPhoneBase::ReqModeL(aIpc);
|
|
310 |
if ((reqMode & KReqModeFlowControlObeyed) && iPhoneGlobals->iPhoneStatus.iDataPortLoaned)
|
|
311 |
{
|
|
312 |
LOGTEXT2(_L8("ReqModeL Leaving with KErrInUse as data port is loaned (aIpc=%d)"),aIpc);
|
|
313 |
User::Leave(KErrInUse);
|
|
314 |
}
|
|
315 |
|
|
316 |
return reqMode;
|
|
317 |
}
|
|
318 |
|
|
319 |
TInt CPhoneHayes::RegisterNotification(const TInt /*aIpc*/)
|
|
320 |
{
|
|
321 |
return KErrNone;
|
|
322 |
}
|
|
323 |
TInt CPhoneHayes::DeregisterNotification(const TInt /*aIpc*/)
|
|
324 |
{
|
|
325 |
return KErrNone;
|
|
326 |
}
|
|
327 |
|
|
328 |
void CPhoneHayes::Init()
|
|
329 |
//
|
|
330 |
// Automatic start-up initialise function, doesn't call an AT command on completion
|
|
331 |
// Re-implemented because modem must be initialised before any RING comes in
|
|
332 |
//
|
|
333 |
{
|
|
334 |
}
|
|
335 |
|
|
336 |
TInt CPhoneHayes::ControlledInitialisation(const TTsyReqHandle aTsyReqHandle)
|
|
337 |
/*
|
|
338 |
* If the phone is already initialised, then there's nothing to do. However, if for some
|
|
339 |
* reason the phone has not been successfully initialised, but the port is not available
|
|
340 |
* (e.g. it may be loaned) then just return KErrAccessDenied.
|
|
341 |
* If none of the cases above apply then proceed with the initialisation as usual.
|
|
342 |
*/
|
|
343 |
{
|
|
344 |
if(iPhoneGlobals->iPhoneStatus.iInitStatus==EPhoneInitialised) // This also fixes defect MPO-4ZECUN
|
|
345 |
{
|
|
346 |
LOGTEXT(_L8("CPhoneHayes::ControlledInitialisation\tPhone has been initialised - Completing request."));
|
|
347 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
348 |
return KErrNone;
|
|
349 |
}
|
|
350 |
|
|
351 |
if(iPhoneGlobals->iPhoneStatus.iPortAccess==EPortAccessDenied)
|
|
352 |
{
|
|
353 |
LOGTEXT(_L8("CPhoneHayes::ControlledInitialisation\tPort Access Denied flag detected"));
|
|
354 |
ReqCompleted(aTsyReqHandle,KErrAccessDenied);
|
|
355 |
return KErrNone;
|
|
356 |
}
|
|
357 |
|
|
358 |
if(iInit==NULL)
|
|
359 |
{
|
|
360 |
LOGTEXT(_L8("CPhoneHayes::ControlledInitialisation\tPort Access Denied flag detected"));
|
|
361 |
ReqCompleted(aTsyReqHandle,KErrHardwareNotAvailable);
|
|
362 |
return KErrNone;
|
|
363 |
}
|
|
364 |
|
|
365 |
TInt aError;
|
|
366 |
if (iInit->JustInitialised(aError))
|
|
367 |
ReqCompleted(aTsyReqHandle,aError);
|
|
368 |
else
|
|
369 |
iInit->SpecialStart(aTsyReqHandle);
|
|
370 |
|
|
371 |
return KErrNone;
|
|
372 |
}
|
|
373 |
|
|
374 |
TInt CPhoneHayes::ControlledInitialisationCancel(const TTsyReqHandle aTsyReqHandle)
|
|
375 |
{
|
|
376 |
iInit->StopInit(aTsyReqHandle);
|
|
377 |
return KErrNone;
|
|
378 |
}
|
|
379 |
|
|
380 |
TInt CPhoneHayes::NotifyCapsChange(const TTsyReqHandle aTsyReqHandle, RPhone::TCaps* /*aCaps*/)
|
|
381 |
{
|
|
382 |
// iPhoneGlobals->iNotificationStore->RegisterNotification(EPhoneGeneral,aTsyReqHandle,this,aPhoneInfo);
|
|
383 |
ReqCompleted(aTsyReqHandle,KErrNotSupported);
|
|
384 |
return KErrNone;
|
|
385 |
}
|
|
386 |
|
|
387 |
TInt CPhoneHayes::NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
388 |
{
|
|
389 |
// iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
|
|
390 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
391 |
return KErrNone;
|
|
392 |
}
|
|
393 |
|
|
394 |
TInt CPhoneHayes::NotifyModemDetected(const TTsyReqHandle aTsyReqHandle, RPhone::TModemDetection* aDetection)
|
|
395 |
//
|
|
396 |
// This request will be completed when the phone's connection status changes
|
|
397 |
//
|
|
398 |
{
|
|
399 |
LOGTEXT(_L8("Phone:\tDetection Change Notification lodged"));
|
|
400 |
iPhoneGlobals->iNotificationStore->RegisterNotification(EModemDetection,aTsyReqHandle,this,aDetection);
|
|
401 |
return KErrNone;
|
|
402 |
}
|
|
403 |
|
|
404 |
TInt CPhoneHayes::NotifyModemDetectedCancel(const TTsyReqHandle aTsyReqHandle)
|
|
405 |
//
|
|
406 |
// Cancel outstanding modem detection notification, by TSY handle
|
|
407 |
//
|
|
408 |
{
|
|
409 |
LOGTEXT(_L8("Phone:\tDetection Change Notification cancelled"));
|
|
410 |
iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
|
|
411 |
return KErrNone;
|
|
412 |
}
|
|
413 |
|
|
414 |
TInt CPhoneHayes::GetInfo(const TTsyReqHandle aTsyReqHandle, RPhone::TPhoneInfo* aPhoneInfo)
|
|
415 |
{
|
|
416 |
aPhoneInfo->iDetection = iPhoneGlobals->iPhoneStatus.iModemDetected;
|
|
417 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
418 |
return KErrNone;
|
|
419 |
}
|
|
420 |
|
|
421 |
TInt CPhoneHayes::GetCaps(const TTsyReqHandle aTsyReqHandle, RPhone::TCaps* aCaps)
|
|
422 |
//
|
|
423 |
// Get the phone capabilities
|
|
424 |
//
|
|
425 |
{
|
|
426 |
LOGTEXT(_L8("Phone:\tExecuting Get Caps"));
|
|
427 |
aCaps->iFlags = iPhoneGlobals->iPhoneStatus.iDataAndFaxFlags;
|
|
428 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
429 |
return KErrNone;
|
|
430 |
}
|
|
431 |
|
|
432 |
TInt CPhoneHayes::GetStatus(const TTsyReqHandle aTsyReqHandle,RPhone::TStatus* aStatus)
|
|
433 |
//
|
|
434 |
// Get the phone status
|
|
435 |
//
|
|
436 |
{
|
|
437 |
LOGTEXT(_L8("Phone:\tExecuting Get Status"));
|
|
438 |
aStatus->iMode = iPhoneGlobals->iPhoneStatus.iMode;
|
|
439 |
aStatus->iModemDetected = iPhoneGlobals->iPhoneStatus.iModemDetected;
|
|
440 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
441 |
return KErrNone;
|
|
442 |
}
|
|
443 |
|
|
444 |
TInt CPhoneHayes::EnumerateLines(const TTsyReqHandle aTsyReqHandle, TInt* aParams)
|
|
445 |
//
|
|
446 |
// Enumerate the lines
|
|
447 |
//
|
|
448 |
{
|
|
449 |
LOGTEXT(_L8("Phone:\tSubmitting Enumerate Lines"));
|
|
450 |
*aParams = KNumberOfLines;
|
|
451 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
452 |
return KErrNone;
|
|
453 |
}
|
|
454 |
|
|
455 |
TInt CPhoneHayes::GetLineInfo(const TTsyReqHandle aTsyReqHandle, TLineInfoIndex* aParams)
|
|
456 |
//
|
|
457 |
// TLineInfoIndex specifies which of the two lines' info is requested. If that line has not
|
|
458 |
// been created yet, default info is passed back.
|
|
459 |
//
|
|
460 |
{
|
|
461 |
LOGTEXT(_L8("Phone:\tGet Line Info"));
|
|
462 |
if (aParams->iIndex==KDataLineIndex)
|
|
463 |
{
|
|
464 |
if (iDataLine!=NULL)
|
|
465 |
{
|
|
466 |
aParams->iInfo.iStatus = iPhoneGlobals->iPhoneStatus.iLineStatus;
|
|
467 |
aParams->iInfo.iName = iDataLine->iLineName;
|
|
468 |
aParams->iInfo.iLineCapsFlags = (RLine::KCapsData|RLine::KCapsEventIncomingCall);
|
|
469 |
}
|
|
470 |
else
|
|
471 |
{
|
|
472 |
aParams->iInfo = iDefaultDataLineInfo;
|
|
473 |
}
|
|
474 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
475 |
}
|
|
476 |
else if (aParams->iIndex==KVoiceLineIndex)
|
|
477 |
{
|
|
478 |
if (iVoiceLine!=NULL)
|
|
479 |
{
|
|
480 |
aParams->iInfo.iStatus = iPhoneGlobals->iPhoneStatus.iLineStatus;
|
|
481 |
aParams->iInfo.iName = iVoiceLine->iLineName;
|
|
482 |
aParams->iInfo.iLineCapsFlags = (RLine::KCapsVoice|RLine::KCapsEventIncomingCall);
|
|
483 |
}
|
|
484 |
else
|
|
485 |
{
|
|
486 |
aParams->iInfo = iDefaultVoiceLineInfo;
|
|
487 |
}
|
|
488 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
489 |
}
|
|
490 |
else
|
|
491 |
{
|
|
492 |
ReqCompleted(aTsyReqHandle,KErrNotFound);
|
|
493 |
}
|
|
494 |
return KErrNone;
|
|
495 |
}
|
|
496 |
|
|
497 |
void CPhoneHayes::RemoveLine(CLineHayes* aLineHayes)
|
|
498 |
//
|
|
499 |
// When a line closes, it calls this to remove its pointer from CPhoneHayes
|
|
500 |
//
|
|
501 |
{
|
|
502 |
if (aLineHayes == iDataLine)
|
|
503 |
iDataLine=NULL;
|
|
504 |
if (aLineHayes == iVoiceLine)
|
|
505 |
iVoiceLine=NULL;
|
|
506 |
}
|
|
507 |
|
|
508 |
void CPhoneHayes::StartWaitForRing()
|
|
509 |
{
|
|
510 |
iWaitForCall->StartWait();
|
|
511 |
}
|
|
512 |
|
|
513 |
void CPhoneHayes::SetCallRinging(TInt aIndex)
|
|
514 |
//
|
|
515 |
// If a call has had AnswerIncomingCall() called on it, this will be used to answer immediately.
|
|
516 |
// If a NotifyIncomingCall has been called on a line, use PreAlloc call on it and complete notify.
|
|
517 |
//
|
|
518 |
// Returns ETrue if a call has begun to answer, otherwise EFalse
|
|
519 |
{
|
|
520 |
_LIT16(KNokiaMatchString,"*Nokia*");
|
|
521 |
TBool nokiaPhone=(iPhoneGlobals->iPhoneId.iManufacturer.MatchF(KNokiaMatchString)==0);
|
|
522 |
|
|
523 |
// If its not a Nokia Phone or its an incoming voice or fax call (i.e. anything other than data)
|
|
524 |
// then do the proper thing...
|
|
525 |
if((!nokiaPhone)||(aIndex==KVoiceLineIndex)||(aIndex==KFaxLineIndex))
|
|
526 |
{
|
|
527 |
CLineHayes* line=NULL;
|
|
528 |
switch (aIndex)
|
|
529 |
{
|
|
530 |
case KDataLineIndex:
|
|
531 |
line=iDataLine;
|
|
532 |
break;
|
|
533 |
case KVoiceLineIndex:
|
|
534 |
line=iVoiceLine;
|
|
535 |
break;
|
|
536 |
default:
|
|
537 |
return;
|
|
538 |
};
|
|
539 |
|
|
540 |
if (line==NULL)
|
|
541 |
{
|
|
542 |
LOGTEXT(_L8("No line has been opened"));
|
|
543 |
return;
|
|
544 |
}
|
|
545 |
LOGTEXT(_L8("Calling AnswerIfPossible on line"));
|
|
546 |
if (line->AnswerIfPossible())
|
|
547 |
return;
|
|
548 |
LOGTEXT(_L8("Calling SetPreAllocCall on line"));
|
|
549 |
line->SetPreAllocCall();
|
|
550 |
return;
|
|
551 |
}
|
|
552 |
else
|
|
553 |
{
|
|
554 |
// Otherwise we need to handle the Nokia's ambiguous data call signal: it could actually be
|
|
555 |
// data or fax
|
|
556 |
LOGTEXT(_L8("SetCallRinging()\tDetected an incoming data call on a Nokia phone"));
|
|
557 |
SetAmbiguousDataFaxCallRinging();
|
|
558 |
return;
|
|
559 |
}
|
|
560 |
}
|
|
561 |
|
|
562 |
void CPhoneHayes::SetAmbiguousDataFaxCallRinging()
|
|
563 |
//
|
|
564 |
// Answer or set a call or line as ringing when the string from the modem could either
|
|
565 |
// indicate it is a data call or a fax call. The algorithm below has to make a decision
|
|
566 |
// based on ETel clients behaviour as to whether the incoming call should be treated as
|
|
567 |
// data or fax.
|
|
568 |
//
|
|
569 |
{
|
|
570 |
if((iDataLine)&&(iDataLine->AnswerIfPossible())) // First priority: if we're waiting for a Data call, answer it
|
|
571 |
{
|
|
572 |
LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tInterpretting as data call"));
|
|
573 |
return;
|
|
574 |
}
|
|
575 |
// So both lines MIGHT exist. It's then down to Notify on incoming call notifications,
|
|
576 |
// and we'll make a priority call in favour of data...
|
|
577 |
// First ensure that either a Data line or a Fax line does exist (Nokia 7110 fix: returns
|
|
578 |
// +CRING: REL ASYNC for a voice call (hence a voice line is created). This response
|
|
579 |
// however, is correctly treated as an incoming indication for a Data or Fax call).
|
|
580 |
if (iDataLine)
|
|
581 |
{
|
|
582 |
LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tA DataLine has been found. Now checking for an outstanding Notification"));
|
|
583 |
|
|
584 |
if(iDataLine->IsNotifyIncomingCallOutstanding())
|
|
585 |
{
|
|
586 |
LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNotify: SetPreAllocCall on DataLine"));
|
|
587 |
iDataLine->SetPreAllocCall();
|
|
588 |
}
|
|
589 |
}
|
|
590 |
else
|
|
591 |
LOGTEXT(_L8("SetAmbiguousDataFaxCallRinging()\tNo DataLine has been found; this may be a voice call"));
|
|
592 |
}
|
|
593 |
|
|
594 |
void CPhoneHayes::StopRinging()
|
|
595 |
{
|
|
596 |
if (iDataLine)
|
|
597 |
{
|
|
598 |
(void)iDataLine->StopMyCallRinging();
|
|
599 |
iDataLine->ResetPreAllocCall(); // this may not revert the call to PreAlloc status as
|
|
600 |
// the call may have been opened by a client but not
|
|
601 |
// answered.
|
|
602 |
}
|
|
603 |
if (iVoiceLine)
|
|
604 |
{
|
|
605 |
(void)iVoiceLine->StopMyCallRinging();
|
|
606 |
iVoiceLine->ResetPreAllocCall(); // ditto
|
|
607 |
}
|
|
608 |
}
|
|
609 |
|
|
610 |
void CPhoneHayes::StopRingCounter() const
|
|
611 |
{
|
|
612 |
iPhoneGlobals->iNotificationStore->RemoveEventFromLastEvents(ERingOccurred);
|
|
613 |
iWaitForCall->ResetRingCounter();
|
|
614 |
}
|
|
615 |
|
|
616 |
void CPhoneHayes::SetHookStatus(RCall::THookStatus aHookStatus)
|
|
617 |
{
|
|
618 |
if (iDataLine)
|
|
619 |
iDataLine->SetCallsHookStatus(aHookStatus);
|
|
620 |
|
|
621 |
}
|
|
622 |
|
|
623 |
TBool CPhoneHayes::CheckForOutstandingAnswer() const
|
|
624 |
//
|
|
625 |
// Returns TRUE if any call in the system has AnswerIncomingCall() outstanding on it.
|
|
626 |
//
|
|
627 |
{
|
|
628 |
TBool check=EFalse;
|
|
629 |
if (iDataLine)
|
|
630 |
check = iDataLine->CheckForOutstandingAnswer();
|
|
631 |
|
|
632 |
if (!check && iVoiceLine)
|
|
633 |
check = iVoiceLine->CheckForOutstandingAnswer();
|
|
634 |
return check;
|
|
635 |
}
|
|
636 |
|
|
637 |
void CPhoneHayes::CancelOtherRingingCall(CLineHayes* aLine) const
|
|
638 |
{
|
|
639 |
if (iDataLine && aLine!=iDataLine)
|
|
640 |
{
|
|
641 |
(void)iDataLine->StopMyCallRinging();
|
|
642 |
iDataLine->ResetPreAllocCall();
|
|
643 |
}
|
|
644 |
if (iVoiceLine && aLine!=iVoiceLine)
|
|
645 |
{
|
|
646 |
(void)iVoiceLine->StopMyCallRinging();
|
|
647 |
iVoiceLine->ResetPreAllocCall();
|
|
648 |
}
|
|
649 |
}
|
|
650 |
|
|
651 |
const CArrayFixFlat<TInt>* CPhoneHayes::ArrayOfMemberDataSizes(const TInt /*aIpc*/) const
|
|
652 |
{
|
|
653 |
return iSizeOfMemberData;
|
|
654 |
}
|