localconnectivityservice/dun/atext/inc/DunAtUrcHandler.h
branchRCL_3
changeset 19 0aa8cc770c8a
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
       
     1 /*
       
     2 * Copyright (c) 2008 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 URC handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CDUNATURCHANDLER_H
       
    20 #define C_CDUNATURCHANDLER_H
       
    21 
       
    22 #include <atext.h>
       
    23 #include "DunDataPusher.h"
       
    24 
       
    25 class MDunStreamManipulator;
       
    26 
       
    27 /**
       
    28  *  Class for AT command URC handler
       
    29  *
       
    30  *  @lib dunatext.lib
       
    31  *  @since TB9.2
       
    32  */
       
    33 NONSHARABLE_CLASS( CDunAtUrcHandler ) : public CActive,
       
    34                                         public MDunCompletionReporter
       
    35     {
       
    36 
       
    37 public:
       
    38 
       
    39     /**
       
    40      * Two-phased constructor.
       
    41      * @param aAtCmdExt Pointer to AT command extension
       
    42      * @param aStreamCallback Callback to stream
       
    43      * @return Instance of self
       
    44      */
       
    45 	static CDunAtUrcHandler* NewL( RATExt* aAtCmdExt,
       
    46 	                               MDunStreamManipulator* aStreamCallback );
       
    47 
       
    48     /**
       
    49      * Two-phased constructor.
       
    50      * @param aAtCmdExt Pointer to AT command extension
       
    51      * @param aStreamCallback Callback to stream
       
    52      * @return Instance of self
       
    53      */
       
    54 	static CDunAtUrcHandler* NewLC( RATExt* aAtCmdExt,
       
    55 	                                MDunStreamManipulator* aStreamCallback );
       
    56 
       
    57     /**
       
    58     * Destructor.
       
    59     */
       
    60     virtual ~CDunAtUrcHandler();
       
    61 
       
    62     /**
       
    63      * Resets data to initial values
       
    64      *
       
    65      * @since TB9.2
       
    66      * @return None
       
    67      */
       
    68     void ResetData();
       
    69 
       
    70     /**
       
    71      * Starts waiting for an incoming URC message
       
    72      *
       
    73      * @since TB9.2
       
    74      * @return Symbian error code on error, KErrNone otherwise
       
    75      */
       
    76     TInt IssueRequest();
       
    77 
       
    78     /**
       
    79      * Stops waiting for an incoming URC message
       
    80      *
       
    81      * @since TB9.2
       
    82      * @return Symbian error code on error, KErrNone otherwise
       
    83      */
       
    84     TInt Stop();
       
    85 
       
    86     /**
       
    87      * UID of the owning plugin
       
    88      *
       
    89      * @since TB9.2
       
    90      * @return UID of the owning plugin
       
    91      */
       
    92     TUid OwnerUid();
       
    93 
       
    94 private:
       
    95 
       
    96     CDunAtUrcHandler( RATExt* aAtCmdExt,
       
    97                       MDunStreamManipulator* aStreamCallback );
       
    98 
       
    99     void ConstructL();
       
   100 
       
   101     /**
       
   102      * Initializes this class
       
   103      *
       
   104      * @since TB9.2
       
   105      * @return None
       
   106      */
       
   107     void Initialize();
       
   108 
       
   109 // from base class CActive
       
   110 
       
   111     /**
       
   112      * From CActive.
       
   113      * Gets called when URC command received
       
   114      *
       
   115      * @since TB9.2
       
   116      * @return None
       
   117      */
       
   118     void RunL();
       
   119 
       
   120     /**
       
   121      * From CActive.
       
   122      * Gets called on cancel
       
   123      *
       
   124      * @since TB9.2
       
   125      * @return None
       
   126      */
       
   127     void DoCancel();
       
   128 
       
   129 // from base class MDunCompletionReporter
       
   130 
       
   131     /**
       
   132      * From MDunCompletionReporter.
       
   133      * Gets called when data push is complete
       
   134      *
       
   135      * @since TB9.2
       
   136      * @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
       
   137      * @return None
       
   138      */
       
   139     void NotifyDataPushComplete( TBool aAllPushed );
       
   140 
       
   141 private:  // data
       
   142 
       
   143     /**
       
   144      * AT command extension
       
   145      * Not own.
       
   146      */
       
   147     RATExt* iAtCmdExt;
       
   148 
       
   149     /**
       
   150      * Callback to call when data to push
       
   151      * Not own.
       
   152      */
       
   153     MDunStreamManipulator* iStreamCallback;
       
   154 
       
   155     /**
       
   156      * Current state of URC message handling: active or inactive
       
   157      */
       
   158     TDunState iUrcHandleState;
       
   159 
       
   160     /**
       
   161      * Buffer for receiving
       
   162      */
       
   163     TBuf8<KDefaultUrcBufLength> iRecvBuffer;
       
   164 
       
   165     /**
       
   166      * UID of the responsible ATEXT plugin
       
   167      */
       
   168     TUid iOwnerUid;
       
   169 
       
   170     /**
       
   171      * Package for owner UID
       
   172      */
       
   173     TPckg<TUid> iOwnerUidPckg;
       
   174 
       
   175     /**
       
   176      * Flag to indicate start of receiving (for ownership marking)
       
   177      */
       
   178     TBool iStarted;
       
   179 
       
   180     };
       
   181 
       
   182 #endif  // C_CDUNATURCHANDLER_H