1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
21 #include <atext.h> |
21 #include <atext.h> |
22 #include <e32base.h> |
22 #include <e32base.h> |
23 #include <atextcommon.h> |
23 #include <atextcommon.h> |
24 #include "DunDataPusher.h" |
24 #include "DunDataPusher.h" |
25 #include "DunAtCmdPusher.h" |
25 #include "DunAtCmdPusher.h" |
|
26 #include "DunAtCmdEchoer.h" |
26 #include "DunAtEcomListen.h" |
27 #include "DunAtEcomListen.h" |
27 #include "DunAtModeListen.h" |
28 #include "DunAtModeListen.h" |
28 #include "DunAtNvramListen.h" |
29 #include "DunAtNvramListen.h" |
29 #include "DunAtSpecialCmdHandler.h" |
30 #include "DunAtSpecialCmdHandler.h" |
30 |
31 |
31 const TInt KDunChSetMaxCharLen = 1; // Only ASCII supported for now |
32 const TInt KDunChSetMaxCharLen = 1; // Only ASCII supported for now |
32 const TInt KDunOkBufLength = 1+1+2+1+1; // <CR>+<LF>+"OK"+<CR>+<LF> |
33 const TInt KDunOkBufLength = 1+1+2+1+1; // <CR>+<LF>+"OK"+<CR>+<LF> |
33 const TInt KDunErrorBufLength = 1+1+5+1+1; // <CR>+<LF>+"ERROR"+<CR>+<LF> |
34 const TInt KDunErrorBufLength = 1+1+5+1+1; // <CR>+<LF>+"ERROR"+<CR>+<LF> |
34 const TInt KDunInputBufLength = (512 + 1); // 512 chars for command + <CR> |
35 const TInt KDunInputBufLength = (512 + 1); // 512 chars for command + <CR> |
|
36 const TInt KDunEscBufLength = 1; // Escape (0x1B) character |
35 |
37 |
36 class CDunAtUrcHandler; |
38 class CDunAtUrcHandler; |
37 class MDunConnMon; |
39 class MDunConnMon; |
38 class MDunStreamManipulator; |
40 class MDunStreamManipulator; |
39 |
41 |
99 TBuf8<KDunInputBufLength> iDecodeBuffer; |
101 TBuf8<KDunInputBufLength> iDecodeBuffer; |
100 |
102 |
101 }; |
103 }; |
102 |
104 |
103 /** |
105 /** |
|
106 * Class used for AT command editor mode related functionality |
|
107 * |
|
108 * @lib dunatext.lib |
|
109 * @since TB9.2 |
|
110 */ |
|
111 NONSHARABLE_CLASS( TDunEditorModeInfo ) |
|
112 { |
|
113 |
|
114 public: |
|
115 |
|
116 /** |
|
117 * Flag to indicate if content found (not used if iContentFindStarted is EFalse) |
|
118 */ |
|
119 TBool iContentFound; |
|
120 |
|
121 /** |
|
122 * AT command decoding related information for peeked data |
|
123 * (not to be used if HandleNextDecodedCommand() returns EFalse) |
|
124 */ |
|
125 TDunDecodeInfo iPeekInfo; |
|
126 |
|
127 }; |
|
128 |
|
129 /** |
104 * Notification interface class for command mode start/end |
130 * Notification interface class for command mode start/end |
105 * |
131 * |
106 * @lib dunutils.lib |
132 * @lib dunutils.lib |
107 * @since S60 v5.0 |
133 * @since S60 v5.0 |
108 */ |
134 */ |
154 * @since S60 5.0 |
180 * @since S60 5.0 |
155 * @param aEndIndex Index to the start of next command |
181 * @param aEndIndex Index to the start of next command |
156 * @return None |
182 * @return None |
157 */ |
183 */ |
158 virtual void NotifyAtCmdHandlingEnd( TInt aStartIndex ) = 0; |
184 virtual void NotifyAtCmdHandlingEnd( TInt aStartIndex ) = 0; |
|
185 |
|
186 /** |
|
187 * Notifies about editor mode reply |
|
188 * |
|
189 * @since TB9.2 |
|
190 * @param aStart ETrue if start of editor mode, EFalse otherwise |
|
191 * @return None |
|
192 */ |
|
193 virtual void NotifyEditorModeReply( TBool aStart ) = 0; |
159 |
194 |
160 }; |
195 }; |
161 |
196 |
162 /** |
197 /** |
163 * Class for AT command handler and notifier |
198 * Class for AT command handler and notifier |
235 * @return None |
270 * @return None |
236 */ |
271 */ |
237 IMPORT_C void SetEndOfCmdLine( TBool aClearInput ); |
272 IMPORT_C void SetEndOfCmdLine( TBool aClearInput ); |
238 |
273 |
239 /** |
274 /** |
|
275 * Sends a character to be echoed |
|
276 * |
|
277 * @since TB9.2 |
|
278 * @param aInput Input to echo |
|
279 * @param aCallback Callback to echo request completions |
|
280 * @return Symbian error code on error, KErrNone otherwise |
|
281 */ |
|
282 IMPORT_C TInt SendEchoCharacter( const TDesC8* aInput, |
|
283 MDunAtCmdEchoer* aCallback ); |
|
284 |
|
285 /** |
240 * Stops sending of AT command from decode buffer |
286 * Stops sending of AT command from decode buffer |
241 * |
287 * |
242 * @since S60 3.2 |
288 * @since S60 3.2 |
243 * @return Symbian error code on error, KErrNone otherwise |
289 * @return Symbian error code on error, KErrNone otherwise |
244 */ |
290 */ |
406 * @return ETrue if last command decoded, EFalse otherwise |
452 * @return ETrue if last command decoded, EFalse otherwise |
407 */ |
453 */ |
408 TBool HandleNextDecodedCommand(); |
454 TBool HandleNextDecodedCommand(); |
409 |
455 |
410 /** |
456 /** |
|
457 * Finds the start of the next command |
|
458 * |
|
459 * @since TB9.2 |
|
460 * @return Index to the next command or Symbian error code on error |
|
461 */ |
|
462 TInt FindStartOfNextCommand(); |
|
463 |
|
464 /** |
411 * Manages end of AT command handling |
465 * Manages end of AT command handling |
412 * |
466 * |
413 * @since S60 5.0 |
467 * @since S60 5.0 |
414 * @param aNotifyExternal Notify external parties |
468 * @param aNotifyExternal Notify external parties |
415 * @param aNotifyLocal Notify local parties |
469 * @param aNotifyLocal Notify local parties |
620 * @param aMode Mode to manage |
674 * @param aMode Mode to manage |
621 * @return None |
675 * @return None |
622 */ |
676 */ |
623 void ManageCharacterChange( TUint aMode ); |
677 void ManageCharacterChange( TUint aMode ); |
624 |
678 |
|
679 /** |
|
680 * Manages editor mode reply |
|
681 * |
|
682 * @since TB9.2 |
|
683 * @param aStart ETrue if start of editor mode, EFalse otherwise |
|
684 * @return Symbian error code on error, KErrNone otherwise |
|
685 */ |
|
686 TInt ManageEditorModeReply( TBool aStart ); |
|
687 |
|
688 /** |
|
689 * Finds the next content from the input buffer |
|
690 * |
|
691 * @since TB9.2 |
|
692 * @param aStart ETrue if start of editor mode, EFalse otherwise |
|
693 * @return ETrue if next content found, EFalse otherwise |
|
694 */ |
|
695 TBool FindNextContent( TBool aStart ); |
|
696 |
625 // from base class MDunAtCmdPusher |
697 // from base class MDunAtCmdPusher |
626 |
698 |
627 /** |
699 /** |
628 * From MDunAtCmdPusher. |
700 * From MDunAtCmdPusher. |
629 * Notifies about end of AT command processing. |
701 * Notifies about end of AT command processing. |
630 * This is after all reply data for an AT command is multiplexed to the |
702 * This is after all reply data for an AT command is multiplexed to the |
631 * downstream. |
703 * downstream. |
632 * |
704 * |
633 * @since S60 5.0 |
705 * @since S60 5.0 |
|
706 * @param aError Error code of command processing completion |
634 * @return None |
707 * @return None |
635 */ |
708 */ |
636 TInt NotifyEndOfProcessing( TInt aError ); |
709 TInt NotifyEndOfProcessing( TInt aError ); |
637 |
710 |
638 /** |
711 /** |
650 * @since S60 5.0 |
723 * @since S60 5.0 |
651 * @return ETrue if next command exists, EFalse otherwise |
724 * @return ETrue if next command exists, EFalse otherwise |
652 */ |
725 */ |
653 TBool NotifyNextCommandPeekRequest(); |
726 TBool NotifyNextCommandPeekRequest(); |
654 |
727 |
|
728 /** |
|
729 * Notifies about editor mode reply |
|
730 * |
|
731 * @since TB9.2 |
|
732 * @return Symbian error code on error, KErrNone otherwise |
|
733 */ |
|
734 TInt NotifyEditorModeReply(); |
|
735 |
|
736 // from base class MDunAtCmdEchoer |
|
737 |
|
738 /** |
|
739 * Notifies about completed echo in text mode |
|
740 * |
|
741 * @since TB9.2 |
|
742 * @return None |
|
743 */ |
|
744 void NotifyEchoComplete(); |
|
745 |
655 // from base class MDunAtEcomListen |
746 // from base class MDunAtEcomListen |
656 |
747 |
657 /** |
748 /** |
658 * From MDunAtEcomListen. |
749 * From MDunAtEcomListen. |
659 * Notifies about new plugin installation |
750 * Notifies about new plugin installation |
764 * Buffer for last AT command input (for "A/") |
855 * Buffer for last AT command input (for "A/") |
765 */ |
856 */ |
766 TBuf8<KDunInputBufLength> iLastBuffer; |
857 TBuf8<KDunInputBufLength> iLastBuffer; |
767 |
858 |
768 /** |
859 /** |
|
860 * Buffer for <ESC> command |
|
861 */ |
|
862 TBuf8<KDunEscBufLength> iEscapeBuffer; |
|
863 |
|
864 /** |
769 * AT command decoding related information |
865 * AT command decoding related information |
770 */ |
866 */ |
771 TDunDecodeInfo iDecodeInfo; |
867 TDunDecodeInfo iDecodeInfo; |
772 |
868 |
773 /** |
869 /** |
774 * Information for parsing |
870 * Information for parsing |
775 */ |
871 */ |
776 TDunParseInfo iParseInfo; |
872 TDunParseInfo iParseInfo; |
|
873 |
|
874 /** |
|
875 * Information for editor mode |
|
876 */ |
|
877 TDunEditorModeInfo iEditorModeInfo; |
777 |
878 |
778 /** |
879 /** |
779 * AT command reply pusher |
880 * AT command reply pusher |
780 * Own. |
881 * Own. |
781 */ |
882 */ |
782 CDunAtCmdPusher* iCmdPusher; |
883 CDunAtCmdPusher* iCmdPusher; |
783 |
884 |
784 /** |
885 /** |
|
886 * AT command reply echoer |
|
887 * Own. |
|
888 */ |
|
889 CDunAtCmdEchoer* iCmdEchoer; |
|
890 |
|
891 /** |
785 * URC message handlers |
892 * URC message handlers |
786 * Own. |
893 * Own. |
787 */ |
894 */ |
788 RPointerArray<CDunAtUrcHandler> iUrcHandlers; |
895 RPointerArray<CDunAtUrcHandler> iUrcHandlers; |
789 |
896 |