bluetoothengine/btsac/inc/btsacGavdp.h
changeset 0 f63038272f30
child 12 e769fd13b1f0
child 67 16e4b9007960
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Contains definition of CBTSACGavdp class which uses GAVDP API. 
       
    15 *				 Two other classes CAVStreamEndPoint and CAVSEPManager are helper 
       
    16 *				 classes to use GAVDP. This class also constructs CBTSACStreamerController
       
    17 *				 class.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef BTSAC_GAVDP_H
       
    23 #define BTSAC_GAVDP_H
       
    24 
       
    25 
       
    26 
       
    27 //  INCLUDES
       
    28 #include <btengdiscovery.h>	// Register SDP record for A2DP
       
    29 #include <gavdp.h>			// symbian Bluetooth GAVDP API
       
    30 
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CBTSACStreamerController;
       
    38 class CBTSACSEPManager;
       
    39 class MInternalGavdpUser; 
       
    40 
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  
       
    46 *  
       
    47 *  
       
    48 */
       
    49 NONSHARABLE_CLASS(CBTSACGavdp) : public CBase, public MGavdpUser
       
    50                        
       
    51     {
       
    52     public:  // Constructors and destructor
       
    53         
       
    54         
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         * 
       
    58         * 
       
    59         * 
       
    60         */
       
    61         static CBTSACGavdp* NewL( MInternalGavdpUser* aObserver );
       
    62         
       
    63         /**
       
    64         * 
       
    65         * 
       
    66         * 
       
    67         */
       
    68         virtual ~CBTSACGavdp();
       
    69         
       
    70    public: // New Functions
       
    71    
       
    72 			/*
       
    73 			 *
       
    74 			 *
       
    75 			 */	 
       
    76 			void RegisterObserver(MInternalGavdpUser* aObserver, const TDesC& aName);
       
    77 			
       
    78 			/*
       
    79 			 *
       
    80 			 *
       
    81 			 */
       
    82 			TInt StartSrc(CBTSACSEPManager& aLocalSEPs, TSBCCodecCapabilities& aSbc);
       
    83 	
       
    84 	 		/*
       
    85 			 *
       
    86 			 *
       
    87 			 */
       
    88 	 		void StopSrc(); // disconnect from accessory
       
    89 					
       
    90 			 /*
       
    91 			 * Connect with remote accessory
       
    92 			 * @param 	aAddr	bluetooth address of the device to be connected
       
    93 			 * @return	KErrNone if connection is successfull, error otherwise.
       
    94 			 */
       
    95 			 void Connect( const TBTDevAddr& aAddr );  		
       
    96 			 
       
    97 			 /*
       
    98 			 *
       
    99 			 *
       
   100 			 */
       
   101 			 TInt Listen();
       
   102  
       
   103 			 /*
       
   104 			 *
       
   105 			 *
       
   106 			 */	 			
       
   107      		 void Cancel();
       
   108     		 
       
   109     		 /*
       
   110 			 *
       
   111 			 *
       
   112 			 */
       
   113     		 void DiscoverSEPs();
       
   114       		 
       
   115     		 /*
       
   116     		 * Stop streaming to the connected remote accessory
       
   117     		 * @param   None.
       
   118     		 * @return  None.
       
   119     		 */
       
   120     		 void AbortStreaming(TSEID& aRemoteSEPId);
       
   121     		 
       
   122     		 
       
   123     		 /*
       
   124     		 * Disconnects the RGavdp session from the signalling channel, but does not destroy the local SEPs owned
       
   125 			 * by the signalling channel. Must only be called if there is no stream present -
       
   126 			 * if a stream is present AbortStream() should be called.
       
   127     		 * @param   None.
       
   128     		 * @return  None.
       
   129     		 */
       
   130     		 TInt CBTSACGavdp::Shutdown();
       
   131     		
       
   132     		 /**
       
   133     		 * Suspend (Pause) streaming to remote accessory
       
   134     		 * @ param None.
       
   135     		 * @return KErrNone if streaming could be suspended successfully, error otherwise
       
   136     		 */
       
   137     		 void SuspendStreams(TSEID& aRemoteSEPId);
       
   138     		 
       
   139     		 /*
       
   140 			 *
       
   141 			 *
       
   142 			 */
       
   143     		 TInt ConnectAsSrc();	// Not implemented yet
       
   144 			 
       
   145 			 /*
       
   146 			 *
       
   147 			 *
       
   148 			 */
       
   149 			 TInt CreateBearers(TSEID& aRemoteSEPId);
       
   150 			 
       
   151 			 /*
       
   152 			 *
       
   153 			 *
       
   154 			 */
       
   155 			 TInt ConfigureSEP(TSEID aLocalSEPId, TSEID aRemoteSEPId, 
       
   156 			 					TSBCCodecCapabilities& aSBCCaps, TAvdtpMediaTransportCapabilities& aMedTranCaps  );
       
   157 			 
       
   158 			 /*
       
   159 			 *
       
   160 			 *
       
   161 			 */
       
   162 			 void DoSink();				// Not implemented yet
       
   163 			 
       
   164 			 /*
       
   165 			 *
       
   166 			 *
       
   167 			 */
       
   168 			 void StartStreams(TSEID& aRemoteSEPId); 
       
   169 			 
       
   170 			 /*
       
   171 			 *
       
   172 			 *
       
   173 			 */
       
   174 			 void GetCapabilities(TSEID& aId); 
       
   175 			 
       
   176 			 /*
       
   177 			 *
       
   178 			 *
       
   179 			 */
       
   180 			 void SendSecurityControl();
       
   181 			 
       
   182 			 /*
       
   183 			 * Closes the stream
       
   184 			 */
       
   185 			 void Close();
       
   186 			 
       
   187 			 /*
       
   188 			 * Opens a RGavdp session
       
   189 			 */
       
   190 			 TInt Open();
       
   191 			 
       
   192 			/*
       
   193 			* Registers Stream endpoint to gavdp
       
   194 			*
       
   195 			*/    
       
   196 			TInt RegisterSEPs(CBTSACSEPManager& aLocalSEPs, TSBCCodecCapabilities& aSbc );
       
   197 
       
   198    private:
       
   199 
       
   200         /**
       
   201         * C++ default constructor.
       
   202         */
       
   203         CBTSACGavdp();
       
   204         
       
   205         /**
       
   206         * C++ default constructor.
       
   207         */
       
   208         CBTSACGavdp( MInternalGavdpUser* aObserver );
       
   209 
       
   210         /**
       
   211         * Symbian 2nd phase constructor.
       
   212         * 
       
   213         * 
       
   214         * 
       
   215         * 
       
   216         */
       
   217         void ConstructL();
       
   218 
       
   219 		
       
   220 
       
   221    private:		// GAVDP callbacks - @see gavdp.h for definitions
       
   222 		
       
   223 		virtual void GAVDP_SEPDiscovered(const TAvdtpSEPInfo& aSEP);
       
   224 		virtual void GAVDP_SEPDiscoveryComplete();
       
   225 		virtual void GAVDP_SEPCapability(TAvdtpServiceCapability* aCapability);	
       
   226 		virtual void GAVDP_SEPCapabilityComplete();
       
   227 		virtual void GAVDP_AbortStreamConfirm();
       
   228 		virtual void GAVDP_StartStreamsConfirm();
       
   229 		virtual void GAVDP_SuspendStreamsConfirm();
       
   230 		virtual void GAVDP_SecurityControlConfirm(const TDesC8& aResponseData);
       
   231 		virtual void GAVDP_ConfigurationConfirm();	// configuration complete and SEP selected *AND* reconfigure confirm
       
   232 		virtual void GAVDP_Error(TInt aError, const TDesC8& aErrorData);
       
   233 		virtual void GAVDP_ConnectConfirm(const TBTDevAddr& aAddr);
       
   234 		virtual void GAVDP_ConfigurationStartIndication(TSEID aLocalSEID, TSEID aRemoteSEID);	
       
   235 		virtual TInt GAVDP_ConfigurationIndication(TAvdtpServiceCapability* aCapability);
       
   236 		virtual TInt GAVDP_ConfigurationEndIndication();
       
   237 		virtual TInt GAVDP_StartIndication(TSEID aSEID);
       
   238 		virtual TInt GAVDP_SuspendIndication(TSEID aSEID);
       
   239 		virtual TInt GAVDP_SecurityControlIndication(TSEID aSEID, TDes8& aSecurityData);
       
   240 		virtual void GAVDP_AbortIndication(TSEID aSEID);
       
   241 		virtual void GAVDP_ReleaseIndication(TSEID aSEID);
       
   242 		virtual void GAVDP_BearerReady(RSocket aNewSocket, const TAvdtpSockAddr& aAddr);
       
   243 	    
       
   244 		
       
   245     private:    // Data
       
   246         
       
   247 	    MInternalGavdpUser* iObserver; 
       
   248       
       
   249 	    CBTSACStreamerController* iStreamer;
       
   250 		RSocketServ	iSockServ;
       
   251 		RGavdp iGavdp;	
       
   252 
       
   253 		// Handle to the AVDTP SOURCE SDP service record, which is 
       
   254     	// created to our local SDP database
       
   255     	TSdpServRecordHandle iA2dpSourceSDPrecordHandle;
       
   256     	CBTEngDiscovery* iBTConnectionPtr;
       
   257 	   };
       
   258 
       
   259 
       
   260 #endif      // BTSAC_STREAMER_H
       
   261             
       
   262 // End of File