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 |
// AT Command TSY Standard Header
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalAll
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifndef __ATSTD_H__
|
|
24 |
#define __ATSTD_H__
|
|
25 |
|
|
26 |
#include <etel.h>
|
|
27 |
#include <etelmm.h>
|
|
28 |
#include <etelqos.h>
|
|
29 |
#include "panic.h" // for panic codes and function
|
|
30 |
/**
|
|
31 |
@internalComponent
|
|
32 |
*/
|
|
33 |
const TInt KLengthOfGuardTime=50; // in 1/50ths of a second
|
|
34 |
const TInt KDefaultSecondsToWaitForCarrier=40;
|
|
35 |
const TInt KExtraWaitTime=4000; // in milliseconds
|
|
36 |
const TInt KMaxNoChecks=3;
|
|
37 |
const TInt KTimeForExtraRxData=500;
|
|
38 |
const TInt KDefaultPauseInterval=5;
|
|
39 |
const TInt KTimeBetweenRings=7000000; // in microseconds
|
|
40 |
const TInt KDelayForModemSettleAfterRing=500; // in milliseconds
|
|
41 |
const TInt KMinTimeForSuccessfulInit=2000000; // in microseconds
|
|
42 |
const TInt KMinTimeForSuccessfulPreConnectInit=1000000; // in microseconds
|
|
43 |
const TInt KMaxLengthOfUserDefinedInitString=50; // Chosen because this is the max length of a "short" CommDb text entry
|
|
44 |
const TInt KDefaultAutoAnswer=0;
|
|
45 |
const TInt KFaxCaps=(RPhone::KCapsFaxClassOne | RPhone::KCapsFaxClassTwo | RPhone::KCapsFaxClassTwoPointZero);
|
|
46 |
const TInt KOneSecondPause=1000; // in milliseconds
|
|
47 |
const TInt KCallTimerInterval=1000000; // in microseconds
|
|
48 |
|
|
49 |
/**
|
|
50 |
CMS Error Codes
|
|
51 |
@internalComponent
|
|
52 |
*/
|
|
53 |
const TInt KErrCmsMe=300;
|
|
54 |
const TInt KErrCmsUndefined=500;
|
|
55 |
/**
|
|
56 |
@internalComponent
|
|
57 |
*/
|
|
58 |
_LIT(KDataLineName,"Data");
|
|
59 |
_LIT(KFaxLineName,"Fax");
|
|
60 |
_LIT(KDataCallName,"DataCall");
|
|
61 |
_LIT(KFaxCallName,"FaxCall");
|
|
62 |
_LIT(KFaxModuleName,"FaxSvr.DLL");
|
|
63 |
_LIT(KModuleName,"HAYES");
|
|
64 |
_LIT(KsmsName,"Sms");
|
|
65 |
_LIT(KVoiceLineName,"Voice");
|
|
66 |
_LIT(KVoiceCallName,"VoiceCall");
|
|
67 |
/**
|
|
68 |
@internalComponent
|
|
69 |
*/
|
|
70 |
const TInt KFaxLineIndex=0;
|
|
71 |
const TInt KDataLineIndex=1;
|
|
72 |
const TInt KVoiceLineIndex=2;
|
|
73 |
const TInt KNumberOfLines=3;
|
|
74 |
|
|
75 |
|
|
76 |
/**
|
|
77 |
Command strings
|
|
78 |
@internalComponent
|
|
79 |
*/
|
|
80 |
_LIT8(KATCommand,"AT\r");
|
|
81 |
_LIT8(KAT2Command,"AT");
|
|
82 |
_LIT8(KATAndStringFormatString,"AT%S\r");
|
|
83 |
_LIT8(KReturnATCommand,"\rAT");
|
|
84 |
_LIT8(KHangUpCommand,"ATH");
|
|
85 |
_LIT8(KDialCommand,"ATD");
|
|
86 |
_LIT8(KDialDataCommandFormat,"ATD%S\r");
|
|
87 |
_LIT8(KDialVoiceCommandFormat,"ATD%S;\r");
|
|
88 |
_LIT8(KAnswerCommand,"ATA");
|
|
89 |
_LIT8(KDataClassCommand,"AT+FCLASS=0");
|
|
90 |
_LIT8(KGetPhoneCapsCommand,"AT+FCLASS=?");
|
|
91 |
_LIT8(KAutoAnswerCommand,"ATS0=");
|
|
92 |
_LIT8(KGetCarrierWaitTimeCommand,"ATS7?");
|
|
93 |
|
|
94 |
|
|
95 |
/**
|
|
96 |
Expected modem responses
|
|
97 |
@internalComponent
|
|
98 |
*/
|
|
99 |
_LIT8(KCarrierString, "CONNECT");
|
|
100 |
_LIT8(KNoCarrierString,"NO CARRIER");
|
|
101 |
_LIT8(KCallMonitoringEventString,"?ECAV: ?,0*"); // For Ericsson Phones that don't return NO CARRIER on Voice calls
|
|
102 |
_LIT8(KRingString,"RING");
|
|
103 |
_LIT8(KOkString,"OK");
|
|
104 |
_LIT8(KErrorString,"ERROR");
|
|
105 |
_LIT8(KDelayedString,"DELAYED");
|
|
106 |
_LIT8(KNotifyMeIfErrorString,"QWERTY"); // so that CATBase-derived thing will always be notified if an IO error occurs
|
|
107 |
_LIT8(KOkAndCarriageReturnString,"OK");
|
|
108 |
|
|
109 |
|
|
110 |
/**
|
|
111 |
Fax class strings
|
|
112 |
@internalComponent
|
|
113 |
*/
|
|
114 |
_LIT8(KZeroString,"0");
|
|
115 |
_LIT8(KOneString,"1");
|
|
116 |
_LIT8(KOnePointZeroString,"1.0");
|
|
117 |
_LIT8(KTwoString,"2");
|
|
118 |
_LIT8(KTwoPointZeroString,"2.0");
|
|
119 |
_LIT8(KTwoPointOneString,"2.1");
|
|
120 |
|
|
121 |
|
|
122 |
/**
|
|
123 |
Gprs strings
|
|
124 |
@internalComponent
|
|
125 |
*/
|
|
126 |
_LIT8(KMSClassA, "\"A\"");
|
|
127 |
_LIT8(KMSClassB, "\"B\"");
|
|
128 |
_LIT8(KMSClassCAlternateMode, "\"CA\"");
|
|
129 |
_LIT8(KMSClassCGPRSOnly, "\"CG\"");
|
|
130 |
_LIT8(KMSClassCCircuitSwitchedOnly, "\"CC\"");
|
|
131 |
|
|
132 |
|
|
133 |
/**
|
|
134 |
General strings for TSY
|
|
135 |
@internalComponent
|
|
136 |
*/
|
|
137 |
_LIT8(KCarriageReturn,"\r");
|
|
138 |
_LIT8(KEscapeChar,"\x1b");
|
|
139 |
_LIT8(KEqualsSign,"=");
|
|
140 |
_LIT8(KStringAndIntegerFormatString,"%S%d\r");
|
|
141 |
_LIT8(KStringFormatString,"%S\r");
|
|
142 |
_LIT8(KStringAndStringFormatString,"%S%S\r");
|
|
143 |
_LIT8(KThreeStringFormatString,"%S%S%S\r");
|
|
144 |
_LIT8(KDblQuoteChar,"\"");
|
|
145 |
_LIT8(KPlusChar,"+");
|
|
146 |
_LIT8(KCommaChar,",");
|
|
147 |
_LIT8(KCtrlZChar,"\032");
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
/**
|
|
152 |
@internalComponent
|
|
153 |
*/
|
|
154 |
enum TPortAccess
|
|
155 |
{
|
|
156 |
EPortAccessAllowed,
|
|
157 |
EPortAccessDenied
|
|
158 |
};
|
|
159 |
/**
|
|
160 |
@internalComponent
|
|
161 |
*/
|
|
162 |
enum TPhoneInitStatus
|
|
163 |
{
|
|
164 |
EPhoneNotInitialised,
|
|
165 |
EPhoneInitialising,
|
|
166 |
EPhoneInitialiseCancelling,
|
|
167 |
EPhoneInitialised
|
|
168 |
};
|
|
169 |
/**
|
|
170 |
@internalComponent
|
|
171 |
*/
|
|
172 |
typedef TBuf8<2> TStorageType;
|
|
173 |
/**
|
|
174 |
@internalComponent
|
|
175 |
*/
|
|
176 |
struct TPhoneStatusTSY
|
|
177 |
{
|
|
178 |
RPhone::TModemDetection iModemDetected;
|
|
179 |
RPhone::TMode iMode;
|
|
180 |
TUint iDataAndFaxFlags;
|
|
181 |
TPhoneInitStatus iInitStatus;
|
|
182 |
RCall::TStatus iLineStatus; // Used for all lines as physically there is only one line
|
|
183 |
TPortAccess iPortAccess;
|
|
184 |
TInt iWaitForCarrierTime;
|
|
185 |
TBool iDataPortLoaned;
|
|
186 |
TUint iSupportedPhoneBookStorageFlag;
|
|
187 |
TInt iSupportedPhoneBookCount;
|
|
188 |
TStorageType iLastAccessedPhoneBook;
|
|
189 |
TBool iNetworkChanged;
|
|
190 |
RMobilePhone::TMobilePhoneRegistrationStatus iRegistrationStatus;
|
|
191 |
RMobilePhone::TMobilePhoneLocationAreaV1 iLocationArea;
|
|
192 |
RMobilePhone::TMobilePhoneNetworkInfoV1 iCurrentNetwork;
|
|
193 |
|
|
194 |
};
|
|
195 |
|
|
196 |
// Forward class declarations (as CPhoneGlobals holds pointers to these classes)
|
|
197 |
class CTsyConfig;
|
|
198 |
class CNotifications;
|
|
199 |
class CATWaitForMessageArrived;
|
|
200 |
class CATHandleCmtArrived;
|
|
201 |
class CATSmsMessagingRead;
|
|
202 |
class CATNetworkInfo;
|
|
203 |
class CReceiveSmsQueue;
|
|
204 |
|
|
205 |
class CPhoneGlobals : public CBase
|
|
206 |
/**
|
|
207 |
This class is used by nearly all CATCommands dervied classes
|
|
208 |
as a general storage place for TSY global values.
|
|
209 |
|
|
210 |
If this TSY was better designed, there should be no need for this class.
|
|
211 |
@internalComponent
|
|
212 |
*/
|
|
213 |
{
|
|
214 |
public:
|
|
215 |
static CPhoneGlobals* NewL(TBool aExplicit =EFalse); // Factory function
|
|
216 |
~CPhoneGlobals(); // destructor
|
|
217 |
|
|
218 |
public:
|
|
219 |
// Utility functions
|
|
220 |
static TBool IsWriteAccess(TStorageType aStorageType);
|
|
221 |
inline void SetUnreadMsgPtr(CATSmsMessagingRead* aATSmsMessagingRead);
|
|
222 |
void CheckForUnreadMessages();
|
|
223 |
inline void SetChangeOfNetworkPtr(CATNetworkInfo* aATNetworkInfo);
|
|
224 |
void CheckForChangeOfNetwork();
|
|
225 |
TInt ConvertFromUnicode(TDes8& aMEString, const TDesC16& aUnicode) const;
|
|
226 |
TInt ConvertToUnicode(TDes16& aUnicode, const TDesC8& aMEString) const;
|
|
227 |
|
|
228 |
public:
|
|
229 |
// TSY Global data
|
|
230 |
TPhoneStatusTSY iPhoneStatus;
|
|
231 |
CNotifications* iNotificationStore;
|
|
232 |
CTsyConfig* iConfiguration;
|
|
233 |
|
|
234 |
TStorageType iPhonePrefMem;
|
|
235 |
RMobilePhone::TMobilePhoneIdentityV1 iPhoneId;
|
|
236 |
|
|
237 |
enum TPhoneSmsPduStd
|
|
238 |
{
|
|
239 |
EPhoneTestUndefined,
|
|
240 |
EPhoneTestNewStandard,
|
|
241 |
EPhoneTestOldStandard
|
|
242 |
};
|
|
243 |
|
|
244 |
struct TMsgLocation
|
|
245 |
{
|
|
246 |
TInt iIndex;
|
|
247 |
TName iStoreName;
|
|
248 |
};
|
|
249 |
|
|
250 |
TPhoneSmsPduStd iPhoneTestState;
|
|
251 |
CATHandleCmtArrived* iCmtArrived;
|
|
252 |
|
|
253 |
TBool iSmsPduModeSupported;
|
|
254 |
|
|
255 |
CATSmsMessagingRead* iATSmsMessagingRead;
|
|
256 |
CATNetworkInfo* iATNetworkInfo;
|
|
257 |
|
|
258 |
TUint32 iBatteryCaps;
|
|
259 |
TUint32 iSignalCaps;
|
|
260 |
TUint32 iPhoneIdCaps;
|
|
261 |
TUint32 iSubscriberIdCaps;
|
|
262 |
TUint32 iNetworkCaps;
|
|
263 |
RMobilePhone::TMobilePhoneNetworkMode iNetworkMode;
|
|
264 |
|
|
265 |
// CATBase flow control flag.
|
|
266 |
// This flag is true when an AT command is writing to the serial port and thus
|
|
267 |
// no other AT command should write to the serial port.
|
|
268 |
// Generally setting and clearing of this flag is done in CATBAse::ExecuteCommand.
|
|
269 |
// Some special case AT commands implement their own flow control.
|
|
270 |
TBool iEventSignalActive;
|
|
271 |
|
|
272 |
// We have a copy of a pointer to the CReceiveSmsQueue object (owned by CMobileSmsMessaging)
|
|
273 |
// as when CATCommands::Complete is called we need to prod the CReceiveSmsQueue
|
|
274 |
// object to let it know that it is safe for it to read any PDUs that it needs
|
|
275 |
// from the phones memory.
|
|
276 |
CReceiveSmsQueue* iReceiveSmsQueuePtr; // This class does not own this object
|
|
277 |
// Gprs capabilities
|
|
278 |
TInt iGprsMaxNumContexts;
|
|
279 |
RPacketService::TMSClass iMSClass;
|
|
280 |
RPacketService::TMSClass iMaxMSClass;
|
|
281 |
RPacketService::TStatus iGprsStatus;
|
|
282 |
RPacketService::TRegistrationStatus iGprsRegistrationStatus;
|
|
283 |
RPacketQoS::TQoSCapsGPRS iStaticQoSCaps;
|
|
284 |
|
|
285 |
//
|
|
286 |
// Modem's SMS receiving capabiltiies.
|
|
287 |
// These values set during the initialisation of the TSY
|
|
288 |
TBool iModemSupportsCMTIMode;
|
|
289 |
TBool iModemSupportsCMTMode;
|
|
290 |
TBool iModemSupportsCSCAMode;
|
|
291 |
|
|
292 |
//
|
|
293 |
// Modem's GPRS capabiltiies.
|
|
294 |
// These values set during the initialisation of the TSY
|
|
295 |
TBool iModemSupportsCGREGNotification;
|
|
296 |
|
|
297 |
//
|
|
298 |
// Data call capabilities (found out using +CBST=? in ATINIT)
|
|
299 |
RMobileCall::TMobileCallDataCapsV1 iCallDataCaps;
|
|
300 |
|
|
301 |
private:
|
|
302 |
void ConstructL(TBool aExplicit); // 2nd stage constructor
|
|
303 |
};
|
|
304 |
/**
|
|
305 |
@internalComponent
|
|
306 |
*/
|
|
307 |
enum TPanicOccurred
|
|
308 |
{
|
|
309 |
ENoPanicOccurred,
|
|
310 |
EPanicOccurredWithoutDataPortLoan,
|
|
311 |
EPanicOccurredDuringDataPortLoan
|
|
312 |
};
|
|
313 |
/**
|
|
314 |
@internalComponent
|
|
315 |
*/
|
|
316 |
struct TCallInfoTSY
|
|
317 |
{
|
|
318 |
TName iCallName;
|
|
319 |
TName iLineOwnerName;
|
|
320 |
RMobileCall::TMobileCallStatus iMobileStatus;
|
|
321 |
TTime iTimeCallBegan;
|
|
322 |
RCall::TBearerService iBearerService;
|
|
323 |
RCall::THookStatus iHookStatus;
|
|
324 |
TPanicOccurred iClientPanicOccurred;
|
|
325 |
RCall::TMonitorSpeakerControl iSpeakerControl;
|
|
326 |
RCall::TMonitorSpeakerVolume iSpeakerVolume;
|
|
327 |
TInt iInterval;
|
|
328 |
RCall::TWaitForDialTone iWaitForDialTone;
|
|
329 |
TBool iLoanedToClient;
|
|
330 |
RMobileCall::TMobileHscsdCallParamsV1 iCallParams; // just moved DJN
|
|
331 |
};
|
|
332 |
|
|
333 |
inline void CPhoneGlobals::SetUnreadMsgPtr(CATSmsMessagingRead* aATSmsMessagingRead)
|
|
334 |
{
|
|
335 |
iATSmsMessagingRead = aATSmsMessagingRead;
|
|
336 |
}
|
|
337 |
|
|
338 |
inline void CPhoneGlobals::SetChangeOfNetworkPtr(CATNetworkInfo* aATNetworkInfo)
|
|
339 |
{
|
|
340 |
iATNetworkInfo = aATNetworkInfo;
|
|
341 |
}
|
|
342 |
|
|
343 |
#endif
|