|
1 /* |
|
2 * Copyright (c) 2009-2010 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 "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: AT command handler and notifier |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CDUNATCMDHANDLER_H |
|
19 #define C_CDUNATCMDHANDLER_H |
|
20 |
|
21 #include <atext.h> |
|
22 #include <e32base.h> |
|
23 #include <atextcommon.h> |
|
24 #include "DunDataPusher.h" |
|
25 #include "DunAtCmdPusher.h" |
|
26 #include "DunAtCmdEchoer.h" |
|
27 #include "DunAtEcomListen.h" |
|
28 #include "DunAtModeListen.h" |
|
29 #include "DunAtNvramListen.h" |
|
30 #include "DunAtSpecialCmdHandler.h" |
|
31 |
|
32 const TInt KDunChSetMaxCharLen = 1; // Only ASCII supported for now |
|
33 const TInt KDunOkBufLength = 1+1+2+1+1; // <CR>+<LF>+"OK"+<CR>+<LF> |
|
34 const TInt KDunErrorBufLength = 1+1+5+1+1; // <CR>+<LF>+"ERROR"+<CR>+<LF> |
|
35 const TInt KDunInputBufLength = (512 + 1); // 512 chars for command + <CR> |
|
36 const TInt KDunEscBufLength = 1; // Escape (0x1B) character |
|
37 |
|
38 class CDunAtUrcHandler; |
|
39 class MDunConnMon; |
|
40 class MDunStreamManipulator; |
|
41 |
|
42 /** |
|
43 * Class used for storing information related to string conversion and parsing |
|
44 * |
|
45 * @lib dunatext.lib |
|
46 * @since S60 v3.2 |
|
47 */ |
|
48 NONSHARABLE_CLASS( TDunParseInfo ) |
|
49 { |
|
50 |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Buffer for sending |
|
55 */ |
|
56 TBuf8<KDunInputBufLength> iSendBuffer; |
|
57 |
|
58 /** |
|
59 * Conversion limit for upper case conversion. |
|
60 * This is needed to convert the base part of special commands to upper case |
|
61 * where the part after the base part should not be converted to upper case. |
|
62 */ |
|
63 TInt iLimit; |
|
64 |
|
65 }; |
|
66 |
|
67 /** |
|
68 * Class used for AT command decoding related functionality |
|
69 * |
|
70 * @lib dunatext.lib |
|
71 * @since S60 v5.0 |
|
72 */ |
|
73 NONSHARABLE_CLASS( TDunDecodeInfo ) |
|
74 { |
|
75 |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Flag to indicate if first decode |
|
80 */ |
|
81 TBool iFirstDecode; |
|
82 |
|
83 /** |
|
84 * Index in iInputBuffer for decoding to iDecodeBuffer |
|
85 */ |
|
86 TInt iDecodeIndex; |
|
87 |
|
88 /** |
|
89 * Index in iInputBuffer for extended character position |
|
90 */ |
|
91 TInt iExtendedIndex; |
|
92 |
|
93 /** |
|
94 * Previous character in parsing |
|
95 */ |
|
96 TChar iPrevChar; |
|
97 |
|
98 /** |
|
99 * Flag to indicate if previous character exists |
|
100 */ |
|
101 TBool iPrevExists; |
|
102 |
|
103 /** |
|
104 * Flag to indicate if assignment mark found |
|
105 */ |
|
106 TBool iAssignFound; |
|
107 |
|
108 /** |
|
109 * Flag to indicate if processing inside quotes |
|
110 */ |
|
111 TBool iInQuotes; |
|
112 |
|
113 /** |
|
114 * Flag to indicate if special subcommand found |
|
115 */ |
|
116 TBool iSpecialFound; |
|
117 |
|
118 /** |
|
119 * Buffer for parsing |
|
120 */ |
|
121 TBuf8<KDunInputBufLength> iDecodeBuffer; |
|
122 |
|
123 }; |
|
124 |
|
125 /** |
|
126 * Class used for AT command editor mode related functionality |
|
127 * |
|
128 * @lib dunatext.lib |
|
129 * @since TB9.2 |
|
130 */ |
|
131 NONSHARABLE_CLASS( TDunEditorModeInfo ) |
|
132 { |
|
133 |
|
134 public: |
|
135 |
|
136 /** |
|
137 * Flag to indicate if content found (not used if iContentFindStarted is EFalse) |
|
138 */ |
|
139 TBool iContentFound; |
|
140 |
|
141 /** |
|
142 * AT command decoding related information for peeked data |
|
143 * (not to be used if HandleNextDecodedCommand() returns EFalse) |
|
144 */ |
|
145 TDunDecodeInfo iPeekInfo; |
|
146 |
|
147 }; |
|
148 |
|
149 /** |
|
150 * Notification interface class for command mode start/end |
|
151 * |
|
152 * @lib dunutils.lib |
|
153 * @since S60 v5.0 |
|
154 */ |
|
155 NONSHARABLE_CLASS( MDunCmdModeMonitor ) |
|
156 { |
|
157 |
|
158 public: |
|
159 |
|
160 /** |
|
161 * Notifies about command mode start |
|
162 * |
|
163 * @since S60 5.0 |
|
164 * @return None |
|
165 */ |
|
166 virtual void NotifyCommandModeStart() = 0; |
|
167 |
|
168 /** |
|
169 * Notifies about command mode end |
|
170 * |
|
171 * @since S60 5.0 |
|
172 * @return None |
|
173 */ |
|
174 virtual void NotifyCommandModeEnd() = 0; |
|
175 |
|
176 }; |
|
177 |
|
178 /** |
|
179 * Notification interface class for status changes in AT command handling |
|
180 * |
|
181 * @lib dunatext.lib |
|
182 * @since S60 v5.0 |
|
183 */ |
|
184 NONSHARABLE_CLASS( MDunAtCmdStatusReporter ) |
|
185 { |
|
186 |
|
187 public: |
|
188 |
|
189 /** |
|
190 * Notifies about AT command handling start |
|
191 * |
|
192 * @since S60 5.0 |
|
193 * @return None |
|
194 */ |
|
195 virtual void NotifyAtCmdHandlingStart() = 0; |
|
196 |
|
197 /** |
|
198 * Notifies about AT command handling end |
|
199 * |
|
200 * @since S60 5.0 |
|
201 * @param aEndIndex Index to the start of next command |
|
202 * @return None |
|
203 */ |
|
204 virtual void NotifyAtCmdHandlingEnd( TInt aStartIndex ) = 0; |
|
205 |
|
206 /** |
|
207 * Notifies about editor mode reply |
|
208 * |
|
209 * @since TB9.2 |
|
210 * @param aStart ETrue if start of editor mode, EFalse otherwise |
|
211 * @return None |
|
212 */ |
|
213 virtual void NotifyEditorModeReply( TBool aStart ) = 0; |
|
214 |
|
215 }; |
|
216 |
|
217 /** |
|
218 * Class for AT command handler and notifier |
|
219 * |
|
220 * @lib dunatext.lib |
|
221 * @since S60 v5.0 |
|
222 */ |
|
223 NONSHARABLE_CLASS( CDunAtCmdHandler ) : public CBase, |
|
224 public MDunAtCmdPusher, |
|
225 public MDunAtEcomListen, |
|
226 public MDunAtModeListen |
|
227 { |
|
228 |
|
229 public: |
|
230 |
|
231 /** |
|
232 * Two-phased constructor. |
|
233 * @param aUpstream Callback to upstream |
|
234 * @param aDownstream Callback to downstream |
|
235 * @param aConnectionName Connection identifier name |
|
236 * @return Instance of self |
|
237 */ |
|
238 IMPORT_C static CDunAtCmdHandler* NewL( |
|
239 MDunAtCmdStatusReporter* aUpstream, |
|
240 MDunStreamManipulator* aDownstream, |
|
241 const TDesC8* aConnectionName ); |
|
242 |
|
243 /** |
|
244 * Destructor. |
|
245 */ |
|
246 virtual ~CDunAtCmdHandler(); |
|
247 |
|
248 /** |
|
249 * Resets data to initial values |
|
250 * |
|
251 * @since S60 5.0 |
|
252 * @return None |
|
253 */ |
|
254 IMPORT_C void ResetData(); |
|
255 |
|
256 /** |
|
257 * Adds callback for command mode notification |
|
258 * The callback will be called when command mode starts or ends |
|
259 * |
|
260 * @since S60 5.0 |
|
261 * @param aCallback Callback to call when command mode starts or ends |
|
262 * @return Symbian error code on error, KErrNone otherwise |
|
263 */ |
|
264 IMPORT_C TInt AddCmdModeCallback( MDunCmdModeMonitor* aCallback ); |
|
265 |
|
266 /** |
|
267 * Parses an AT command |
|
268 * |
|
269 * @since S60 5.0 |
|
270 * @param aCommand Command to parse |
|
271 * @param aPartialInput ETrue if partial input, EFalse otherwise |
|
272 * @return Symbian error code on error, KErrNone otherwise |
|
273 */ |
|
274 IMPORT_C TInt ParseCommand( TDesC8& aCommand, TBool& aPartialInput ); |
|
275 |
|
276 /** |
|
277 * Manages request to abort command handling |
|
278 * |
|
279 * @since S60 5.0 |
|
280 * @return Symbian error code on error, KErrNone otherwise |
|
281 */ |
|
282 IMPORT_C TInt ManageAbortRequest(); |
|
283 |
|
284 /** |
|
285 * Sets end of command line marker on for the possible series of AT |
|
286 * commands. |
|
287 * |
|
288 * @since S60 5.0 |
|
289 * @param aClearInput ETrue to clear input buffer, EFalse otherwise |
|
290 * @return None |
|
291 */ |
|
292 IMPORT_C void SetEndOfCmdLine( TBool aClearInput ); |
|
293 |
|
294 /** |
|
295 * Sends a character to be echoed |
|
296 * |
|
297 * @since TB9.2 |
|
298 * @param aInput Input to echo |
|
299 * @param aCallback Callback to echo request completions |
|
300 * @return Symbian error code on error, KErrNone otherwise |
|
301 */ |
|
302 IMPORT_C TInt SendEchoCharacter( const TDesC8* aInput, |
|
303 MDunAtCmdEchoer* aCallback ); |
|
304 |
|
305 /** |
|
306 * Stops sending of AT command from decode buffer |
|
307 * |
|
308 * @since S60 3.2 |
|
309 * @return Symbian error code on error, KErrNone otherwise |
|
310 */ |
|
311 IMPORT_C TInt Stop(); |
|
312 |
|
313 /** |
|
314 * Starts URC message handling |
|
315 * |
|
316 * @since S60 5.0 |
|
317 * @return Symbian error code on error, KErrNone otherwise |
|
318 */ |
|
319 IMPORT_C TInt StartUrc(); |
|
320 |
|
321 /** |
|
322 * Stops URC message handling |
|
323 * |
|
324 * @since S60 3.2 |
|
325 * @return Symbian error code on error, KErrNone otherwise |
|
326 */ |
|
327 IMPORT_C TInt StopUrc(); |
|
328 |
|
329 private: |
|
330 |
|
331 CDunAtCmdHandler( MDunAtCmdStatusReporter* aUpstream, |
|
332 MDunStreamManipulator* aDownstream, |
|
333 const TDesC8* aConnectionName ); |
|
334 |
|
335 void ConstructL(); |
|
336 |
|
337 /** |
|
338 * Initializes this class |
|
339 * |
|
340 * @since S60 3.2 |
|
341 * @return None |
|
342 */ |
|
343 void Initialize(); |
|
344 |
|
345 /** |
|
346 * Creates plugin handlers for this class |
|
347 * |
|
348 * @since S60 5.0 |
|
349 * @return None |
|
350 */ |
|
351 void CreatePluginHandlersL(); |
|
352 |
|
353 /** |
|
354 * Creates the array of special commands |
|
355 * |
|
356 * @since S60 5.0 |
|
357 * @return None |
|
358 */ |
|
359 void CreateSpecialCommandsL(); |
|
360 |
|
361 /** |
|
362 * Recreates special command data. |
|
363 * This is done when a plugin is installed or uninstalled. |
|
364 * |
|
365 * @since S60 5.0 |
|
366 * @return Symbian error code on error, KErrNone otherwise |
|
367 */ |
|
368 TInt RecreateSpecialCommands(); |
|
369 |
|
370 /** |
|
371 * Gets default settings from RATExtCommon and sets them to RATExt |
|
372 * |
|
373 * @since S60 5.0 |
|
374 * @return None |
|
375 */ |
|
376 void GetAndSetDefaultSettingsL(); |
|
377 |
|
378 /** |
|
379 * Regenerates the reply strings based on settings |
|
380 * |
|
381 * @since S60 5.0 |
|
382 * @return ETrue if quiet mode, EFalse otherwise |
|
383 */ |
|
384 TBool RegenerateReplyStrings(); |
|
385 |
|
386 /** |
|
387 * Regenerates the ok reply based on settings |
|
388 * |
|
389 * @since S60 5.0 |
|
390 * @return ETrue if quiet mode, EFalse otherwise |
|
391 */ |
|
392 TBool RegenerateOkReply(); |
|
393 |
|
394 /** |
|
395 * Regenerates the error reply based on settings |
|
396 * |
|
397 * @since S60 5.0 |
|
398 * @return ETrue if quiet mode, EFalse otherwise |
|
399 */ |
|
400 TBool RegenerateErrorReply(); |
|
401 |
|
402 /** |
|
403 * Gets current mode |
|
404 * |
|
405 * @since S60 5.0 |
|
406 * @param aMask Mask for current mode (only one supported) |
|
407 * @return New current mode |
|
408 */ |
|
409 TUint GetCurrentModeL( TUint aMask ); |
|
410 |
|
411 /** |
|
412 * Instantiates one URC message handling class instance and adds it to |
|
413 * the URC message handler array |
|
414 * |
|
415 * @since S60 3.2 |
|
416 * @return None |
|
417 */ |
|
418 CDunAtUrcHandler* AddOneUrcHandlerL(); |
|
419 |
|
420 /** |
|
421 * Deletes all instantiated URC message handlers |
|
422 * |
|
423 * @since S60 5.0 |
|
424 * @return None |
|
425 */ |
|
426 void DeletePluginHandlers(); |
|
427 |
|
428 /** |
|
429 * Manages partial AT command |
|
430 * |
|
431 * @since S60 5.0 |
|
432 * @param aCommand Command to process |
|
433 * @param aNeedsCarriage ETrue if full and non-consumed AT command needs |
|
434 * carriage return (AT command "A/") |
|
435 * @return ETrue if no other processing needed, EFalse otherwise |
|
436 */ |
|
437 TBool ManagePartialCommand( TDesC8& aCommand, |
|
438 TBool& aNeedsCarriage ); |
|
439 |
|
440 /** |
|
441 * Echoes a command if echo is on |
|
442 * |
|
443 * @since S60 5.0 |
|
444 * @param aDes String descriptor |
|
445 * @return ETrue if echo push started, EFalse otherwise |
|
446 */ |
|
447 TBool EchoCommand( TDesC8& aDes ); |
|
448 |
|
449 /** |
|
450 * Handles backspace and cancel characters |
|
451 * |
|
452 * @since S60 5.0 |
|
453 * @param aCommand Command to process |
|
454 * @return ETrue if special character found, EFalse otherwise |
|
455 */ |
|
456 TBool HandleSpecialCharacters( TDesC8& aCommand ); |
|
457 |
|
458 /** |
|
459 * Appends command to input buffer |
|
460 * |
|
461 * @since S60 5.0 |
|
462 * @param aCommand Command to append to input buffer |
|
463 * @param aEndFound ETrue if end (carriage return) was found |
|
464 * @return ETrue if overflow was found, EFalse otherwise |
|
465 */ |
|
466 TBool AppendCommandToInputBuffer( TDesC8& aCommand, TBool& aEndFound ); |
|
467 |
|
468 /** |
|
469 * Handles next decoded command from input buffer |
|
470 * |
|
471 * @since S60 5.0 |
|
472 * @return ETrue if last command decoded, EFalse otherwise |
|
473 */ |
|
474 TBool HandleNextDecodedCommand(); |
|
475 |
|
476 /** |
|
477 * Finds the start of the next command |
|
478 * |
|
479 * @since TB9.2 |
|
480 * @return Index to the next command or Symbian error code on error |
|
481 */ |
|
482 TInt FindStartOfNextCommand(); |
|
483 |
|
484 /** |
|
485 * Manages end of AT command handling |
|
486 * |
|
487 * @since S60 5.0 |
|
488 * @param aNotifyExternal Notify external parties |
|
489 * @param aNotifyLocal Notify local parties |
|
490 * @param aClearInput ETrue to clear input buffer, EFalse otherwise |
|
491 * @return None |
|
492 */ |
|
493 void ManageEndOfCmdHandling( TBool aNotifyExternal, |
|
494 TBool aNotifyLocal, |
|
495 TBool aClearInput ); |
|
496 |
|
497 /** |
|
498 * Extracts next decoded command from input buffer to decode buffer |
|
499 * |
|
500 * @since S60 5.0 |
|
501 * @param aPeek Peek for the next command if ETrue, EFalse otherwise |
|
502 * @return ETrue if command extracted, EFalse otherwise |
|
503 */ |
|
504 TBool ExtractNextDecodedCommand( TBool aPeek=EFalse ); |
|
505 |
|
506 /** |
|
507 * Restores old decode info. For ExtractNextDecodedCommand() when aPeeks is |
|
508 * ETrue. |
|
509 * |
|
510 * @since S60 5.0 |
|
511 * @param aPeek Peek for the next command if ETrue, EFalse otherwise |
|
512 * @param aOldInfo Old information to restore when aPeek is ETrue |
|
513 * @return None |
|
514 */ |
|
515 void RestoreOldDecodeInfo( TBool aPeek, TDunDecodeInfo& aOldInfo ); |
|
516 |
|
517 /** |
|
518 * Finds end of an AT command |
|
519 * |
|
520 * @since S60 5.0 |
|
521 * @param aDes String descriptor |
|
522 * @param aStartIndex Start index for search |
|
523 * @return Index if found, KErrNotFound otherwise |
|
524 */ |
|
525 TInt FindEndOfCommand( TDesC8& aDes, TInt aStartIndex=0 ); |
|
526 |
|
527 /** |
|
528 * Tests for end of AT command character |
|
529 * |
|
530 * @since S60 5.0 |
|
531 * @param aCharacter Character to test |
|
532 * @return ETrue if end of command, EFalse otherwise |
|
533 */ |
|
534 TBool IsEndOfCommand( TChar& aCharacter ); |
|
535 |
|
536 /** |
|
537 * Finds start of a decoded AT command |
|
538 * |
|
539 * @since S60 5.0 |
|
540 * @param aDes String descriptor |
|
541 * @param aStartIndex Start index for search |
|
542 * @return Index if found, KErrNotFound otherwise |
|
543 */ |
|
544 TInt FindStartOfDecodedCommand( TDesC8& aDes, |
|
545 TInt aStartIndex ); |
|
546 |
|
547 /** |
|
548 * Checks if character is delimiter character |
|
549 * |
|
550 * @since S60 5.0 |
|
551 * @param aCharacter Character to test |
|
552 * @return ETrue if delimiter character, EFalse otherwise |
|
553 */ |
|
554 TBool IsDelimiterCharacter( TChar aCharacter ); |
|
555 |
|
556 /** |
|
557 * Checks if character is of extended group |
|
558 * |
|
559 * @since S60 5.0 |
|
560 * @param aCharacter Character to test |
|
561 * @return ETrue if extended character, EFalse otherwise |
|
562 */ |
|
563 TBool IsExtendedCharacter( TChar aCharacter ); |
|
564 |
|
565 /** |
|
566 * Checks special command |
|
567 * |
|
568 * @since S60 5.0 |
|
569 * @param aStartIndex Start index (doesn't change) |
|
570 * @param aEndIndex End index (changes) |
|
571 * @return Symbian error code on error, KErrNone otherwise |
|
572 */ |
|
573 TBool CheckSpecialCommand( TInt aStartIndex, |
|
574 TInt& aEndIndex ); |
|
575 |
|
576 /** |
|
577 * Saves character decode state for a found character |
|
578 * |
|
579 * @since TB9.2 |
|
580 * @param aCharacter Character to save a state for |
|
581 * @param aAddSpecial ETrue to add character for special command, |
|
582 * EFalse otherwise |
|
583 * @return Symbian error code on error, KErrNone otherwise |
|
584 */ |
|
585 void SaveFoundCharDecodeState( TChar aCharacter, |
|
586 TBool aAddSpecial=ETrue ); |
|
587 |
|
588 /** |
|
589 * Saves character decode state for a not found character |
|
590 * |
|
591 * @since TB9.2 |
|
592 * @param aStartIndex Start index (doesn't change) |
|
593 * @param aEndIndex End index (changes) |
|
594 * @return Symbian error code on error, KErrNone otherwise |
|
595 */ |
|
596 void SaveNotFoundCharDecodeState(); |
|
597 |
|
598 /** |
|
599 * Find quotes within subcommands |
|
600 * |
|
601 * @since TB9.2 |
|
602 * @param aCharacter Character to check |
|
603 * @param aStartIndex Start index (doesn't change) |
|
604 * @param aEndIndex End index (changes) |
|
605 * @return Symbian error code on error, KErrNone otherwise |
|
606 */ |
|
607 TBool FindSubCommandQuotes( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex ); |
|
608 |
|
609 /** |
|
610 * Check if in next subcommand's extended border |
|
611 * |
|
612 * @since TB9.2 |
|
613 * @param aCharacter Extended character to check |
|
614 * @param aStartIndex Start index (doesn't change) |
|
615 * @param aEndIndex End index (changes) |
|
616 * @return ETrue if in next command's extended border, EFalse otherwise |
|
617 */ |
|
618 TBool IsExtendedBorder( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex ); |
|
619 |
|
620 /** |
|
621 * Finds subcommand with alphanumeric borders |
|
622 * |
|
623 * @since TB9.2 |
|
624 * @param aCharacter Character to check |
|
625 * @param aEndIndex End index (changes) |
|
626 * @return ETrue if alpha border found, EFalse otherwise |
|
627 */ |
|
628 TBool FindSubCommandAlphaBorder( TChar aCharacter, TInt& aEndIndex ); |
|
629 |
|
630 /** |
|
631 * Finds subcommand |
|
632 * |
|
633 * @since TB9.2 |
|
634 * @param aStartIndex Start index (doesn't change) |
|
635 * @param aEndIndex End index (changes) |
|
636 * @return Symbian error code on error, KErrNone otherwise |
|
637 */ |
|
638 TInt FindSubCommand( TInt aStartIndex, TInt& aEndIndex ); |
|
639 |
|
640 /** |
|
641 * Check if "A/" command |
|
642 * |
|
643 * @since S60 5.0 |
|
644 * @return ETrue if "A/" command, EFalse otherwise |
|
645 */ |
|
646 TBool IsASlashCommand(); |
|
647 |
|
648 /** |
|
649 * Handles "A/" command |
|
650 * |
|
651 * @since S60 5.0 |
|
652 * @return ETrue if error reply push started, EFalse otherwise |
|
653 */ |
|
654 TBool HandleASlashCommand(); |
|
655 |
|
656 /** |
|
657 * Resets parse buffers |
|
658 * |
|
659 * @since S60 5.0 |
|
660 * @param aClearInput ETrue to clear input buffer, EFalse otherwise |
|
661 * @return None |
|
662 */ |
|
663 void ResetParseBuffers( TBool aClearInput=ETrue ); |
|
664 |
|
665 /** |
|
666 * Manages command mode change |
|
667 * |
|
668 * @since S60 5.0 |
|
669 * @param aMode Mode to manage |
|
670 * @return ETrue if command mode change detected, EFalse otherwise |
|
671 */ |
|
672 TBool ManageCommandModeChange( TUint aMode ); |
|
673 |
|
674 /** |
|
675 * Reports command mode start/end change |
|
676 * |
|
677 * @since S60 3.2 |
|
678 * @param aStart Command mode start if ETrue, end otherwise |
|
679 * @return None |
|
680 */ |
|
681 void ReportCommandModeChange( TBool aStart ); |
|
682 |
|
683 /** |
|
684 * Manages echo mode change |
|
685 * |
|
686 * @since S60 5.0 |
|
687 * @param aMode Mode to manage |
|
688 * @return ETrue if echo mode change detected, EFalse otherwise |
|
689 */ |
|
690 TBool ManageEchoModeChange( TUint aMode ); |
|
691 |
|
692 /** |
|
693 * Manages quiet mode change |
|
694 * |
|
695 * @since S60 5.0 |
|
696 * @param aMode Mode to manage |
|
697 * @return ETrue if quiet mode change detected, EFalse otherwise |
|
698 */ |
|
699 TBool ManageQuietModeChange( TUint aMode ); |
|
700 |
|
701 /** |
|
702 * Manages verbose mode change |
|
703 * |
|
704 * @since S60 5.0 |
|
705 * @param aMode Mode to manage |
|
706 * @return ETrue if verbose mode change detected, EFalse otherwise |
|
707 */ |
|
708 TBool ManageVerboseModeChange( TUint aMode ); |
|
709 |
|
710 /** |
|
711 * Manages character change |
|
712 * |
|
713 * @since S60 5.0 |
|
714 * @param aMode Mode to manage |
|
715 * @return None |
|
716 */ |
|
717 void ManageCharacterChange( TUint aMode ); |
|
718 |
|
719 /** |
|
720 * Manages editor mode reply |
|
721 * |
|
722 * @since TB9.2 |
|
723 * @param aStart ETrue if start of editor mode, EFalse otherwise |
|
724 * @return Symbian error code on error, KErrNone otherwise |
|
725 */ |
|
726 TInt ManageEditorModeReply( TBool aStart ); |
|
727 |
|
728 /** |
|
729 * Finds the next content from the input buffer |
|
730 * |
|
731 * @since TB9.2 |
|
732 * @param aStart ETrue if start of editor mode, EFalse otherwise |
|
733 * @return ETrue if next content found, EFalse otherwise |
|
734 */ |
|
735 TBool FindNextContent( TBool aStart ); |
|
736 |
|
737 // from base class MDunAtCmdPusher |
|
738 |
|
739 /** |
|
740 * From MDunAtCmdPusher. |
|
741 * Notifies about end of AT command processing. |
|
742 * This is after all reply data for an AT command is multiplexed to the |
|
743 * downstream. |
|
744 * |
|
745 * @since S60 5.0 |
|
746 * @param aError Error code of command processing completion |
|
747 * @return None |
|
748 */ |
|
749 TInt NotifyEndOfProcessing( TInt aError ); |
|
750 |
|
751 /** |
|
752 * Notifies about request to stop AT command handling for the rest of the |
|
753 * command line data |
|
754 * |
|
755 * @since S60 5.0 |
|
756 * @return Symbian error code on error, KErrNone otherwise |
|
757 */ |
|
758 TInt NotifyEndOfCmdLineProcessing(); |
|
759 |
|
760 /** |
|
761 * Notifies about request to peek for the next command |
|
762 * |
|
763 * @since S60 5.0 |
|
764 * @return ETrue if next command exists, EFalse otherwise |
|
765 */ |
|
766 TBool NotifyNextCommandPeekRequest(); |
|
767 |
|
768 /** |
|
769 * Notifies about editor mode reply |
|
770 * |
|
771 * @since TB9.2 |
|
772 * @return Symbian error code on error, KErrNone otherwise |
|
773 */ |
|
774 TInt NotifyEditorModeReply(); |
|
775 |
|
776 // from base class MDunAtCmdEchoer |
|
777 |
|
778 /** |
|
779 * Notifies about completed echo in text mode |
|
780 * |
|
781 * @since TB9.2 |
|
782 * @return None |
|
783 */ |
|
784 void NotifyEchoComplete(); |
|
785 |
|
786 // from base class MDunAtEcomListen |
|
787 |
|
788 /** |
|
789 * From MDunAtEcomListen. |
|
790 * Notifies about new plugin installation |
|
791 * |
|
792 * @since S60 5.0 |
|
793 * @return None |
|
794 */ |
|
795 TInt NotifyPluginInstallation( TUid& aPluginUid ); |
|
796 |
|
797 /** |
|
798 * From MDunAtEcomListen. |
|
799 * Notifies about existing plugin uninstallation |
|
800 * |
|
801 * @since S60 5.0 |
|
802 * @return None |
|
803 */ |
|
804 TInt NotifyPluginUninstallation( TUid& aPluginUid ); |
|
805 |
|
806 // from base class MDunAtModeListen |
|
807 |
|
808 /** |
|
809 * From MDunAtModeListen. |
|
810 * Gets called on mode status change |
|
811 * |
|
812 * @since S60 5.0 |
|
813 * @param aMode Mode to manage |
|
814 * @return Symbian error code on error, KErrNone otherwise |
|
815 */ |
|
816 TInt NotifyModeStatusChange( TUint aMode ); |
|
817 |
|
818 private: // data |
|
819 |
|
820 /** |
|
821 * Callback to call when AT command handling status changes |
|
822 * Not own. |
|
823 */ |
|
824 MDunAtCmdStatusReporter* iUpstream; |
|
825 |
|
826 /** |
|
827 * Callback to call when data to push |
|
828 * Not own. |
|
829 */ |
|
830 MDunStreamManipulator* iDownstream; |
|
831 |
|
832 /** |
|
833 * Callback(s) to call when command mode starts or ends |
|
834 * Usually two needed: one for upstream and second for downstream |
|
835 */ |
|
836 RPointerArray<MDunCmdModeMonitor> iCmdCallbacks; |
|
837 |
|
838 /** |
|
839 * Connection identifier name |
|
840 */ |
|
841 const TDesC8* iConnectionName; |
|
842 |
|
843 /** |
|
844 * Current state of AT command handling: active or inactive |
|
845 */ |
|
846 TDunState iHandleState; |
|
847 |
|
848 /** |
|
849 * Character for carriage return |
|
850 */ |
|
851 TInt8 iCarriageReturn; |
|
852 |
|
853 /** |
|
854 * Character for line feed |
|
855 */ |
|
856 TInt8 iLineFeed; |
|
857 |
|
858 /** |
|
859 * Character for backspace |
|
860 */ |
|
861 TInt8 iBackspace; |
|
862 |
|
863 /** |
|
864 * Current command to ParseCommand() |
|
865 * Not own. |
|
866 */ |
|
867 TDesC8* iCommand; |
|
868 |
|
869 /** |
|
870 * Special commands for parsing |
|
871 */ |
|
872 RPointerArray<HBufC8> iSpecials; |
|
873 |
|
874 /** |
|
875 * Buffer for character echoing |
|
876 */ |
|
877 TBuf8<KDunChSetMaxCharLen> iEchoBuffer; |
|
878 |
|
879 /** |
|
880 * Buffer for ok reply |
|
881 */ |
|
882 TBuf8<KDunOkBufLength> iOkBuffer; |
|
883 |
|
884 /** |
|
885 * Buffer for error reply |
|
886 */ |
|
887 TBuf8<KDunErrorBufLength> iErrorBuffer; |
|
888 |
|
889 /** |
|
890 * Buffer for AT command input |
|
891 */ |
|
892 TBuf8<KDunInputBufLength> iInputBuffer; |
|
893 |
|
894 /** |
|
895 * Buffer for last AT command input (for "A/") |
|
896 */ |
|
897 TBuf8<KDunInputBufLength> iLastBuffer; |
|
898 |
|
899 /** |
|
900 * Buffer for <ESC> command |
|
901 */ |
|
902 TBuf8<KDunEscBufLength> iEscapeBuffer; |
|
903 |
|
904 /** |
|
905 * AT command decoding related information |
|
906 */ |
|
907 TDunDecodeInfo iDecodeInfo; |
|
908 |
|
909 /** |
|
910 * Information for parsing |
|
911 */ |
|
912 TDunParseInfo iParseInfo; |
|
913 |
|
914 /** |
|
915 * Information for editor mode |
|
916 */ |
|
917 TDunEditorModeInfo iEditorModeInfo; |
|
918 |
|
919 /** |
|
920 * AT command reply pusher |
|
921 * Own. |
|
922 */ |
|
923 CDunAtCmdPusher* iCmdPusher; |
|
924 |
|
925 /** |
|
926 * AT command reply echoer |
|
927 * Own. |
|
928 */ |
|
929 CDunAtCmdEchoer* iCmdEchoer; |
|
930 |
|
931 /** |
|
932 * URC message handlers |
|
933 * Own. |
|
934 */ |
|
935 RPointerArray<CDunAtUrcHandler> iUrcHandlers; |
|
936 |
|
937 /** |
|
938 * ECOM plugin interface status change listener |
|
939 * Own. |
|
940 */ |
|
941 CDunAtEcomListen* iEcomListen; |
|
942 |
|
943 /** |
|
944 * Modem mode status change listener |
|
945 * Own. |
|
946 */ |
|
947 CDunAtModeListen* iModeListen; |
|
948 |
|
949 /** |
|
950 * NVRAM status change listener |
|
951 * Own. |
|
952 */ |
|
953 CDunAtNvramListen* iNvramListen; |
|
954 |
|
955 /** |
|
956 * Flag to mark command mode start/end |
|
957 */ |
|
958 TBool iDataMode; |
|
959 |
|
960 /** |
|
961 * Flag to be set on if echo on |
|
962 */ |
|
963 TBool iEchoOn; |
|
964 |
|
965 /** |
|
966 * Flag to be set on if quiet mode on |
|
967 */ |
|
968 TBool iQuietOn; |
|
969 |
|
970 /** |
|
971 * Flag to be set on if verbose mode on |
|
972 */ |
|
973 TBool iVerboseOn; |
|
974 |
|
975 /** |
|
976 * End index for command delimiter |
|
977 */ |
|
978 TInt iEndIndex; |
|
979 |
|
980 /** |
|
981 * AT command extension |
|
982 */ |
|
983 RATExt iAtCmdExt; |
|
984 |
|
985 /** |
|
986 * AT command extension to common functionality |
|
987 */ |
|
988 RATExtCommon iAtCmdExtCommon; |
|
989 |
|
990 /** |
|
991 * Special AT command handler for handling commands like AT&FE0Q0V1&C1&D2+IFC=3,1. |
|
992 */ |
|
993 CDunAtSpecialCmdHandler* iAtSpecialCmdHandler; |
|
994 }; |
|
995 |
|
996 #endif // C_CDUNATCMDHANDLER_H |