localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h
branchRCL_3
changeset 38 3dcb815346df
parent 20 2553637c2525
equal deleted inserted replaced
37:7e0ecb5b116a 38:3dcb815346df
    30 #include "DunAtSpecialCmdHandler.h"
    30 #include "DunAtSpecialCmdHandler.h"
    31 
    31 
    32 const TInt KDunChSetMaxCharLen = 1;          // Only ASCII supported for now
    32 const TInt KDunChSetMaxCharLen = 1;          // Only ASCII supported for now
    33 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>
    34 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>
    35 const TInt KDunInputBufLength  = (512 + 1);  // 512 chars for command + <CR>
    35 const TInt KDunLineBufLength   = (512 + 1);  // 512 chars for command + <CR>
    36 const TInt KDunEscBufLength    = 1;          // Escape (0x1B) character
    36 const TInt KDunEscBufLength    = 1;          // Escape (0x1B) character
    37 
    37 
    38 class CDunAtUrcHandler;
    38 class CDunAtUrcHandler;
    39 class MDunConnMon;
    39 class MDunConnMon;
    40 class MDunStreamManipulator;
    40 class MDunStreamManipulator;
    41 
    41 
    42 /**
    42 /**
    43  *  Class used for storing information related to string conversion and parsing
    43  *  Class used for storing information related to string conversion and parsing
    44  *
    44  *
    45  *  @lib dunatext.lib
    45  *  @lib dunatext.lib
    46  *  @since S60 v3.2
    46  *  @since TB9.2
    47  */
    47  */
    48 NONSHARABLE_CLASS( TDunParseInfo )
    48 NONSHARABLE_CLASS( TDunParseInfo )
    49     {
    49     {
    50 
    50 
    51 public:
    51 public:
    52 
    52 
    53     /**
    53     /**
    54      * Buffer for sending
    54      * Buffer for sending to ATEXT (one command)
    55      */
    55      * (length is part of KDunLineBufLength)
    56     TBuf8<KDunInputBufLength> iSendBuffer;
    56      */
       
    57     TBuf8<KDunLineBufLength> iSendBuffer;
    57 
    58 
    58     /**
    59     /**
    59      * Conversion limit for upper case conversion.
    60      * Conversion limit for upper case conversion.
    60      * This is needed to convert the base part of special commands to upper case
    61      * 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      * where the part after the base part should not be converted to upper case.
    66 
    67 
    67 /**
    68 /**
    68  *  Class used for AT command decoding related functionality
    69  *  Class used for AT command decoding related functionality
    69  *
    70  *
    70  *  @lib dunatext.lib
    71  *  @lib dunatext.lib
    71  *  @since S60 v5.0
    72  *  @since TB9.2
    72  */
    73  */
    73 NONSHARABLE_CLASS( TDunDecodeInfo )
    74 NONSHARABLE_CLASS( TDunDecodeInfo )
    74     {
    75     {
    75 
    76 
    76 public:
    77 public:
    79      * Flag to indicate if first decode
    80      * Flag to indicate if first decode
    80      */
    81      */
    81     TBool iFirstDecode;
    82     TBool iFirstDecode;
    82 
    83 
    83     /**
    84     /**
    84      * Index in iInputBuffer for decoding to iDecodeBuffer
    85      * Index in iLineBuffer for decoding to iSendBuffer
    85      */
    86      */
    86     TInt iDecodeIndex;
    87     TInt iDecodeIndex;
    87 
    88 
    88     /**
    89     /**
    89      * Index in iInputBuffer for extended character position 
    90      * Index in iLineBuffer for extended character position
    90      */
    91      */
    91     TInt iExtendedIndex;
    92     TInt iExtendedIndex;
    92 
    93 
    93     /**
    94     /**
    94      * Previous character in parsing
    95      * Previous character in parsing
   104      * Flag to indicate if assignment mark found
   105      * Flag to indicate if assignment mark found
   105      */
   106      */
   106     TBool iAssignFound;
   107     TBool iAssignFound;
   107 
   108 
   108     /**
   109     /**
   109      * Flag to indicate if processing inside quotes 
   110      * Flag to indicate if processing inside quotes
   110      */
   111      */
   111     TBool iInQuotes;
   112     TBool iInQuotes;
   112 
   113 
   113     /**
   114     /**
   114      * Flag to indicate if special subcommand found
   115      * Flag to indicate if special subcommand found
   115      */
   116      */
   116     TBool iSpecialFound;
   117     TBool iSpecialFound;
   117     
   118 
   118     /**
   119     /**
   119      * Buffer for parsing
   120      * Number of commands handled (for debugging purposes)
   120      */
   121      */
   121     TBuf8<KDunInputBufLength> iDecodeBuffer;
   122     TBool iCmdsHandled;
   122 
   123 
   123     };
   124     };
   124 
   125 
   125 /**
   126 /**
   126  *  Class used for AT command editor mode related functionality
   127  *  Class used for AT command editor mode related functionality
   138      */
   139      */
   139     TBool iContentFound;
   140     TBool iContentFound;
   140 
   141 
   141     /**
   142     /**
   142      * AT command decoding related information for peeked data
   143      * AT command decoding related information for peeked data
   143      * (not to be used if HandleNextDecodedCommand() returns EFalse)
   144      * (not to be used if HandleNextSubCommand() returns EFalse)
   144      */
   145      */
   145     TDunDecodeInfo iPeekInfo;
   146     TDunDecodeInfo iPeekInfo;
   146 
   147 
   147     };
   148     };
   148 
   149 
   149 /**
   150 /**
   150  *  Notification interface class for command mode start/end
   151  *  Notification interface class for command mode start/end
   151  *
   152  *
   152  *  @lib dunutils.lib
   153  *  @lib dunutils.lib
   153  *  @since S60 v5.0
   154  *  @since TB9.2
   154  */
   155  */
   155 NONSHARABLE_CLASS( MDunCmdModeMonitor )
   156 NONSHARABLE_CLASS( MDunCmdModeMonitor )
   156     {
   157     {
   157 
   158 
   158 public:
   159 public:
   159 
   160 
   160     /**
   161     /**
   161      * Notifies about command mode start
   162      * Notifies about command mode start
   162      *
   163      *
   163      * @since S60 5.0
   164      * @since TB9.2
   164      * @return None
   165      * @return None
   165      */
   166      */
   166     virtual void NotifyCommandModeStart() = 0;
   167     virtual void NotifyCommandModeStart() = 0;
   167 
   168 
   168     /**
   169     /**
   169      * Notifies about command mode end
   170      * Notifies about command mode end
   170      *
   171      *
   171      * @since S60 5.0
   172      * @since TB9.2
   172      * @return None
   173      * @return None
   173      */
   174      */
   174     virtual void NotifyCommandModeEnd() = 0;
   175     virtual void NotifyCommandModeEnd() = 0;
   175 
   176 
   176     };
   177     };
   177 
   178 
   178 /**
   179 /**
   179  *  Notification interface class for status changes in AT command handling
   180  *  Notification interface class for status changes in AT command handling
   180  *
   181  *
   181  *  @lib dunatext.lib
   182  *  @lib dunatext.lib
   182  *  @since S60 v5.0
   183  *  @since TB9.2
   183  */
   184  */
   184 NONSHARABLE_CLASS( MDunAtCmdStatusReporter )
   185 NONSHARABLE_CLASS( MDunAtCmdStatusReporter )
   185     {
   186     {
   186 
   187 
   187 public:
   188 public:
   188 
   189 
   189     /**
   190     /**
   190      * Notifies about AT command handling start
   191      * Notifies about parser's need to get more data
   191      *
   192      *
   192      * @since S60 5.0
   193      * @since TB9.2
   193      * @return None
   194      * @return None
   194      */
   195      */
   195     virtual void NotifyAtCmdHandlingStart() = 0;
   196     virtual void NotifyParserNeedsMoreData() = 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 
   197 
   206     /**
   198     /**
   207      * Notifies about editor mode reply
   199      * Notifies about editor mode reply
   208      *
   200      *
   209      * @since TB9.2
   201      * @since TB9.2
   216 
   208 
   217 /**
   209 /**
   218  *  Class for AT command handler and notifier
   210  *  Class for AT command handler and notifier
   219  *
   211  *
   220  *  @lib dunatext.lib
   212  *  @lib dunatext.lib
   221  *  @since S60 v5.0
   213  *  @since TB9.2
   222  */
   214  */
   223 NONSHARABLE_CLASS( CDunAtCmdHandler ) : public CBase,
   215 NONSHARABLE_CLASS( CDunAtCmdHandler ) : public CBase,
   224                                         public MDunAtCmdPusher,
   216                                         public MDunAtCmdPusher,
   225                                         public MDunAtEcomListen,
   217                                         public MDunAtEcomListen,
   226                                         public MDunAtModeListen
   218                                         public MDunAtModeListen
   246     virtual ~CDunAtCmdHandler();
   238     virtual ~CDunAtCmdHandler();
   247 
   239 
   248     /**
   240     /**
   249      * Resets data to initial values
   241      * Resets data to initial values
   250      *
   242      *
   251      * @since S60 5.0
   243      * @since TB9.2
   252      * @return None
   244      * @return None
   253      */
   245      */
   254     IMPORT_C void ResetData();
   246     IMPORT_C void ResetData();
   255 
   247 
   256     /**
   248     /**
   257      * Adds callback for command mode notification
   249      * Adds callback for command mode notification
   258      * The callback will be called when command mode starts or ends
   250      * The callback will be called when command mode starts or ends
   259      *
   251      *
   260      * @since S60 5.0
   252      * @since TB9.2
   261      * @param aCallback Callback to call when command mode starts or ends
   253      * @param aCallback Callback to call when command mode starts or ends
   262      * @return Symbian error code on error, KErrNone otherwise
   254      * @return Symbian error code on error, KErrNone otherwise
   263      */
   255      */
   264     IMPORT_C TInt AddCmdModeCallback( MDunCmdModeMonitor* aCallback );
   256     IMPORT_C TInt AddCmdModeCallback( MDunCmdModeMonitor* aCallback );
   265 
   257 
   266     /**
   258     /**
   267      * Parses an AT command
   259      * Adds data for parsing and parses if necessary
   268      *
   260      *
   269      * @since S60 5.0
   261      * @since TB9.2
   270      * @param aCommand Command to parse
   262      * @param aInput Data to add for parsing
   271      * @param aPartialInput ETrue if partial input, EFalse otherwise
   263      * @param aMoreNeeded ETrue if more data needed, EFalse otherwise
   272      * @return Symbian error code on error, KErrNone otherwise
   264      * @return Symbian error code on error, KErrNone otherwise
   273      */
   265      */
   274     IMPORT_C TInt ParseCommand( TDesC8& aCommand, TBool& aPartialInput );
   266     IMPORT_C TInt AddDataForParsing( TDesC8& aInput, TBool& aMoreNeeded );
   275 
   267 
   276     /**
   268     /**
   277      * Manages request to abort command handling
   269      * Manages request to abort command handling
   278      *
   270      *
   279      * @since S60 5.0
   271      * @since TB9.2
   280      * @return Symbian error code on error, KErrNone otherwise
   272      * @return Symbian error code on error, KErrNone otherwise
   281      */
   273      */
   282     IMPORT_C TInt ManageAbortRequest();
   274     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 
   275 
   294     /**
   276     /**
   295      * Sends a character to be echoed
   277      * Sends a character to be echoed
   296      *
   278      *
   297      * @since TB9.2
   279      * @since TB9.2
   303                                      MDunAtCmdEchoer* aCallback );
   285                                      MDunAtCmdEchoer* aCallback );
   304 
   286 
   305     /**
   287     /**
   306      * Stops sending of AT command from decode buffer
   288      * Stops sending of AT command from decode buffer
   307      *
   289      *
   308      * @since S60 3.2
   290      * @since TB9.2
   309      * @return Symbian error code on error, KErrNone otherwise
   291      * @return Symbian error code on error, KErrNone otherwise
   310      */
   292      */
   311     IMPORT_C TInt Stop();
   293     IMPORT_C TInt Stop();
   312 
   294 
   313     /**
   295     /**
   314      * Starts URC message handling
   296      * Starts URC message handling
   315      *
   297      *
   316      * @since S60 5.0
   298      * @since TB9.2
   317      * @return Symbian error code on error, KErrNone otherwise
   299      * @return Symbian error code on error, KErrNone otherwise
   318      */
   300      */
   319     IMPORT_C TInt StartUrc();
   301     IMPORT_C TInt StartUrc();
   320 
   302 
   321     /**
   303     /**
   322      * Stops URC message handling
   304      * Stops URC message handling
   323      *
   305      *
   324      * @since S60 3.2
   306      * @since TB9.2
   325      * @return Symbian error code on error, KErrNone otherwise
   307      * @return Symbian error code on error, KErrNone otherwise
   326      */
   308      */
   327     IMPORT_C TInt StopUrc();
   309     IMPORT_C TInt StopUrc();
   328 
   310 
   329 private:
   311 private:
   335     void ConstructL();
   317     void ConstructL();
   336 
   318 
   337     /**
   319     /**
   338      * Initializes this class
   320      * Initializes this class
   339      *
   321      *
   340      * @since S60 3.2
   322      * @since TB9.2
   341      * @return None
   323      * @return None
   342      */
   324      */
   343     void Initialize();
   325     void Initialize();
   344 
   326 
   345     /**
   327     /**
   346      * Creates plugin handlers for this class
   328      * Creates plugin handlers for this class
   347      *
   329      *
   348      * @since S60 5.0
   330      * @since TB9.2
   349      * @return None
   331      * @return None
   350      */
   332      */
   351     void CreatePluginHandlersL();
   333     void CreatePluginHandlersL();
   352 
   334 
   353     /**
   335     /**
   354      * Creates the array of special commands
   336      * Creates the array of special commands
   355      *
   337      *
   356      * @since S60 5.0
   338      * @since TB9.2
   357      * @return None
   339      * @return None
   358      */
   340      */
   359     void CreateSpecialCommandsL();
   341     void CreateSpecialCommandsL();
   360 
   342 
   361     /**
   343     /**
   362      * Recreates special command data.
   344      * Recreates special command data.
   363      * This is done when a plugin is installed or uninstalled.
   345      * This is done when a plugin is installed or uninstalled.
   364      *
   346      *
   365      * @since S60 5.0
   347      * @since TB9.2
   366      * @return Symbian error code on error, KErrNone otherwise
   348      * @return Symbian error code on error, KErrNone otherwise
   367      */
   349      */
   368     TInt RecreateSpecialCommands();
   350     TInt RecreateSpecialCommands();
   369 
   351 
   370     /**
   352     /**
   371      * Gets default settings from RATExtCommon and sets them to RATExt
   353      * Gets default settings from RATExtCommon and sets them to RATExt
   372      *
   354      *
   373      * @since S60 5.0
   355      * @since TB9.2
   374      * @return None
   356      * @return None
   375      */
   357      */
   376     void GetAndSetDefaultSettingsL();
   358     void GetAndSetDefaultSettingsL();
   377 
   359 
   378     /**
   360     /**
   379      * Regenerates the reply strings based on settings
   361      * Regenerates the reply strings based on settings
   380      *
   362      *
   381      * @since S60 5.0
   363      * @since TB9.2
   382      * @return ETrue if quiet mode, EFalse otherwise
   364      * @return ETrue if quiet mode, EFalse otherwise
   383      */
   365      */
   384     TBool RegenerateReplyStrings();
   366     TBool RegenerateReplyStrings();
   385 
   367 
   386     /**
   368     /**
   387      * Regenerates the ok reply based on settings
   369      * Regenerates the ok reply based on settings
   388      *
   370      *
   389      * @since S60 5.0
   371      * @since TB9.2
   390      * @return ETrue if quiet mode, EFalse otherwise
   372      * @return ETrue if quiet mode, EFalse otherwise
   391      */
   373      */
   392     TBool RegenerateOkReply();
   374     TBool RegenerateOkReply();
   393 
   375 
   394     /**
   376     /**
   395      * Regenerates the error reply based on settings
   377      * Regenerates the error reply based on settings
   396      *
   378      *
   397      * @since S60 5.0
   379      * @since TB9.2
   398      * @return ETrue if quiet mode, EFalse otherwise
   380      * @return ETrue if quiet mode, EFalse otherwise
   399      */
   381      */
   400     TBool RegenerateErrorReply();
   382     TBool RegenerateErrorReply();
   401 
   383 
   402     /**
   384     /**
   403      * Gets current mode
   385      * Gets current mode
   404      *
   386      *
   405      * @since S60 5.0
   387      * @since TB9.2
   406      * @param aMask Mask for current mode (only one supported)
   388      * @param aMask Mask for current mode (only one supported)
   407      * @return New current mode
   389      * @return New current mode
   408      */
   390      */
   409     TUint GetCurrentModeL( TUint aMask );
   391     TUint GetCurrentModeL( TUint aMask );
   410 
   392 
   411     /**
   393     /**
   412      * Instantiates one URC message handling class instance and adds it to
   394      * Instantiates one URC message handling class instance and adds it to
   413      * the URC message handler array
   395      * the URC message handler array
   414      *
   396      *
   415      * @since S60 3.2
   397      * @since TB9.2
   416      * @return None
   398      * @return None
   417      */
   399      */
   418     CDunAtUrcHandler* AddOneUrcHandlerL();
   400     CDunAtUrcHandler* AddOneUrcHandlerL();
   419 
   401 
   420     /**
   402     /**
   421      * Deletes all instantiated URC message handlers
   403      * Deletes all instantiated URC message handlers
   422      *
   404      *
   423      * @since S60 5.0
   405      * @since TB9.2
   424      * @return None
   406      * @return None
   425      */
   407      */
   426     void DeletePluginHandlers();
   408     void DeletePluginHandlers();
   427 
   409 
   428     /**
   410     /**
   429      * Manages partial AT command
   411      * Manages partial AT command
   430      *
   412      *
   431      * @since S60 5.0
   413      * @since TB9.2
   432      * @param aCommand Command to process
   414      * @return ETrue if more data needed, EFalse otherwise
   433      * @param aNeedsCarriage ETrue if full and non-consumed AT command needs
   415      */
   434      *                       carriage return (AT command "A/")
   416     TBool ManagePartialCommand();
   435      * @return ETrue if no other processing needed, EFalse otherwise
       
   436      */
       
   437     TBool ManagePartialCommand( TDesC8& aCommand,
       
   438                                 TBool& aNeedsCarriage );
       
   439 
   417 
   440     /**
   418     /**
   441      * Echoes a command if echo is on
   419      * Echoes a command if echo is on
   442      *
   420      *
   443      * @since S60 5.0
   421      * @since TB9.2
   444      * @param aDes String descriptor
       
   445      * @return ETrue if echo push started, EFalse otherwise
   422      * @return ETrue if echo push started, EFalse otherwise
   446      */
   423      */
   447     TBool EchoCommand( TDesC8& aDes );
   424     TBool EchoCommand();
   448 
   425 
   449     /**
   426     /**
   450      * Handles backspace and cancel characters
   427      * Handles backspace and cancel characters
   451      *
   428      *
   452      * @since S60 5.0
   429      * @since TB9.2
   453      * @param aCommand Command to process
       
   454      * @return ETrue if special character found, EFalse otherwise
   430      * @return ETrue if special character found, EFalse otherwise
   455      */
   431      */
   456     TBool HandleSpecialCharacters( TDesC8& aCommand );
   432     TBool HandleSpecialCharacters();
   457 
   433 
   458     /**
   434     /**
   459      * Appends command to input buffer
   435      * Extracts line from input buffer to line buffer
   460      *
   436      *
   461      * @since S60 5.0
   437      * @since TB9.2
   462      * @param aCommand Command to append to input buffer
   438      * @return ETrue if more data needed, EFalse otherwise
   463      * @param aEndFound ETrue if end (carriage return) was found
   439      */
   464      * @return ETrue if overflow was found, EFalse otherwise
   440     TBool ExtractLineFromInputBuffer();
   465      */
   441 
   466     TBool AppendCommandToInputBuffer( TDesC8& aCommand, TBool& aEndFound );
   442     /**
   467 
   443      * Handles generic buffer management
   468     /**
   444      * (explanation in ExtractLineFromInputBuffer())
   469      * Handles next decoded command from input buffer
   445      *
   470      *
   446      * @since TB9.2
   471      * @since S60 5.0
   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
   472      * @return ETrue if last command decoded, EFalse otherwise
   501      * @return ETrue if last command decoded, EFalse otherwise
   473      */
   502      */
   474     TBool HandleNextDecodedCommand();
   503     TBool HandleNextSubCommand();
   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 
   504 
   484     /**
   505     /**
   485      * Manages end of AT command handling
   506      * Manages end of AT command handling
   486      *
   507      *
   487      * @since S60 5.0
   508      * @since TB9.2
       
   509      * @param aNotifyLocal Notify local parties
   488      * @param aNotifyExternal Notify external parties
   510      * @param aNotifyExternal Notify external parties
   489      * @param aNotifyLocal Notify local parties
   511      * @return None
   490      * @param aClearInput ETrue to clear input buffer, EFalse otherwise
   512      */
   491      * @return None
   513     void ManageEndOfCmdHandling( TBool aNotifyLocal,
   492      */
   514                                  TBool aNotifyExternal );
   493     void ManageEndOfCmdHandling( TBool aNotifyExternal,
   515 
   494                                  TBool aNotifyLocal,
   516     /**
   495                                  TBool aClearInput );
   517      * Extracts next subcommand from line buffer to send buffer
   496 
   518      *
   497     /**
   519      * @since TB9.2
   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
   520      * @param aPeek Peek for the next command if ETrue, EFalse otherwise
   502      * @return ETrue if command extracted, EFalse otherwise
   521      * @return ETrue if command extracted, EFalse otherwise
   503      */
   522      */
   504     TBool ExtractNextDecodedCommand( TBool aPeek=EFalse );
   523     TBool ExtractNextSubCommand( TBool aPeek=EFalse );
   505 
   524 
   506     /**
   525     /**
   507      * Restores old decode info. For ExtractNextDecodedCommand() when aPeeks is
   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
   508      * ETrue.
   535      * ETrue.
   509      *
   536      *
   510      * @since S60 5.0
   537      * @since TB9.2
   511      * @param aPeek Peek for the next command if ETrue, EFalse otherwise
   538      * @param aPeek Peek for the next command if ETrue, EFalse otherwise
   512      * @param aOldInfo Old information to restore when aPeek is ETrue
   539      * @param aOldInfo Old information to restore when aPeek is ETrue
   513      * @return None
   540      * @return None
   514      */
   541      */
   515     void RestoreOldDecodeInfo( TBool aPeek, TDunDecodeInfo& aOldInfo );
   542     void RestoreOldDecodeInfo( TBool aPeek, TDunDecodeInfo& aOldInfo );
   516 
   543 
   517     /**
   544     /**
   518      * Finds end of an AT command
   545      * Tests for end of AT command line
   519      *
   546      *
   520      * @since S60 5.0
   547      * @since TB9.2
   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
   548      * @param aCharacter Character to test
   532      * @return ETrue if end of command, EFalse otherwise
   549      * @return ETrue if end of command, EFalse otherwise
   533      */
   550      */
   534     TBool IsEndOfCommand( TChar& aCharacter );
   551     TBool IsEndOfLine( 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 
   552 
   547     /**
   553     /**
   548      * Checks if character is delimiter character
   554      * Checks if character is delimiter character
   549      *
   555      *
   550      * @since S60 5.0
   556      * @since TB9.2
   551      * @param aCharacter Character to test
   557      * @param aCharacter Character to test
   552      * @return ETrue if delimiter character, EFalse otherwise
   558      * @return ETrue if delimiter character, EFalse otherwise
   553      */
   559      */
   554     TBool IsDelimiterCharacter( TChar aCharacter );
   560     TBool IsDelimiterCharacter( TChar aCharacter );
   555 
   561 
   556     /**
   562     /**
   557      * Checks if character is of extended group
   563      * Checks if character is of extended group
   558      *
   564      *
   559      * @since S60 5.0
   565      * @since TB9.2
   560      * @param aCharacter Character to test
   566      * @param aCharacter Character to test
   561      * @return ETrue if extended character, EFalse otherwise
   567      * @return ETrue if extended character, EFalse otherwise
   562      */
   568      */
   563     TBool IsExtendedCharacter( TChar aCharacter );
   569     TBool IsExtendedCharacter( TChar aCharacter );
   564 
   570 
   565     /**
   571     /**
   566      * Checks special command
   572      * Checks special command
   567      *
   573      *
   568      * @since S60 5.0
   574      * @since TB9.2
   569      * @param aStartIndex Start index (doesn't change)
       
   570      * @param aEndIndex End index (changes)
   575      * @param aEndIndex End index (changes)
   571      * @return Symbian error code on error, KErrNone otherwise
   576      * @return Symbian error code on error, KErrNone otherwise
   572      */
   577      */
   573     TBool CheckSpecialCommand( TInt aStartIndex,
   578     TBool CheckSpecialCommand( TInt& aEndIndex );
   574                                TInt& aEndIndex );
       
   575 
   579 
   576     /**
   580     /**
   577      * Saves character decode state for a found character
   581      * Saves character decode state for a found character
   578      *
   582      *
   579      * @since TB9.2
   583      * @since TB9.2
   582      *                    EFalse otherwise
   586      *                    EFalse otherwise
   583      * @return Symbian error code on error, KErrNone otherwise
   587      * @return Symbian error code on error, KErrNone otherwise
   584      */
   588      */
   585     void SaveFoundCharDecodeState( TChar aCharacter,
   589     void SaveFoundCharDecodeState( TChar aCharacter,
   586                                    TBool aAddSpecial=ETrue );
   590                                    TBool aAddSpecial=ETrue );
   587     
   591 
   588     /**
   592     /**
   589      * Saves character decode state for a not found character
   593      * Saves character decode state for a not found character
   590      *
   594      *
   591      * @since TB9.2
   595      * @since TB9.2
   592      * @param aStartIndex Start index (doesn't change)
   596      * @param aStartIndex Start index (doesn't change)
   614      * @param aStartIndex Start index (doesn't change)
   618      * @param aStartIndex Start index (doesn't change)
   615      * @param aEndIndex End index (changes)
   619      * @param aEndIndex End index (changes)
   616      * @return ETrue if in next command's extended border, EFalse otherwise
   620      * @return ETrue if in next command's extended border, EFalse otherwise
   617      */
   621      */
   618     TBool IsExtendedBorder( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
   622     TBool IsExtendedBorder( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
   619     
   623 
   620     /**
   624     /**
   621      * Finds subcommand with alphanumeric borders
   625      * Finds subcommand with alphanumeric borders
   622      *
   626      *
   623      * @since TB9.2
   627      * @since TB9.2
   624      * @param aCharacter Character to check
   628      * @param aCharacter Character to check
   629 
   633 
   630     /**
   634     /**
   631      * Finds subcommand
   635      * Finds subcommand
   632      *
   636      *
   633      * @since TB9.2
   637      * @since TB9.2
   634      * @param aStartIndex Start index (doesn't change)
       
   635      * @param aEndIndex End index (changes)
   638      * @param aEndIndex End index (changes)
   636      * @return Symbian error code on error, KErrNone otherwise
   639      * @return Symbian error code on error, KErrNone otherwise
   637      */
   640      */
   638     TInt FindSubCommand( TInt aStartIndex, TInt& aEndIndex );
   641     TInt FindSubCommand( TInt& aEndIndex );
   639 
   642 
   640     /**
   643     /**
   641      * Check if "A/" command
   644      * Check if "A/" command
   642      *
   645      *
   643      * @since S60 5.0
   646      * @since TB9.2
   644      * @return ETrue if "A/" command, EFalse otherwise
   647      * @return ETrue if "A/" command, EFalse otherwise
   645      */
   648      */
   646     TBool IsASlashCommand();
   649     TBool IsASlashCommand();
   647 
   650 
   648     /**
   651     /**
   649      * Handles "A/" command
   652      * Handles "A/" command
   650      *
   653      *
   651      * @since S60 5.0
   654      * @since TB9.2
   652      * @return ETrue if error reply push started, EFalse otherwise
   655      * @return ETrue if error reply push started, EFalse otherwise
   653      */
   656      */
   654     TBool HandleASlashCommand();
   657     TBool HandleASlashCommand();
   655 
   658 
   656     /**
   659     /**
   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
   660      * Manages command mode change
   667      *
   661      *
   668      * @since S60 5.0
   662      * @since TB9.2
   669      * @param aMode Mode to manage
   663      * @param aMode Mode to manage
   670      * @return ETrue if command mode change detected, EFalse otherwise
   664      * @return ETrue if command mode change detected, EFalse otherwise
   671      */
   665      */
   672     TBool ManageCommandModeChange( TUint aMode );
   666     TBool ManageCommandModeChange( TUint aMode );
   673 
   667 
   674     /**
   668     /**
   675      * Reports command mode start/end change
   669      * Reports command mode start/end change
   676      *
   670      *
   677      * @since S60 3.2
   671      * @since TB9.2
   678      * @param aStart Command mode start if ETrue, end otherwise
   672      * @param aStart Command mode start if ETrue, end otherwise
   679      * @return None
   673      * @return None
   680      */
   674      */
   681     void ReportCommandModeChange( TBool aStart );
   675     void ReportCommandModeChange( TBool aStart );
   682 
   676 
   683     /**
   677     /**
   684      * Manages echo mode change
   678      * Manages echo mode change
   685      *
   679      *
   686      * @since S60 5.0
   680      * @since TB9.2
   687      * @param aMode Mode to manage
   681      * @param aMode Mode to manage
   688      * @return ETrue if echo mode change detected, EFalse otherwise
   682      * @return ETrue if echo mode change detected, EFalse otherwise
   689      */
   683      */
   690     TBool ManageEchoModeChange( TUint aMode );
   684     TBool ManageEchoModeChange( TUint aMode );
   691 
   685 
   692     /**
   686     /**
   693      * Manages quiet mode change
   687      * Manages quiet mode change
   694      *
   688      *
   695      * @since S60 5.0
   689      * @since TB9.2
   696      * @param aMode Mode to manage
   690      * @param aMode Mode to manage
   697      * @return ETrue if quiet mode change detected, EFalse otherwise
   691      * @return ETrue if quiet mode change detected, EFalse otherwise
   698      */
   692      */
   699     TBool ManageQuietModeChange( TUint aMode );
   693     TBool ManageQuietModeChange( TUint aMode );
   700 
   694 
   701     /**
   695     /**
   702      * Manages verbose mode change
   696      * Manages verbose mode change
   703      *
   697      *
   704      * @since S60 5.0
   698      * @since TB9.2
   705      * @param aMode Mode to manage
   699      * @param aMode Mode to manage
   706      * @return ETrue if verbose mode change detected, EFalse otherwise
   700      * @return ETrue if verbose mode change detected, EFalse otherwise
   707      */
   701      */
   708     TBool ManageVerboseModeChange( TUint aMode );
   702     TBool ManageVerboseModeChange( TUint aMode );
   709 
   703 
   710     /**
   704     /**
   711      * Manages character change
   705      * Manages character change
   712      *
   706      *
   713      * @since S60 5.0
   707      * @since TB9.2
   714      * @param aMode Mode to manage
   708      * @param aMode Mode to manage
   715      * @return None
   709      * @return None
   716      */
   710      */
   717     void ManageCharacterChange( TUint aMode );
   711     void ManageCharacterChange( TUint aMode );
   718 
   712 
   740      * From MDunAtCmdPusher.
   734      * From MDunAtCmdPusher.
   741      * Notifies about end of AT command processing.
   735      * Notifies about end of AT command processing.
   742      * This is after all reply data for an AT command is multiplexed to the
   736      * This is after all reply data for an AT command is multiplexed to the
   743      * downstream.
   737      * downstream.
   744      *
   738      *
   745      * @since S60 5.0
   739      * @since TB9.2
   746      * @param aError Error code of command processing completion
   740      * @param aError Error code of command processing completion
   747      * @return None
   741      * @return None
   748      */
   742      */
   749     TInt NotifyEndOfProcessing( TInt aError );
   743     TInt NotifyEndOfProcessing( TInt aError );
   750 
   744 
   751     /**
   745     /**
   752      * Notifies about request to stop AT command handling for the rest of the
   746      * Notifies about request to stop AT command handling for the rest of the
   753      * command line data
   747      * command line data
   754      *
   748      *
   755      * @since S60 5.0
   749      * @since TB9.2
   756      * @return Symbian error code on error, KErrNone otherwise
   750      * @return None
   757      */
   751      */
   758     TInt NotifyEndOfCmdLineProcessing();
   752     void NotifyEndOfCmdLineProcessing();
   759 
   753 
   760     /**
   754     /**
   761      * Notifies about request to peek for the next command
   755      * Notifies about request to peek for the next command
   762      *
   756      *
   763      * @since S60 5.0
   757      * @since TB9.2
   764      * @return ETrue if next command exists, EFalse otherwise
   758      * @return ETrue if next command exists, EFalse otherwise
   765      */
   759      */
   766     TBool NotifyNextCommandPeekRequest();
   760     TBool NotifyNextCommandPeekRequest();
   767 
   761 
   768     /**
   762     /**
   787 
   781 
   788     /**
   782     /**
   789      * From MDunAtEcomListen.
   783      * From MDunAtEcomListen.
   790      * Notifies about new plugin installation
   784      * Notifies about new plugin installation
   791      *
   785      *
   792      * @since S60 5.0
   786      * @since TB9.2
   793      * @return None
   787      * @return None
   794      */
   788      */
   795     TInt NotifyPluginInstallation( TUid& aPluginUid );
   789     TInt NotifyPluginInstallation( TUid& aPluginUid );
   796 
   790 
   797     /**
   791     /**
   798      * From MDunAtEcomListen.
   792      * From MDunAtEcomListen.
   799      * Notifies about existing plugin uninstallation
   793      * Notifies about existing plugin uninstallation
   800      *
   794      *
   801      * @since S60 5.0
   795      * @since TB9.2
   802      * @return None
   796      * @return None
   803      */
   797      */
   804     TInt NotifyPluginUninstallation( TUid& aPluginUid );
   798     TInt NotifyPluginUninstallation( TUid& aPluginUid );
   805 
   799 
   806 // from base class MDunAtModeListen
   800 // from base class MDunAtModeListen
   807 
   801 
   808     /**
   802     /**
   809      * From MDunAtModeListen.
   803      * From MDunAtModeListen.
   810      * Gets called on mode status change
   804      * Gets called on mode status change
   811      *
   805      *
   812      * @since S60 5.0
   806      * @since TB9.2
   813      * @param aMode Mode to manage
   807      * @param aMode Mode to manage
   814      * @return Symbian error code on error, KErrNone otherwise
   808      * @return Symbian error code on error, KErrNone otherwise
   815      */
   809      */
   816     TInt NotifyModeStatusChange( TUint aMode );
   810     TInt NotifyModeStatusChange( TUint aMode );
   817 
   811 
   859      * Character for backspace
   853      * Character for backspace
   860      */
   854      */
   861     TInt8 iBackspace;
   855     TInt8 iBackspace;
   862 
   856 
   863     /**
   857     /**
   864      * Current command to ParseCommand()
   858      * Current input to AddDataForParsing()
   865      * Not own.
   859      * Not own.
   866      */
   860      */
   867     TDesC8* iCommand;
   861     TDesC8* iInput;
   868 
   862 
   869     /**
   863     /**
   870      * Special commands for parsing
   864      * Special commands for parsing
   871      */
   865      */
   872     RPointerArray<HBufC8> iSpecials;
   866     RPointerArray<HBufC8> iSpecials;
   885      * Buffer for error reply
   879      * Buffer for error reply
   886      */
   880      */
   887     TBuf8<KDunErrorBufLength> iErrorBuffer;
   881     TBuf8<KDunErrorBufLength> iErrorBuffer;
   888 
   882 
   889     /**
   883     /**
   890      * Buffer for AT command input
   884      * Buffer for AT command (one line)
   891      */
   885      */
   892     TBuf8<KDunInputBufLength> iInputBuffer;
   886     TBuf8<KDunLineBufLength> iLineBuffer;
   893 
   887 
   894     /**
   888     /**
   895      * Buffer for last AT command input (for "A/")
   889      * Buffer for last AT command input (for "A/")
   896      */
   890      */
   897     TBuf8<KDunInputBufLength> iLastBuffer;
   891     TBuf8<KDunLineBufLength> iLastBuffer;
   898 
   892 
   899     /**
   893     /**
   900      * Buffer for <ESC> command
   894      * Buffer for <ESC> command
   901      */
   895      */
   902     TBuf8<KDunEscBufLength> iEscapeBuffer;
   896     TBuf8<KDunEscBufLength> iEscapeBuffer;
   971      * Flag to be set on if verbose mode on
   965      * Flag to be set on if verbose mode on
   972      */
   966      */
   973     TBool iVerboseOn;
   967     TBool iVerboseOn;
   974 
   968 
   975     /**
   969     /**
   976      * End index for command delimiter
   970      * End index for not added data in iCommand
   977      */
   971      */
   978     TInt iEndIndex;
   972     TInt iEndIndex;
   979 
   973 
   980     /**
   974     /**
   981      * AT command extension
   975      * AT command extension