bluetooth/btstack/avdtp/avdtpLocalSEP.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Defines the avdtp local SEP class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 
       
    24 #ifndef AVDTPLOCALSEP_H
       
    25 #define AVDTPLOCALSEP_H
       
    26 
       
    27 #include <bluetoothav.h>
       
    28 #include "gavdpinterface.h"
       
    29 #include "avdtpAllocators.h"
       
    30 
       
    31 class CAVStream;
       
    32 class CAvdtpProtocol;
       
    33 class MAvdtpStreamNotify;
       
    34 
       
    35 NONSHARABLE_CLASS(CLocalSEP) : public CBase
       
    36 	{
       
    37 public:
       
    38 	static CLocalSEP* NewL(TAvdtpSEPInfo& aSEPInfo, TSEIDManager& aSEIDManager);
       
    39 	inline TSEID SEID() const;
       
    40 	inline TAvdtpSEPInfo Info() const;
       
    41 
       
    42 	void AddCapability(const TAvdtpServiceCapability* aCapability); //transfers ownership
       
    43 	inline TAvdtpServiceCategories Categories() const;
       
    44 	TInt CheckConfigurationState(TBool aIsReconfig) const;
       
    45 	TInt SetPendingConfiguration(const RBuf8& aConfigurationProtocolDomain, TBool aIsReconfig);
       
    46 	void SetRemoteSEID(TSEID aSEID);
       
    47 	inline TPtrC8 PendingConfiguration() const;
       
    48 	void SetSecurityControl(const HBufC8* aSecurityControl);
       
    49 	inline TPtrC8 SecurityControl() const;
       
    50 	void CommitPendingConfigurationL(TBool aSuccess, TBool aReconfig);
       
    51 	inline const TCapabilitiesArray& Configuration() const; // returns in non-protocol domain
       
    52 	inline const TCapabilitiesArray& Capabilities() const; // returns in non-protocol domain	
       
    53 	void SetInUse(TBool aInUse);
       
    54 	inline TBool InUse() const;
       
    55 	void PrepareInitialConfiguration();
       
    56 	inline TBool PreConfigured() const;
       
    57 	TBool MultiplexingConfigured() const;
       
    58 	
       
    59 	~CLocalSEP();
       
    60 	
       
    61 	CAVStream& CreateStreamL(const TAvdtpSockAddr& aAddr,
       
    62 							 MAvdtpStreamNotify& aStreamNotify,
       
    63 							 CAvdtpProtocol& aProtocol);
       
    64 							 
       
    65 	void ExpectStreamL(const TBTDevAddr& aBTAddr,
       
    66 						MAvdtpStreamNotify& aStreamNotify,
       
    67 						CAvdtpProtocol& aProtocol);
       
    68 							 
       
    69 	inline void StreamDestroyed(const CAVStream& aStream);
       
    70 	inline CAVStream* Stream() const;
       
    71 public:
       
    72 	TDblQueLink		iSignallingSessionLink;
       
    73 private:
       
    74 	void ConstructL(TAvdtpSEPInfo& aSEPInfo, TSEIDManager& aSEIDManager);
       
    75 	CLocalSEP();
       
    76 private:
       
    77 	RSEID			iLocalSEID;
       
    78 	TAvdtpSEPInfo	iInfo;
       
    79 	
       
    80 	TCapabilitiesArray iCapabilities;
       
    81 	TCapabilitiesArray iConfiguration;
       
    82 
       
    83 	RBuf8	iPendingConfigurationProtocolDomain;	
       
    84 	const HBufC8*	iSecurityControl;
       
    85 	
       
    86 	TAvdtpServiceCategories iCapabilityCategories;
       
    87 	CAVStream*	iStream; // the stream we may or may not end up in, owned
       
    88 	TSEID	iRemoteSEID;
       
    89 	TBool	iPreConfigured;
       
    90 	};
       
    91 
       
    92 inline TBool CLocalSEP::PreConfigured() const
       
    93 	{
       
    94 	return iPreConfigured;
       
    95 	}
       
    96 
       
    97 inline TSEID CLocalSEP::SEID() const
       
    98 	{
       
    99 	return iInfo.SEID();
       
   100 	}
       
   101 		
       
   102 inline TAvdtpSEPInfo CLocalSEP::Info() const
       
   103 	{
       
   104 	return iInfo;
       
   105 	}
       
   106 	
       
   107 inline const TCapabilitiesArray& CLocalSEP::Capabilities() const
       
   108 	{
       
   109 	return iCapabilities;
       
   110 	}
       
   111 
       
   112 inline const TCapabilitiesArray& CLocalSEP::Configuration() const
       
   113 	{
       
   114 	return iConfiguration;
       
   115 	}
       
   116 	
       
   117 inline TAvdtpServiceCategories CLocalSEP::Categories() const
       
   118 	{
       
   119 	return iCapabilityCategories;
       
   120 	}
       
   121 
       
   122 inline TBool CLocalSEP::InUse() const
       
   123 	{
       
   124 	return iInfo.InUse();
       
   125 	}
       
   126 	
       
   127 inline CAVStream* CLocalSEP::Stream() const
       
   128 	{
       
   129 	// doesn't return ownership
       
   130 	return iStream;
       
   131 	}
       
   132 	
       
   133 inline TPtrC8 CLocalSEP::PendingConfiguration() const
       
   134 	{
       
   135 	return iPendingConfigurationProtocolDomain;
       
   136 	}
       
   137 	
       
   138 inline TPtrC8 CLocalSEP::SecurityControl() const
       
   139 	{
       
   140 	return *iSecurityControl;
       
   141 	}
       
   142 
       
   143 #endif //AVDTPLOCALSEP
       
   144 
       
   145 #ifndef _AVDTPLOCALSEPSTREAM
       
   146 #define _AVDTPLOCALSEPSTREAM
       
   147 #include "avdtpStream.h"
       
   148 
       
   149 #ifdef _DEBUG
       
   150 inline void CLocalSEP::StreamDestroyed(const CAVStream& aStream)
       
   151 #else
       
   152 inline void CLocalSEP::StreamDestroyed(const CAVStream& /*aStream*/)
       
   153 #endif
       
   154 	{
       
   155 	if (iStream) __ASSERT_DEBUG(&aStream == iStream, User::Panic(_L("avdtplocalsep.h"), __LINE__));
       
   156 	iStream = NULL;
       
   157 	SetInUse(EFalse);
       
   158 	}
       
   159 
       
   160 #endif // _AVDTPLOCALSEPSTREAM
       
   161