bluetoothengine/btmac/inc/btmonobearer/bmbplugin.h
changeset 0 f63038272f30
child 21 53b7818cd282
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:  Remote connection observer interface declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BTASBAUDIOSERVICEPLUGIN_H
       
    20 #define BTASBAUDIOSERVICEPLUGIN_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <remcon/remconbearerplugin.h>
       
    25 #include <remcon/remconbearerinterface.h>
       
    26 #include <remcon/messagetype.h>
       
    27 #include <remconaddress.h>
       
    28 #include <bttypes.h>
       
    29 #include "atcodec.h"
       
    30 #include "playercontrolistener.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 
       
    34 class CBmbCmdListener;
       
    35 
       
    36 /**
       
    37 *  RemCon bearer plugin implementation for BT Audio Service.
       
    38 */
       
    39 class CBmbPlugin 
       
    40 :   public CRemConBearerPlugin,
       
    41     public MRemConBearerInterface,
       
    42     public MBmbPlayerControl
       
    43 	{
       
    44     public:
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         * @param aParams   
       
    48         */
       
    49     	static CBmbPlugin* NewL(TBearerParams& aParams);
       
    50     	~CBmbPlugin();
       
    51 
       
    52         void DataFromRemote(const TDesC8& aATCmd);
       
    53 
       
    54 
       
    55     private: // from CRemConBearerPlugin
       
    56     
       
    57     	/**
       
    58     	* Called by RemCon server to get a pointer to an object which implements the 
       
    59     	* bearer API with UID aUid. This is a mechanism for allowing future change 
       
    60     	* to the bearer API without breaking BC in existing (non-updated) bearer 
       
    61     	* plugins.
       
    62     	* @return the pointer of this implementation
       
    63     	*/    
       
    64 	    TAny* GetInterface(TUid aUid);
       
    65         
       
    66     private: // from MRemConBearerInterface
       
    67     
       
    68     	/** 
       
    69     	* Called by RemCon to retrieve a response on a connection. Must only be 
       
    70     	* called as a result of a NewResponse upcall.
       
    71     	* @param aInterfaceUid The UID of the outer-layer client API specifying the 
       
    72     	*         response.
       
    73     	* @param aId The command identifier used as a cookie for command/response 
       
    74     	*        matching.
       
    75     	* @param aOperationId The ID of the response operation in the outer-layer 
       
    76     	*        client API.
       
    77     	* @param aData API-specific message data. On success, ownership is 
       
    78     	*        returned.
       
    79     	* @param aAddr The connection.
       
    80     	*/    
       
    81     	TInt GetResponse(
       
    82     	    TUid& aInterfaceUid, 
       
    83     		TUint& aTransactionId, 
       
    84     		TUint& aOperationId, 
       
    85     		RBuf8& aData, 
       
    86     		TRemConAddress& aAddr);
       
    87 
       
    88     	/** 
       
    89     	* Called by RemCon to send a command on a connection. Must only be 
       
    90     	* called as a result of a NewCommand upcall.
       
    91     	* @param aInterfaceUid The UID of the outer-layer client API specifying the 
       
    92     	*        command.
       
    93     	* @param aId The command identifier used as a cookie for command/response 
       
    94     	*        matching.
       
    95     	* @param aOperationId The ID of the command operation in the outer-layer 
       
    96     	*        client API.
       
    97     	* @param aData API-specific message data. On success, ownership is 
       
    98     	*        returned.
       
    99     	* @param aAddr The connection.
       
   100     	*/    		
       
   101     	TInt SendCommand(
       
   102     	    TUid aInterfaceUid, 
       
   103     		TUint aCommand, 
       
   104     		TUint aTransactionId,  
       
   105     		RBuf8& aData, 
       
   106     		const TRemConAddress& aAddr);
       
   107 
       
   108     	/** 
       
   109     	* Called by RemCon to retrieve a command on a connection. The connection is not 
       
   110     	* assumed to exist- the bearer is responsible for bringing up the requested 
       
   111     	* connection if necessary.
       
   112     	* @param aInterfaceUid The UID of the outer-layer client API specifying the 
       
   113     	*        command.
       
   114     	* @param aOperationId The ID of the command operation in the outer-layer 
       
   115     	*        client API.
       
   116     	* @param aId The command identifier used as a cookie for command/response 
       
   117     	*        matching.
       
   118     	* @param aData API-specific message data. On success, ownership is passed. 
       
   119     	* @param aAddr The connection.
       
   120     	* @return Error. This request is synchronous. It should be completed by the 
       
   121     	* bearer when it has taken responsibility for sending the message. This will 
       
   122     	* involve checking that the message is well-formed, and possibly actually 
       
   123     	* trying to send it, or adding it to a queue.
       
   124     	*/    		
       
   125     	TInt GetCommand(
       
   126     	    TUid& aInterfaceUid, 
       
   127     		TUint& aTransactionId, 
       
   128     		TUint& aCommand, 
       
   129     		RBuf8& aData, 
       
   130     		TRemConAddress& aAddr);
       
   131 
       
   132     	/** 
       
   133     	* Called by RemCon to send a response on a connection. The connection is not 
       
   134     	* assumed to exist- the bearer is responsible for bringing up the requested 
       
   135     	* connection if necessary.
       
   136     	* @param aInterfaceUid The UID of the outer-layer client API specifying the 
       
   137     	*        response.
       
   138     	* @param aOperationId The ID of the response operation in the outer-layer 
       
   139     	*       client API.
       
   140     	* @param aId The command identifier used as a cookie for command/response 
       
   141     	*        matching
       
   142     	* @param aData API-specific message data. On success, ownership is passed.
       
   143     	* @param aAddr The connection.
       
   144     	* @return Error. This request is synchronous. It should be completed by the 
       
   145     	* bearer when it has taken responsibility for sending the message. This will 
       
   146     	* involve checking that the message is well-formed, and possibly actually 
       
   147     	* trying to send it, or adding it to a queue.
       
   148     	*/    		
       
   149     	TInt SendResponse(
       
   150     	    TUid aInterfaceUid, 
       
   151     		TUint aOperationId, 
       
   152     		TUint aTransactionId, 
       
   153     		RBuf8& aData, 
       
   154     		const TRemConAddress& aAddr);
       
   155 
       
   156     	/** 
       
   157     	* Called by RemCon to establish a bearer-level connection to another party. 
       
   158     	* Completion is signalled back in ConnectConfirm.
       
   159     	* @param aAddr The RemCon address to connect to.
       
   160     	*/    		
       
   161     	void ConnectRequest(const TRemConAddress& aAddr);
       
   162     	
       
   163     	/** 
       
   164     	* Called by RemCon to destroy a bearer-level connection to another party. 
       
   165     	* Completion is signalled back in DisconnectConfirm.
       
   166     	* @param aAddr The RemCon address to disconnect from.
       
   167     	*/    	
       
   168     	void DisconnectRequest(const TRemConAddress& aAddr);
       
   169     	
       
   170     	/**
       
   171     	* Called by RemCon when either (a) the number of controller clients changes 
       
   172     	* from 0 to 1 or from 1 to 0, or (b) the number of target clients changes 
       
   173     	* from 0 to 1 or from 1 to 0.
       
   174     	*/    	
       
   175     	void ClientStatus(TBool aControllerPresent, TBool aTargetPresent);
       
   176 
       
   177     	/**
       
   178     	* Called by RemCon to get the capabilities required to make/destroy 
       
   179     	* connections over the bearer, and to send and receive messages over the 
       
   180     	* bearer.
       
   181     	@return The bearer's security policy.
       
   182     	*/    	
       
   183     	TSecurityPolicy SecurityPolicy() const;        
       
   184                
       
   185     private:
       
   186         // From MBmbPlayerControl
       
   187         void Pause();
       
   188         void Play();
       
   189             
       
   190     private:
       
   191         
       
   192         /**
       
   193         * C++ default constructor.
       
   194         */
       
   195     	CBmbPlugin(TBearerParams& aParams);
       
   196 
       
   197         /**
       
   198         * Symbian 2nd phase constructor.
       
   199         */    	
       
   200     	void ConstructL();
       
   201 
       
   202     private: // owned
       
   203 
       
   204     	// Last received and corrected-decoded message.
       
   205 		TBuf8<KMaxATSize> iInData;       
       
   206     	TUid iInterfaceUid;
       
   207     	TUint iTransactionId;
       
   208     	TUint iOperationId;
       
   209     	TRemConMessageType iMsgType;
       
   210         TRemConAddress iRemConAddress;
       
   211         CBTAudioPlayerControlListener *iPlayerControlListener;       
       
   212         CBmbCmdListener *iListener; 
       
   213 
       
   214         TBool iConnIndicated;
       
   215 	};
       
   216 
       
   217 
       
   218 #endif // BTASBAUDIOSERVICEPLUGIN_H