bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h
changeset 0 f63038272f30
child 15 53b7818cd282
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2007 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 extension API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BTATEXTAGENT_H
       
    20 #define BTATEXTAGENT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <atext.h>
       
    25 #include "btmcactive.h"
       
    26 #include "HFPAtEcomListen.h"
       
    27 #include "HFPAtUrcHandler.h"
       
    28 
       
    29 class CBtmcActive;
       
    30 
       
    31 class MATExtObserver
       
    32     {
       
    33 public:
       
    34     virtual void ATExtHandleCommandCompletedL(TInt aErr, const TDesC8& aReply) = 0;
       
    35 
       
    36     virtual void UnsolicitedResultFromATExtL(TInt aErr, const TDesC8& aAT) = 0;
       
    37     };
       
    38 
       
    39 NONSHARABLE_CLASS( CHFPAtCmdHandler ) : public CBase, 
       
    40                                         public MBtmcActiveObserver,
       
    41                                         public MHFPAtEcomListen
       
    42 	{
       
    43 public:
       
    44 
       
    45     static CHFPAtCmdHandler* NewL(MATExtObserver& aObserver);
       
    46 
       
    47 public:
       
    48 
       
    49 	~CHFPAtCmdHandler();
       
    50 	
       
    51 	void HandleCommand(const TDesC8& aAT, const TDesC8& aReply = KNullDesC8);
       
    52 	
       
    53 
       
    54 	
       
    55 private:
       
    56 
       
    57     void RequestCompletedL(CBtmcActive& aActive, TInt aErr);
       
    58 
       
    59     void CancelRequest(TInt aServiceId);
       
    60 
       
    61     TInt HandleRunError(TInt aErr);
       
    62     
       
    63 
       
    64 
       
    65 private:
       
    66 
       
    67 	CHFPAtCmdHandler(MATExtObserver& aObserver);
       
    68 	
       
    69     /**
       
    70      * Creates plugin handlers for this class
       
    71      *
       
    72      * @since S60 5.0
       
    73      * @return None
       
    74      */
       
    75     void CreatePluginHandlersL();
       
    76 	
       
    77     /**
       
    78      * Instantiates one URC message handling class instance and adds it to
       
    79      * the URC message handler array
       
    80      *
       
    81      * @since S60 3.2
       
    82      * @return None
       
    83      */
       
    84     CHFPAtUrcHandler* AddOneUrcHandlerL();
       
    85 
       
    86     /**
       
    87      * Deletes all instantiated URC message handlers
       
    88      *
       
    89      * @since S60 5.0
       
    90      * @return None
       
    91      */
       
    92     void DeletePluginHandlers();
       
    93     
       
    94     // from base class MHFPAtEcomListen
       
    95 
       
    96     /**
       
    97       * From MHFPAtEcomListen.
       
    98       * Notifies about new plugin installation
       
    99       *
       
   100       * @since S60 5.0
       
   101       * @return None
       
   102       */
       
   103     TInt NotifyPluginInstallation( TUid& aPluginUid );
       
   104 
       
   105     /**
       
   106       * From MHFPAtEcomListen.
       
   107       * Notifies about existing plugin uninstallation
       
   108       *
       
   109       * @since S60 5.0
       
   110       * @return None
       
   111       */
       
   112     TInt NotifyPluginUninstallation( TUid& aPluginUid );
       
   113     
       
   114     /**
       
   115      * Starts URC message handling
       
   116      *
       
   117      * @since S60 5.0
       
   118      * @return Symbian error code on error, KErrNone otherwise
       
   119      */
       
   120     TInt StartUrc();
       
   121 
       
   122     /**
       
   123      * Stops URC message handling
       
   124      *
       
   125      * @since S60 3.2
       
   126      * @return Symbian error code on error, KErrNone otherwise
       
   127      */
       
   128     TInt StopUrc();
       
   129 	
       
   130 	void ConstructL();
       
   131 	
       
   132 private:
       
   133     MATExtObserver& iObserver;
       
   134     
       
   135     RATExt iATExtClient;
       
   136     TBuf8<KDefaultCmdBufLength> iCmdBuffer;
       
   137     TBuf8<KDefaultCmdBufLength> iRecvBuffer;
       
   138     TBuf8<KDefaultCmdBufLength> iReplyBuffer;
       
   139     TBuf8<512> iSystemReply;
       
   140     
       
   141     TInt iRemainingReplyLength;
       
   142     TPckg<TInt> iRemainingReplyLengthPckg;
       
   143     TATExtensionReplyType iReplyType;
       
   144     TPckg<TATExtensionReplyType> iReplyTypePckg;
       
   145     CBtmcActive* iCommander; // for command handling
       
   146    
       
   147         /**
       
   148      * URC message handlers
       
   149      * Own.
       
   150      */
       
   151     RPointerArray<CHFPAtUrcHandler> iUrcHandlers;
       
   152 
       
   153     /**
       
   154      * ECOM plugin interface status change listener
       
   155      * Own.
       
   156      */
       
   157     CHFPAtEcomListen* iEcomListen;
       
   158 	};
       
   159 
       
   160 #endif      // BTATEXTAGENT_H
       
   161             
       
   162 // End of File