localconnectivityservice/dun/atext/inc/DunAtCmdEchoer.h
branchRCL_3
changeset 19 0aa8cc770c8a
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
       
     1 /*
       
     2 * Copyright (c) 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:  Echoer for AT commands
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CDUNATCMDECHOER_H
       
    19 #define C_CDUNATCMDECHOER_H
       
    20 
       
    21 #include "DunDataPusher.h"
       
    22 
       
    23 class MDunStreamManipulator;
       
    24 
       
    25 /**
       
    26  *  Notification interface class for text mode
       
    27  *
       
    28  *  @lib dunatext.lib
       
    29  *  @since TB9.2
       
    30  */
       
    31 NONSHARABLE_CLASS( MDunAtCmdEchoer )
       
    32     {
       
    33 
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Notifies about completed echo in text mode
       
    38      *
       
    39      * @since TB9.2
       
    40      * @return None
       
    41      */
       
    42     virtual void NotifyEchoComplete() = 0;
       
    43 
       
    44     };
       
    45 
       
    46 /**
       
    47  *  Class for AT command echoer
       
    48  *
       
    49  *  @lib dunatext.lib
       
    50  *  @since TB9.2
       
    51  */
       
    52 NONSHARABLE_CLASS( CDunAtCmdEchoer ) : public CBase,
       
    53                                        public MDunCompletionReporter
       
    54     {
       
    55 
       
    56 public:
       
    57 
       
    58     /**
       
    59      * Two-phased constructor.
       
    60      * @param aStreamCallback Callback to stream
       
    61      * @return Instance of self
       
    62      */
       
    63     static CDunAtCmdEchoer* NewL( MDunStreamManipulator* aStreamCallback );
       
    64 
       
    65     /**
       
    66     * Destructor.
       
    67     */
       
    68     virtual ~CDunAtCmdEchoer();
       
    69 
       
    70     /**
       
    71      * Resets data to initial values
       
    72      *
       
    73      * @since TB9.2
       
    74      * @return None
       
    75      */
       
    76     void ResetData();
       
    77 
       
    78     /**
       
    79      * Sends a character to be echoed
       
    80      *
       
    81      * @since TB9.2
       
    82      * @param aInput Input to echo
       
    83      * @param aCallback Callback to echo request completions
       
    84      * @return Symbian error code on error, KErrNone otherwise
       
    85      */
       
    86     TInt SendEchoCharacter( const TDesC8* aInput, MDunAtCmdEchoer* aCallback );
       
    87 
       
    88 private:
       
    89 
       
    90     CDunAtCmdEchoer( MDunStreamManipulator* aStreamCallback );
       
    91 
       
    92     void ConstructL();
       
    93 
       
    94     /**
       
    95      * Initializes this class
       
    96      *
       
    97      * @since TB9.2
       
    98      * @return None
       
    99      */
       
   100     void Initialize();
       
   101 
       
   102 // from base class MDunCompletionReporter
       
   103 
       
   104     /**
       
   105      * From MDunCompletionReporter.
       
   106      * Gets called when data push is complete
       
   107      *
       
   108      * @since TB9.2
       
   109      * @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
       
   110      * @return None
       
   111      */
       
   112     void NotifyDataPushComplete( TBool aAllPushed );
       
   113 
       
   114 private:  // data
       
   115 
       
   116     /**
       
   117      * Notification interface class for echo request completions
       
   118      * Not own.
       
   119      */
       
   120     MDunAtCmdEchoer* iCallback;
       
   121 
       
   122     /**
       
   123      * Callback to call when data to push
       
   124      * Not own.
       
   125      */
       
   126     MDunStreamManipulator* iStreamCallback;
       
   127 
       
   128     /**
       
   129      * Current state of echoing: active or inactive
       
   130      */
       
   131     TDunState iAtEchoState;
       
   132 
       
   133     };
       
   134 
       
   135 #endif  // C_CDUNATCMDECHOER_H