0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef MODEMAT_ATEXT_IMPL_H
|
|
20 |
#define MODEMAT_ATEXT_IMPL_H
|
|
21 |
|
|
22 |
#include <atextpluginbase.h>
|
|
23 |
#include "rmodematcontroller.h"
|
|
24 |
|
|
25 |
const TInt KNameLength(256);
|
|
26 |
|
|
27 |
NONSHARABLE_CLASS(CModemATExt) : public CATExtPluginBase, public MAtControllerObserver
|
|
28 |
{
|
|
29 |
public:
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Two-phased constructor.
|
|
33 |
*/
|
|
34 |
static CModemATExt* NewL();
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Destructor.
|
|
38 |
*/
|
|
39 |
~CModemATExt();
|
|
40 |
|
|
41 |
public:
|
|
42 |
|
|
43 |
//from atextpluginbase
|
|
44 |
/**
|
|
45 |
* Reports the support status of an AT command. This is a synchronous API
|
|
46 |
* and the extension plugin must set aEditorCmd parameter before this
|
|
47 |
* function returns.
|
|
48 |
*
|
|
49 |
* @param aCmd The AT command. Its format may vary depending on the
|
|
50 |
* specification. E.g. in BT HFP case, the command may contain
|
|
51 |
* a character carriage return (<cr>) in the end.
|
|
52 |
* @return ETrue if the command is supported; EFalse otherwise.
|
|
53 |
*/
|
|
54 |
|
|
55 |
TBool IsCommandSupported( const TDesC8& aCmd );
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Handles an AT command. Cancelling of the pending request is done by
|
|
59 |
* HandleCommandCancel(). The implementation in the extension plugin should
|
|
60 |
* be asynchronous.
|
|
61 |
*
|
|
62 |
* The extension plugin which accepts this command is responsible to supply
|
|
63 |
* the result codes and response and to format result codes properly, e.g.
|
|
64 |
* in BT HFP case, the format should be <cr><lf><result code><cr><lf>
|
|
65 |
*
|
|
66 |
* After an extension plugin has handled or decided to reject the given AT
|
|
67 |
* command, it must inform ATEXT by HandleCommandCompleted() with a proper
|
|
68 |
* error code.
|
|
69 |
*
|
|
70 |
* @since S60 5.0
|
|
71 |
* @param aCmd The AT command to be handled. Its format may vary depending
|
|
72 |
* on the specification. E.g. in BT HFP case, the command may
|
|
73 |
* contain a character carriage return (<cr>) in the end.
|
|
74 |
* @param aReply When passed in, contains the built in answer filled by
|
|
75 |
* ATEXT if it is not empty; when command handling completes
|
|
76 |
* successfully, contains the result codes and responses to
|
|
77 |
* this command; Its ownership always belongs to ATEXT, plugin
|
|
78 |
* may reallocate its space when needed.
|
|
79 |
* @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
|
|
80 |
* the aReply must not contain the reply, otherwise it
|
|
81 |
* must contain verbose or numeric reply (ATV0/1) or an
|
|
82 |
* empty string reply (with ATQ).
|
|
83 |
* @return None
|
|
84 |
*/
|
|
85 |
void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
|
|
86 |
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Cancels a pending HandleCommand request.
|
|
90 |
*
|
|
91 |
* @since S60 5.0
|
|
92 |
* @return None
|
|
93 |
*/
|
|
94 |
|
|
95 |
void HandleCommandCancel();
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Receives unsolicited results. Cancelling of the pending request is done
|
|
99 |
* by ReceiveUnsolicitedResultCancel(). The implementation in the extension
|
|
100 |
* plugin should be asynchronous.
|
|
101 |
*
|
|
102 |
* @since S60 5.0
|
|
103 |
* @return None
|
|
104 |
*/
|
|
105 |
void ReceiveUnsolicitedResult();
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Cancels a pending ReceiveUnsolicitedResult request.
|
|
109 |
*
|
|
110 |
* @since S60 5.0
|
|
111 |
* @return None
|
|
112 |
*/
|
|
113 |
void ReceiveUnsolicitedResultCancel();
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Handles editor mode input.
|
|
117 |
*
|
|
118 |
* @since S60 5.0
|
|
119 |
* @param aInput The input to process after IsCommandSupported() has
|
|
120 |
* reported about a supported command with aEditorCmd=ETrue
|
|
121 |
* @param aReply Reply to return when end of editor mode found
|
|
122 |
* @return ETrue if end of editor mode (ctrl-z), EFalse otherwise
|
|
123 |
*/
|
|
124 |
|
|
125 |
TBool HandleEditorModeInput( const TDesC8& aInput,
|
|
126 |
RBuf8& aReply,
|
|
127 |
TBool& aEchoOn );
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Reports NVRAM status change to the plugins.
|
|
131 |
*
|
|
132 |
* @since S60 5.0
|
|
133 |
* @param aNvram New NVRAM status. Each call of this function is a result
|
|
134 |
* of DUN extracting the form notified by
|
|
135 |
* CATExtCommonBase::SendNvramStatusChange(). Each of the
|
|
136 |
* settings from SendNvramStatusChange() is separated to
|
|
137 |
* one call of ReportNvramStatusChange().
|
|
138 |
* @return None
|
|
139 |
*/
|
|
140 |
void ReportNvramStatusChange( const TDesC8& aNvram );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Gets the next part of reply initially set by HandleCommandComplete().
|
|
144 |
* Length of aNextReply must be equal or less than KDefaultCmdBufLength.
|
|
145 |
*
|
|
146 |
* @since S60 5.0
|
|
147 |
* @param aNextReply Next reply
|
|
148 |
* @return Symbian error code on error, KErrNone otherwise
|
|
149 |
*/
|
|
150 |
TInt GetNextPartOfReply( RBuf8& aNextReply );
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Reports connection identifier name to the extension plugin.
|
|
154 |
*
|
|
155 |
* @since S60 5.0
|
|
156 |
* @param aName Connection identifier name
|
|
157 |
* @return None
|
|
158 |
*/
|
|
159 |
void ReportConnectionName( const TDesC8& aName );
|
|
160 |
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Next reply part's length.
|
|
164 |
* The value must be equal or less than KDefaultCmdBufLength.
|
|
165 |
* When the reply from this method is zero, ATEXT stops calling
|
|
166 |
* GetNextPartOfReply().
|
|
167 |
*
|
|
168 |
* @since S60 5.0
|
|
169 |
* @return Next reply part's length if zero or positive
|
|
170 |
*/
|
|
171 |
|
|
172 |
TInt NextReplyPartLength();
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Reports about external handle command error condition.
|
|
176 |
* This is for cases when for example DUN decided the reply contained an
|
|
177 |
* error condition but the plugin is still handling the command internally.
|
|
178 |
* Example: in command line "AT+TEST;ATDT1234" was given. "AT+TEST" returns
|
|
179 |
* "OK" and "ATDT" returns "CONNECT". Because "OK" and "CONNECT" are
|
|
180 |
* different reply types the condition is "ERROR" and DUN ends processing.
|
|
181 |
* This solution keeps the pointer to the last AT command handling plugin
|
|
182 |
* inside ATEXT and calls this function there to report the error.
|
|
183 |
* It is to be noted that HandleCommandCancel() is not sufficient to stop
|
|
184 |
* the processing as the command handling has already finished.
|
|
185 |
*
|
|
186 |
* @since S60 5.0
|
|
187 |
* @return None
|
|
188 |
*/
|
|
189 |
void ReportExternalHandleCommandError();
|
|
190 |
|
|
191 |
|
|
192 |
//from RModemAtController
|
|
193 |
|
|
194 |
/**
|
|
195 |
* AT-command is compeleted. Called by modematcontroller.
|
|
196 |
* @param aErr Error value of completed command
|
|
197 |
*/
|
|
198 |
|
|
199 |
void HandleATCommandCompleted( TInt aErr ) ;
|
|
200 |
|
|
201 |
/**
|
|
202 |
* Unsolicited data is received. Called by modematcontroller.
|
|
203 |
* @param aErr Error value of unsolicited data
|
|
204 |
*/
|
|
205 |
void HandleUnsolicitedResultReceived( TInt aErr ) ;
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Signal indication is received. Called by modematcontroller.
|
|
209 |
* @param aErr Error value of signal indication
|
|
210 |
*/
|
|
211 |
void HandleSignalIndication( TInt aErr ) ;
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Command mode change. Called by modematcontroller.
|
|
215 |
* @param aErr Error value of command mode request
|
|
216 |
*/
|
|
217 |
void HandleCommandModeChanged( TInt aErr, TCommandMode aMode );
|
|
218 |
|
|
219 |
private:
|
|
220 |
|
|
221 |
CModemATExt();
|
|
222 |
//Constructor
|
|
223 |
void ConstructL();
|
|
224 |
|
|
225 |
//Returns AT command by index
|
|
226 |
TPtrC8 GetAtCommand( TInt aNumber );
|
|
227 |
|
|
228 |
|
|
229 |
private: // Data
|
|
230 |
|
|
231 |
RModemAtController iRModemAt;
|
|
232 |
TBuf8<KNameLength> iName;
|
|
233 |
HBufC8* iReplyBuffer;
|
|
234 |
TPtr8 iReplyPtr;
|
|
235 |
TPtr8 iUnsolicitedPtr;
|
|
236 |
HBufC8* iUnsolicitedBuffer;
|
|
237 |
RBuf8* iReply;
|
|
238 |
TBool iReplyNeeded;
|
|
239 |
HBufC8* iCommandBuf;
|
|
240 |
};
|
|
241 |
|
|
242 |
#endif //MODEMAT_ATEXT_IMPL_H
|
|
243 |
|
|
244 |
// End of File
|