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