diff -r 000000000000 -r 29b1cd4cb562 bluetooth/btstack/avdtp/avdtpSEPCache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetooth/btstack/avdtp/avdtpSEPCache.h Fri Jan 15 08:13:17 2010 +0200 @@ -0,0 +1,83 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Defines the avdtp SEP cache which holds details about the capabilities of remote SEPs +// these details can then be used later by the stack without having to send a GetCaps +// +// + +/** + @file + @internalComponent +*/ + +#ifndef AVDTPSEPCACHE_H +#define AVDTPSEPCACHE_H + +#include +#include + +static const TInt KSEPCacheCallbackInterval = 5; // seconds +static const TInt KSEPCacheRecordDeadAge = 4; // multiples of CBInterval + +class CCapabilityVisitor; + +NONSHARABLE_CLASS(CRemoteSEP) : public CBase + { +friend class CRemoteSEPCache; +public: + ~CRemoteSEP(); // RPointerArray deletion +private: + static CRemoteSEP* NewL(const TBTDevAddr& aAddr, const TAvdtpSEPInfo& aInfo); + void SetCapabilities(HBufC8* aCapsAsProtocol); + TPtrC8 GetCapabilityL(TAvdtpServiceCategory aCat); + TBool HasCapability(TAvdtpServiceCategory aCat); + inline TAvdtpServiceCategories GetCapabilities() const; + void UpdateInfo(const TAvdtpSEPInfo& aInfo); +private: + CRemoteSEP(const TBTDevAddr& aAddr, const TAvdtpSEPInfo& aInfo); + void ConstructL(); +private: + TBTDevAddr iRemoteDev; + TAvdtpSEPInfo iInfo; + RPointerArray iParsedCaps; + HBufC8* iCapabilitiesBuf; // the bit of the packet we got, copied out + TAvdtpServiceCategories iKnownCaps; + }; + +NONSHARABLE_CLASS(CRemoteSEPCache) : public CBase + { +public: + static CRemoteSEPCache* NewL(); + TInt AddSEP(const TBTDevAddr& aAddr, const struct TAvdtpSEPInfo& aInfo); + void SetCapabilities(const TBTDevAddr& aAddr, TSEID aSEID, HBufC8* aCapsAsProtocol); + static TInt PerformMaintenanceCallback(TAny*); // maintains the cache; + TBool Exists(const TBTDevAddr& aAddr, TSEID aSEID) const; + TPtrC8 GetCapabilityL(const TBTDevAddr& aAddr, TSEID aSEID, TAvdtpServiceCategory aCat); + TBool HasCapability(const TBTDevAddr& aAddr, TSEID aSEID, TAvdtpServiceCategory aCat); + TAvdtpServiceCategories GetCapabilitiesL(const TBTDevAddr& aAddr, TSEID aSEID) const; + void InvalidateSEPs(const TBTDevAddr& aAddr); + ~CRemoteSEPCache(); +private: + CRemoteSEP* FindSEP(const TBTDevAddr& aAddr, TSEID aSEID) const; +private: +// async callback to age these things + RPointerArray iRemoteSEPs; + }; + +inline TAvdtpServiceCategories CRemoteSEP::GetCapabilities() const + { + return iKnownCaps; + } + +#endif //AVDTPSEPCACHE_H