bluetoothengine/btmac/inc/btmonocmdhandler/HFPAtUrcHandler.h
changeset 0 f63038272f30
child 2 0b192a3a05a4
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     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_CHFPATURCHANDLER_H
       
    20 #define C_CHFPATURCHANDLER_H
       
    21 
       
    22 #include <atext.h>
       
    23 #include "HfpAtCmdHandler.h"
       
    24 #include "HFPAtEcomListen.h"
       
    25 
       
    26 /**
       
    27  *  Class for AT command URC handler
       
    28  *
       
    29  *  @lib HFPatext.lib
       
    30  *  @since S60 v5.0
       
    31  */
       
    32 class MATExtObserver;
       
    33 
       
    34 NONSHARABLE_CLASS( CHFPAtUrcHandler ) : public CActive
       
    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 CHFPAtUrcHandler* NewL( RATExt* aAtCmdExt,
       
    46 	                               MATExtObserver& aObserver );
       
    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 CHFPAtUrcHandler* NewLC( RATExt* aAtCmdExt,
       
    55 	                                MATExtObserver& aObserver );
       
    56 
       
    57     /**
       
    58     * Destructor.
       
    59     */
       
    60     virtual ~CHFPAtUrcHandler();
       
    61 
       
    62     /**
       
    63      * Resets data to initial values
       
    64      *
       
    65      * @since S60 5.0
       
    66      * @return None
       
    67      */
       
    68     void ResetData();
       
    69 
       
    70     /**
       
    71      * Starts waiting for an incoming URC message
       
    72      *
       
    73      * @since S60 5.0
       
    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 S60 5.0
       
    82      * @return Symbian error code on error, KErrNone otherwise
       
    83      */
       
    84     TInt Stop();
       
    85 
       
    86     /**
       
    87      * UID of the owning plugin
       
    88      *
       
    89      * @since S60 5.0
       
    90      * @return UID of the owning plugin
       
    91      */
       
    92     TUid OwnerUid();
       
    93 
       
    94 private:
       
    95 
       
    96     CHFPAtUrcHandler( RATExt* aAtCmdExt,
       
    97                       MATExtObserver& aObserver );
       
    98 
       
    99     void ConstructL();
       
   100 
       
   101     /**
       
   102      * Initializes this class
       
   103      *
       
   104      * @since S60 3.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 S60 3.2
       
   116      * @return None
       
   117      */
       
   118     void RunL();
       
   119 
       
   120     /**
       
   121      * From CActive.
       
   122      * Gets called on cancel
       
   123      *
       
   124      * @since S60 3.2
       
   125      * @return None
       
   126      */
       
   127     void DoCancel();
       
   128 
       
   129 
       
   130 private:  // data
       
   131 
       
   132     /**
       
   133      * AT command extension
       
   134      * Not own.
       
   135      */
       
   136     RATExt* iAtCmdExt;
       
   137 
       
   138     MATExtObserver& iObserver;
       
   139 
       
   140     /**
       
   141      * Current state of URC message handling: active or inactive
       
   142      */
       
   143     THFPState iUrcHandleState;
       
   144 
       
   145     /**
       
   146      * Buffer for receiving
       
   147      */
       
   148     TBuf8<KDefaultUrcBufLength> iRecvBuffer;
       
   149 
       
   150     /**
       
   151      * UID of the responsible ATEXT plugin
       
   152      */
       
   153     TUid iOwnerUid;
       
   154 
       
   155     /**
       
   156      * Package for owner UID
       
   157      */
       
   158     TPckg<TUid> iOwnerUidPckg;
       
   159 
       
   160     /**
       
   161      * Flag to indicate start of receiving (for ownership marking)
       
   162      */
       
   163     TBool iStarted;
       
   164 
       
   165     };
       
   166 
       
   167 #endif  // C_CHFPATURCHANDLER_H