|
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 Initialisation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalAll |
|
21 */ |
|
22 |
|
23 #ifndef __ATINIT_H__ |
|
24 #define __ATINIT_H__ |
|
25 |
|
26 #include <cdblen.h> |
|
27 #include "ATBASE.H" |
|
28 #include "mSMSMEM.H" |
|
29 |
|
30 class CATInit : public CATBase |
|
31 /** |
|
32 @internalTechnology |
|
33 */ |
|
34 { |
|
35 public: |
|
36 // Object instantiation method |
|
37 static CATInit* NewL(CATIO* aIo,CTelObject* aTelObject,CPhoneGlobals* aPhoneGlobals); |
|
38 |
|
39 // C++ destructor |
|
40 ~CATInit(); |
|
41 |
|
42 // Public API methods |
|
43 void StartInit(CATCommands* aPendingCommand, TTsyReqHandle aTsyReqHandle, TAny* aParams); |
|
44 void StopInit(TTsyReqHandle aTsyReqHandle); |
|
45 void SpecialStart(TTsyReqHandle aTsyReqHandle=NULL); |
|
46 TBool JustInitialised(TInt& aError) const; |
|
47 void Complete(TInt aError); |
|
48 CATSmsMemoryStorage* iEnumerate; |
|
49 TBool CheckActiveReqHandle(const TTsyReqHandle aTsyReqHandle); |
|
50 |
|
51 private: |
|
52 // C++ constructor and second stage construct |
|
53 CATInit(CATIO* aIo,CTelObject* aTelObject,CPhoneGlobals* aPhoneGlobals); |
|
54 void ConstructL(); |
|
55 |
|
56 // Methods inherited from CATBase |
|
57 virtual void EventSignal(TEventSource aSource); |
|
58 virtual void CompleteWithIOError(TEventSource aSource,TInt aStatus); |
|
59 |
|
60 // Class Utility Methods |
|
61 void InitAttempt(); |
|
62 void ParseWaitTimeL(); |
|
63 void ValidateATHExpectStringL(); |
|
64 void RetryOrFail(TBool aCommsErrorOccurred = EFalse); |
|
65 void ParsePhoneBearerServiceTypeL(); |
|
66 void ParsePhoneCapsL(); |
|
67 void ParseAnErroredPhoneCaps(); |
|
68 void ParsePhoneBookStorageL(); |
|
69 TInt GetIdentityResponse(); |
|
70 void DoGetIdentityResponseL(); |
|
71 TBool CheckResponse(TPtrC8 aResult); |
|
72 void CheckCMGFResponseL(); |
|
73 void ParseOperatorL(); |
|
74 void ParseCurrentMsClassL(); |
|
75 void ParseMaxMsClassL(); |
|
76 void ParseCGQREQResponseL(); |
|
77 void ParseCGATTResponseL(); |
|
78 void ParseCNMIResponseL(); |
|
79 void ParseCBSTResponseL(); |
|
80 void SetSpeedCaps(TInt aVal,RMobileCall::TMobileCallDataCapsV1& aCaps); |
|
81 void SetNameCaps(TInt aVal,RMobileCall::TMobileCallDataCapsV1& aCaps); |
|
82 void SetCECaps(TInt aVal,RMobileCall::TMobileCallDataCapsV1& aCaps); |
|
83 |
|
84 private: |
|
85 TUint iAttemptCnt; // For the entire initialise sequence |
|
86 TUint iRetryCounter; // For "AT" which is sent after the user-defined modem |
|
87 // init string |
|
88 CATCommands* iPendingCommand; // Which command to set going after initialisation |
|
89 TAny* iParams; |
|
90 CCommChatString* iExpectString; |
|
91 CCommChatString* iConnectExpectString; |
|
92 CCommChatString* iNoCarrierExpectString; |
|
93 TBool iInitJustCompleted; |
|
94 TInt iInitError; |
|
95 TBool iMoreInfoFlag; |
|
96 TBool iCGMIFlag; |
|
97 TBool iCGMMFlag; |
|
98 TBool iCGMRFlag; |
|
99 TBool iCGSNFlag; |
|
100 |
|
101 enum { |
|
102 EShortTimeOutFix, |
|
103 EWaitForDSR, |
|
104 EWaitForATHangUpWriteComplete, |
|
105 EWaitForATHangUpOK, |
|
106 EWaitForModemInitWrite, |
|
107 EWaitForModemInitOK, |
|
108 EWaitForATCheckWrite, |
|
109 EATWaitForATCheckOK, |
|
110 EWaitForATGetPhoneCapsWrite, |
|
111 EWaitForATGetPhoneCapsOK, |
|
112 EWaitForATStandardInitWrite, |
|
113 EWaitForATStandardInitOK, |
|
114 EWaitForATUnsolicitedFixWrite, |
|
115 EWaitForATUnsolicitedFixOK, |
|
116 EWaitForATCarrierWaitTimeWrite, |
|
117 EWaitForATCarrierWaitTimeOK, |
|
118 EWaitForATAutoAnswerTimeWrite, |
|
119 EWaitForATAutoAnswerTimeOK, |
|
120 EATWaitForSendingCMGFRequestWrite, |
|
121 EATWaitForSendingCMGFRequestComplete, |
|
122 EATWaitForSendingCMGFConfigureWrite, |
|
123 EATWaitForCMGFResponseOKComplete, |
|
124 EATWaitForSendingCNMIConfigRequest, |
|
125 EATWaitForSendingCNMIRequestComplete, |
|
126 EATWaitForSendingCNMIConfigureWrite, |
|
127 EATWaitForSendingCNMIConfigureComplete, |
|
128 EATWaitForTestPhoneBookStorageWriteComplete, |
|
129 EATWaitForTestPhoneBookStorageRequestComplete, |
|
130 EATWaitForSendingEnumRequest, |
|
131 EATWaitForSendingEnumRequestComplete, |
|
132 EATWaitForGetPrefMemWriteComplete, |
|
133 EATWaitForGetPrefMemReadComplete, |
|
134 EATWaitForSendingCGMIRequest, |
|
135 EATWaitForSendingCGMIRequestComplete, |
|
136 EATWaitForSendingCGMMRequest, |
|
137 EATWaitForSendingCGMMRequestComplete, |
|
138 EATWaitForSendingCGMRRequest, |
|
139 EATWaitForSendingCGMRRequestComplete, |
|
140 EATWaitForSendingCGSNRequest, |
|
141 EATWaitForSendingCGSNRequestComplete, |
|
142 EATGetSubscriberIdWriteComplete, |
|
143 EATGetSubscriberIdReadComplete, |
|
144 EATWaitForSetExtendedCallIndicationWrite, |
|
145 EATWaitForSetExtendedCallIndicationOK, |
|
146 EATWaitForClearUnsolicitedNetworkRegistrationWrite, |
|
147 EATWaitForClearUnsolicitedNetworkRegistrationOK, |
|
148 EATWaitForSetUnsolicitedNetworkRegistrationWrite, |
|
149 EATWaitForSetUnsolicitedNetworkRegistrationOK, |
|
150 EATWaitForReadUnsolicitedNetworkRegistrationWrite, |
|
151 EATWaitForReadUnsolicitedNetworkRegistrationOK, |
|
152 EATGetCurrentOperatorWriteComplete, |
|
153 EATGetCurrentOperatorReadComplete, |
|
154 EATGetBatteryInfoWriteComplete, |
|
155 EATGetBatteryInfoReadComplete, |
|
156 EATGetSignalInfoWriteComplete, |
|
157 EATGetSignalInfoReadComplete, |
|
158 EATGetBearerServiceType, // DJN these should be changed ??? |
|
159 EATSetBearerServiceType, // DJN |
|
160 EATGetCurrentMSCLASSWriteComplete, |
|
161 EATGetCurrentMSCLASSReadComplete, |
|
162 EATGetMaxMSCLASSWriteComplete, |
|
163 EATGetMaxMSCLASSReadComplete, |
|
164 EATGetCurrentCGQREQTWriteComplete, |
|
165 EATGetCurrentCGQREQTReadComplete, |
|
166 EATGetCurrentGprsAttachStateWriteComplete, |
|
167 EATGetCurrentGprsAttachStateReadComplete, |
|
168 EATWaitForSendingCNMIRequest, |
|
169 EATWaitForSendingCNMIComplete, |
|
170 EATWaitForSendingCBSTRequest, |
|
171 EATWaitForSendingCBSTComplete, |
|
172 EATWaitForSendingCSCARequest, |
|
173 EATWaitForSendingCSCAComplete, |
|
174 EATWaitForSetUnsolicitedGPRSNetworkRegistrationWrite, |
|
175 EATWaitForSetUnsolicitedGPRSNetworkRegistrationOK, |
|
176 EATWaitForSendingECAMRequest, |
|
177 EATWaitForSendingECAMComplete |
|
178 } iState; |
|
179 }; |
|
180 |
|
181 class CATHangUpData; |
|
182 class CCallHayes; |
|
183 class CATQuickInit : public CATBase |
|
184 /** |
|
185 @internalTechnology |
|
186 */ |
|
187 { |
|
188 public: |
|
189 static CATQuickInit* NewL(CATIO* aIo,CTelObject* aTelObject,CPhoneGlobals* aPhoneGlobals); |
|
190 ~CATQuickInit(); |
|
191 void StartQuickInit(); |
|
192 void CancelAndHangUp(TCallInfoTSY* aCallInfoTSY, CATHangUpData* aHangUpData); |
|
193 protected: |
|
194 CATQuickInit(CATIO* aIo,CTelObject* aTelObject,CPhoneGlobals* aPhoneGlobals); |
|
195 virtual void EventSignal(TEventSource aSource); |
|
196 virtual void CompleteWithIOError(TEventSource aEventSource, TInt aStatus); |
|
197 private: |
|
198 void ValidateATHExpectStringL(); |
|
199 void Complete(TInt aError); |
|
200 void RemoveQuickInitExpectStrings(); |
|
201 private: |
|
202 TInt iAttempt; |
|
203 enum { |
|
204 ENotInProgress, |
|
205 EWaitForATSilence, |
|
206 EWaitForEscapeWriteCompletion, |
|
207 EWaitForATEscapeOK, |
|
208 EWaitForATWrite, |
|
209 EWaitForATOK, |
|
210 EATOWaitForWriteComplete, |
|
211 EWaitForATOOK, |
|
212 EWaitForDTRDropped, |
|
213 EWaitForDTRRaised, |
|
214 ECancelling |
|
215 } iState; |
|
216 CCommChatString* iConnectExpectString; |
|
217 CCommChatString* iRingExpectString; |
|
218 CCommChatString* iNoCarrierExpectString; |
|
219 CATHangUpData* iHangUpData; // temporary storage while quick init cancels, before calling |
|
220 TCallInfoTSY* iCallInfo; // hang up. |
|
221 TBuf8<KCommsDbSvrMaxFieldLength> iConnectString; |
|
222 }; |
|
223 |
|
224 #endif |