|
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 Base Class Header |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalAll |
|
21 */ |
|
22 |
|
23 |
|
24 #ifndef __ATBASE_H__ |
|
25 #define __ATBASE_H__ |
|
26 |
|
27 #include "ATSTD.H" |
|
28 #include <et_tsy.h> |
|
29 #include "SCHAT.H" |
|
30 /** |
|
31 @internalComponent |
|
32 */ |
|
33 enum TEventSource |
|
34 { |
|
35 EReadCompletion, |
|
36 EWriteCompletion, |
|
37 ETimeOutCompletion |
|
38 }; |
|
39 |
|
40 /** |
|
41 @internalTechnology |
|
42 */ |
|
43 const TUint KGenericBufferSize=200; // Changed from 100 to 200 hs |
|
44 |
|
45 class CATParamListEntry : public CBase |
|
46 /** |
|
47 @internalTechnology |
|
48 */ |
|
49 { |
|
50 public: |
|
51 CATParamListEntry(const TDesC8& aPtr); |
|
52 ~CATParamListEntry(); |
|
53 void Deque(); |
|
54 static void EntryValL(CATParamListEntry* aEntry,TInt& aValue); |
|
55 static TInt EntryValL(CATParamListEntry* aEntry); |
|
56 public: |
|
57 TPtrC8 iResultPtr; |
|
58 private: |
|
59 TDblQueLink iLink; |
|
60 friend class CATBase; |
|
61 }; |
|
62 |
|
63 |
|
64 class CTelObject; |
|
65 class CCompleteRelinquish : public CAsyncOneShot |
|
66 /** |
|
67 CCompleteRelinquish calls RelinquishOwnershipCompleted() in ETel server so that the |
|
68 server only closes down the session once the TSY's I/O has finished processing |
|
69 |
|
70 @internalTechnology |
|
71 */ |
|
72 { |
|
73 public: |
|
74 static CCompleteRelinquish* New(CTelObject* aTelObject); |
|
75 ~CCompleteRelinquish(); |
|
76 void SetWhichCompletion(TPanicOccurred aPanicOccurred) {iPanicOccurred = aPanicOccurred;} |
|
77 protected: |
|
78 CCompleteRelinquish(CTelObject* aTelObject); |
|
79 virtual void RunL(); |
|
80 private: |
|
81 CTelObject* iTelObject; |
|
82 TPanicOccurred iPanicOccurred; |
|
83 }; |
|
84 |
|
85 |
|
86 class CATIO; |
|
87 class CATBase : public CBase |
|
88 /** |
|
89 @internalTechnology |
|
90 */ |
|
91 { |
|
92 public: |
|
93 void GenericEventSignal(TEventSource aEventSource, TInt aStatus); |
|
94 CTelObject* Owner(); |
|
95 TCallInfoTSY* CallInfo(); |
|
96 void AppendWildCardChar(TDes8& aString); |
|
97 protected: |
|
98 CATBase(CATIO* aIo, CTelObject* aTelObject,CPhoneGlobals* aPhoneGlobals); |
|
99 ~CATBase(); |
|
100 virtual void EventSignal(TEventSource aEventSource)=0; |
|
101 virtual void CompleteWithIOError(TEventSource aSource,TInt aStatus)=0; |
|
102 void ChangeCallStatus(RMobileCall::TMobileCallStatus aCallStatus); |
|
103 void ChangeLineStatus(RCall::TStatus aLineStatus); |
|
104 void StandardWriteCompletionHandler(TEventSource aSource,TInt aLengthOfPause); |
|
105 void Write(const TDesC8& aCommand,TInt aTimeOut = 5); |
|
106 void Write(const TDesC8& aCommand,TInt aTimeOut,TInt aValue); |
|
107 void Write(const TInt aTimeOut); |
|
108 void WriteExpectingResults(const TDesC8& aCommand,TInt aTimeOut); |
|
109 void AddStdExpectStrings(); |
|
110 TInt ValidateExpectString(); // New version which does not leave 13/Sep/01 |
|
111 void RemoveStdExpectStrings(); |
|
112 void RemoveUnsolicitedStrings(); // Removes any unsolicited strings received during initialisation |
|
113 void AddCmsErrorExpectString(); |
|
114 void RemoveCmsErrorExpectString(); |
|
115 void ParseBufferLC(TBool aReportLists=EFalse, TUint aSeparatorChar=','); |
|
116 void ParseLineLC(TBool aReportLists=EFalse, TUint aSeparatorChar=','); |
|
117 void ParseLC(TBool aReportLists, TUint aSeparatorChar); |
|
118 void AddParamL(const TDesC8& aPtr); |
|
119 void SetToNotInitialised(); |
|
120 void RxResultsPushLC(); |
|
121 static void CleanupRxResults(TAny *aCATBase); // for TCleanupOperation |
|
122 protected: |
|
123 CCommChatString* iOKExpectString; |
|
124 CCommChatString* iErrorExpectString; |
|
125 CCommChatString* iCmsExpectString; |
|
126 CATIO* iIo; |
|
127 protected: |
|
128 TBuf8<KGenericBufferSize> iTxBuffer; |
|
129 TDblQue<CATParamListEntry> iRxResults; |
|
130 TPtrC8 iBuffer; |
|
131 TTsyReqHandle iReqHandle; |
|
132 CPhoneGlobals* iPhoneGlobals; |
|
133 CCompleteRelinquish* iComplete; |
|
134 CTelObject* iTelObject; |
|
135 TCallInfoTSY* iCallInfo; |
|
136 }; |
|
137 |
|
138 class CATInit; |
|
139 class CATSetToOnlineCommandMode; |
|
140 class CATCommands : public CATBase |
|
141 /** |
|
142 @internalTechnology |
|
143 */ |
|
144 { |
|
145 public: |
|
146 void ExecuteCommand(TTsyReqHandle aTsyReqHandle, TAny* aParams); |
|
147 void ExecuteCommand(TTsyReqHandle aTsyReqHandle, TAny* aParams,TCallInfoTSY* aCallInfo); |
|
148 void CancelCommand(TTsyReqHandle aTsyReqHandle); |
|
149 virtual void Start(TTsyReqHandle aTsyReqHandle, TAny* aParams)=0; |
|
150 virtual void Stop(TTsyReqHandle aTsyReqHandle)=0; |
|
151 protected: |
|
152 CATCommands(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals); |
|
153 void ConstructL(); |
|
154 ~CATCommands(); |
|
155 virtual void Complete(TInt aError,TEventSource aSource); |
|
156 protected: |
|
157 CATInit* iInit; |
|
158 CATSetToOnlineCommandMode* iATSetToOnlineCommandMode; |
|
159 }; |
|
160 |
|
161 #endif |