--- a/bluetooth/btexample/example/btproperties/BTProperties.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btexample/example/btproperties/BTProperties.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -55,6 +55,56 @@
}
}
+void CreateSubscribersL(RPointerArray<CSubscriber>& aSubscribers)
+ {
+ CSubscriber* subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothGetPHYCount, KNumLinks);
+
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothGetRegistryTableChange, KRegistry);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothGetConnectingStatus, KConnecting);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothGetScanningStatus, KScanning);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothGetLimitedDiscoverableStatus, KLimited);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothGetDeviceClass, KDeviceClass);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothGetCorruptRegistryResetIndication, KCorruptRegistry);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CDeviceNameSubscriber::NewL(test, KPropertyKeyBluetoothGetDeviceName, KDeviceName);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+
+ subscriber = CSubscriber::NewL(test, KPropertyKeyBluetoothHostResolverActive, KDiscovering);
+ CleanupStack::PushL(subscriber);
+ aSubscribers.AppendL(subscriber);
+ CleanupStack::Pop(subscriber);
+ }
+
+
void TestL()
{
// first do a sync test
@@ -62,27 +112,22 @@
RPointerArray<CSubscriber> subscribers;
- //ignoring errors!
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothGetPHYCount, KNumLinks));
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothGetRegistryTableChange, KRegistry));
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothGetConnectingStatus, KConnecting));
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothGetScanningStatus, KScanning));
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothGetLimitedDiscoverableStatus, KLimited));
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothGetDeviceClass, KDeviceClass));
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothGetCorruptRegistryResetIndication, KCorruptRegistry));
- subscribers.Append(CDeviceNameSubscriber::NewL(test, KPropertyKeyBluetoothGetDeviceName, KDeviceName));
- subscribers.Append(CSubscriber::NewL(test, KPropertyKeyBluetoothHostResolverActive, KDiscovering));
+ TRAPD(err, CreateSubscribersL(subscribers));
test.Printf(_L("%d Subscribers\n"), subscribers.Count());
- for (TInt i=0; i<subscribers.Count(); i++)
- subscribers[i]->Start();
-
- CActiveScheduler::Start();
+ if (err == KErrNone)
+ {
+ // Only start if no errors when creating the subscribers
+ for (TInt i=0; i<subscribers.Count(); i++)
+ {
+ subscribers[i]->Start();
+ }
+ CActiveScheduler::Start();
+ }
subscribers.ResetAndDestroy();
}
-
CSubscriber* CSubscriber::NewL(RTest& aTest, TUint aKey, const TDesC& aString)
{
CSubscriber* s = new(ELeave) CSubscriber(aTest, aString);
--- a/bluetooth/btexample/example/eir/teir.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btexample/example/eir/teir.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -143,8 +143,13 @@
switch(aTag)
{
case ETestDeviceName:
- iResolvers.Append(CActiveInquirer::NewL(iConsole, *this, 0, EFalse, EFalse, EFalse, EFalse));
+ {
+ CActiveInquirer* inquirer = CActiveInquirer::NewL(iConsole, *this, 0, EFalse, EFalse, EFalse, EFalse);
+ CleanupStack::PushL(inquirer);
+ iResolvers.AppendL(inquirer);
+ CleanupStack::Pop(inquirer);
iNameRequester->SetLocalNameL();
+ }
break;
case ETestUuid16:
@@ -249,12 +254,18 @@
void CEirApp::NewNameRequesterL(TBool aEirInstead, TBool aIgnoreCache)
{
- iResolvers.Append(CActiveNameRequester::NewL(iConsole, *this, aEirInstead, aIgnoreCache));
+ CActiveNameRequester* requester = CActiveNameRequester::NewL(iConsole, *this, aEirInstead, aIgnoreCache);
+ CleanupStack::PushL(requester);
+ iResolvers.AppendL(requester);
+ CleanupStack::Pop(requester);
}
void CEirApp::NewInquirerL(TUint aIAC, TBool aDoNames, TBool aIgnoreCache, TBool aDoEir, TBool forever)
{
- iResolvers.Append(CActiveInquirer::NewL(iConsole, *this, aIAC, aDoNames, aIgnoreCache, aDoEir, forever));
+ CActiveInquirer* inquirer = CActiveInquirer::NewL(iConsole, *this, aIAC, aDoNames, aIgnoreCache, aDoEir, forever);
+ CleanupStack::PushL(inquirer);
+ iResolvers.AppendL(inquirer);
+ CleanupStack::Pop(inquirer);
}
void CEirApp::CancelInquirer()
@@ -268,7 +279,10 @@
void CEirApp::NewNameArrayRequesterL()
{
- iResolvers.Append(CActiveNameArrayRequester::NewL(iConsole, *this, iDevicesFound));
+ CActiveNameArrayRequester* requester = CActiveNameArrayRequester::NewL(iConsole, *this, iDevicesFound);
+ CleanupStack::PushL(requester);
+ iResolvers.AppendL(requester);
+ CleanupStack::Pop(requester);
}
void CEirApp::DeviceFound(TBTDevAddr aAddress)
@@ -276,7 +290,7 @@
#if USE_SMALL_CONSOLE
iConsole.Printf(_L("App: Found device.\n"));
#endif
- iDevicesFound.Append(aAddress);
+ (void)iDevicesFound.Append(aAddress);
}
void CEirApp::InquiryComplete()
--- a/bluetooth/btlogger/btsnoophcilogger/src/hciloggerbtsnoop.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btlogger/btsnoophcilogger/src/hciloggerbtsnoop.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -66,14 +66,15 @@
for (TInt i = 0; i <= TInt(KHCILoggerControllerToHost | KHCILoggerCommandOrEvent); i++)
{
CHCILoggerBufferedFrame* temp = new(ELeave) CHCILoggerBufferedFrame;
- iBuffers.Append(temp); // array now "owns" temp
+ CleanupStack::PushL(temp);
+ iBuffers.AppendL(temp); // array now "owns" temp
+ CleanupStack::Pop(temp);
}
}
void CHCILoggerBtSnoop::DoInitialise(TInt aType)
{
iDatalinkType = aType;
- iFs.Connect();
OpenFile(); // if it fails, just ignore it - try later when writing
}
@@ -149,7 +150,18 @@
break;
};
- TInt err = iLogFile.Open(iFs, fileName, EFileWrite | EFileShareAny);
+ TInt err = KErrNone;
+
+ if (!iFs.Handle())
+ {
+ err = iFs.Connect();
+ if (err)
+ {
+ return err;
+ }
+ }
+
+ err = iLogFile.Open(iFs, fileName, EFileWrite | EFileShareAny);
if (err == KErrNotFound)
{ // if it doesn't already exist, create it
//Note that the potential KErrPathNotFound error is deliberately not handled,
--- a/bluetooth/btsdp/server/epocsvr.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btsdp/server/epocsvr.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -967,7 +967,7 @@
// we wouldn't want to remove the record if an error did occur,
// which is very unlikely as typically only 1 or 2 records are
// added per session.
- iSessionRecords.Append(newRecord);
+ (void)iSessionRecords.Append(newRecord);
}
aMessage.Complete(err);
}
--- a/bluetooth/btstack/avdtp/avdtpDirectChannel.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpDirectChannel.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -45,15 +45,28 @@
LOG_FUNC
}
-TInt CDirectChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType /*aType*/)
+TInt CDirectChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType /*aType*/, TL2CapConfig::TChannelPriority aPriority)
{
LOG_FUNC
__ASSERT_DEBUG(!iTransportSession, Panic(EAVDTPBadSessionAttachToTransportChannel));
- // don't care about session type for direct channels
iTransportSession = &aSession;
+ iChannelPriority = aPriority;
+ UpdateChannelPriority();
return KErrNone;
}
+void CDirectChannel::UpdateChannelPriority()
+ {
+ LOG_FUNC
+
+ if(iLogicalChannel)
+ {
+ TPckgBuf<TL2CapConfig> configBuf;
+ configBuf().ConfigureChannelPriority(iChannelPriority);
+ (void)iLogicalChannel->SetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
+ }
+ }
+
TBool CDirectChannel::CouldAttachSession(const TAvdtpSockAddr& /*aAddr*/)
{
LOG_FUNC
@@ -136,6 +149,10 @@
LOG_FUNC
__ASSERT_DEBUG(&aSession == iTransportSession, Panic(EAVDTPBadSessionDetachFromTransportChannel));
iTransportSession = NULL;
+ iChannelPriority = TL2CapConfig::ELow;
+
+ UpdateChannelPriority();
+
// closing logical channel is async - we die on CanClose
// but we're invalid, so tell protocol
Protocol().TransportChannelClosing(*this);
--- a/bluetooth/btstack/avdtp/avdtpDirectChannel.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpDirectChannel.h Wed Aug 18 10:54:44 2010 +0300
@@ -37,7 +37,7 @@
// can just forward down to L2CAP...
virtual void DetachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
- virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
+ virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority = TL2CapConfig::ELow);
virtual TBool CouldAttachSession(const TAvdtpSockAddr& aAddr);
virtual TTCID TCID() const;
CServProviderBase* ObtainSAP();
@@ -48,7 +48,8 @@
private:
CDirectChannel(CAvdtpProtocol& aProtocol, const TBTDevAddr& aRemoteDevice);
-
+ void UpdateChannelPriority();
+
private:
// interesting stuff from l2cap
virtual void NewData(TUint aCount);
@@ -59,6 +60,7 @@
private:
CUserPlaneTransportSession* iTransportSession; // non-owned
TBool iTransportSessionBlocked;
+ TL2CapConfig::TChannelPriority iChannelPriority;
};
#endif //AVDTPDIRECTCHANNEL_H
--- a/bluetooth/btstack/avdtp/avdtpLogicalChannelFactory.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpLogicalChannelFactory.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -1296,13 +1296,7 @@
TPckgBuf<TL2CapConfig> configBuf;
iLogicalChannelSAP->GetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
-
- if(iSequenceNumber != KInitialSequenceNumber)
- {
- configBuf().ConfigureChannelPriority(TL2CapConfig::EHigh);
- iLogicalChannelSAP->SetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
- }
- else if(!aPrecreatedSAP)
+ if(!aPrecreatedSAP)
{
// FIXME consider value of rtx timer, should consider Tgavdp
// Note: The 'rtx timer' actually sets max retransmit count instead [Piotr].
--- a/bluetooth/btstack/avdtp/avdtpMediaSession.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMediaSession.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -76,7 +76,7 @@
__ASSERT_DEBUG(iStream, Panic(EAvdtpTransportSessionBaseNotCheckStream));
TInt ret = KErrGeneral; // may be OOM or notfound
- ret = iStream->AddSession(EMedia,*this,iTransportChannel);
+ ret = iStream->AddSession(EMedia,*this,iTransportChannel,TL2CapConfig::EHigh);
if (ret!=KErrNone)
{
// not erroring the stream, as it's not it's fault
--- a/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -295,7 +295,7 @@
#pragma message("is there n pools for eg media, or just one?")
}
*/
-TInt CMuxChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)
+TInt CMuxChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority)
/**
Protocol must ensure it has found appropriate muxchannel for
Recovery packets
@@ -321,7 +321,45 @@
__ASSERT_DEBUG(sessionArray, Panic(EAVDTPBadSessionAttachToTransportChannel));
- return sessionArray->Append(TUserPlaneTransportSessionState(aSession));
+ TInt err = sessionArray->Append(TUserPlaneTransportSessionState(aSession, aPriority));
+ if(err == KErrNone)
+ {
+ UpdateChannelPriority();
+ }
+ return err;
+ }
+
+void CMuxChannel::UpdateChannelPriority()
+ {
+ LOG_FUNC
+
+ TL2CapConfig::TChannelPriority maxPriority = TL2CapConfig::ELow;
+
+ MaxChannelPriority(maxPriority, iMediaSessions);
+ MaxChannelPriority(maxPriority, iReportingSessions);
+ MaxChannelPriority(maxPriority, iRecoverySessions);
+
+ if(iLogicalChannel)
+ {
+ TPckgBuf<TL2CapConfig> configBuf;
+ configBuf().ConfigureChannelPriority(maxPriority);
+ (void)iLogicalChannel->SetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
+ }
+ }
+
+
+void CMuxChannel::MaxChannelPriority(TL2CapConfig::TChannelPriority& aMaxPriority, const RArray<TUserPlaneTransportSessionState>& aSessions)
+ {
+ LOG_STATIC_FUNC
+
+ for(TInt i=0; i < aSessions.Count(); ++i)
+ {
+ TL2CapConfig::TChannelPriority priority = aSessions[i].iChannelPriority;
+ if(aMaxPriority < priority)
+ {
+ aMaxPriority = priority;
+ }
+ }
}
/**
@@ -419,6 +457,7 @@
}
__ASSERT_DEBUG(found==1, Panic(EAVDTPBadSessionDetachFromTransportChannel));
+ UpdateChannelPriority();
CheckForClose();
}
--- a/bluetooth/btstack/avdtp/avdtpMuxChannel.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMuxChannel.h Wed Aug 18 10:54:44 2010 +0300
@@ -134,7 +134,7 @@
TTCID aRemotelyAssignedTCID);
// management path
- virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
+ virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority = TL2CapConfig::ELow);
virtual void DetachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
virtual TBool CouldAttachSession(const TAvdtpSockAddr& aAddr);
virtual TTCID TCID() const;
@@ -153,7 +153,9 @@
private:
CMuxChannel(CAvdtpProtocol& aProtocol, const TBTDevAddr& aRemoteDevice);
-
+
+ void UpdateChannelPriority();
+
static TInt MuxSendIntervalCb(TAny* aCMuxChannel);
void CheckForClose();
TUint DoSend();
@@ -171,13 +173,15 @@
// receive path
struct TUserPlaneTransportSessionState
{
- inline TUserPlaneTransportSessionState(CUserPlaneTransportSession& aSession);
+ inline TUserPlaneTransportSessionState(CUserPlaneTransportSession& aSession, TL2CapConfig::TChannelPriority aChannelPriority);
CUserPlaneTransportSession& iSession;
TBool iIsBlocked;
-
+ TL2CapConfig::TChannelPriority iChannelPriority;
};
+ static void MaxChannelPriority(TL2CapConfig::TChannelPriority& aMaxPriority, const RArray<TUserPlaneTransportSessionState>& aSessions);
+
RArray<TUserPlaneTransportSessionState> iMediaSessions;
RArray<TUserPlaneTransportSessionState> iReportingSessions;
RArray<TUserPlaneTransportSessionState> iRecoverySessions; // recall not from same streams as other sessions
@@ -202,8 +206,10 @@
};
inline CMuxChannel::TUserPlaneTransportSessionState::TUserPlaneTransportSessionState(
- CUserPlaneTransportSession& aSession)
-: iSession(aSession)
+ CUserPlaneTransportSession& aSession,
+ TL2CapConfig::TChannelPriority aChannelPriority)
+ : iSession(aSession)
+ , iChannelPriority(aChannelPriority)
{
}
--- a/bluetooth/btstack/avdtp/avdtpStream.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStream.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -343,10 +343,11 @@
TInt CAVStream::AddSession(TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel)
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority)
{
LOG_FUNC
- return iState->AddSession(*this, aType, aSession, aChannel);
+ return iState->AddSession(*this, aType, aSession, aChannel, aPriority);
}
void CAVStream::DropSession(TAvdtpTransportSessionType aType, CUserPlaneTransportSession& aSession)
--- a/bluetooth/btstack/avdtp/avdtpStream.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStream.h Wed Aug 18 10:54:44 2010 +0300
@@ -149,7 +149,8 @@
TInt AddSession(TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aTransportChannel);
+ CTransportChannel*& aTransportChannel,
+ TL2CapConfig::TChannelPriority aPriority = TL2CapConfig::ELow);
void DropSession(TAvdtpTransportSessionType aType, CUserPlaneTransportSession& aSession);
void ClearSession(CUserPlaneTransportSession& aSession);
@@ -303,7 +304,8 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aTransportChannel) const;
+ CTransportChannel*& aTransportChannel,
+ TL2CapConfig::TChannelPriority aPriority) const;
virtual void DropSession(CAVStream& aStream, TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession) const;
@@ -398,7 +400,8 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel) const;
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority) const;
virtual void DropSession(CAVStream& aStream, TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession) const;
virtual void SetConfigurationL(CAVStream& aStream,
@@ -419,7 +422,8 @@
TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aTransportChannel) const;
+ CTransportChannel*& aTransportChannel,
+ TL2CapConfig::TChannelPriority aPriority) const;
virtual void Enter(CAVStream& aStream) const;
private:
void TryToOpen(CAVStream& aStream) const;
@@ -440,7 +444,8 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel) const;
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority) const;
virtual TInt StartReceived(CAVStream& aStream) const;
virtual void Enter(CAVStream& aStream) const;
@@ -454,7 +459,8 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel) const;
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority) const;
virtual TInt StartReceived(CAVStream& aStream) const;
virtual void Enter(CAVStream& aStream) const;
@@ -494,7 +500,8 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel) const;
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority) const;
// next pertains to reconfiguration
void SetConfigurationL(CAVStream& aStream,
RBuf8& aPacketBuffer,
--- a/bluetooth/btstack/avdtp/avdtpStreamStates.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStreamStates.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -254,7 +254,8 @@
TInt TAVStreamState::AddSession(CAVStream& /*aStream*/,
TAvdtpTransportSessionType /*aType*/,
CUserPlaneTransportSession& /*aSession*/,
- CTransportChannel*& /*aTransportChannel*/) const
+ CTransportChannel*& /*aTransportChannel*/,
+ TL2CapConfig::TChannelPriority /*aPriority*/) const
{
LOG_FUNC
DEBUGPANICINSTATE(EAvdtpUnexpectedAddSessionEvent);
@@ -490,7 +491,8 @@
TInt TAVStreamStateINTConfigured::AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel) const
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority) const
{
LOG_FUNC
TInt ret = KErrNone;
@@ -513,7 +515,7 @@
if (aChannel)
{
// bind session to channel
- ret = aChannel->AttachTransportSession(aSession, aType);
+ ret = aChannel->AttachTransportSession(aSession, aType, aPriority);
if (ret==KErrNone)
{
// keep a copy of this binding
@@ -774,7 +776,8 @@
TInt TAVStreamStateACPConfigured::AddSession(CAVStream& /*aStream*/,
TAvdtpTransportSessionType /*aType*/,
CUserPlaneTransportSession& /*aSession*/,
- CTransportChannel*& /*aTransportChannel*/) const
+ CTransportChannel*& /*aTransportChannel*/,
+ TL2CapConfig::TChannelPriority /*aPriority*/) const
{
LOG_FUNC
return KErrNotReady;
@@ -828,7 +831,8 @@
TInt TAVStreamStateReady::AddSession(CAVStream& /*aStream*/,
TAvdtpTransportSessionType /*aType*/,
CUserPlaneTransportSession& /*aSession*/,
- CTransportChannel*& /*aTransportChannel*/) const
+ CTransportChannel*& /*aTransportChannel*/,
+ TL2CapConfig::TChannelPriority /*aPriority*/) const
{
LOG_FUNC
#ifdef _DEBUG
@@ -918,8 +922,7 @@
{
sigch->SendAbort(aStream, aStream.RemoteSEID());
}
-
- // no need to tell signalling session as Opening is not available to RGavdp
+
// Opening is performed when the necessary sockets are created and connected in a stream
aStream.NotifyUserPlaneTransportSessionsError(NULL, aResult);
}
@@ -1194,7 +1197,8 @@
TInt TAVStreamStateWaitForSessions::AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel) const
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority) const
{
LOG_FUNC
TInt ret = KErrNone;
@@ -1237,7 +1241,7 @@
if (ret == KErrNone)
{
- ret = b->iChannel->AttachTransportSession(aSession, aType);
+ ret = b->iChannel->AttachTransportSession(aSession, aType, aPriority);
if (ret==KErrNone)
{
// stream needs to remember binding
@@ -1277,11 +1281,12 @@
TInt TAVStreamStateWaitForSessionsStartReceived::AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel) const
+ CTransportChannel*& aChannel,
+ TL2CapConfig::TChannelPriority aPriority) const
{
LOG_FUNC
// Call the function from the parent class to bind the session
- TInt ret = TAVStreamStateWaitForSessions::AddSession(aStream,aType,aSession,aChannel);
+ TInt ret = TAVStreamStateWaitForSessions::AddSession(aStream,aType,aSession,aChannel, aPriority);
// if that worked, and all the channels are bound, we can now issue the delayed start
if((ret == KErrNone) && (!aStream.iNumSessionsRequired))
--- a/bluetooth/btstack/avdtp/avdtpTransportChannel.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpTransportChannel.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -99,6 +99,7 @@
// take ownership
iLogicalChannel = aLogicalChannelRecord.iLogicalChannelSAP;
iLogicalChannel->SetNotify(this);
+ UpdateChannelPriority();
// drain any data
if (aLogicalChannelRecord.iDataCount)
{
--- a/bluetooth/btstack/avdtp/avdtpTransportChannel.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpTransportChannel.h Wed Aug 18 10:54:44 2010 +0300
@@ -59,7 +59,7 @@
// management path
virtual void DetachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)=0;
- virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)=0;
+ virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority)=0;
virtual TBool CouldAttachSession(const TAvdtpSockAddr& aAddr)=0;
virtual TTCID TCID() const=0;
inline const TBTDevAddr& RemoteAddress() const;
@@ -101,6 +101,9 @@
void CloseLogicalChannel();
inline CAvdtpProtocol& Protocol() const;
+private:
+ virtual void UpdateChannelPriority() = 0;
+
protected:
RTCID iTCID;
CServProviderBase* iLogicalChannel;
--- a/bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -558,6 +558,14 @@
ProcessPeerValue(response, EFalse);
}
+void TL2CapIncomingFecNegotiator::DowngradeToBasic()
+ {
+ LOG_FUNC
+ iPreferred = TRetransmissionAndFlowControlOption();
+ iConfigStatus = EOptionConfigComplete;
+ }
+
+
void TL2CapIncomingFecNegotiator::BuildRequest(TL2CapChannelMode aMode, TRetransmissionAndFlowControlOption& aFecOption)
{
LOG_FUNC
@@ -761,9 +769,7 @@
iIncomingNegotiator.Preferred().LinkMode() != EL2CAPBasicMode)
{
LOG(_L("\tReceived Basic mode Config Request, downgrading incoming channel mode to Basic"));
- // Downgrade incoming FEC to be basic mode.
- TRetransmissionAndFlowControlOption basicFec;
- iIncomingNegotiator.SetPreferred(basicFec);
+ iIncomingNegotiator.DowngradeToBasic();
}
}
--- a/bluetooth/btstack/l2cap/L2CapFecNegotiator.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapFecNegotiator.h Wed Aug 18 10:54:44 2010 +0300
@@ -207,6 +207,7 @@
void ProcessPeerValue(const TRetransmissionAndFlowControlOption& aFecOption,
TBool aIsUnacceptableParameters);
void ProcessImplicitPeerValue();
+ void DowngradeToBasic();
void Setup();
protected:
void BuildRequest(TL2CapChannelMode aMode, TRetransmissionAndFlowControlOption& aFecOption);
--- a/bluetooth/btstack/l2cap/l2sap.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2sap.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -435,7 +435,7 @@
case KL2CAPUpdateChannelConfig:
{
const TL2CapConfig apiConf = *reinterpret_cast<const TL2CapConfig*>(aOption.Ptr());
- return iL2CapSAPSignalHandler->UpdateChannelConfig(apiConf);
+ return UpdateChannelConfig(apiConf);
}
// Can't set these
@@ -1084,6 +1084,11 @@
if(dataConfig)
{
+ // if UpdateChannelConfig was called before iL2CapDataQueue was created we update the priority now
+ if (iChannelPriority != 0)
+ {
+ dataConfig->SetChannelPriority(iChannelPriority);
+ }
TRAP(rerr, iL2CapDataQueue = CL2CapSDUQueue::NewL(*this,
aLocalPort,
aRemotePort,
--- a/bluetooth/btstack/l2cap/l2signalmgr.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2signalmgr.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -1177,11 +1177,11 @@
else
{
TBool controllerAdded = EFalse;
- while((handler = iter++) != NULL && !controllerAdded)
+ while(!controllerAdded && (handler = iter++) != NULL)
{
if(channelPriority > handler->Config().ChannelPriority())
{
- handler->iLink.AddBefore(&(aDataController.iLink));
+ aDataController.iLink.AddBefore(&handler->iLink);
controllerAdded = ETrue;
}
}
--- a/bluetooth/btstack/linkmgr/hcifacade_commands.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hcifacade_commands.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -559,7 +559,7 @@
for (TInt count = 0; count < aNumCurrentIAC; count++)
{
- iacLap.Append(aIAC_LAP[count]);
+ iacLap.AppendL(aIAC_LAP[count]);
}
CWriteCurrentIACLAPCommand* cmd = CWriteCurrentIACLAPCommand::NewL(aNumCurrentIAC, iacLap);
--- a/bluetooth/btstack/linkmgr/hostresolver.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hostresolver.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -2284,7 +2284,7 @@
TInquiryCacheAge ageInfo;
ageInfo.iIAC = aIAC;
ageInfo.iCacheAge = aAge;
- iCacheAge.Append(ageInfo);
+ (void)iCacheAge.Append(ageInfo);
// If we can't append, there's not a lot we can do - we'll just have
// to return KMaxTInt when someone asks for the age
}
--- a/bluetooth/btstack/linkmgr/physicallinks.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinks.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -58,7 +58,7 @@
static const THCIErrorCode KDefaultRejectReason = EHostSecurityRejection; // see spec Error Codes
#ifdef _DEBUG
-#define __CHECK_CONNECTION_HANDLE(aHandle) __ASSERT_DEBUG(aHandle==iHandle, Panic(EBTLinkMgrConnectionEventInWrongSAP));
+#define __CHECK_CONNECTION_HANDLE(aHandle) __ASSERT_DEBUG(HasHandle(aHandle), Panic(EBTLinkMgrConnectionEventInWrongSAP));
#else
#define __CHECK_CONNECTION_HANDLE(aHandle) aHandle=aHandle; // to suppress warnings
#endif
@@ -1826,63 +1826,36 @@
return KErrNone;
}
- TBTLinkMode nextMode = EActiveMode;
+ TBTLinkMode targetMode = EActiveMode;
// Determine which LPM we should be in (if any)
if(modeChangeMask & KExplicitActiveMode)
{
- nextMode = EActiveMode;
+ targetMode = EActiveMode;
}
else if(modeChangeMask & EHoldMode)
{
- nextMode = EHoldMode;
+ targetMode = EHoldMode;
}
else if(modeChangeMask & ESniffMode)
{
- nextMode = ESniffMode;
+ targetMode = ESniffMode;
}
else if(modeChangeMask & EParkMode)
{
- nextMode = EParkMode;
+ targetMode = EParkMode;
}
- LOG2(_L8("Arbitration: Arbitrating mode 0x%02x -> 0x%02x"), currentMode, nextMode);
+ LOG2(_L8("Arbitration: Arbitrating mode 0x%02x -> 0x%02x"), currentMode, targetMode);
- if(nextMode != currentMode)
- {
- if(currentMode != EActiveMode)
- {
- LOG(_L8("Arbitration: Exiting existing LPM mode..."));
- TInt err = RequestActive();
- if(err != KErrNone)
- {
- return err;
- }
- }
- if(nextMode == EHoldMode)
- {
- LOG(_L8("Arbitration: Entering Hold mode..."));
- return RequestHold();
- }
- else if(nextMode == ESniffMode)
- {
- LOG(_L8("Arbitration: Entering Sniff mode..."));
- return RequestSniff();
- }
- else if(nextMode == EParkMode)
- {
- LOG(_L8("Arbitration: Entering Park mode..."));
- return RequestPark();
- }
- else if(nextMode == EActiveMode)
- {
- LOG(_L8("Arbitration: Staying in Active mode..."));
- return KErrNone;
- }
- // Shouldn't reach here, we have a strange mode
- DEBUG_PANIC_LINENUM;
- }
-
- LOG(_L8("Arbitration: Already in correct LPM, not doing anything"));
- return KErrNone;
+ if(IsConnected())
+ {
+ TInt err = iLowPowModeCtrl.ExecuteModeChange(targetMode);
+ LOG1(_L8("Arbitration: iLowPowModeCtrl.ExecuteModeChange: err:%d"), err);
+ return err;
+ }
+ else
+ {
+ return KErrDisconnected;
+ }
}
void CPhysicalLink::SetPassKey(const TDesC8& aPassKey)
@@ -2613,29 +2586,6 @@
return rerr;
}
-TInt CPhysicalLink::ExitMode(TBTLinkMode aMode)
- {
- LOG_FUNC
- return iLowPowModeCtrl.ExitMode(aMode, iHandle);
- }
-
-TInt CPhysicalLink::RequestMode(TBTLinkMode aMode)
- {
- LOG_FUNC
- if (!IsConnected())
- return KErrDisconnected;
-
- // if active mode is required, try to exit whatever Low Power mode we are in -
- // if neither sniff nor park nothing will happen.
- if(aMode == EActiveMode)
- {
- return ExitMode(iLinkState.LinkMode());
- }
-
- // now request this connection goes to requested mode
- return iLowPowModeCtrl.ChangeMode(aMode, iHandle);
- }
-
TInt CPhysicalLink::RequestChangeRole(TBTBasebandRole aRole)
{
LOG_FUNC
@@ -3143,29 +3093,14 @@
AuthenticationComplete(EPinRequestPending);
}
-
TInt CPhysicalLink::RequestHold()
{
LOG_FUNC
- return RequestMode(EHoldMode);
- }
-
-TInt CPhysicalLink::RequestSniff()
- {
- LOG_FUNC
- return RequestMode(ESniffMode);
- }
-
-TInt CPhysicalLink::RequestPark()
- {
- LOG_FUNC
- return RequestMode(EParkMode);
- }
-
-TInt CPhysicalLink::RequestActive()
- {
- LOG_FUNC
- return RequestMode(EActiveMode);
+ if (!IsConnected())
+ {
+ return KErrDisconnected;
+ }
+ return iLowPowModeCtrl.ChangeMode(EHoldMode, iHandle);
}
void CPhysicalLink::ReadNewPhysicalLinkMetricValue(TUint aIoctlName, CBTProxySAP& aSAP, TInt aCurrentValue)
@@ -3433,21 +3368,21 @@
LOG_FUNC
// Work out what the local priority will be now
iLocalPriority = iLocalPriority || aLocalPriority;
- LOG1(_L8("Arbitraion: Local Priority now %d"), iLocalPriority);
+ LOG1(_L8("Arbitration: Local Priority now %d"), iLocalPriority);
if(aImmediate)
{
- LOG(_L8("Arbitraion: Immediate Arbitration Requested..."));
+ LOG(_L8("Arbitration: Immediate Arbitration Requested..."));
CancelButPreserveLocalPriority();
return DoArbitrate();
}
else if(!IsActive())
{
- LOG(_L8("Arbitraion: Arbitration requested, will execute after delay timer..."));
+ LOG(_L8("Arbitration: Arbitration requested, will execute after delay timer..."));
After(KBTArbitrationDelay);
}
else // timer is already on its way
{
- LOG(_L8("Arbitraion: Arbitration delay timer still pending..."));
+ LOG(_L8("Arbitration: Arbitration delay timer still pending..."));
}
return KErrNone;
}
@@ -3455,7 +3390,7 @@
void CArbitrationDelayTimer::Restart()
{
LOG_FUNC
- LOG(_L8("Arbitraion: Arbitration timer restarted..."));
+ LOG(_L8("Arbitration: Arbitration timer restarted..."));
CancelButPreserveLocalPriority();
After(KBTArbitrationDelay);
}
@@ -3475,7 +3410,7 @@
**/
{
LOG_FUNC
- LOG(_L8("Arbitraion: Delayed Arbitration executing..."));
+ LOG(_L8("Arbitration: Delayed Arbitration executing..."));
static_cast<void>(DoArbitrate()); // ignore the error (always has been...)
}
@@ -4013,6 +3948,46 @@
return err;
}
+TInt TLowPowModeCmdController::ExecuteModeChange(TBTLinkMode aTargetMode)
+ {
+ LOG_FUNC
+ iTargetMode = aTargetMode;
+ if(iTargetMode != iParent.LinkState().LinkMode())
+ {
+ if(iParent.LinkState().LinkMode() != EActiveMode)
+ {
+ //the current mode is not in Active Mode, therefore the mode need to change to active first before change to other mode.
+ LOG(_L8("ExecuteModeChange: Exiting existing LPM mode..."));
+ return ExitMode(iParent.LinkState().LinkMode(), iParent.Handle());
+ }
+ //the current mode is in Active mode, therefore the mode is ready to go other mode.
+ if(iTargetMode == EHoldMode)
+ {
+ LOG(_L8("ExecuteModeChange: Entering Hold mode..."));
+ return ChangeMode(EHoldMode, iParent.Handle());
+ }
+ else if(iTargetMode == ESniffMode)
+ {
+ LOG(_L8("ExecuteModeChange: Entering Sniff mode..."));
+ return ChangeMode(ESniffMode, iParent.Handle());
+ }
+ else if(iTargetMode == EParkMode)
+ {
+ LOG(_L8("ExecuteModeChange: Entering Park mode..."));
+ return ChangeMode(EParkMode, iParent.Handle());
+ }
+ else if(iTargetMode == EActiveMode)
+ {
+ LOG(_L8("ExecuteModeChange: Staying in Active mode..."));
+ return KErrNone;
+ }
+ // Shouldn't reach here, we have a strange mode
+ DEBUG_PANIC_LINENUM;
+ }
+ LOG(_L8("ExecuteModeChange: Already in correct LPM, not doing anything"));
+ return KErrNone;
+ }
+
void TLowPowModeCmdController::SniffL(THCIConnHandle aHandleToRemote)
{
LOG_FUNC
@@ -4082,29 +4057,36 @@
LOG2(_L("TLowPowModeCmdController::MhcqcCommandEventReceived: event:%d opcode:0x%x"), code, aRelatedCommand->Opcode());
const TModeChangeEvent& modeChangeEvent = TModeChangeEvent::Cast(aEvent);
- TBTLinkMode mode = EActiveMode;
+ TBTLinkMode currentmode = EActiveMode;
switch(modeChangeEvent.CurrentMode())
{
// Mode 0, as defined for the Mode Change Event, is Active Mode
case 0:
break;
case 1:
- mode = EHoldMode;
+ currentmode = EHoldMode;
break;
case 2:
- mode = ESniffMode;
+ currentmode = ESniffMode;
break;
case 3:
- mode = EParkMode;
+ currentmode = EParkMode;
break;
default:
__ASSERT_ALWAYS(EFalse, Panic(EHCICommandBadArgument));
break;
}
- // In the HCI_Facade, in this situation, CPhysicalLinksManager::ModeChanged() is called.
- // Since this methods find the CPhysicalLink object (that is iParent) and then call its
- // ModeChange method, we can call it directly.
- iParent.ModeChange(aEvent.ErrorCode(), modeChangeEvent.ConnectionHandle(), mode, modeChangeEvent.Interval());
+ // In the HCI_Facade, in this situation, CPhysicalLinksManager::ModeChanged() is called.
+ // Since this methods find the CPhysicalLink object (that is iParent) and then call its
+ // ModeChange method, we can call it directly.
+ iParent.ModeChange(aEvent.ErrorCode(), modeChangeEvent.ConnectionHandle(), currentmode, modeChangeEvent.Interval());
+ //pass the current mode into Gear box. let gear box to decide if the mode is on the target mode.
+ //if it is, the gear box returns KErrNone, if it is not, the gear box will make another request for the target mode
+ if (aEvent.ErrorCode() == EOK)
+ {
+ TInt err = ExecuteModeChange(iTargetMode);
+ LOG1(_L("TLowPowModeCmdController::ExecuteModeChange: err:%d"), err);
+ }
}
}
--- a/bluetooth/btstack/linkmgr/physicallinks.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinks.h Wed Aug 18 10:54:44 2010 +0300
@@ -113,6 +113,8 @@
TInt ExitMode(TBTLinkMode aMode, THCIConnHandle aHandle);
TInt ChangeMode(TBTLinkMode aMode, THCIConnHandle aHandle);
+
+ TInt ExecuteModeChange(TBTLinkMode aTargetMode);
private: // events from MHCICommandQueueClient
virtual void MhcqcCommandEventReceived(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand);
@@ -127,11 +129,12 @@
void HoldL(THCIConnHandle aHandle);
void ParkL(THCIConnHandle aHandleToRemote);
void ExitParkL(THCIConnHandle aHandleToRemote);
-
+
private:
CPhysicalLink& iParent;
MHCICommandQueue& iCmdController;
TBool iOutstandingCmd;
+ TBTLinkMode iTargetMode;
};
/**
@@ -332,11 +335,7 @@
TInt ChangeConnectionPacketType(TUint16 aType);
- TInt ExitMode(TBTLinkMode aMode);
TInt RequestHold();
- TInt RequestSniff();
- TInt RequestPark();
- TInt RequestActive();
TInt RequestChangeRole(TBTBasebandRole aRole);
void ReadNewPhysicalLinkMetricValue(TUint aIoctlName, CBTProxySAP& aSAP, TInt aCurrentValue);
@@ -490,7 +489,6 @@
void NotifyStateChange(TBTBasebandEventNotification & aEvent);
TBool IsPhysicalLinkIdle() const;
- TInt RequestMode(TBTLinkMode aMode);
TBasebandTime CalculatePageTimeout(TBasebandPageTimePolicy aPolicy, TUint8 aRepMode, TBool aValidClockOffset);
TBool IsPasskeyMinLengthOK();
TBool PeerSupportsLinkKeyRegeneration() const;
--- a/bluetooth/gavdp/group/bld.inf Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/gavdp/group/bld.inf Wed Aug 18 10:54:44 2010 +0300
@@ -14,7 +14,6 @@
// BLD.INF for GAVDP user library
//
-#include "../test/bld.inf"
PRJ_EXPORTS
../public/gavdp.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gavdp.h)
--- a/bluetooth/gavdp/inc/gavdpInternal.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/gavdp/inc/gavdpInternal.h Wed Aug 18 10:54:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -301,16 +301,17 @@
NONSHARABLE_CLASS(CGavdpConnector) : public CGavdpHelper
{
public:
- static CGavdpConnector* NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr);
+ static CGavdpConnector* NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive = EFalse);
virtual void Begin();
~CGavdpConnector();
private:
- CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr);
+ CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive);
void RunL();
void DoCancel();
private:
TAvdtpSockAddr iSocketAddress;
+ TBool iIsPassiveConnector; //true when listening
};
class CGavdpUPlaneConnector;
--- a/bluetooth/gavdp/source/gavdpHelpers.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/gavdp/source/gavdpHelpers.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -473,16 +473,17 @@
-CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr)
+CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive)
{
- return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr);
+ return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr, aPassive);
}
-
-CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr)
+
+CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive)
: CGavdpHelper(aGavdp, aUser)
{
iSocketAddress.SetBTAddr(aAddr);
iSocketAddress.SetSession(ESignalling);
+ iIsPassiveConnector = aPassive;
}
CGavdpConnector::~CGavdpConnector()
@@ -492,10 +493,13 @@
void CGavdpConnector::DoCancel()
{
- AvdtpRequester().CancelAll(); // ESOCK has better semantics to SAP than CancelConnect.
+ //don't call cancel on the socket for passive connectors to prevent cancelling a listening socket
+ if (!iIsPassiveConnector)
+ {
+ AvdtpRequester().CancelAll(); // ESOCK has better semantics to SAP than CancelConnect.
+ }
}
-
void CGavdpConnector::Begin()
{
// Ensure that once this is completed the RunL is scheduled
@@ -507,7 +511,6 @@
void CGavdpConnector::RunL()
{
-
// Do not call CGavdpHelper::CheckFailedL() here - avdtp will indicate a failure to connect,
// and GAVDP is informed via CGavdpIndicator::RunL().
@@ -751,14 +754,14 @@
}
};
}
+
+ // This service is never complete, reissue ioctl. We do this once we have finished using
+ // the iIndication data as once the ioctl has been issued the data may be overwritten.
+ // If AVDTP has an indication to pass to us and an ioctl has not been issued the
+ // indication will be queued within AVDTP until we have issued the ioctl again.
+ Begin();
+ }
- // This service is never complete, reissue ioctl. We do this once we have finished using
- // the iIndication data as once the ioctl has been issued the data may be overwritten.
- // If AVDTP has an indication to pass to us and an ioctl has not been issued the
- // indication will be queued within AVDTP until we have issued the ioctl again.
- Begin();
- }
-
/**
RunError overriden for CGavdpIndicator only. This GAVDP helper is used in its own right by GAVDP.
It is not treated as a 'general' GAVDP helper, and, unlike a 'general' GAVDP helper,
--- a/bluetooth/gavdp/source/gavdpImp.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetooth/gavdp/source/gavdpImp.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -445,12 +445,37 @@
void CGavdp::Error(TInt aError)
{
- // helper tells user - here we do whatever we need to tidy ourselves
+ //here we do whatever we need to tidy ourselves
delete iRequesterHelper;
iRequesterHelper = NULL;
- iState = EIdle;
- // and tell the user
- iServiceUser.GAVDP_Error(aError, KNullDesC8);
+
+ if (iState == EListening)
+ {
+ //if we're in the listening state and we get a KErrDisconnected error, this is
+ //because a connection completed and was disconnected straight away before we got
+ //the chance to pickup the connection indicator. We need to re-listen and throw
+ //away this error. Let's replace the error with the result of the re-listen.
+ if (aError == KErrDisconnected)
+ {
+ aError = Listen();
+ }
+
+ //when listening, it doesn't make sense to pass this error to the user
+ if (aError == KErrCouldNotConnect)
+ {
+ aError = KErrNone;
+ }
+ }
+
+ //the error might have been replaced due to the condition mentioned above so
+ //this needs to be checked.
+ if (aError != KErrNone)
+ {
+ iServiceUser.GAVDP_Error(aError, KNullDesC8);
+
+ //update the state because an error did occur
+ iState = EIdle;
+ }
}
void CGavdp::FatalError()
@@ -476,10 +501,12 @@
// eg Abort, Config
User::Leave(KErrInUse);
}
- iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddress);
+
+ //create a passive connector helper
+ iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddress, ETrue);
iRequesterHelper->Begin();
}
-
+
/*
Forms the binding between passively created transport sessions and sockets
*/
--- a/bluetooth/gavdp/test/activecallbackconsole.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-// Copyright (c) 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:
-//
-
-#include "activecallbackconsole.h"
-
-CActiveCallBackConsole::CActiveCallBackConsole(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr)
- : CActive(EPriorityStandard), iFunction(aFunction), iPtr(aPtr)
- {
- CActiveScheduler::Add(this);
- }
-
-
-CActiveCallBackConsole::~CActiveCallBackConsole()
- {
- Cancel();
- delete iConsole;
- }
-
-CActiveCallBackConsole* CActiveCallBackConsole::NewL(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr, const TDesC& aTitle,const TSize& aSize)
- {
- CActiveCallBackConsole* console = new (ELeave) CActiveCallBackConsole(aFunction, aPtr);
- CleanupStack::PushL(console);
- console->ConstructL(aTitle,aSize);
- CleanupStack::Pop();
- return console;
- }
-
-void CActiveCallBackConsole::ConstructL(const TDesC& aTitle,const TSize& aSize)
- {
- iConsole = Console::NewL(aTitle,aSize);
- }
-
-void CActiveCallBackConsole::DoCancel()
- {
- iConsole->ReadCancel();
- }
-
-void CActiveCallBackConsole::RequestKey()
- {
- DrawCursor();
- iConsole->Read(iStatus);
- SetActive();
- }
-
-void CActiveCallBackConsole::DrawCursor()
- {
- iConsole->Printf(_L(">>"));
- }
-
-void CActiveCallBackConsole::RunL()
- {
- // key has been pressed
- TChar ch = iConsole->KeyCode();
- (*iFunction)(iPtr, ch);
- }
-
-TInt CActiveCallBackConsole::RunError(TInt aError)
- {
- iConsole->Printf(_L("Console error %d\nTrying again...\n"), aError);
- RequestKey();
- return KErrNone;
- }
--- a/bluetooth/gavdp/test/activecallbackconsole.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-// Copyright (c) 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:
-//
-
-#ifndef ACTIVECALLBACKCONSOLE_H
-#define ACTIVECALLBACKCONSOLE_H
-
-#include <e32base.h>
-#include <e32cons.h>
-
-
-
-class CActiveCallBackConsole : public CActive
- {
-public:
- static CActiveCallBackConsole* NewL(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr, const TDesC& aTitle,const TSize& aSize);
- void RequestKey();
-
- inline CConsoleBase& Console() const
- {
- return *iConsole;
- };
-
- ~CActiveCallBackConsole();
-
-private:
- void RunL();
- TInt RunError(TInt aError);
- void DoCancel();
- void DrawCursor();
- CActiveCallBackConsole(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr);
- void ConstructL(const TDesC& aTitle,const TSize& aSize);
-
-private:
- CConsoleBase* iConsole;
- TInt(*iFunction)(TAny *aPtr, TChar aKey);
- TAny* iPtr;
- };
-
-#endif //ACTIVECALLBACKCONSOLE_H
--- a/bluetooth/gavdp/test/bld.inf Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-// Copyright (c) 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:
-//
-
-PRJ_TESTMMPFILES
-
-tavsrc.mmp
--- a/bluetooth/gavdp/test/tavsrc.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2678 +0,0 @@
-// Copyright (c) 2005-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:
-//
-
-#include "tavsrc.h"
-#include "tavsrcUtils.h"
-#include "tavsrcSock.h"
-#include "tavsrcController.h"
-#include "tavsrcStreamer.h"
-
-#include <es_sock.h>
-#include <bt_sock.h>
-#include <bluetoothav.h>
-#include <btsdp.h>
-#include <flogger.h>
-#include <btmanclient.h>
-#include <remconinterfaceselector.h>
-#include <remconcoreapitarget.h>
-#include <remcontrackinfotarget.h>
-#include <remconabsvoltarget.h>
-#include <remconmediainformationtargetobserver.h>
-#include <remconinterfaceselector.h>
-#include <remconaddress.h>
-#include <bacline.h>
-#ifdef DBAWARE
-#include "tavsrcmtupdaterdatabaseaware.h"
-#else
-#include "tavsrcmtupdaterdatabaseunaware.h"
-#endif
-#include "tavsrcAbsoluteVolume.h"
-
-#ifdef __WINS__
-static const TSize KMainConsole(75,30);
-static const TSize KLogConsole(75,30);
-#else
-static const TSize KMainConsole(KConsFullScreen,KConsFullScreen);
-static const TSize KLogConsole(KConsFullScreen,KConsFullScreen);
-#endif
-
-using namespace SymbianBluetoothAV;
-using namespace SymbianSBC;
-
-void CAVTestApp::PreventLowPowerModes()
- {
- // Prevent any other application from setting to low power mode
- TInt err = iPhy.PreventLowPowerModes(EAnyLowPowerMode);
- __LOG(_L("Low power mode prevented, result %d\n"), err);
- }
-
-void CAVTestApp::AllowLowPowerModes()
- {
- // Allow any other application to set to low power mode
- TInt err = iPhy.AllowLowPowerModes(EAnyLowPowerMode);
- __LOG(_L("Low power mode allowed, result %d\n"), err);
- }
-
-void CAVTestApp::EchoStorm()
- {
- //UPF test
- //connect phy
- CBluetoothPhysicalLinks* phys = NULL;
- TRAP_IGNORE(phys = CBluetoothPhysicalLinks::NewL(*this, iSockServ));
- if (phys)
- {
- phys->CreateConnection(iDevAddr);
- }
- }
-
- void CAVTestApp::HandleCreateConnectionCompleteL(TInt /*aErr*/)
- {
- TBuf8<32> echo;
- RSocket sock;
-
- sock.Open(iSockServ, _L("L2CAP"));
- TL2CAPSockAddr addr;
- addr.SetBTAddr(iDevAddr);
- addr.SetPort(1);
-
- TRequestStatus status;
-
- __LOG(_L("Connecting l2cap"));
- sock.Connect(addr, status);
- User::WaitForRequest(status);
-
- echo.SetMax();
- echo.Fill('!');
- __LOG(_L("Echooing"));
- FOREVER
- {
- sock.Ioctl(KL2CAPEchoRequestIoctl, status, &echo, KSolBtL2CAP);
- User::WaitForRequest(status);
- }
- }
-
-void CAVTestApp::HandleDisconnectCompleteL(TInt /*aErr*/)
- {
- }
-
-void CAVTestApp::HandleDisconnectAllCompleteL(TInt /*aErr*/)
- {
- }
-
-void CAVTestApp::CreateStreamerL(RSocketArray aSockets)
- {
- __LOG(_L("Creating new streamer\n"));
- iStreamer = CActiveStreamer::NewL(aSockets,iLogConsole->Console(), *this, iDisplayMode, iPreloadFile);
- __LOG(_L("OK\n"));
- }
-
-void CAVTestApp::Abort()
- {
- __PRINT(_L("\n (!ABORT!) Enter remote SEID to ABORT"));
- TInt seid = TTavsrcUtils::GetIntFromUser(iActiveConsole->Console());
- __PRINT(_L("\n"));
- __LOG(_L("Aborting SEID &d...\n"),seid);
- iGavdp.AbortStream(TSEID(seid, EFalse));
- }
-
-void CAVTestApp::SendSecurityControl()
- {
- __PRINT(_L("\n Enter remote SEID to Send Security Control"));
- TInt seid = TTavsrcUtils::GetIntFromUser(iActiveConsole->Console());
- __PRINT(_L("\n"));
- __LOG(_L("Sending security control to SEID %d...\n"),seid);
-
- TBuf8<20> secBuf(_L8("Danger!\n"));
-
- iGavdp.SendSecurityControl(TSEID(seid, EFalse), secBuf);
- }
-
-void CAVTestApp::GetCapabilities()
- {
- if (!iLocalReconfigure) // Don't change the remote SEID if we're reconfiguring
- {
- if (iAutoStream)
- {
- // start at first in shortlisted sep array
- iCurrentSEID = iShortlistedSEIDs[0];
- iShortlistedSEIDs.Remove(0); // so next time around, take head again
- }
- else
- {
- __PRINT(_L("\n Enter remote SEID to get caps for"));
- iCurrentSEID = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()), EFalse);
- }
- }
-
- __PRINT(_L("\n"));
- __LOG(_L("Getting Capabilities for SEID %d...\n"),iCurrentSEID.Value());
-
- iSEPCapabilities.ResetAndDestroy(); //clear what's already there
-
- // we're interested in all caps as we are *TEST CODE*
- // some GCs should only register interest in the capabilities they might select
- TAvdtpServiceCategories caps;
- caps.SetCapability(EAllServiceCategories);
-
- iGavdp.GetRemoteSEPCapabilities(iCurrentSEID, caps);
- }
-
-
-void CAVTestApp::GAVDP_SEPCapability(TAvdtpServiceCapability* aCapability)
- {
- TInt err;
- PrettyPrint(*aCapability);
-
- // we own cap, stash it in our RPointerArray for owning and later use
- err = iSEPCapabilities.Append(aCapability);
-
- if(err == KErrNone)
- {
- // check if remote does SBC
- if (aCapability->Category() == EServiceCategoryMediaCodec)
- {
- if (static_cast<TAvdtpMediaCodecCapabilities*>(aCapability)->MediaCodecType() == EAudioCodecSBC)
- {
- iChosenSEP = ETrue;
- __LOG(_L("Found remote suitable SEP with SEID %d\n"), iCurrentSEID.SEID());
- }
- }
- }
- else
- {
- delete aCapability;
- }
- }
-
-
-void CAVTestApp::GAVDP_SEPDiscoveryComplete()
- {
- // complete the operation
- iOperations->EndOperation(KTavsrcOpDiscoverSEPs, KErrNone);
-
- __LOG(_L("GAVDP:SEP Discovery complete.\n"));
-
- if (iAutoStream)
- {
- // go through all the shortlisted SEPs to find the SBC one
- GetCapabilities();
- }
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_SEPCapabilityComplete()
- {
- // complete the operation
- iOperations->EndOperation(KTavsrcOpGetCapabilities, KErrNone);
-
- __LOG(_L("GAVDP:SEP has no more capabilities.\n"));
-
- if ((iAutoStream && iChosenSEP) || iLocalReconfigure)
- {
- // configure iCurrentSEID
- TRAPD(err, ConfigureSEPL());
- if (err != KErrNone)
- {
- __LOG(_L("Error configuring remote SEP: %d\n"), err);
- }
- }
- else if (iAutoStream && !iShortlistedSEIDs.Count())
- {
- __LOG(_L("Error: Remote does not have SBC codec available\n"));
- }
- else if (iAutoStream)
- {
- //try next sep
- GetCapabilities();
- }
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_ConnectConfirm(const TBTDevAddr& aAddr)
- {
- // complete the operation
- iOperations->EndOperation(KTavsrcOpConnect, KErrNone);
-
- // update our tiny state...
- iGavdpState = ESigConnected;
-
- // hack :o)
- iDevAddr = aAddr;
- __LOG(_L("Signalling channel connected = GAVDP ready\n"));
-
- // Open RBTPhysicalLinkAdapter for prevention of low power modes during streaming
- TInt err = iPhy.Open(iSockServ, iDevAddr);
- __LOG(_L("Opened iPhy, result %d\n"), err);
-
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_SEPDiscovered(const TAvdtpSEPInfo& aSEPInfo)
- {
- // this test code at present doesnt "remember" the SEPs
- switch (aSEPInfo.MediaType())
- {
- case EAvdtpMediaTypeAudio:
- __LOG(_L("Audio"));
- break;
- case EAvdtpMediaTypeVideo:
- __LOG(_L("Video"));
- break;
- case EAvdtpMediaTypeMultimedia:
- __LOG(_L("Multimedia"));
- break;
- }
-
- if (aSEPInfo.IsSink())
- {
- __LOG(_L(" Sink"));
- }
- else
- {
- __LOG(_L(" Source"));
- }
-
- __LOG(_L(" SEP (SEID %d)"), aSEPInfo.SEID().Value());
-
- if (aSEPInfo.InUse())
- {
- __LOG(_L("[In use]"));
- }
-
- // as we intend streaming audio, we need a free audio sink sep
- if (aSEPInfo.MediaType()==EAvdtpMediaTypeAudio && aSEPInfo.IsSink() && !aSEPInfo.InUse())
- {
- __LOG(_L("<-- Shortlisted SEP"));
- (void)iShortlistedSEIDs.Append(aSEPInfo.SEID());
- }
-
- __LOG(_L("\n"));
- TestMenu();
- }
-
-
-void CAVTestApp::GAVDP_AbortStreamConfirm()
- {
- // complete the operation
- iOperations->EndOperation(KTavsrcOpAbort, KErrNone);
-
- __LOG(_L("GAVDP:Aborted\n"));
- delete iStreamer;
- iStreamer = NULL;
-
- AllowLowPowerModes();
-
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_SecurityControlConfirm(const TDesC8& aResponseData)
- {
- // complete the operation
- iOperations->EndOperation(KTavsrcOpContentProtection, KErrNone);
-
- __LOG(_L("GAVDP:Security control complete\n"));
- __LOG(_L("GAVDP:Security control rsp=%S\n"), &aResponseData);
-
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_StartStreamsConfirm()
- {
- // complete the operation
- iOperations->EndOperation(KTavsrcOpStartStreams, KErrNone);
-
- __LOG(_L("GAVDP: StartStreamConfirm: now ready for use\n"));
-
- RThread().SetPriority(EPriorityRealTime);
-
- if (iLocalReconfigure)
- {
- iStreamer->ReStream();
- iStreamState = EStreaming;
-
- iOperations->EndOperation(KTavsrcOpStream, KErrNone);
- iLocalReconfigure = EFalse;
- }
- else if (iAutoStream)
- {
- //this maynot be true as SNK can be INT (but tavsrc only looks for remote SNKs)
- iStreamer->Stream(CurrentSEIDIsSink());
- iStreamState = EStreaming;
-
- iOperations->EndOperation(KTavsrcOpStream, KErrNone);
- }
-
- iAutoStream = EFalse; // done
- iLocalReconfigure = EFalse;
-
- PreventLowPowerModes();
-
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_SuspendStreamsConfirm()
- {
- // complete the operation
- iOperations->EndOperation(KTavsrcOpSuspendStreams, KErrNone);
-
- iGavdpState = ESuspended;
-
- __LOG(_L("Suspending stream!\n"));
- iStreamer->Suspend();
- iStreamState = EPaused;
-
- // we might be doing a reconfigure due to a request from the streamer
- if (iLocalReconfigure)
- {
- GetCapabilities();
- }
-
- AllowLowPowerModes();
-
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_ConfigurationConfirm()
- {
- // complete the operation
- if (iRegisteringLocalSEP)
- {
- __LOG(_L("SEP [SEID %d]: Local Configuration complete\n"), iCurrentSEID.SEID());
- iOperations->EndOperation(KTavsrcOpRegisterSEP, KErrNone);
-
- iRegisteringLocalSEP = EFalse;
-
- // time to listen now SEP registered, ignore error, logged in Listen()
- Listen();
- }
- else
- {
- __LOG(_L("SEP [SEID %d]: Remote Configuration complete\n"), iCurrentSEID.SEID());
- iOperations->EndOperation(KTavsrcOpConfigureSEP, KErrNone);
-
- // we might be doing a reconfigure due to a request from the streamer
- if (iLocalReconfigure)
- {
- StartStreams();
- }
- // if we;re doing autoCSR stuff we choose to go straight to open
- else if (iAutoStream)
- {
- CreateBearers();
- }
- }
-
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_Error(TInt aError, const TDesC8& /*aErrorData*/)
- {
- __LOG(_L("GAVDP: **Error**: %d:\n"), aError);
-
- // complete the outstanding operation with an error
- iOperations->EndOperation(0, aError);
-
- switch (aError)
- {
- case KErrAvdtpBaseError-KErrAvdtpRequestTimeout:
- {
- __LOG(_L("AVDTP Request timed out\n"));
- break;
- }
- case -6305:
- case KErrDisconnected:
- {
- iPhy.Close();
- __LOG(_L("Closed iPhy\n"));
-
- __LOG(_L("Signalling disconnected\nTest code is going to Re-listen...\n"));
- aError = Listen();
-
- iAutoStream = EFalse;
- if (iStreamer)
- {
- iStreamer->Stop();
- }
- iStreamState = EStopped;
-
- // reset the state
- iOperations->EndOperation(KTavsrcOpDisconnectSrc, aError);
- break;
- }
-
- // Errors we can't match to a specific command
- case EAvdtpBadHeaderFormat:
- case EAvdtpBadLength:
- case EAvdtpBadACPSEID:
- case EAvdtpBadPayloadFormat:
- case EAvdtpNotSupportedCommand:
- case EAvdtpBadState:
- {
- __LOG(_L("Couldn't determine operation that caused error\n"));
- break;
- }
-
- // Errors on SetConfig/Reconfig
- case EAvdtpSEPInUse:
- case EAvdtpSepNotInUse:
- case EAvdtpBadServCategory:
- case EAvdtpInvalidCapabilities:
- case EAvdtpBadRecoveryType:
- case EAvdtpBadMediaTransportFormat:
- case EAvdtpBadReportingFormat:
- case EAvdtpBadRecoveryFormat:
- case EAvdtpBadRohcFormat:
- case EAvdtpBadCpFormat:
- case EAvdtpBadMultiplexingFormat:
- case EAvdtpUnsupportedConfiguration:
- case EGavdpBadService:
- case EGavdpInsufficientResource:
- case EA2dpInvalidCodec:
- case EA2dpNotSupportedCodec:
- case EA2dpInvalidSamplingFrequency:
- case EA2dpNotSupportedSamplingFrequency:
- case EA2dpInvalidChannelMode:
- case EA2dpNotSupportedChannelMode:
- case EA2dpInvalidSubbands:
- case EA2dpNotSupportedSubbands:
- case EA2dpInvalidAllocationMethod:
- case EA2dpNotSupportedAllocationMethod:
- case EA2dpInvalidMinimumBitPoolValue:
- case EA2dpNotSupportedMinimumBitPoolValue:
- case EA2dpInvalidMaximumBitPoolValue:
- case EA2dpNotSupportedMaximumBitPoolValue:
- case EA2dpInvalidLayer:
- case EA2dpNotSupportedLayer:
- case EA2dpNotSupportedCRC:
- case EA2dpNotSupportedMPF:
- case EA2dpNotSupportedVBR:
- case EA2dpInvalidBitRate:
- case EA2dpNotSupportedBitRate:
- case EA2dpInvalidObjectType:
- case EA2dpNotSupportedObjectType:
- case EA2dpInvalidChannels:
- case EA2dpNotSupportedChannels:
- case EA2dpInvalidVersion:
- case EA2dpNotSupportedVersion:
- case EA2dpNotSupportedSUL:
- case EA2dpInvalidBlockLength:
- case EA2dpInvalidCPType:
- case EA2dpInvalidCPFormat:
- {
- __LOG(_L("Error setting configuration\n"));
- break;
- };
- }
-
- TestMenu();
- }
-
-// passive gubbins
-void CAVTestApp::GAVDP_ConfigurationStartIndication(TSEID aLocalSEID, TSEID aRemoteSEID)
- {
- // ah - remote is attempting to confuigure us
- // we need to set our state
- __LOG(_L("Remote SEP [SEID %d] is configuring Local SEP [SEID %d]\n"), aRemoteSEID.Value(), aLocalSEID.Value());
-
-
- // the seid has already been checked, but we could see which of our endpoints this refers to
- iGavdpState = ERemoteReconfiguring;
- iCurrentSEID = aRemoteSEID;
- iCurrentLocalSEID = aLocalSEID;
- }
-
-TInt CAVTestApp::GAVDP_ConfigurationIndication(TAvdtpServiceCapability* aCapability)
- {
- // the new capability proposed by remote
- __LOG(_L("Configuration proposed: category %d\n"), aCapability->Category());
-
- // for this test code we currently accept everything
- //** A REAL GC SHOULD THINK ABOUT WHAT THE REMOTE IS PROPOSING
- PrettyPrint(*aCapability);
-
- TInt ret = KErrNone;
- if (aCapability->Category() == EServiceCategoryRecovery)
- {
- TAvdtpRecoveryCapabilities* recCap = static_cast<TAvdtpRecoveryCapabilities*>(aCapability);
- if (static_cast<TInt>(recCap->RecoveryType()) == 0xff)
- {
- ret = ConvertToSymbianError::AvdtpError(EAvdtpBadRecoveryType);
- }
-
- }
-
-
- if (ret == KErrNone)
- {
- delete aCapability;
- }
-
- return ret;
- }
-
-
-TInt CAVTestApp::GAVDP_ConfigurationEndIndication()
- {
- // just accept all we saw
- __LOG(_L("GAVDP: Remote configuration proposals now finished"));
- __LOG(_L(" - we are replying that all is OK\n"));
-
- // real GC should think about what remote has said!!
-
- return KErrNone;
- }
-
-TInt CAVTestApp::GAVDP_StartIndication(TSEID aLocalSEID)
- {
- __LOG(_L("Start indication for Local SEID %d\n"), aLocalSEID.SEID());
- TInt err = KErrNone;
-
- if(iStreamer)
- {
- __LOG(_L("Starting streamer (passively!)\n"));
-
- TBool sink = EFalse;
-
- for (TInt i=0; i<iLocallyRegisteredSEPs.Count(); i++)
- {
- // see if we are being a sink or source
- if (aLocalSEID==iLocallyRegisteredSEPs[i].SEID())
- {
- sink = iLocallyRegisteredSEPs[i].IsSink();
- }
- }
- iCurrentLocalSEID = aLocalSEID;
- iStreamer->Stream(sink);
- iStreamState = EStreaming;
-
- iOperations->EndOperation(KTavsrcOpStream, KErrNone);
-
- PreventLowPowerModes();
- }
- else
- {
- __LOG(_L("No streamer! Rejecting start\n"));
- err = KErrNotReady;
- }
- TestMenu();
- return err;
- }
-
-void CAVTestApp::GAVDP_AbortIndication(TSEID aSEID)
- {
- __LOG(_L("GAVDP:Stream %d ABORTED by peer\n"), aSEID.SEID());
-
- iOperations->EndOperation(KTavsrcOpAbort, KErrNone);
-
- delete iStreamer;
- iStreamer = NULL;
-
- iPhy.Close();
- __LOG(_L("Closed iPhy\n"));
-
- TestMenu();
- }
-
-void CAVTestApp::GAVDP_ReleaseIndication(TSEID aSEID)
- {
- __LOG(_L("GAVDP:Stream %d RELEASED by peer\n"), aSEID.SEID());
-
- AllowLowPowerModes();
- }
-
-
-TInt CAVTestApp::GAVDP_SuspendIndication(TSEID aSEID)
- {
- __LOG(_L("GAVDP:Stream %d SUSPENDED by peer\n"), aSEID.SEID());
-
- iStreamer->Suspend();
- // should ask the streamer object what SEID it is streaming really
-
- // as test code we always consume this for now
- iOperations->EndOperation(KTavsrcOpSuspendStreams, KErrNone);
-
- AllowLowPowerModes();
-
- TestMenu();
- return KErrNone;
- }
-
-TInt CAVTestApp::GAVDP_SecurityControlIndication(TSEID aSEID, TDes8& aSecurityData)
- {
- __LOG(_L("GAVDP:Got security control data length %d for SEID %d\n"), aSecurityData.Length(), aSEID.Value());
-
- TBool identical = TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("Security control data: respond identically?"));
- if (!identical)
- {
- aSecurityData[0]^='!';
- }
-
- return KErrNone;
- }
-
-void CAVTestApp::GAVDP_BearerReady(RSocket aNewSocket, const TAvdtpSockAddr& aAddr)
- {
- // wrap socket with active wrapper...
- __LOG(_L("Got a bearer, for session %d\n"), aAddr.Session());
-
- // we'll make a streamer now (easy way to keep this socket)
- // set the PHY to be AV friendly!
- switch(aAddr.Session())
- {
- case EMedia:
- {
- iPendingSockets[0] = aNewSocket;
-
- // complete the operation
- iOperations->EndOperation(KTavsrcOpCreateBearers, KErrNone);
-
- iGavdpState = EOpen;
-
- // all bearers ready!
- __LOG(_L("Got all bearers, can now start\n"));
-
- RBTPhysicalLinkAdapter phy;
-
- // AV sockets don't foward opts yet so use addr version
- TInt err = phy.Open(iSockServ, iDevAddr);
- TUint16 packets = EPacketsDH1|EPacketsDH3|EPacketsDH5;
- err = phy.RequestChangeSupportedPacketTypes(packets);
- __LOG(_L("Modified PHY, result %d\n"), err);
- TRAP(err, CreateStreamerL(iPendingSockets)); //FIXME arrange array better for different #bearers
- if(err)
- {
- __LOG(_L("Creating streamer failed with err %d, closing socket\n"), err);
- aNewSocket.Close();
- }
-
- if (iAutoStream)
- {
- StartStreams();
- }
- // but not start streaming until manually started
-
- TestMenu();
- break;
- }
- case EReporting:
- {
- iPendingSockets[1] = aNewSocket;
-#ifdef CHANNEL_BINDING_DEBUG_CHECK
- TInt err(KErrNone);
- // Create the active socket reader
- TRAP(err,iRepReader = CActiveSockReader::NewL(iPendingSockets[1], EReporting));
- if (err != KErrNone)
- {
- __LOG(_L("Creating active socket reader failed with error %d"),err);
- }
- else
- {
- iRepReader->Start();
- }
- // Create the active socket writer
- TRAP(err,iRepWriter = CActiveSockWriter::NewL(iPendingSockets[1], EReporting));
- if (err != KErrNone)
- {
- __LOG(_L("Creating active socket writer failed with error %d"),err);
- }
- else
- {
- iRepWriter->Send();
- }
-#endif
- }
- break;
-
- case ERecovery:
- {
- iPendingSockets[2] = aNewSocket;
-#ifdef CHANNEL_BINDING_DEBUG_CHECK
- TInt err(KErrNone);
- // Create the active socket reader
- TRAP(err,iRecvReader = CActiveSockReader::NewL(iPendingSockets[2], ERecovery));
- if (err != KErrNone)
- {
- __LOG(_L("Creating active socket reader failed with error %d"),err);
- }
- else
- {
- iRecvReader->Start();
- }
- // Create the active socket writer
- TRAP(err,iRecvWriter = CActiveSockWriter::NewL(iPendingSockets[2], ERecovery));
- if (err != KErrNone)
- {
- __LOG(_L("Creating active socket writer failed with error %d"),err);
- }
- else
- {
- iRecvWriter->Send();
- }
-#endif
- }
- break;
- default:
- __DEBUGGER();
- break;
- }
- }
-
-void CAVTestApp::PrettyPrint(TAvdtpServiceCapability& aCapability)
- {
- __LOG(_L("Capability = "));
-
- switch (aCapability.Category())
- {
- case EServiceCategoryMediaTransport:
- __LOG(_L("Media Transport\n"));
- break;
-
- case EServiceCategoryReporting:
- __LOG(_L("Reporting\n"));
- break;
-
- case EServiceCategoryRecovery:
- __LOG(_L("Recovery\n"));
- break;
-
- case EServiceCategoryContentProtection:
- __LOG(_L("Content Protection: Type %d\n"), static_cast<TAvdtpContentProtectionCapabilities&>(aCapability).ContentProtectionType());
- break;
-
- case EServiceCategoryHeaderCompression:
- __LOG(_L("Header Compression\n"));
- break;
-
- case EServiceCategoryMultiplexing:
- __LOG(_L("Multiplexing\n"));
- break;
-
- case EServiceCategoryMediaCodec:
- __LOG(_L("Media Codec\n-----------\n"));
- // print name of codec
- TAvdtpMediaCodecCapabilities& codecCaps = static_cast<TAvdtpMediaCodecCapabilities&>(aCapability);
- switch (codecCaps.MediaType())
- {
- case EAvdtpMediaTypeAudio:
- __LOG(_L("Audio:"));
- break;
- case EAvdtpMediaTypeVideo:
- __LOG(_L("Video:"));
- break;
- case EAvdtpMediaTypeMultimedia:
- __LOG(_L("Multimedia:"));
- break;
- }
-
- if (codecCaps.MediaCodecType() == EAudioCodecSBC)
- {
- __LOG(_L("SBC\n"));
-
- TSBCCodecCapabilities& sbcCaps = static_cast<TSBCCodecCapabilities&>(aCapability);
- __LOG(_L("Sampling frequencies: "));
- if (sbcCaps.SamplingFrequencies() & E48kHz) __LOG(_L("48kHz "));
- if (sbcCaps.SamplingFrequencies() & E44100Hz) __LOG(_L("44.1kHz "));
- if (sbcCaps.SamplingFrequencies() & E32kHz) __LOG(_L("32kHz "));
- if (sbcCaps.SamplingFrequencies() & E16kHz) __LOG(_L("16kHz"));
- __LOG(_L("\nChannel modes: "));
- if (sbcCaps.ChannelModes() & EMono) __LOG(_L("Mono "));
- if (sbcCaps.ChannelModes() & EStereo) __LOG(_L("Stereo "));
- if (sbcCaps.ChannelModes() & EJointStereo) __LOG(_L("JointStereo "));
- if (sbcCaps.ChannelModes() & EDualChannel) __LOG(_L("DualChannel"));
- __LOG(_L("\nBlockLengths: "));
- if (sbcCaps.BlockLengths() & EBlockLenFour) __LOG(_L("4 "));
- if (sbcCaps.BlockLengths() & EBlockLenEight) __LOG(_L("8 "));
- if (sbcCaps.BlockLengths() & EBlockLenTwelve) __LOG(_L("12 "));
- if (sbcCaps.BlockLengths() & EBlockLenSixteen) __LOG(_L("16"));
- __LOG(_L("\nSubbands: "));
- if (sbcCaps.Subbands() & EFourSubbands) __LOG(_L("4 "));
- if (sbcCaps.Subbands() & EEightSubbands) __LOG(_L("8"));
- __LOG(_L("\nAllocation: "));
- if (sbcCaps.AllocationMethods() & ELoudness) __LOG(_L("Loudness "));
- if (sbcCaps.AllocationMethods() & ESNR) __LOG(_L("SNR"));
- __LOG(_L("\nMinBitpool: %d"), sbcCaps.MinBitpoolValue());
- __LOG(_L("\nMaxBitpool: %d\n"), sbcCaps.MaxBitpoolValue());
- }
- else
- {
- TNonSBCCodecCapabilities& nonSbcCaps = static_cast<TNonSBCCodecCapabilities&>(aCapability);
- TPtrC8 codecData = nonSbcCaps.CodecData();
-
- switch (codecCaps.MediaCodecType())
- {
- case EAudioCodecMPEG12Audio:
- __LOG(_L("MPEG1,2 Audio\n"));
- __LOG(_L("Manually parsing caps of length %d\n"), codecData.Length());
- __LOG(_L("Layers: "));
- if (codecData[0] & 0x80) __LOG(_L("mp1"));
- if (codecData[0] & 0x40) __LOG(_L("mp2"));
- if (codecData[0] & 0x20) __LOG(_L("mp3"));
- __LOG(_L("\nCRC protection: "));
- codecData[0] & 0x10 ? __LOG(_L("yes")) : __LOG(_L("no"));
- __LOG(_L("\nChannel modes: "));
- if (codecData[0] & 0x08) __LOG(_L("Mono "));
- if (codecData[0] & 0x04) __LOG(_L("DualChannel "));
- if (codecData[0] & 0x02) __LOG(_L("Stereo "));
- if (codecData[0] & 0x01) __LOG(_L("JointStereo"));
- __LOG(_L("\nMPF: %d"), codecData[1] & 0x40 ? 1 : 0);
- __LOG(_L("\nSampling frequencies: "));
- if (codecData[1] & 0x20) __LOG(_L("16kHz "));
- if (codecData[1] & 0x10) __LOG(_L("22.05kHz "));
- if (codecData[1] & 0x08) __LOG(_L("24kHz "));
- if (codecData[1] & 0x04) __LOG(_L("32kHz "));
- if (codecData[1] & 0x02) __LOG(_L("44.1kHz "));
- if (codecData[1] & 0x01) __LOG(_L("48kHz"));
- __LOG(_L("\nVBR: "));
- codecData[2] & 0x80 ? __LOG(_L("yes")) : __LOG(_L("no"));
- __LOG(_L("\nBit rate index: %b\n"), codecData[3]+((codecData[2] & 0x7f)<<8));
- break;
- case EAudioCodecMPEG24AAC:
- __LOG(_L("MPEG 2,4 AAC\n"));
- __LOG(_L("Not parsing caps of length %d\n"), nonSbcCaps.CodecData().Length());
- break;
- case EAudioCodecATRAC:
- __LOG(_L("ATRAC\n"));
- __LOG(_L("Not parsing caps of length %d\n"), nonSbcCaps.CodecData().Length());
- break;
-
- default:
- __LOG(_L("Unknown codec, Type %d\n"), codecCaps.MediaCodecType());
- }
- }
- }
- }
-
-TInt CAVTestApp::Listen()
- {
- TInt err = iGavdp.Listen();
- __LOG(_L("Listening (result %d)\n"), err);
- return err;
- }
-
-void CAVTestApp::StartStreams()
- {
- iGavdpState = EOpen;
- TSEID seid;
-
- if (iAutoStream)
- {
- seid = iCurrentSEID;
- }
- else
- {
- __PRINT(_L("\n Enter remote SEID to start streaming"));
- seid = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()),EFalse);
- }
-
- __PRINT(_L("\n"));
- __LOG(_L("Starting remoteSEP %d streaming...\n"),seid.SEID());
-
- iGavdp.StartStream(seid);
- }
-
-void CAVTestApp::SuspendStreams()
- {
- TSEID seid;
-
- if (iAutoStream)
- {
- seid = iCurrentSEID;
- }
- else
- {
- __PRINT(_L("\n Enter remote SEID to suspend streaming"));
- seid = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()),EFalse);
- }
-
- __PRINT(_L("\n"));
- __LOG(_L("Suspending remoteSEP %d streaming...\n"),seid.SEID());
-
- iGavdp.SuspendStream(seid);
- iGavdpState = EOpen;
- }
-
-TSBCCodecCapabilities CAVTestApp::InteractiveSBCMediaCodecConfig(TSBCCodecCapabilities& caps)
- {
- TSBCCodecCapabilities res;
-
- TSBCSamplingFrequencyBitmask freqs = caps.SamplingFrequencies();
- TBool resp = EFalse;
-
- if (freqs)
- {
- __PRINT(_L("\nFreqs: Remote Supports: "));
- if (freqs & E48kHz && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("48kHz Use"));
- if (resp)
- {
- res.SetSamplingFrequencies(E48kHz);
- }
- }
- if (freqs & E44100Hz && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n44.1kHz Use"));
- if (resp)
- {
- res.SetSamplingFrequencies(E44100Hz);
- }
- }
- if (freqs & E32kHz && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n32kHz Use"));
- if (resp)
- {
- res.SetSamplingFrequencies(E32kHz);
- }
- }
- if (freqs & E16kHz && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n16kHz Use"));
- if (resp)
- {
- res.SetSamplingFrequencies(E16kHz);
- }
- }
- }
-
- resp = EFalse;
- TSBCChannelModeBitmask chmodes = caps.ChannelModes();
- if (chmodes)
- {
- __PRINT(_L("\nChModes: remote supports:"));
- if (chmodes & EJointStereo && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nJointStereo Use"));
- if (resp)
- {
- res.SetChannelModes(EJointStereo);
- }
- }
- if (chmodes & EStereo && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nStereo Use"));
- if (resp)
- {
- res.SetChannelModes(EStereo);
- }
- }
- if (chmodes & EDualChannel && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nDual Ch Use"));
- if (resp)
- {
- res.SetChannelModes(EDualChannel);
- }
- }
- if (chmodes & EMono && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nMono Use"));
- if (resp)
- {
- res.SetChannelModes(EMono);
- }
- }
- }
-
- TSBCBlockLengthBitmask blockLens = caps.BlockLengths();
- resp = EFalse;
-
- if (blockLens)
- {
- __PRINT(_L("\nBlockLens: remote supports:"));
- if (blockLens & EBlockLenFour && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n4 Use"));
- if (resp)
- {
- res.SetBlockLengths(EBlockLenFour);
- }
- }
- if (blockLens & EBlockLenEight && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n8 Use"));
- if (resp)
- {
- res.SetBlockLengths(EBlockLenEight);
- }
- }
- if (blockLens & EBlockLenTwelve && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n12 Use"));
- if (resp)
- {
- res.SetBlockLengths(EBlockLenTwelve);
- }
- }
- if (blockLens & EBlockLenSixteen && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n16 Use"));
- if (resp)
- {
- res.SetBlockLengths(EBlockLenSixteen);
- }
- }
- }
-
- resp = EFalse;
- TSBCSubbandsBitmask subbands = caps.Subbands();
- if (subbands)
- {
- __PRINT(_L("\nSubbands: remote supports:"));
- if (subbands & EFourSubbands && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n4 Use"));
- if (resp)
- {
- res.SetSubbands(EFourSubbands);
- }
- }
- if (subbands & EEightSubbands && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n8 Use"));
- if (resp)
- {
- res.SetSubbands(EEightSubbands);
- }
- }
- }
-
-
- resp = EFalse;
- TSBCAllocationMethodBitmask allocs = caps.AllocationMethods();
- if (allocs)
- {
- __PRINT(_L("\nAllocation methods: remote supports:"));
- if (allocs & ESNR && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSNR Use"));
- if (resp)
- {
- res.SetAllocationMethods(ESNR);
- }
- }
- if (allocs & ELoudness && !resp)
- {
- resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nLoudness Use"));
- if (resp)
- {
- res.SetAllocationMethods(ELoudness);
- }
- }
- }
-
- // cat2 test
- //res.SetSamplingFrequencies(freqs);
- //res.SetBlockLengths(4);
- //res.SetSubbands(1);
- //res.SetAllocMethods(1);
-
- // set bitpool to whatever they said - ok to set range - see 4.3.2.6 A2DP
- res.SetMaxBitpoolValue(caps.MaxBitpoolValue());
- res.SetMinBitpoolValue(caps.MinBitpoolValue());
-
- //dodgy iWish needs to select one
- //res.SetMinBitpoolValue(42);
- //res.SetMaxBitpoolValue(42);
-
- return res;
- }
-
-TBool CAVTestApp::CurrentSEIDIsSink()
- {
- TBool sink = EFalse;
- TUint localSEPIndex = iCurrentLocalSEID.Value();
-
- //Get the current local SEP index in iLocallyRegisteredSEPs, by screening out flags
- localSEPIndex &= 0x3f;
-
- sink = iLocallyRegisteredSEPs[localSEPIndex-1].IsSink();
-
- return sink;
- }
-
-void CAVTestApp::ConfigureSEPL()
- {
- TInt res;
-
- // user for test code gets to choose "right" local sep to connect to remote sep
- TSEID localSEPtoUse(1, ETrue); // settings for iAutoStream
- if (!iAutoStream)
- {
- __PRINT(_L("Choose local SEP to use for Stream"));
- localSEPtoUse.Set(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console())); // it *is* local
- }
- //Record the SEID of chosen local SEP
- iCurrentLocalSEID = localSEPtoUse;
-
- TSEID remoteSEPtoUse = iCurrentSEID; // settings for iAutoStream
- if (!iAutoStream)
- {
- __PRINT(_L("\nChoose remote SEP to use for Stream"));
- remoteSEPtoUse.Set(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()));
-
- if (remoteSEPtoUse != iCurrentSEID)
- {
- __PRINT(_L("\nWARNING: Do not have the capabilities of the selected remote SEP, "));
- __PRINT(_L("\nthis may lead to sending incorrect configuration information. To"));
- __PRINT(_L("\nfix this Get Capabilities for selected remote SEP first and then"));
- if (!TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),
- _L("\nconfigure. \nDo you still wish to continue this configuration?")))
- {
- User::Leave(KErrAbort);
- }
- }
- }
-
- // we have to choose which of our seps to bind with the remote
- // this test code assumes the local SEP to use has SEID 1.
- // real code would have better code to fathom a good binding based on caps etc
- res = iGavdp.BeginConfiguringRemoteSEP(remoteSEPtoUse, localSEPtoUse);
-
- __LOG(_L("Begin configuring remote SEP returned %d\n"), res);
- User::LeaveIfError(res);
-
- for (TInt index=0; index<iSEPCapabilities.Count(); index++)
- {
- TAvdtpServiceCapability* cap = iSEPCapabilities[index];
-
- TAvdtpServiceCategory cat = cap->Category();
-
- TBool use = EFalse;
-
- if (cat==EServiceCategoryMediaTransport)
- {
- if (iAutoStream)
- {
- use = ETrue;
- }
- else
- {
- use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Media Transport - use?")));
- }
- if (use)
- {
- res = iGavdp.AddSEPCapability(*cap);
- __LOG(_L("completed: %d"),res);
- }
- }
- if (cat==EServiceCategoryReporting)
- {
- if (iAutoStream)
- {
- use = /*ETrue*/EFalse;
- }
- else
- {
- use = TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Reporting - use?"));
- }
- if (use)
- {
- res = iGavdp.AddSEPCapability(*cap);
- __LOG(_L("completed: %d"),res);
- }
- }
- if (cat==EServiceCategoryRecovery)
- {
- if (iAutoStream)
- {
- use = /*ETrue*/EFalse;
- }
- else
- {
- use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Recovery - use?")));
- }
- if (use)
- {
- res = iGavdp.AddSEPCapability(*cap);
- __LOG(_L("completed: %d"),res);
- }
- }
-
- if (cat==EServiceCategoryContentProtection)
- {
- if (iAutoStream)
- {
- use = EFalse;
- }
- else
- {
- use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Content Protection - use?")));
- }
-
- if (use)
- {
- res = iGavdp.AddSEPCapability(*cap);
- __LOG(_L("completed: %d"),res);
- }
- }
-
- if (cat==EServiceCategoryMediaCodec)
- {
- if (iAutoStream)
- {
- use = ETrue;
- }
- else
- {
- use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nConfigure Media Codec?")));
- }
-
- if (use)
- {
- if (static_cast<TBluetoothAudioCodecType>(static_cast<TAvdtpMediaCodecCapabilities*>(cap)->MediaCodecType())==EAudioCodecSBC)
- {
- const TSBCCodecCapabilities& available = *static_cast<TSBCCodecCapabilities*>(cap);
- TSBCCodecCapabilities cfg;
-
- if (iAutoStream || TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nAutomatically Configure Media Codec?")))
- {
- // we might be doing a reconfigure due to a request from the streamer
- if (iLocalReconfigure)
- {
- cfg = iReconfigInfo;
- }
- else
- {
- // CSR board ignores the configuration
- // which makes playlisting quite easy
- // will need to fix this to playlist to boards that do care
- TInt err, numChannels, chMode, numSubbands, blkLen, bitPool, freq, allocMethod;
- err = TTavsrcUtils::GetCodecSettingsFromSBCFile(iFilename, chMode, numChannels, numSubbands, blkLen, bitPool, freq, allocMethod);
-
- if (err != KErrNone)
- {
- __LOG(_L("Problem accessing SBC file: %d\n"), err);
- __LOG(_L("Warning - Codec settings not obtained\n"));
- }
- else
- {
- TSBCSubbandsBitmask subbands = numSubbands == 8 ? EEightSubbands : EFourSubbands;
- TSBCAllocationMethodBitmask alloc = allocMethod == 0 ? ELoudness : ESNR;
-
- TSBCSamplingFrequencyBitmask freqs(0);
- if (freq == 48000) freqs = E48kHz;
- else if (freq == 44100) freqs = E44100Hz; // note else if now as only select one
- else if (freq == 32000) freqs = E32kHz;
- else if (freq == 16000) freqs = E16kHz;
-
- TSBCChannelModeBitmask chs(0); // set it to anything to prevent warning
- if (chMode == 0) chs=EMono;
- else if (chMode == 1) chs=EDualChannel;
- else if (chMode == 2) chs=EStereo;
- else if (chMode == 3) chs=EJointStereo;
-
- TSBCBlockLengthBitmask blkLens(0); // set it to anything to prevent warning
- if (blkLen == 4) blkLens = EBlockLenFour;
- else if (blkLen == 8) blkLens = EBlockLenEight;
- else if (blkLen == 12) blkLens = EBlockLenTwelve;
- else if (blkLen == 16) blkLens = EBlockLenSixteen;
-
- cfg.SetSamplingFrequencies(freqs);
- cfg.SetChannelModes(chs);
- cfg.SetBlockLengths(blkLens);
- cfg.SetSubbands(subbands);
- cfg.SetAllocationMethods(alloc);
-
- }
- }
-
- // use the available bitpool
- cfg.SetMaxBitpoolValue(available.MaxBitpoolValue());
- cfg.SetMinBitpoolValue(available.MinBitpoolValue());
- }
- else if (use && !iAutoStream)
- {
- cfg = InteractiveSBCMediaCodecConfig(*static_cast<TSBCCodecCapabilities*>(cap));
- }
-
-
- res = iGavdp.AddSEPCapability(cfg);
- __LOG(_L("Add SEP Capability completed: %d"),res);
- }
- else
- {
- __LOG(_L("MP3 codec, choosing fixed configuration...\n"));
- // assume mp3 for now
- // testing with blueant, just choose stereo, 44.1khz
- TBuf8<4> mp3Cfg;
- mp3Cfg.SetLength(4);
- mp3Cfg[0]=0x32;
- mp3Cfg[1]=0x02;
- mp3Cfg[2]=0x00;
- mp3Cfg[3]=0x02;
-
- TNonSBCCodecCapabilities mp3codecCaps(EAvdtpMediaTypeAudio,EAudioCodecMPEG12Audio);
- mp3codecCaps.SetCodecData(mp3Cfg);
- res = iGavdp.AddSEPCapability(mp3codecCaps);
- }
- }
- }
- }// for
-
- __LOG(_L("\nCommiting configuration...\n"));
- iGavdp.CommitSEPConfiguration();
- }
-
-
-TInt CAVTestApp::StartSrc()
- {
- TBool failed = EFalse;
-
- // register source/sink records in sdp
- __LOG(_L("Registering A2DP Sink SDP Record"));
- TRAPD(err, TTavsrcUtils::RegisterSinkSDPRecordL(iSdpDB, iSnkHandle, ETrue, ETrue, ETrue, ETrue));
- if (err != KErrNone)
- {
- __LOG(_L("Failed to Register A2DP Sink SDP Record: %d"), err);
- __DEBUGGER();
- failed = ETrue;
- }
-
- __LOG(_L("Registering A2DP Source SDP Record"));
- TRAP(err, TTavsrcUtils::RegisterSourceSDPRecordL(iSdpDB, iSrcHandle, ETrue, ETrue, ETrue, ETrue));
- if (err != KErrNone)
- {
- __LOG(_L("Failed to Register A2DP Source SDP Record: %d"), err);
- __DEBUGGER();
- failed = ETrue;
- }
-
- __LOG(_L("Opening GAVDP Session"));
- err = iGavdp.Open(*this, iSockServ);
- if (err == KErrNone)
- {
- RHostResolver hostResolver;
- err = hostResolver.Open( iSockServ, KBTAddrFamily, KBTLinkManager);
- if (err == KErrNone)
- {
- err = hostResolver.SetHostName(_L("Boom Box!"));
- hostResolver.Close();
- }
- iActiveConsole->Console().Printf(_L("Set Host Name (ret:%d)\r\n"),err);
-
- iGavdpState = EIdle;
- }
- else
- {
- __LOG(_L("Failed to Open GAVDP Session: %d"), err);
- __DEBUGGER();
- failed = ETrue;
- }
- err = RegisterSEP();
- if (err != KErrNone)
- {
- __LOG(_L("Failed to Register SEP: %d"), err);
- __DEBUGGER();
- failed = ETrue;
- }
-
- TRAP(err, CreateRemConInterfacesL());
- if (err != KErrNone)
- {
- __LOG(_L("Failed to Register RemCon interfaces: %d"), err);
- __DEBUGGER();
- failed = ETrue;
- }
-
- if(failed)
- {
- return KErrGeneral;
- }
- return KErrNone;
- }
-
-void CAVTestApp::StopSrc()
- {
- // Close RBTPhysicalLinkAdapter
- iPhy.Close();
- __LOG(_L("Closed iPhy\n"));
-
- iSdpDB.DeleteRecord(iSrcHandle);
- iSdpDB.DeleteRecord(iSnkHandle);
- delete iStreamer;
- iStreamer = NULL;
- iGavdp.Close();
- iAutoStream = EFalse;
-
- iGavdpState = ENoClientOpen;
-
- }
-
-void CAVTestApp::DisconnectSrc()
- {
- // Close RBTPhysicalLinkAdapter
- iPhy.Close();
- __LOG(_L("Closed iPhy\n"));
-
- delete iStreamer;
- iStreamer = NULL;
- iGavdp.Shutdown();
- iAutoStream = EFalse;
-
- iGavdpState = EIdle;
- Listen();
- }
-
-void CAVTestApp::Connect()
- {
- __LOG(_L("Connecting...\n"));
- iGavdp.Connect(iDevAddr);
- }
-
-void CAVTestApp::CreateBearers()
- {
- TInt ret = KErrNone;
- TSEID seid;
-
- if (iAutoStream)
- {
- seid = iCurrentSEID;
- }
- else
- {
- __PRINT(_L("\n-> Create bearers for remote SEID"));
- seid = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()), EFalse);
- }
-
- ret = iGavdp.CreateBearerSockets(seid);
- __LOG(_L("Asking for Bearers..(sync_result) %d.\n"), ret);
- }
-
-void CAVTestApp::CloseBearers()
- {
- __LOG(_L("Closing Bearer 0 (via Streamer dtor)...\n\r"));
-
- delete iStreamer;
- iStreamer = NULL;
-
- __LOG(_L("Bearer closed (via Streamer dtor)...\n\r"));
-
- AllowLowPowerModes();
- }
-
-void CAVTestApp::DiscoverSEPs()
- {
- __LOG(_L("Sending SEP Discovery...\n\r"));
-
- iGavdp.DiscoverRemoteSEPs();
- }
-
-CAVTestApp::CAVTestApp()
- {
- }
-
-CAVTestApp::~CAVTestApp()
- {
- StopSrc();
- delete iActiveConsole;
- delete iLogConsole;
- delete iMtUpdater;
- delete iTavsrcAbsoluteVolume;
- delete iStreamer;
- delete iRemConInterfaceSelector;
- delete iController;
- delete iPacketDropIoctl;
- delete iOperations;
-
-#ifdef CHANNEL_BINDING_DEBUG_CHECK
- delete iRepReader;
- delete iRepWriter;
- delete iRecvReader;
- delete iRecvWriter;
-#endif
-
- iFilename.Close();
- iLocallyRegisteredSEPs.Close();
- iSockServ.Close();
- iSdpDB.Close();
- iSdp.Close();
- iSEPCapabilities.ResetAndDestroy();
- iShortlistedSEIDs.Close();
- }
-
-CAVTestApp* CAVTestApp::NewL()
- {
- CAVTestApp* thisapp = new (ELeave) CAVTestApp;
- CleanupStack::PushL(thisapp);
- thisapp->ConstructL();
- CleanupStack::Pop();
- return thisapp;
- }
-
-void CAVTestApp::ConstructL()
- {
- iLogConsole = CActiveConsole::NewL(*this,_L("Event Log"),KLogConsole);
- iActiveConsole = CActiveConsole::NewL(*this,_L(" Boom Box "),KMainConsole);
-
- User::LeaveIfError(iSockServ.Connect());
- }
-
-void CAVTestApp::CreateRemConInterfacesL()
- {
- iRemConInterfaceSelector = CRemConInterfaceSelector::NewL();
-
- RArray<TRemConCoreApiOperationId> coreFeatures;
- for(TInt i = 0; i<0x76; i++)
- {
- coreFeatures.Append(static_cast<TRemConCoreApiOperationId>(i));
- }
-
- if(iRemConInterfaces & ECoreApiTarget)
- {
- iRemConTarget = CRemConCoreApiTarget::NewL(*iRemConInterfaceSelector, *this, coreFeatures);
- }
- coreFeatures.Close();
-
- if(iRemConInterfaces & EGroupNavigation)
- {
- iGroupNavigation = CRemConGroupNavigationApiTarget::NewL(*iRemConInterfaceSelector, *this, ETrue, ETrue);
- }
-
- if(iRemConInterfaces & EMediaInformation)
- {
- iMediaInformation = CRemConMediaInformationTarget::NewL(*iRemConInterfaceSelector, *this);
- }
-
- if(iRemConInterfaces & EBatteryStatus)
- {
- iBatteryStatus = CRemConBatteryApiTarget::NewL(*iRemConInterfaceSelector, *this);
- }
-
- if(iRemConInterfaces & (EAbsoluteVolumeTarget | EAbsoluteVolumeController))
- {
- iTavsrcAbsoluteVolume = CTavsrcAbsoluteVolume::NewL(*iRemConInterfaceSelector);
- }
-
- if(iRemConInterfaces & EVendorTrackInfoTarget)
- {
- iTrackInfo = CRemConTrackInfoTarget::NewL(*iRemConInterfaceSelector, *this);
- }
-
- if(iRemConInterfaces & (EPlayerInformation | ENowPlaying | EMediaBrowse ))
- {
- iMtUpdater = CTavsrcMtUpdater::NewL(*iRemConInterfaceSelector, iRemConInterfaces);
- }
-
- if(iRemConInterfaces & EVendorAbsoluteVolumeTarget)
- {
- iAbsoluteVolume = CRemConAbsVolTarget::NewL(*iRemConInterfaceSelector, *this);
- }
-
- iController = CTavsrcController::NewL(*iRemConInterfaceSelector, *iLogConsole);
-
- _LIT8(KTavsrcName, "Tavsrc");
- iRemConInterfaceSelector->OpenTargetL(ERemConAudioPlayer, ERemConNoSubType, KTavsrcName);
-
- iRemConInterfaceSelector->OpenControllerL();
- iOperations = CTavsrcOperations::NewL();
- }
-
-void CAVTestApp::DisplayHelp()
- {
- __LOG(_L("\nUsage: tavsrc [-A <Remote BT Addr>] [-D <Display Mode>] [-P] [-H]\n"));
- __LOG(_L("\n-A <Remote BT Addr>: Optional argument to specify remote\n"));
- __LOG(_L("Bluetooth address. If not specified then you will be prompted\n"));
- __LOG(_L("using notifiers.\n"));
- __LOG(_L("\n-D <Display Mode>: Optional argument to specify the display mode\n"));
- __LOG(_L("to use. The possible values are a logical AND of the following:\n"));
- __LOG(_L(" 0x00: Status and Command windows only\n"));
- __LOG(_L(" 0x01: Streamer Info window\n"));
- __LOG(_L(" 0x02: Progress Bar window\n"));
- __LOG(_L(" 0x04: Playlist window\n"));
- __LOG(_L(" 0x08: Chunky Icon window\n"));
- __LOG(_L("For example, for all the windows except the Progress Bar: -D d\n"));
- __LOG(_L("Default value is 1 - Status, Command and Streamer Info windows\n"));
- __LOG(_L("\n-P: Preload SBC file before streaming.\n"));
- __LOG(_L("\n-H: Display this help information.\n"));
- __LOG(_L("\n-R <RemCon interfaces>: Optional argument to specify what interfaces to use:\n"));
- __LOG(_L(" ECoreApiTarget = 1 << 0\n"));
- __LOG(_L(" ECoreApiController = 1 << 1\n"));
- __LOG(_L(" EGroupNavigation = 1 << 2\n"));
- __LOG(_L(" EMediaInformation = 1 << 3\n"));
- __LOG(_L(" EBatteryStatus = 1 << 4\n"));
- __LOG(_L(" EAbsoluteVolumeTarget = 1 << 5\n"));
- __LOG(_L(" EAbsoluteVolumeController = 1 << 6\n"));
- __LOG(_L(" EPlayerInformation = 1 << 7\n"));
- __LOG(_L(" ENowPlaying = 1 << 8\n"));
- __LOG(_L(" EMediaBrowse = 1 << 9\n"));
- __LOG(_L(" EDatabaseAware = 1 << 10\n"));
- __LOG(_L(" ESeparateThreadForBrowse = 1 << 11\n"));
- __LOG(_L(" EVendorTrackInfoTarget = 1 << 12\n"));
- __LOG(_L(" EVendorAbsoluteVolumeTarget = 1 << 13\n"));
- }
-
-void CAVTestApp::ParseCommandLineL()
- {
- CCommandLineArguments *cmdLine = CCommandLineArguments::NewL();
- CleanupStack::PushL(cmdLine);
-
- // set defaults
- iDisplayMode = 0x01;
- iPreloadFile = EFalse;
-
- TBool btAddrFound = EFalse;
- TBool remConInterfacesFound = EFalse;
- TBuf<20> arg;
- for (TInt argIndex = 1; argIndex < cmdLine->Count(); argIndex++)
- {
- arg = cmdLine->Arg(argIndex);
- arg.UpperCase();
-
- // look for help
- if (arg.FindF(_L("-H")) != KErrNotFound)
- {
- DisplayHelp();
- User::Leave(KErrArgument);
- }
-
- // look for preload file
- if (arg.FindF(_L("-P")) != KErrNotFound)
- {
- iPreloadFile = ETrue;
- continue;
- }
-
- // look for remote device address
- if (arg.FindF(_L("-A")) != KErrNotFound)
- {
- if (argIndex != cmdLine->Count() - 1)
- {
- btAddrFound = ETrue;
- iDevAddr.SetReadable(cmdLine->Arg(++argIndex));
- continue;
- }
- else
- {
- __LOG(_L("No address found for -A option\n"));
- DisplayHelp();
- User::Leave(KErrArgument);
- }
- }
-
- // look for display mode
- if (arg.FindF(_L("-D")) != KErrNotFound)
- {
- if(argIndex != cmdLine->Count() - 1)
- {
- TLex lex(cmdLine->Arg(++argIndex));
- lex.Val(iDisplayMode, EHex);
- continue;
- }
- else
- {
- __LOG(_L("No display mode found for -D option\n"));
- DisplayHelp();
- User::Leave(KErrArgument);
- }
- }
-
- // look for remcon interfaces
- if (arg.FindF(_L("-R")) != KErrNotFound)
- {
- if(argIndex != cmdLine->Count() - 1)
- {
- TLex lex(cmdLine->Arg(++argIndex));
- TInt err = lex.Val(iRemConInterfaces, EHex);
- if(!err)
- {
- remConInterfacesFound = ETrue;
- }
- else
- {
- __LOG(_L("Badly formatted interface bitmask\n"));
- }
- continue;
- }
- else
- {
- __LOG(_L("No remconinterfaces found for -R option\n"));
- DisplayHelp();
- User::Leave(KErrArgument);
- }
- }
-
- // if we got here it means that we have an unhandled argument
- __LOG(_L("Unrecognised argument\n"));
- DisplayHelp();
- User::Leave(KErrArgument);
- }
- CleanupStack::PopAndDestroy(); // cmdLine
-
- if (!btAddrFound)
- {
- __LOG(_L("No address found on command line - please enter an address\n"));
- TTavsrcUtils::GetDeviceAddressL(iDevAddr);
- }
-
- if(!remConInterfacesFound)
- {
- __LOG(_L("No interfaces found on command line, defaulting to all interfaces\n"));
- iRemConInterfaces = 0xFFFFFFFF;
- }
- }
-
-void CAVTestApp::StartL()
- {
- // connect to sdp
- __LOG(_L("Connecting to ESOCK\n"));
- User::LeaveIfError(iSockServ.Connect());
- __LOG(_L("Connecting to SDP Server\n"));
-
- __LOG(_L("Connecting to SDP Server\n"));
- User::LeaveIfError(iSdp.Connect());
- __LOG(_L("Opening subsession on SDP Server\n"));
-
- __LOG(_L("Opening subsession on SDP Server\n"));
- User::LeaveIfError(iSdpDB.Open(iSdp));
- TBuf<512> cmdline;
-
- // ensure that we have something to stream
- RFs fs;
- CDir* files;
- User::LeaveIfError(fs.Connect());
-
- TInt err = fs.GetDir(KSBCFiles, KEntryAttNormal, ESortByName, files);
-
- fs.Close();
-
- if (err != KErrNone)
- {
- __LOG(_L("Error getting files %S: %d \n"), &KSBCFiles, err);
- User::Leave(err);
- }
-
- if (files->Count() > 0)
- {
- // store the filename for registering the SEP later
- iFilename.Create(KMaxFileName);
- iFilename.Append(KSBCFileRoot);
- iFilename.Append(files->operator[](0).iName);
- delete files;
- }
- else
- {
- __LOG(_L("\nNo files matching %S found, at least one is required,\n"), &KSBCFiles);
- __LOG(_L("please add files and restart the application\n"));
- delete files;
- User::Leave(KErrNotFound);
- }
-
- TRAP(err, ParseCommandLineL());
- if (err != KErrNone)
- {
- iActiveConsole->Console().ClearScreen();
- iActiveConsole->Console().Printf(_L("\nProblem with Command Line arguments, see status window for"));
- iActiveConsole->Console().Printf(_L("\nmore information or press ESC to exit.\n"));
- iActiveConsole->RequestKey();
- }
- else
- {
- err = StartSrc();
- if(err == KErrNone)
- {
- TestMenu();
- }
- else
- {
- iActiveConsole->Console().ClearScreen();
- iActiveConsole->Console().Printf(_L("\nProblem starting source, see status window for"));
- iActiveConsole->Console().Printf(_L("\nmore information or press ESC to exit.\n"));
- iActiveConsole->RequestKey();
- }
- }
- CActiveScheduler::Start();
- }
-
-void CAVTestApp::Stop()
- {
- CActiveScheduler::Stop();
- }
-
-//remcon
- void CAVTestApp::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
- TRemConCoreApiButtonAction aButtonAct)
- {
- __LOG(_L("RemCon::Command received 0x%02x\t Button Act %d\n"), aOperationId, aButtonAct);
- if((aOperationId == ERemConCoreApiStop) &&
- (aButtonAct == ERemConCoreApiButtonClick || aButtonAct == ERemConCoreApiButtonPress) )
- {
- __LOG(_L("RemCon::Stop received\n"));
- iAutoStream = EFalse;
- if (iStreamer)
- {
- iStreamer->Stop();
- }
- iStreamState = EStopped;
- iOperations->EndOperation(KTavsrcOpStopStream, KErrNone);
- }
- else if (((aOperationId == ERemConCoreApiBackward) || (aOperationId == ERemConCoreApiRewind)) && iStreamer)
- {
- if (aButtonAct == ERemConCoreApiButtonClick)
- {
- iStreamer->PrevTrack();
- }
- else if ((aButtonAct == ERemConCoreApiButtonPress) && (iStreamState == EStreaming))
- {
- iStreamer->Backward();
- iStreamer->Faster();
- }
- else if ((aButtonAct == ERemConCoreApiButtonRelease) && (iStreamState == EStreaming))
- {
- iStreamer->Forward();
- iStreamer->Slower();
- }
- }
- else if (((aOperationId == ERemConCoreApiForward) || (aOperationId == ERemConCoreApiFastForward)) && iStreamer)
- {
- if (aButtonAct == ERemConCoreApiButtonClick)
- {
- iStreamer->NextTrack();
- }
- else if ((aButtonAct == ERemConCoreApiButtonPress) && (iStreamState == EStreaming))
- {
- iStreamer->Faster();
- }
- else if ((aButtonAct == ERemConCoreApiButtonRelease) && (iStreamState == EStreaming))
- {
- iStreamer->Slower();
- }
- }
- else if ((aOperationId == ERemConCoreApiPause) && (aButtonAct != ERemConCoreApiButtonRelease))
- {
- TInt operation = KTavsrcOpStream;
-
- if (iStreamState == EStreaming)
- {
- // this demo app doesn't suspend GAVDP, just the streamer
- if (iStreamer)
- {
- iStreamer->Suspend();
- }
- iStreamState = EPaused;
- operation = KTavsrcOpStopStream;
- }
- iOperations->EndOperation(operation, KErrNone);
- }
-
- if (iStreamState == EStreaming)
- {
- PreventLowPowerModes();
- }
-
- TestMenu();
- }
-
- void CAVTestApp::MrccatoPlay(TRemConCoreApiPlaybackSpeed /*aSpeed*/,
- TRemConCoreApiButtonAction aButtonAct)
- {
- __LOG(_L("RemCon::Play received\t Button Act %d\n"), aButtonAct);
- if((aButtonAct == ERemConCoreApiButtonClick || aButtonAct == ERemConCoreApiButtonPress))
- {
- TInt operation = KTavsrcOpStream;
-
- // kick everything off
- if (iGavdpState == ESigConnected)
- {
- // auto
- iAutoStream = ETrue;
- // kick off
- DiscoverSEPs();
- }
- else if (iGavdpState == ESuspended)
- {
- if (iStreamer)
- iStreamer->ReStream();
- iStreamState = EStreaming;
- }
- else if (iGavdpState == EOpen)
- {
- if (iStreamState == EPaused)
- {
- // this demo app doesn't unsuspend GAVDP, just the streamer
- if (iStreamer)
- iStreamer->ReStream();
- iStreamState = EStreaming;
- }
- else if (iStreamState == EStopped)
- {
- // this demo app doesn't unsuspend GAVDP, just the streamer
- if (iStreamer)
- iStreamer->Stream(CurrentSEIDIsSink()); //could be source or sink
- iStreamState = EStreaming;
- }
- else if (iStreamState == EClosed)
- {
- if (iStreamer)
- iStreamer->Stream(CurrentSEIDIsSink());
- iStreamState = EStreaming;
- }
- }
- iOperations->EndOperation(operation, KErrNone);
-
- if (iStreamState == EStreaming)
- {
- PreventLowPowerModes();
- }
-
- TestMenu();
- }
- }
-
-void CAVTestApp::MediaCodecConfigurationRequired(TSBCCodecCapabilities& aConfig)
- {
- if (!iLocalReconfigure)
- {
- // set the reconfigure information
- iReconfigInfo = aConfig;
- iLocalReconfigure = ETrue;
-
- // start streaming automatically after the reconfigure
- iAutoStream = ETrue;
-
- SuspendStreams();
- }
- }
-
-void CAVTestApp::PrintCommandOption(TChar aOperation, TPtrC aDesc)
- {
- if (iOperations->IsOperationAllowed(aOperation))
- {
- iActiveConsole->Console().Printf(_L("%c%s"), aOperation.IsUpper() ? aOperation.GetUpperCase() : aOperation.GetLowerCase(), aDesc.Ptr());
- }
- else
- {
- iActiveConsole->Console().Printf(_L(" %s"), aDesc.Ptr());
- }
- }
-
-// from MRemConMediaInformationTargetObserver
-void CAVTestApp::MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter )
- {
- iActiveConsole->Console().Printf(_L("Got MrcpitoGetElementAttributes \n") );
-
- // Make sure total of these defines is greater than KAVCMaxFrame (512 bytes)
- // to ensure that fragmentation is performed on this response
- _LIT8(KMediaTitle, "Frederic Chopin (1810-1849): Ballade for Piano #1 in A flat major, Opus 23, CT 2 - Largo allegretto, Moderato con brio vivace, Presto con fuoco");
- _LIT8(KArtistName, "Maurizio Pollini and the London Philharmonic Orchestra, conducted by Sir Colin Davis, recorded live at the Royal Albert Hall at the 1987 Proms season");
- _LIT8(KAlbumName, "Frederic Chopin (1810-1849): Four Ballades, Two Preludes, the Valse in D-flat major - Op. 64 No. 1 and the Andante Spianato & Grand Polonaise Brillante Op. 22");
- _LIT8(KTrackNumber, "10345");
- _LIT8(KNumberOfTracks, "6876436456");
- _LIT8(KGenre, "Alternative super cool Classical Music with a lemon twist and a hint of progressive rock");
- _LIT8(KPlayingTime, "150000");
-
- TBuf8<255> buffer;
-
- // for each element requested
- TMediaAttributeId id;
- while (aAttributeIter.Next(id))
- {
- switch(id)
- {
- case ETitleOfMedia:
- buffer.Copy(KMediaTitle);
- break;
- case ENameOfArtist:
- buffer.Copy(KArtistName);
- break;
- case ENameOfAlbum:
- buffer.Copy(KAlbumName);
- break;
- case ETrackNumber:
- buffer.Copy(KTrackNumber);
- break;
- case ENumberOfTracks:
- buffer.Copy(KNumberOfTracks);
- break;
- case EGenre:
- buffer.Copy(KGenre);
- break;
- case EPlayingTime:
- buffer.Copy(KPlayingTime);
- break;
- default:
- __DEBUGGER();
- break;
- }
-
- // return the element value
- iMediaInformation->AttributeValue( id, buffer );
-
- // convert the element value to unicode for display
- TBuf16<255> buf16;
- buf16.Copy(buffer);
- buf16.ZeroTerminate();
- iActiveConsole->Console().Printf(_L("Element:%d value:%s \n"), id, buf16.Ptr() );
- }
-
- // send response complete
- iMediaInformation->Completed();
-
- }
-
-
-TInt CAVTestApp::MrcmtcGetElementAttributes(TUint64 /* aElement */, TUint32 aAttribute, HBufC8*& aOutValueOwnershipTransferred)
- {
-//
-// __DEBUGGER(); //try this out
- iActiveConsole->Console().Printf(_L("Got GEA, attrib %d!\n"), aAttribute);
-
- aOutValueOwnershipTransferred = HBufC8::New(20);
- if (aOutValueOwnershipTransferred)
- {
- aOutValueOwnershipTransferred->Des() = _L8("Hello");
- }
-
- return KErrNone;
- }
-
-void CAVTestApp::MrcncRegisterPlaybackStatusChangedNotification()
- {
- iActiveConsole->Console().Printf(_L("Queued notify: PlayStatusChanged!\n"));
- }
-
-void CAVTestApp::MrcncRegisterTrackChangedNotification()
- {
- iActiveConsole->Console().Printf(_L("Queued notify: TrackChanged!\n"));
- }
-
-void CAVTestApp::MrcncRegisterTrackReachedEndNotification()
- {
- iActiveConsole->Console().Printf(_L("Queued notify: TrackReachedEnd!\n"));
- }
-
-void CAVTestApp::MrcncRegisterTrackReachedStartNotification()
- {
- iActiveConsole->Console().Printf(_L("Queued notify: TrackReachedStart!\n"));
- }
-
-void CAVTestApp::MrcncRegisterPositionChangedNotification(TUint32 aInterval)
- {
- iActiveConsole->Console().Printf(_L("Queued notify: PositionChanged (0x%08x)!\n"), aInterval);
- }
-
-void CAVTestApp::MrcncRegisterBatteryStatusChangedNotification()
- {
- iActiveConsole->Console().Printf(_L("Queued notify: BatteryStatusChanged!\n"));
- }
-
-void CAVTestApp::MrcncRegisterSystemStatusChangedNotification()
- {
- iActiveConsole->Console().Printf(_L("Queued notify: SystemStatusChanged!\n"));
- }
-
-void CAVTestApp::MrcncRegisterPlayerApplicationStatusChangedNotification()
- {
- iActiveConsole->Console().Printf(_L("Queued notify: PlayerAppStatusChanged!\n"));
- }
-
-void CAVTestApp::MrcbstoBatteryStatus(TControllerBatteryStatus& aBatteryStatus )
- {
- switch(aBatteryStatus)
- {
- case ENormal:
- iActiveConsole->Console().Printf(_L("Battery status: Normal \n"));
- break;
- case EWarning:
- iActiveConsole->Console().Printf(_L("Battery status: Warning \n"));
- break;
- case ECritical:
- iActiveConsole->Console().Printf(_L("Battery status: Critical \n"));
- break;
- case EExternal:
- iActiveConsole->Console().Printf(_L("Battery status: External \n"));
- break;
- case EFullCharge:
- iActiveConsole->Console().Printf(_L("Battery status: FullCharge \n"));
- break;
- default:
- iActiveConsole->Console().Printf(_L("Battery status: %d \n"), aBatteryStatus);
- break;
- }
- }
-
-void CAVTestApp::MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct )
- {
- switch(aButtonAct)
- {
- case ERemConCoreApiButtonPress:
- iActiveConsole->Console().Printf(_L("Got NextGroup! Button Press \n"));
- break;
- case ERemConCoreApiButtonRelease:
- iActiveConsole->Console().Printf(_L("Got NextGroup! Button Release \n"));
- break;
- case ERemConCoreApiButtonClick:
- iActiveConsole->Console().Printf(_L("Got NextGroup! Button Click \n"));
- break;
- default:
- iActiveConsole->Console().Printf(_L("Got NextGroup! Button ??? \n"));
- break;
- }
-
- // for testing return an error
- TRequestStatus status;
- TRequestStatus* ptrStatus = &status;
- iGroupNavigation->NextGroupResponse( ptrStatus, KErrNone);
- User::WaitForRequest(status);
-
- }
-
-void CAVTestApp::MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct )
- {
- switch(aButtonAct)
- {
- case ERemConCoreApiButtonPress:
- iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button Press \n"));
- break;
- case ERemConCoreApiButtonRelease:
- iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button Release \n"));
- break;
- case ERemConCoreApiButtonClick:
- iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button Click \n"));
- break;
- default:
- iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button ??? \n"));
- break;
- }
-
- // return success
- TRequestStatus status;
- TRequestStatus* ptrStatus = &status;
- iGroupNavigation->PreviousGroupResponse( ptrStatus, KErrNone );
- User::WaitForRequest(status);
- }
-
-void CAVTestApp::MrcavtoGetAbsoluteVolume()
- {
- TRequestStatus status;
- iAbsoluteVolume->GetAbsoluteVolumeResponse(status, 1, 2, KErrNone);
- User::WaitForRequest(status);
- }
-
-void CAVTestApp::MrcavtoSetAbsoluteVolume(TUint /*aAbsVol*/, TUint /*aMaxVol*/)
- {
- TRequestStatus status;
- iAbsoluteVolume->SetAbsoluteVolumeResponse(status, KErrNone);
- User::WaitForRequest(status);
- }
-
-void CAVTestApp::MrctitoGetTrackName()
- {
- TRequestStatus status;
- _LIT(KTrackName, "trackname");
- iTrackInfo->GetTrackNameResponse(status, KTrackName, KErrNone);
- User::WaitForRequest(status);
- }
-
-void CAVTestApp::MrctitoGetArtist()
- {
- TRequestStatus status;
- _LIT(KArtist, "artist");
- iTrackInfo->GetArtistResponse(status, KArtist, KErrNone);
- User::WaitForRequest(status);
- }
-
-void CAVTestApp::MrctitoGetTrackDuration()
- {
- TRequestStatus status;
- _LIT(KTrackDuration, "0.2.56");
- TTime trackDuration(KTrackDuration);
- iTrackInfo->GetTrackDurationResponse(status, trackDuration, KErrNone);
- User::WaitForRequest(status);
- }
-
-_LIT(KOn, "On");
-_LIT(KOff, "Off");
-
-void CAVTestApp::TestMenu()
- {
- iActiveConsole->Console().ClearScreen();
-
- iActiveConsole->Console().Printf(_L("Safe Mode: %S\n"), iOperations->SafeMode() ? &KOn() : &KOff());
-
- if (iGavdpState!=EIdle)
- {
- iActiveConsole->Console().Printf(_L("Connected \n\r"));
- }
- else
- {
- iActiveConsole->Console().Printf(_L(" \n\r"));
- }
-
- RProperty property;
- TBuf8<6> addr;
-
- TInt err = property.Get(KPropertyUidBluetoothCategory,
- KPropertyKeyBluetoothGetLocalDeviceAddress, addr);
-
- if ((err) || (addr.Length()!=6))
- {
- iActiveConsole->Console().Printf(_L("P&S: ERROR retrieving local address\n"));
- }
- else
- {
- TBTDevAddr localAddress(addr);
- TBuf<20> dispBuf;
- localAddress.GetReadable(dispBuf);
- TBuf<20> rBuf;
- iDevAddr.GetReadable(rBuf);
- iActiveConsole->Console().Printf(_L("Local address = 0x%S; Using Remote Addr = 0x%S\n"),&dispBuf,&rBuf);
- }
-
- iActiveConsole->Console().Printf(_L("\n"));
-
- switch (iGavdpState)
- {
- case ENoClientOpen:
- PrintCommandOption(KTavsrcOpStartSrc, _L(". Open GAVDP for Src\n"));
- break;
- case EIdle:
- PrintCommandOption(KTavsrcOpConnect, _L(". Connect\n"));
- PrintCommandOption(KTavsrcOpCancel, _L(". Cancel\n"));
- PrintCommandOption(KTavsrcOpRegisterSEP, _L(". Register SEP\n"));
- break;
- case ESigConnected:
- case EOpen:
- case ESuspended:
- case ERemoteReconfiguring:
- PrintCommandOption(KTavsrcOpAutoStream, _L(". Auto Stream\n"));
- PrintCommandOption(KTavsrcOpDiscoverSEPs, _L(". Discover remote SEPs "));
- PrintCommandOption(KTavsrcOpCreateBearers, _L(". Create Bearers\n"));
-
- PrintCommandOption(KTavsrcOpGetCapabilities, _L(". Get Remote SEP Capabilites "));
- PrintCommandOption(KTavsrcOpCloseBearers, _L(". Close Bearers\n"));
-
- PrintCommandOption(KTavsrcOpStartStreams, _L(". Start Stream "));
- PrintCommandOption(KTavsrcOpSuspendStreams, _L(". Suspend Stream\n"));
-
- PrintCommandOption(KTavsrcOpContentProtection, _L(". Content Protection "));
- PrintCommandOption(KTavsrcOpAbort, _L(". Abort Stream\n"));
-
- PrintCommandOption(KTavsrcOpConfigureSEP, _L(". Select Remote SEP (configure the doofer)\n"));
-
- PrintCommandOption(KTavsrcOpStream, _L(". Start Streamer "));
- PrintCommandOption(KTavsrcOpStopStream, _L(". Stop Streamer\n\n"));
-
- PrintCommandOption(KTavsrcOpPacketDropIoctl, _L(". Send \"Notify Media Packet Dropped\" IOCTL\n\n"));
-
- PrintCommandOption(KTavsrcOpDisconnectSrc, _L(". Disconnect GAVDP - don't close\n"));
- PrintCommandOption(KTavsrcOpStopSrc, _L(". Close GAVDP\n"));
- break;
- }
-
- iActiveConsole->Console().Printf(_L("\n"));
-
- PrintCommandOption(KTavsrcOpPlay, _L(". AVRCP Play "));
- PrintCommandOption(KTavsrcOpStop, _L(". AVRCP Stop\n"));
-
- iActiveConsole->Console().Printf(_L("Up. AVRCP Volume Up "));
- iActiveConsole->Console().Printf(_L("Down. AVRCP Volume Down\n"));
-
- iActiveConsole->Console().Printf(_L("Left. AVRCP Backwards "));
- iActiveConsole->Console().Printf(_L("Right. AVRCP Forwards\n"));
-
- iActiveConsole->Console().Printf(_L("\n"));
-
- PrintCommandOption(KTavsrcOpToggleSafeMode, _L(".\tToggle Safe Mode\n"));
- iActiveConsole->Console().Printf(_L("Esc.\tStop\n"));
-
- if (!iActiveConsole->IsActive())
- {
- iActiveConsole->RequestKey();
- }
- }
-
-void CAVTestApp::KeyPressed(TChar aKey)
- {
- TInt beginOperation = iOperations->BeginOperation(aKey);
-
- if (beginOperation == KErrNone)
- {
- switch (aKey)
- {
- case KTavsrcOpConnect:
- {
- Connect();
- break;
- }
- case KTavsrcOpCancel:
- {
- iOperations->EndOperation(KTavsrcOpCancel, KErrCancel);
-
- iGavdp.Cancel();
- __LOG(_L("Current Request Cancelled \n"));
- break;
- }
- case KTavsrcOpDiscoverSEPs:
- {
- DiscoverSEPs();
- break;
- }
- case KTavsrcOpCreateBearers:
- {
- CreateBearers();
- break;
- }
- case KTavsrcOpCloseBearers:
- {
- iOperations->EndOperation(KTavsrcOpCloseBearers, KErrNone);
-
- CloseBearers();
- break;
- }
- case KTavsrcOpContentProtection:
- {
- SendSecurityControl();
- break;
- }
- case KTavsrcOpGetCapabilities:
- {
- GetCapabilities();
- break;
- }
- case KTavsrcOpStartStreams:
- {
- StartStreams();
- break;
- }
- case KTavsrcOpSuspendStreams:
- {
- SuspendStreams();
- break;
- }
- case KTavsrcOpEchoStorm:
- {
- iOperations->EndOperation(KTavsrcOpEchoStorm, KErrNone);
-
- EchoStorm();
- break;
- }
- case KTavsrcOpAbort:
- {
- Abort();
- break;
- }
- case KTavsrcOpStream:
- {
- iOperations->EndOperation(KTavsrcOpStream, KErrNone);
-
- iStreamer->Stream(CurrentSEIDIsSink());
- iStreamState = EStreaming;
- }
- break;
- case KTavsrcOpStreamFaster:
- {
- iOperations->EndOperation(KTavsrcOpStreamFaster, KErrNone);
-
- iStreamer->Faster();
- break;
- }
-
- case KTavsrcOpStreamSlower:
- {
- iOperations->EndOperation(KTavsrcOpStreamSlower, KErrNone);
-
- iStreamer->Slower();
- break;
- }
-
- case KTavsrcOpAutoStream:
- {
- // auto
- iAutoStream = ETrue;
- // kick off
- DiscoverSEPs();
- }
- break;
-
- case KTavsrcOpStopStream:
- {
- iOperations->EndOperation(KTavsrcOpStopStream, KErrNone);
-
- __LOG(_L("Stopping streaming... \n"));
- iStreamState = EPaused;
- iStreamer->Suspend();
- }
- break;
- case KTavsrcOpRegisterSEP:
- {
- iOperations->EndOperation(KTavsrcOpRegisterSEP, KErrNone);
-
- RegisterSEP();
- break;
- }
- case KTavsrcOpRegisterMultipleSEPs:
- {
- iOperations->EndOperation(KTavsrcOpRegisterMultipleSEPs, KErrNone);
-
- for (TInt i=0; i<=40; i++)
- {
- TAvdtpSEPInfo info; iGavdp.RegisterSEP(info);
- }
- break;
- }
- case KTavsrcOpStartSrc:
- {
- iOperations->EndOperation(KTavsrcOpStartSrc, KErrNone);
-
- //reopen GAVDP
- StartSrc();
- break;
- }
-
- case KTavsrcOpStopSrc:
- {
- iOperations->EndOperation(KTavsrcOpStopSrc, KErrNone);
-
- StopSrc();
- break;
- }
- case KTavsrcOpDisconnectSrc:
- {
- iOperations->EndOperation(KTavsrcOpDisconnectSrc, KErrNone);
-
- DisconnectSrc();
- break;
- }
- case KTavsrcOpConfigureSEP:
- {
- TRAPD(err, ConfigureSEPL());
- if (err != KErrNone)
- {
- iOperations->EndOperation(KTavsrcOpConfigureSEP, err);
- }
- break;
- }
-
- case KTavsrcOpPacketDropIoctl:
- {
- iOperations->EndOperation(KTavsrcOpPacketDropIoctl, KErrNone);
-
- __LOG(_L("Sending packet drop IOCTL\n"));
- iPacketDropIoctl = CActivePacketDropIoctl::NewL(iLogConsole, iPendingSockets);//Qualified
- iPacketDropIoctl->Start();
- break;
- }
-
- case KTavsrcOpVolumeUp:
- {
- iOperations->EndOperation(KTavsrcOpVolumeUp, KErrNone);
-
- iController->Command(ERemConCoreApiVolumeUp);
- break;
- }
-
- case KTavsrcOpVolumeDown:
- {
- iOperations->EndOperation(KTavsrcOpVolumeDown, KErrNone);
-
- iController->Command(ERemConCoreApiVolumeDown);
- break;
- }
-
- case KTavsrcOpBackwards:
- {
- iOperations->EndOperation(KTavsrcOpBackwards, KErrNone);
-
- iController->Command(ERemConCoreApiBackward);
- break;
- }
-
- case KTavsrcOpForwards:
- {
- iOperations->EndOperation(KTavsrcOpForwards, KErrNone);
-
- iController->Command(ERemConCoreApiForward);
- break;
- }
-
- case KTavsrcOpPlay:
- {
- iOperations->EndOperation(KTavsrcOpPlay, KErrNone);
-
- iController->Command(ERemConCoreApiPlay);
- break;
- }
-
- case KTavsrcOpStop:
- {
- iOperations->EndOperation(KTavsrcOpStop, KErrNone);
-
- iController->Command(ERemConCoreApiStop);
- break;
- }
-
- case KTavsrcOpExit:
- {
- iOperations->EndOperation(KTavsrcOpExit, KErrNone);
-
- Stop();
- return;
- }
-
- case KTavsrcOpToggleSafeMode:
- {
- iOperations->EndOperation(KTavsrcOpToggleSafeMode, KErrNone);
-
- iOperations->SetSafeMode(!iOperations->SafeMode());
- break;
- }
-
- default:
- iActiveConsole->Console().Printf(_L("Unknown command\r\n"));
- }
- }
- else
- {
- __LOG(_L("Operation not allowed: %d\r\n"), beginOperation);
- }
-
- TestMenu();
-
- }
-
-TInt CAVTestApp::RegisterSEP()
- {
- TInt err;
-
- TAvdtpSEPInfo info;
- info.SetIsSink(TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("Sink ")));
- info.SetMediaType(TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("Audio ")) ?
- EAvdtpMediaTypeAudio :
- EAvdtpMediaTypeVideo);
- err = iGavdp.RegisterSEP(info);
-
- if (err==KErrNone)
- {
- iLocallyRegisteredSEPs.Append(info);
- }
- __LOG(_L("Registering SEP [SEID %d] - completed with error %d\n"), info.SEID().SEID(), err);
-
- if (err==KErrNone)
- {
- iCurrentLocalSEID = info.SEID();
-
- // add some caps, not to all though for testing!
- err = iGavdp.BeginConfiguringLocalSEP(info.SEID());
-
- __LOG(_L("Begin config Local SEP [SEID %d] - completed with error %d\n"), info.SEID().SEID(), err);
-
- TAvdtpMediaTransportCapabilities media;
- err = iGavdp.AddSEPCapability(media);
- __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), media.Category(), err);
-/*
- TAvdtpReportingCapabilities rep;
- err = iGavdp.AddSEPCapability(rep);
- __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), rep.Category(), err);
-
- TAvdtpRecoveryCapabilities rec;
- rec.SetRecoveryType(ERFC2733Recovery);
- rec.SetMaxWindowSize(5);
- rec.SetMinWindowSize(1);
- err = iGavdp.AddSEPCapability(rec);
- __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), rec.Category(), err);
-
- TAvdtpContentProtectionCapabilities cp;
- cp.SetContentProtectionType(0x1234);
- cp.SetContentProtectionData(_L8("A test content protection method"));
- err = iGavdp.AddSEPCapability(cp);
- */
- if(TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("SBC ")))
- {
- TSBCCodecCapabilities sbc;
- sbc.SetSamplingFrequencies(E48kHz|E44100Hz|E32kHz|E16kHz);
- sbc.SetBlockLengths(EBlockLenFour | EBlockLenEight | EBlockLenTwelve | EBlockLenSixteen);
- sbc.SetMinBitpoolValue(2);
- sbc.SetMaxBitpoolValue(250);
- sbc.SetChannelModes(EJointStereo | EStereo | EMono | EDualChannel);
- sbc.SetSubbands(EFourSubbands|EEightSubbands);
- sbc.SetAllocationMethods(ELoudness | ESNR);
-
- // crazy stuff testing
- /*
- sbc.SetSamplingFrequencies(E16kHz);
- sbc.SetBlockLengths(EBlockLenTwelve);
- sbc.SetChannelModes(EJointStereo);
- sbc.SetSubbands(EFourSubbands);
- */
- err = iGavdp.AddSEPCapability(sbc);
-
- __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), sbc.Category(), err);
- }
- else
- {
- TNonSBCCodecCapabilities codec(SymbianBluetoothAV::EAvdtpMediaTypeAudio, SymbianBluetoothAV::EAudioCodecMPEG24AAC);
- TBuf8<18> mpeg2aacData;
- mpeg2aacData.Append(0x80); // MPEG2 AAC LC
- mpeg2aacData.Append(0x01); // 44.1 kHz
- mpeg2aacData.Append(0x80); // 48.0 kHz, Channels 1 & 2
- mpeg2aacData.Append(0x80); // VBR, unknown bitrate
- mpeg2aacData.Append(0x00); // unknown bitrate
- mpeg2aacData.Append(0x00); // unknown bitrate
-
- codec.SetCodecData(mpeg2aacData);
-
- err = iGavdp.AddSEPCapability(codec);
-
- __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), codec.Category(), err);
- }
-
- iRegisteringLocalSEP = ETrue;
- iGavdp.CommitSEPConfiguration();
-
- __LOG(_L("Commit configuration [SEID %d]\n"), info.SEID().SEID());
- }
- return err;
- }
--- a/bluetooth/gavdp/test/tavsrc.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,305 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRC_H
-#define TAVSRC_H
-
-//only use define CHANNEL_BINDING_DEBUG_CHECK when checking channel binding
-//#define CHANNEL_BINDING_DEBUG_CHECK
-
-#define __PRINT iActiveConsole->Console().Printf
-#define __LOG iLogConsole->Console().Printf /*RDebug::Print*/
-
-#include "tavsrcConsole.h"
-#include "tavsrcStreamerUser.h"
-#include "tavsrcOperations.h"
-
-#include <f32file.h>
-#include <btsdp.h>
-#include <rtp.h>
-#include <gavdp.h>
-#include <remconcoreapitargetobserver.h>
-#include <remcongroupnavigationtarget.h>
-#include <remcongroupnavigationtargetobserver.h>
-
-#include <remconmediainformationtarget.h>
-#include <remconmediainformationtargetobserver.h>
-
-#include <remconbatterytarget.h>
-#include <remconbatterytargetobserver.h>
-
-#include <playerinformationtarget.h>
-#include <playerinformationtargetobserver.h>
-
-#include <remconabsvoltargetobserver.h>
-#include <remcontrackinfotargetobserver.h>
-
-enum TRemConInterfaces
- {
- ECoreApiTarget = 1 << 0,
- ECoreApiController = 1 << 1,
- EGroupNavigation = 1 << 2,
- EMediaInformation = 1 << 3,
- EBatteryStatus = 1 << 4,
- EAbsoluteVolumeTarget = 1 << 5,
- EAbsoluteVolumeController = 1 << 6,
- EPlayerInformation = 1 << 7,
- ENowPlaying = 1 << 8,
- EMediaBrowse = 1 << 9,
- EDatabaseAware = 1 << 10,
- ESeparateThreadForBrowse = 1 << 11,
- EVendorTrackInfoTarget = 1 << 12,
- EVendorAbsoluteVolumeTarget = 1 << 13,
- };
-
-
-typedef TFixedArray<RSocket, 3> RSocketArray;
-
-class CActivePacketDropIoctl;
-class CActiveSockReader;
-class CActiveSockWriter;
-class CRemMetadataTransferTarget;
-class CAVTestApp;
-class CActiveStreamer;
-class CTavsrcController;
-class CRemConInterfaceSelector;
-class CRemConCoreApiTarget;
-class CRemConTrackInfoTarget;
-class CRemConAbsVolTarget;
-class CTavsrcMtUpdater;
-class CTavsrcAbsoluteVolume;
-class CAVTestApp : public CBase, public MActiveConsoleNotify,
- public MGavdpUser, public MBluetoothPhysicalLinksNotifier,
- public MRemConCoreApiTargetObserver,
- public MActiveStreamerUser,
- public MRemConMediaInformationTargetObserver,
- public MRemConGroupNavigationTargetObserver,
- public MRemConBatteryTargetObserver,
- public MRemConTrackInfoTargetObserver,
- public MRemConAbsVolTargetObserver
- {
-private:
- enum TTavsrcServiceCategory
- {
- ETavsrcServiceCategoryNull =0x00,
- ETavsrcServiceCategoryMediaTransport =0x01,
- ETavsrcServiceCategoryReporting =0x02,
- ETavsrcServiceCategoryRecovery =0x04,
- ETavsrcServiceCategoryContentProtection =0x08,
- ETavsrcServiceCategoryHeaderCompression =0x10,
- ETavsrcServiceCategoryMultiplexing =0x20,
- ETavsrcServiceCategoryMediaCodec =0x40,
- };
-public:
- static CAVTestApp* NewL();
- void EchoStorm();
-
- void StartL();
- void Stop();
- ~CAVTestApp();
- void TestMenu();
-
- void KeyPressed(TChar aKey);
-
- TInt StartSrc();
- void StopSrc();
- void DisconnectSrc();
-
- // echo test
- virtual void HandleCreateConnectionCompleteL(TInt aErr);
- virtual void HandleDisconnectCompleteL(TInt aErr);
- virtual void HandleDisconnectAllCompleteL(TInt aErr);
-
-private:
- void PreventLowPowerModes();
- void AllowLowPowerModes();
- void CreateBearers();
- void CloseBearers();
- void ConfigureSEPL();
- void Abort();
- void DiscoverSEPs();
- void StartStreams();
- void SuspendStreams();
- void GetCapabilities();
- void SendSecurityControl();
- TSBCCodecCapabilities InteractiveSBCMediaCodecConfig(TSBCCodecCapabilities& caps);
-
- void PrintCommandOption(TChar aOperation, TPtrC aDesc);
-
- void CreateStreamerL(RSocketArray aSockets);
- void CreateRemConInterfacesL();
-
- void Connect();
- TInt Listen();
- TInt RegisterSEP();
-
- CAVTestApp();
- void ConstructL();
-
- //return ETrue if current SEP is sink, EFalse otherwise
- TBool CurrentSEIDIsSink();
-
- void DisplayHelp();
- void ParseCommandLineL();
-
-private:
- // GAVDP callbacks
- virtual void GAVDP_SEPDiscovered(const TAvdtpSEPInfo& aSEP);
- virtual void GAVDP_SEPDiscoveryComplete();
- virtual void GAVDP_SEPCapability(TAvdtpServiceCapability* aCapability);
- virtual void GAVDP_SEPCapabilityComplete();
- virtual void GAVDP_AbortStreamConfirm();
- virtual void GAVDP_StartStreamsConfirm();
- virtual void GAVDP_SuspendStreamsConfirm();
- virtual void GAVDP_SecurityControlConfirm(const TDesC8& aResponseData);
- virtual void GAVDP_ConfigurationConfirm(); // configuration complete and SEP selected *AND* reconfigure confirm
- virtual void GAVDP_Error(TInt aError, const TDesC8& aErrorData);
- virtual void GAVDP_ConnectConfirm(const TBTDevAddr& aAddr);
-
- virtual void GAVDP_ConfigurationStartIndication(TSEID aLocalSEID, TSEID aRemoteSEID);
- virtual TInt GAVDP_ConfigurationIndication(TAvdtpServiceCapability* aCapability);
- virtual TInt GAVDP_ConfigurationEndIndication();
-
- virtual TInt GAVDP_StartIndication(TSEID aSEID);
- virtual TInt GAVDP_SuspendIndication(TSEID aSEID);
- virtual TInt GAVDP_SecurityControlIndication(TSEID aSEID, TDes8& aSecurityData);
- virtual void GAVDP_AbortIndication(TSEID aSEID);
- virtual void GAVDP_ReleaseIndication(TSEID aSEID);
- virtual void GAVDP_BearerReady(RSocket aNewSocket, const TAvdtpSockAddr& aAddr);
-
- void PrettyPrint(TAvdtpServiceCapability& aCapability);
-
-private:
- // RemConCoreApiTarget callbacks
- virtual void MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct);
- virtual void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed, TRemConCoreApiButtonAction aButtonAct);
-
-private:
- // from MActiveStreamerUser
- virtual void MediaCodecConfigurationRequired(TSBCCodecCapabilities& aConfig);
-
- virtual TInt MrcmtcGetElementAttributes(TUint64 aElement, TUint32 aAttribute, HBufC8*& aOutValueOwnershipTransferred);
-
- // from MRemConGroupNavigationTargetObserver
- virtual void MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct);
- virtual void MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct);
- virtual void MrcbstoBatteryStatus(TControllerBatteryStatus& aBatteryStatus);
-
- // from MRemConMediaInformationTargetObserver
- virtual void MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter );
-
- virtual void MrcncRegisterPlaybackStatusChangedNotification();
- virtual void MrcncRegisterTrackChangedNotification();
- virtual void MrcncRegisterTrackReachedEndNotification();
- virtual void MrcncRegisterTrackReachedStartNotification();
- virtual void MrcncRegisterPositionChangedNotification(TUint32 aInterval);
- virtual void MrcncRegisterBatteryStatusChangedNotification();
- virtual void MrcncRegisterSystemStatusChangedNotification();
- virtual void MrcncRegisterPlayerApplicationStatusChangedNotification();
-
- virtual void MrcavtoGetAbsoluteVolume();
- virtual void MrcavtoSetAbsoluteVolume(TUint /*aAbsVol*/, TUint /*aMaxVol*/);
-
- virtual void MrctitoGetTrackName();
- virtual void MrctitoGetArtist();
- virtual void MrctitoGetTrackDuration();
-
-private:
- CActiveConsole* iActiveConsole;
- CActiveConsole* iLogConsole;
- CTavsrcMtUpdater* iMtUpdater;
-
- RSocketServ iSockServ;
-
-#ifdef CHANNEL_BINDING_DEBUG_CHECK
- CActiveSockReader* iRepReader;
- CActiveSockWriter* iRepWriter;
- CActiveSockReader* iRecvReader;
- CActiveSockWriter* iRecvWriter;
-#endif
-
- CActivePacketDropIoctl* iPacketDropIoctl;
-
- RGavdp iGavdp;
-
- TSEID iCurrentSEID; // Current Remote SEID
- TSEID iCurrentLocalSEID; // Current Local SEID
-
- RPointerArray<TAvdtpServiceCapability> iSEPCapabilities; // only held for one SEP at a time in this test code
-
- RArray<TSEID> iShortlistedSEIDs; // for finding good remote SEP
- TBool iChosenSEP;
-
- RArray<TAvdtpSEPInfo> iLocallyRegisteredSEPs;
- TBool iRegisteringLocalSEP;
-
- CActiveStreamer* iStreamer;
- RSocketArray iPendingSockets;
-
- CRemConInterfaceSelector* iRemConInterfaceSelector;
- CRemConCoreApiTarget* iRemConTarget;
- CRemConGroupNavigationApiTarget* iGroupNavigation;
- CRemConMediaInformationTarget* iMediaInformation;
- CRemConBatteryApiTarget* iBatteryStatus;
- CRemConTrackInfoTarget* iTrackInfo;
- CRemConAbsVolTarget* iAbsoluteVolume;
- CTavsrcAbsoluteVolume* iTavsrcAbsoluteVolume;
-
- RSdp iSdp;
- RSdpDatabase iSdpDB;
- TSdpServRecordHandle iSrcHandle;
- TSdpServRecordHandle iSnkHandle;
-
- TBool iAutoStream;
-
- enum TGavdpState
- {
- ENoClientOpen,
- EIdle,
- ESigConnected,
- EOpen,
- ESuspended,
- ERemoteReconfiguring,
- };
-
- enum TStreamState
- {
- EClosed,
- EStreaming,
- EPaused,
- EStopped,
- };
-
- TGavdpState iGavdpState;
- TStreamState iStreamState;
-
- TSBCCodecCapabilities iReconfigInfo;
- TBool iLocalReconfigure;
-
- TUint iDisplayMode;
- TBool iPreloadFile;
-
- CTavsrcController* iController;
- TBTDevAddr iDevAddr;
-
- CTavsrcOperations* iOperations;
-
- RBuf iFilename;
- RBTPhysicalLinkAdapter iPhy;
-
- TUint iRemConInterfaces;
- };
-
-#endif // TAVSRC_H
--- a/bluetooth/gavdp/test/tavsrc.mmp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-// Copyright (c) 2008-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:
-// tavrsc.mmp
-//
-//
-
-#define DBAWARE
-MACRO DBAWARE
-
-
-TARGET tavsrc.exe
-TARGETTYPE exe
-UID 0
-
-SOURCEPATH .
-SOURCE tavsrc.cpp
-SOURCE tavsrcUI.cpp
-SOURCE tavsrcConsole.cpp
-SOURCE tavsrcController.cpp
-SOURCE tavsrcSock.cpp
-SOURCE tavsrcStreamer.cpp
-SOURCE tavsrcTimer.cpp
-SOURCE tavsrcUtils.cpp
-SOURCE tavsrcOperations.cpp
-SOURCE tavsrcAbsoluteVolume.cpp
-SOURCE activecallbackconsole.cpp
-
-#ifdef DBAWARE
-SOURCE tavsrcmtupdaterdatabaseaware.cpp
-#else
-SOURCE tavsrcmtupdaterdatabaseunaware.cpp
-#endif
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-USERINCLUDE ../../../../../mw/btservices/bluetoothappprofiles/avrcp/common
-
-LIBRARY euser.lib esock.lib bluetooth.lib bluetoothav.lib gavdp.lib
-LIBRARY sdpdatabase.lib
-LIBRARY flogger.lib efsrv.lib rtp.lib
-LIBRARY remconcoreapi.lib
-LIBRARY remconclient.lib
-LIBRARY remcontypes.lib
-LIBRARY remconinterfacebase.lib
-LIBRARY econs.lib
-LIBRARY c32.lib
-LIBRARY hal.lib
-LIBRARY btextnotifiers.lib
-LIBRARY bafl.lib
-
-LIBRARY remcongroupnavigationapi.lib
-LIBRARY remconmediainformationapi.lib
-LIBRARY remconbatterystatusapi.lib
-LIBRARY remconplayerinformation.lib
-LIBRARY remconextapi1.lib
-LIBRARY remconnowplayingapi.lib
-LIBRARY remconmediabrowseapi.lib
-LIBRARY remconabsolutevolume.lib
-
-#include <bluetooth/btlogger.mmh>
-
-EPOCHEAPSIZE 1024000 4096000
-CAPABILITY ALL -TCB
-VENDORID 0x70000001
-
-SMPSAFE
--- a/bluetooth/gavdp/test/tavsrcAbsoluteVolume.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcAbsoluteVolume.h"
-#include <absolutevolumeapicontroller.h>
-#include <absolutevolumeapitarget.h>
-
-#ifdef __WINS__
-GLDEF_D TSize gAbsoluteVolumeConsole(75,30);
-#else
-GLDEF_D TSize gAbsoluteVolumeConsole(KConsFullScreen,KConsFullScreen);
-#endif
-
-
-CTavsrcAbsoluteVolume* CTavsrcAbsoluteVolume::NewL(CRemConInterfaceSelector& aIfSel)
- {
- CTavsrcAbsoluteVolume* self = new (ELeave) CTavsrcAbsoluteVolume();
- CleanupStack::PushL(self);
- self->ConstructL(aIfSel);
- CleanupStack::Pop();
- return self;
- }
-
-CTavsrcAbsoluteVolume::~CTavsrcAbsoluteVolume()
- {
- Cancel();
- delete iMtAbsoluteVolumeConsole;
- }
-
-CTavsrcAbsoluteVolume::CTavsrcAbsoluteVolume()
- : CActive(EPriorityStandard)
- {
- CActiveScheduler::Add(this);
- }
-
-void CTavsrcAbsoluteVolume::ConstructL(CRemConInterfaceSelector& aIfSel)
- {
- iAbsoluteVolumeTarget = CRemConAbsoluteVolumeTarget::NewL(aIfSel, *this, KInitialVolume, KMaxTgVolume);
- iAbsoluteVolumeController = CRemConAbsoluteVolumeController::NewL(aIfSel, *this, KMaxCtVolume);
- iMtAbsoluteVolumeConsole = CActiveConsole::NewL(*this,_L("AbsoluteVolume"),gAbsoluteVolumeConsole);
- MtMenu();
- }
-
-void CTavsrcAbsoluteVolume::MtMenu()
- {
- iMtAbsoluteVolumeConsole->Console().Printf(_L("1.\tCT SetAbsoluteVolume \n"));
- iMtAbsoluteVolumeConsole->Console().Printf(_L("2.\tCT Cancel SetAbsoluteVolume \n"));
- iMtAbsoluteVolumeConsole->Console().Printf(_L("3.\tCT RegisterAbsoluteVolumeNotification \n"));
- iMtAbsoluteVolumeConsole->Console().Printf(_L("4.\tCT CancelAbsoluteVolumeNotification\n"));
- iMtAbsoluteVolumeConsole->Console().Printf(_L("5.\tTG SetAbsoluteVolumeResponse\n"));
- iMtAbsoluteVolumeConsole->Console().Printf(_L("6.\tTG AbsoluteVolumeChanged\n"));
- iMtAbsoluteVolumeConsole->Console().Printf(_L("\n"));
-
- iMtAbsoluteVolumeConsole->RequestKey();
- }
-
-void CTavsrcAbsoluteVolume::KeyPressed(TChar aKey)
- {
- switch(aKey)
- {
- case '1':
- {
- TRequestStatus status;
- iAbsoluteVolumeController->SetAbsoluteVolume(iStatus, GetVolume(), iNumRemotes);
- SetActive();
- break;
- }
- case '2':
- {
- iAbsoluteVolumeController->CancelSetAbsoluteVolume();
- iMtAbsoluteVolumeConsole->Console().Printf(_L("CT Cancelled Set Absolute Volume\n"));
- break;
- }
-
- case '3':
- {
- TRequestStatus status;
- iAbsoluteVolumeController->RegisterAbsoluteVolumeNotification();
- iMtAbsoluteVolumeConsole->Console().Printf(_L("CT Registered Absolute Volume Notification \n"));
- break;
- }
- case '4':
- {
- iAbsoluteVolumeController->CancelAbsoluteVolumeNotification();
- iMtAbsoluteVolumeConsole->Console().Printf(_L("CT Cancelled Absolute Volume Notification \n"));
- break;
- }
- case '5':
- {
- iAbsoluteVolumeTarget->SetAbsoluteVolumeResponse(GetVolume(), KErrNone);
- iMtAbsoluteVolumeConsole->Console().Printf(_L("TG SetAbsoluteVolumeResponse \n"));
- break;
- }
- case '6':
- {
- iAbsoluteVolumeTarget->AbsoluteVolumeChanged(GetVolume());
- iMtAbsoluteVolumeConsole->Console().Printf(_L("TG AbsoluteVolumeChanged \n"));
- break;
- }
- default:
- iMtAbsoluteVolumeConsole->Console().Printf(_L("No such command\n"));
- break;
- };
-
- MtMenu();
- }
-
-void CTavsrcAbsoluteVolume::MrcavtoSetAbsoluteVolumeRequest(TUint32 aVolume,
- TUint32 aMaxVolume)
- {
- TUint32 scaledVolume = (aVolume * 10)/(aMaxVolume);
- iMtAbsoluteVolumeConsole->Console().Printf(_L("MrcavtoSetAbsoluteVolumeRequest vol= %d, maxVol= %d, setting volume = %d\n"), aVolume, aMaxVolume, scaledVolume);
- iMtAbsoluteVolumeConsole->Console().Printf(_L("Provide volume for response relative to local max volume (%d)\n"), KMaxTgVolume);
- iAbsoluteVolumeTarget->SetAbsoluteVolumeResponse(GetVolume(), KErrNone);
- }
-
-void CTavsrcAbsoluteVolume::MrcavcoCurrentVolume(TUint32 aVolume,
- TUint32 aMaxVolume,
- TInt aError)
- {
- iMtAbsoluteVolumeConsole->Console().Printf(
- _L("MrcavcoCurrentVolume vol= %d, maxVol= %d, err= %d\n"),
- aVolume, aMaxVolume, aError);
- }
-
-void CTavsrcAbsoluteVolume::MrcavcoAbsoluteVolumeNotificationError()
- {
- iMtAbsoluteVolumeConsole->Console().Printf(_L("MrcavcoAbsoluteVolumeNotificationError\n"));
- }
-
-void CTavsrcAbsoluteVolume::MrcavcoSetAbsoluteVolumeResponse(TUint32 aVolume,
- TUint32 aMaxVolume,
- TInt aError)
- {
- iMtAbsoluteVolumeConsole->Console().Printf(
- _L("MrcavcoSetAbsoluteVolumeResponse vol= %d, maxVol= %d, err= %d\n"),
- aVolume, aMaxVolume, aError);
- }
-
-void CTavsrcAbsoluteVolume::RunL()
- {
- iMtAbsoluteVolumeConsole->Console().Printf(_L("CT SetAbsoluteVolume Sent %d to %u remotes\n"), iStatus.Int(), iNumRemotes);
- }
-
-void CTavsrcAbsoluteVolume::DoCancel()
- {
- iAbsoluteVolumeController->CancelSetAbsoluteVolume();
- }
-
-TUint32 CTavsrcAbsoluteVolume::GetVolume()
- {
- iMtAbsoluteVolumeConsole->Console().Printf(_L("Enter volume: "));
- TUint32 volume = iMtAbsoluteVolumeConsole->GetIntFromUser();
- iMtAbsoluteVolumeConsole->Console().Printf(_L("\n"));
-
- return volume;
- }
-
-
--- a/bluetooth/gavdp/test/tavsrcAbsoluteVolume.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCABSOLUTEVOLUME_H_
-#define TAVSRCABSOLUTEVOLUME_H_
-#include <absolutevolumeapitargetobserver.h>
-#include <absolutevolumeapicontrollerobserver.h>
-#include "tavsrcConsole.h"
-
-static const TUint32 KInitialVolume = 1;
-static const TUint32 KMaxTgVolume = 10;
-
-static const TUint32 KMaxCtVolume = 100;
-
-class CActiveConsole;
-class CRemConInterfaceSelector;
-class CRemConAbsoluteVolumeTarget;
-class CRemConAbsoluteVolumeController;
-class CTavsrcAbsoluteVolume: public CActive,
- public MActiveConsoleNotify,
- public MRemConAbsoluteVolumeTargetObserver,
- public MRemConAbsoluteVolumeControllerObserver
- {
-public:
- static CTavsrcAbsoluteVolume* NewL(CRemConInterfaceSelector& aIfSel);
- ~CTavsrcAbsoluteVolume();
-
-private:
- CTavsrcAbsoluteVolume();
- void ConstructL(CRemConInterfaceSelector& aIfSel);
-
-private://from MActiveConsoleNotify
- void KeyPressed(TChar aKey);
-
-private:
- //from MRemConAbsoluteVolumeTargetObserver
- void MrcavtoSetAbsoluteVolumeRequest(TUint32 aVolume, TUint32 aMaxVolume);
-
- //from MRemConAbsoluteVolumeControllerObserver
- void MrcavcoCurrentVolume(TUint32 aVolume, TUint32 aMaxVolume, TInt aError);
- void MrcavcoSetAbsoluteVolumeResponse(TUint32 aVolume, TUint32 aMaxVolume, TInt aError);
- void MrcavcoAbsoluteVolumeNotificationError();
-
-private:
- // from CActive
- void RunL();
- void DoCancel();
-
-private:
- void MtMenu();
- TUint32 GetVolume();
-
-private:
- CActiveConsole* iMtAbsoluteVolumeConsole;
- CRemConAbsoluteVolumeTarget* iAbsoluteVolumeTarget;
- CRemConAbsoluteVolumeController* iAbsoluteVolumeController;
- TUint iNumRemotes;
- };
-
-#endif /*TAVSRCABSOLUTEVOLUME_H_*/
--- a/bluetooth/gavdp/test/tavsrcConsole.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcConsole.h"
-#include "tavsrc.h"
-
-#include <e32test.h>
-
-#if defined (__WINS__)
-#define PDD_NAME _L("ECDRV")
-#define LDD_NAME _L("ECOMM")
-#else // __GCC32__
-#define PDD_NAME _L("EUART1")
-#define LDD_NAME _L("ECOMM")
-#endif
-
-static RTest testOutcome(_L("Test results"));
-
-CActiveConsole::CActiveConsole(MActiveConsoleNotify& aNotify)
- : CActive(EPriorityStandard), iNotify(aNotify)
- {
- CActiveScheduler::Add(this);
- }
-
-
-CActiveConsole::~CActiveConsole()
- {
- Cancel();
- delete iConsole;
- }
-
-CActiveConsole* CActiveConsole::NewL(MActiveConsoleNotify& aNotify,const TDesC& aTitle,const TSize& aSize)
- {
- CActiveConsole* console = new (ELeave) CActiveConsole(aNotify);
- CleanupStack::PushL(console);
- console->ConstructL(aTitle,aSize);
- CleanupStack::Pop();
- return console;
- }
-
-void CActiveConsole::ConstructL(const TDesC& aTitle,const TSize& aSize)
- {
- iConsole = Console::NewL(aTitle,aSize);
- }
-
-void CActiveConsole::DoCancel()
- {
- iConsole->ReadCancel();
- }
-
-void CActiveConsole::RequestKey()
- {
- DrawCursor();
- iConsole->Read(iStatus);
- SetActive();
- }
-
-void CActiveConsole::DrawCursor()
- {
- iConsole->Printf(_L(">>"));
- }
-
-void CActiveConsole::RunL()
- {
- // key has been pressed
- TChar ch = iConsole->KeyCode();
- iNotify.KeyPressed(ch);
- }
-
-TInt CActiveConsole::RunError(TInt aError)
- {
- iConsole->Printf(_L("Console error %d\nTrying again...\n"), aError);
- RequestKey();
- return KErrNone;
- }
-
-TInt CActiveConsole::GetIntFromUser()
- {
- TBool requeRead = EFalse;
- if(IsActive())
- {
- Cancel();
- requeRead = ETrue;
- }
-
- TKeyCode key;
-
- TBuf<10> intBuf;
-
- while((key = iConsole->Getch())!=EKeyEnter)
- {
- if(key == EKeyBackspace&&intBuf.Length()!=0)
- {
- intBuf.SetLength(intBuf.Length()-1);
- iConsole->Printf(_L("%c"), key);
- }
- else if ( intBuf.Length() < intBuf.MaxLength())
- {
- intBuf.Append(key);
- iConsole->Printf(_L("%c"), key);
- }
- }
-
- iConsole->Printf(_L("\n"));
-
- TLex lex(intBuf);
- TInt value = 0;
-
- TInt err = lex.Val(value);
- if(err)
- {
- iConsole->Printf(_L("Error %d reading value from console\n"), err);
- }
-
- if(requeRead)
- {
- RequestKey();
- }
- return value;
- }
-
-void LoadLDD_PDDL()
- {
- TInt err = KErrNone;
- testOutcome.Printf(_L("Loading PDD... "));
- err = User::LoadPhysicalDevice(PDD_NAME);
- if(err != KErrNone && err != KErrAlreadyExists)
- {
- User::Leave(err);
- }
- testOutcome.Printf(_L("Loading LDD... "));
- err = User::LoadLogicalDevice(LDD_NAME);
- if(err != KErrNone && err != KErrAlreadyExists)
- {
- User::Leave(err);
- }
- }
-
-void StartL()
- {
- LoadLDD_PDDL();
-
- CAVTestApp* app = CAVTestApp::NewL();
- app->StartL();
-
- delete app;
- }
-
-
-TInt E32Main()
- {
- __UHEAP_MARK;
-
- CTrapCleanup* cleanupStack=CTrapCleanup::New(); // Get CleanupStack
-
- CActiveScheduler* activescheduler=new CActiveScheduler;
- CActiveScheduler::Install(activescheduler);
-
- testOutcome.Printf(_L("Starting tests... "));
-
- TRAPD(err, StartL());
-
- delete activescheduler;
- delete cleanupStack;
-
- testOutcome.Printf(_L("Test completed result %d"), err);
- if(err != KErrNone)
- {
- testOutcome.Getch();
- }
- testOutcome.Close();
-
-
- __UHEAP_MARKEND;
-
- return err ;
- }
-
-
--- a/bluetooth/gavdp/test/tavsrcConsole.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCCONSOLE_H
-#define TAVSRCCONSOLE_H
-
-#include <e32base.h>
-#include <e32cons.h>
-
-class MActiveConsoleNotify
- {
-public:
- virtual void KeyPressed(TChar aKey) =0;
- };
-
-class CActiveConsole : public CActive
- {
-public:
- static CActiveConsole* NewL(MActiveConsoleNotify& aNotify,const TDesC& aTitle,const TSize& aSize);
- void RequestKey();
- TInt GetIntFromUser();
-
- inline CConsoleBase& Console() const
- {
- return *iConsole;
- };
-
- ~CActiveConsole();
-
-private:
- void RunL();
- TInt RunError(TInt aError);
- void DoCancel();
- void DrawCursor();
- CActiveConsole(MActiveConsoleNotify& aNotify);
- void ConstructL(const TDesC& aTitle,const TSize& aSize);
-
-private:
- CConsoleBase* iConsole;
- MActiveConsoleNotify& iNotify;
- };
-
-#endif // TAVSRCCONSOLE_H
--- a/bluetooth/gavdp/test/tavsrcController.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcController.h"
-
-#include <remconinterfaceselector.h>
-#include <remconcoreapicontroller.h>
-#include <remconbeareravrcp.h>
-
-CTavsrcController* CTavsrcController::NewL(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole)
- {
- CTavsrcController* controller = new(ELeave) CTavsrcController(aIfSel, aConsole);
- CleanupStack::PushL(controller);
- controller->ConstructL();
- CleanupStack::Pop(controller);
- return controller;
- }
-
-CTavsrcController::CTavsrcController(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole)
- : CActive(EPriorityStandard), iState(EControllerNotConnected), iSelector(&aIfSel), iConsole(aConsole)
- {
- CActiveScheduler::Add(this);
- }
-
-void CTavsrcController::ConstructL()
- {
- iCoreController = CRemConCoreApiController::NewL(*iSelector, *this);
- iGoConnectionOrientedSent = EFalse;
- }
-
-CTavsrcController::~CTavsrcController()
- {
- Cancel();
- }
-
-TInt CTavsrcController::Command(TRemConCoreApiOperationId aOpId)
- {
- TInt err = KErrNotReady;
-
- if(!IsActive())
- {
- err = KErrNone;
-
- if(iState == EControllerConnected)
- {
- IssueCommand(aOpId);
- }
- else
- {
- // Need to connect first
- TRAP(err, ConnectL());
- }
- }
-
- return err;
- }
-
-
-void CTavsrcController::MrccacoResponse(TRemConCoreApiOperationId aOperationId, TInt aError)
- {
- iConsole.Console().Printf(_L("Received Response for Operation %d, Result %d\n"), aOperationId, aError);
- }
-
-void CTavsrcController::IssueCommand(TRemConCoreApiOperationId aOpId)
- {
- switch(aOpId)
- {
- case ERemConCoreApiVolumeDown:
- iCoreController->VolumeDown(iStatus, iNumRemotes, ERemConCoreApiButtonClick);
- break;
- case ERemConCoreApiVolumeUp:
- iCoreController->VolumeUp(iStatus, iNumRemotes, ERemConCoreApiButtonPress);
- break;
- case ERemConCoreApiForward:
- iCoreController->Forward(iStatus, iNumRemotes, ERemConCoreApiButtonClick);
- break;
- case ERemConCoreApiBackward:
- iCoreController->Backward(iStatus, iNumRemotes, ERemConCoreApiButtonClick);
- break;
- case ERemConCoreApiPlay:
- iCoreController->Play(iStatus, iNumRemotes, ERemConCoreApiButtonClick);
- break;
- case ERemConCoreApiStop:
- iCoreController->Stop(iStatus, iNumRemotes, ERemConCoreApiButtonClick);
- break;
- default:
- // Cos we don't want to SetActive(), alright?
- return;
- }
-
- iConsole.Console().Printf(_L("Sending Command Operation %d\n"), aOpId);
- SetActive();
- }
-
-void CTavsrcController::ConnectL()
- {
- //Ask user which device address we should connect to...
- iState = ESearchingForDevice;
- User::LeaveIfError(iNotify.Connect());
- iNotify.StartNotifierAndGetResponse(iStatus, KDeviceSelectionNotifierUid, iPckg, iResPckg);
- SetActive();
- }
-
-void CTavsrcController::RunL()
- {
- switch(iState)
- {
- case EControllerConnected:
- {
- // We don't care what the result was really
- // Ask Tim about the display logging and
- // log it
- break;
- }
- case EControllerNotConnected:
- {
- iConsole.Console().Printf(_L("AVRCP connection completed, result = %d\n"), iStatus.Int());
-
- if(iStatus.Int() == KErrNone)
- {
- // Connected ok, now issue command
- iState = EControllerConnected;
- IssueCommand(iOutstandingOperation);
- }
- break;
- }
- case ESearchingForDevice:
- {
- if (iStatus.Int() == KErrNone)
- {
- iState = EControllerNotConnected;
-
- iNotify.CancelNotifier(KDeviceSelectionNotifierUid);
- iNotify.Close();
-
- iConsole.Console().Printf(_L("Opening AVRCP connection...\n"));
-
- TBTDevAddr btAddr = iResPckg().BDAddr();
- // Store as 8 bit machine readable
- RBuf8 bearerData;
- bearerData.CreateL(btAddr.Des());
-
- // Form the RemCon Addr from the AVRCP Uid and the
- // bluetooth address
- TRemConAddress addr;
- addr.BearerUid() = TUid::Uid(KRemConBearerAvrcpImplementationUid);
- addr.Addr() = bearerData;
-
- if (iGoConnectionOrientedSent)
- {
- // Only allowed to call GoConnectionOrientedL() once on pain of RemCon panic,
- // ERemConClientPanicAlreadyConnectionOriented. Solution is to call GoConnectionlessL()
- // before recalling GoConnectionOrientedL()
- iSelector->GoConnectionlessL();
- }
- iSelector->GoConnectionOrientedL(addr);
- iSelector->ConnectBearer(iStatus);
- iGoConnectionOrientedSent = ETrue;
-
- SetActive();
- break;
- }
- }
- default:
- {
- // hmm shouldn't be here
- __DEBUGGER();
- break;
- }
- }
- }
-
-void CTavsrcController::DoCancel()
- {
- iCoreController->Cancel();
- }
--- a/bluetooth/gavdp/test/tavsrcController.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCCONTROLLER_H
-#define TAVSRCCONTROLLER_H
-
-#include "tavsrcConsole.h"
-
-#include <e32base.h>
-#include <btextnotifiers.h>
-#include <remconcoreapicontrollerobserver.h>
-
-class CRemConInterfaceSelector;
-class CRemConCoreApiController;
-
-class CTavsrcController : public CActive, public MRemConCoreApiControllerObserver
- {
-public:
- static CTavsrcController* NewL(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole);
- ~CTavsrcController();
-
- TInt Command(TRemConCoreApiOperationId aOpId);
- void MrccacoResponse(TRemConCoreApiOperationId aOperationId, TInt aError);
-
-private:
- CTavsrcController(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole);
- void ConstructL();
-
- void RunL();
- void DoCancel();
-
- void ConnectL();
- void IssueCommand(TRemConCoreApiOperationId aOpId);
-
-private:
- enum TTavsrcControllerState
- {
- EControllerConnected,
- EControllerNotConnected,
- ESearchingForDevice,
- };
-
-private:
- TTavsrcControllerState iState;
- CRemConInterfaceSelector* iSelector;
- TBool iGoConnectionOrientedSent;
- CRemConCoreApiController* iCoreController;
- TUint iNumRemotes;
- TRemConCoreApiOperationId iOutstandingOperation;
- CActiveConsole& iConsole;
- RNotifier iNotify;
- TBTDeviceSelectionParamsPckg iPckg;
- TBTDeviceResponseParamsPckg iResPckg;
- };
-
-#endif // TAVSRCCONTROLLER_H
--- a/bluetooth/gavdp/test/tavsrcOperations.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcOperations.h"
-
-// The opcodes used internally to CTavsrcOperations
-static const TInt KTavsrcOpCodeConnect = 0x00000001;
-static const TInt KTavsrcOpCodeCancel = 0x00000002;
-static const TInt KTavsrcOpCodeDiscoverSEPs = 0x00000004;
-static const TInt KTavsrcOpCodeCreateBearers = 0x00000008;
-static const TInt KTavsrcOpCodeCloseBearers = 0x00000010;
-static const TInt KTavsrcOpCodeContentProtection = 0x00000020;
-static const TInt KTavsrcOpCodeGetCapabilities = 0x00000040;
-static const TInt KTavsrcOpCodeStartStreams = 0x00000080;
-static const TInt KTavsrcOpCodeSuspendStreams = 0x00000100;
-static const TInt KTavsrcOpCodeEchoStorm = 0x00000200;
-static const TInt KTavsrcOpCodeAbort = 0x00000400;
-static const TInt KTavsrcOpCodeStream = 0x00000800;
-static const TInt KTavsrcOpCodeStreamFaster = 0x00001000;
-static const TInt KTavsrcOpCodeStreamSlower = 0x00002000;
-static const TInt KTavsrcOpCodeAutoStream = 0x00004000;
-static const TInt KTavsrcOpCodeStopStream = 0x00008000;
-static const TInt KTavsrcOpCodeRegisterSEP = 0x00010000;
-static const TInt KTavsrcOpCodeRegisterMultipleSEPs = 0x00020000;
-static const TInt KTavsrcOpCodeStartSrc = 0x00040000;
-static const TInt KTavsrcOpCodeStopSrc = 0x00080000;
-static const TInt KTavsrcOpCodeDisconnectSrc = 0x00100000;
-static const TInt KTavsrcOpCodeConfigureSEP = 0x00200000;
-static const TInt KTavsrcOpCodeReconfigureSEP = 0x00400000;
-static const TInt KTavsrcOpCodePacketDropIoctl = 0x00800000;
-static const TInt KTavsrcOpCodeVolumeUp = 0x01000000;
-static const TInt KTavsrcOpCodeVolumeDown = 0x02000000;
-static const TInt KTavsrcOpCodeBackwards = 0x04000000;
-static const TInt KTavsrcOpCodeForwards = 0x08000000;
-static const TInt KTavsrcOpCodePlay = 0x10000000;
-static const TInt KTavsrcOpCodeStop = 0x20000000;
-static const TInt KTavsrcOpCodeExit = 0x40000000;
-static const TInt KTavsrcOpCodeToggleSafeMode = 0x80000000;
-
-// all the AVRCP opcodes
-static const TInt KTavsrcOpCodeAvrcp = KTavsrcOpCodeVolumeUp | KTavsrcOpCodeVolumeDown | KTavsrcOpCodeBackwards | KTavsrcOpCodeForwards | KTavsrcOpCodePlay | KTavsrcOpCodeStop;
-
-// all always available opcodes
-static const TInt KTavsrcOpCodeAlwaysAvailable = KTavsrcOpCodeAvrcp | KTavsrcOpCodeToggleSafeMode | KTavsrcOpCodeCancel | KTavsrcOpCodeExit | KTavsrcOpCodeStopSrc | KTavsrcOpCodeRegisterSEP | KTavsrcOpCodeRegisterMultipleSEPs;
-
-// all possible opcodes
-static const TInt KTavsrcOpCodeAll = 0xffffffff;
-
-// The next opcodes for every command, 0 means to not change state
-static const TInt KTavsrcOpConnectNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeDiscoverSEPs | KTavsrcOpCodeAutoStream;
-static const TInt KTavsrcOpCancelNextOperations = 0;
-static const TInt KTavsrcOpDiscoverSEPsNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeGetCapabilities;
-static const TInt KTavsrcOpCreateBearersNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeCloseBearers;
-static const TInt KTavsrcOpCloseBearersNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeCreateBearers;
-static const TInt KTavsrcOpContentProtectionNextOperations = 0;
-static const TInt KTavsrcOpGetCapabilitiesNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeConfigureSEP;
-static const TInt KTavsrcOpStartStreamsNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeStream | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeSuspendStreams | KTavsrcOpCodeAbort;
-static const TInt KTavsrcOpSuspendStreamsNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeAbort | KTavsrcOpCodeReconfigureSEP;
-static const TInt KTavsrcOpEchoStormNextOperations = 0;
-static const TInt KTavsrcOpAbortNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeCloseBearers;
-static const TInt KTavsrcOpStreamNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeStopStream | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeSuspendStreams | KTavsrcOpCodeAbort | KTavsrcOpCodeStreamFaster | KTavsrcOpCodeStreamSlower;
-static const TInt KTavsrcOpStreamFasterNextOperations = 0;
-static const TInt KTavsrcOpStreamSlowerNextOperations = 0;
-static const TInt KTavsrcOpAutoStreamNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeStopStream | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeSuspendStreams;
-static const TInt KTavsrcOpStopStreamNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeStream | KTavsrcOpCodeSuspendStreams | KTavsrcOpCodeAbort;
-static const TInt KTavsrcOpRegisterSEPNextOperations = 0;
-static const TInt KTavsrcOpRegisterMultipleSEPsNextOperations = 0;
-static const TInt KTavsrcOpStartSrcNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeConnect;
-static const TInt KTavsrcOpStopSrcNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartSrc;
-static const TInt KTavsrcOpDisconnectSrcNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeConnect;
-static const TInt KTavsrcOpConfigureSEPNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeCreateBearers;
-static const TInt KTavsrcOpReconfigureSEPNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeAbort | KTavsrcOpCodeReconfigureSEP;
-static const TInt KTavsrcOpPacketDropIoctlNextOperations = 0;
-static const TInt KTavsrcOpVolumeUpNextOperations = 0;
-static const TInt KTavsrcOpVolumeDownNextOperations = 0;
-static const TInt KTavsrcOpBackwardsNextOperations = 0;
-static const TInt KTavsrcOpForwardsNextOperations = 0;
-static const TInt KTavsrcOpPlayNextOperations = 0;
-static const TInt KTavsrcOpStopNextOperations = 0;
-static const TInt KTavsrcOpExitNextOperations = 0;
-static const TInt KTavsrcOpToggleSafeModeNextOperations = 0;
-
-// TTavsrcOperation
-TTavsrcOperation::TTavsrcOperation(TInt aOpCode, TChar aOperation, TInt aNextOpCodes)
- : iOpCode(aOpCode), iOperation(aOperation), iNextOpCodes(aNextOpCodes)
- {
- }
-
-/*static*/ TBool TTavsrcOperation::OperationMatchesAndAllowed(const TTavsrcOperation& aOpA, const TTavsrcOperation& aOpB)
- {
- return ((aOpA.iOperation == aOpB.iOperation) && (aOpA.iNextOpCodes & aOpB.iOpCode));
- }
-
-TInt TTavsrcOperation::GetNextOpCodes() const
- {
- return iNextOpCodes;
- }
-
-// CTavsrcOperations
-CTavsrcOperations* CTavsrcOperations::NewL()
- {
- CTavsrcOperations* operations = new (ELeave) CTavsrcOperations;
- CleanupStack::PushL(operations);
- operations->ConstructL();
- CleanupStack::Pop(operations);
- return operations;
- }
-
-void CTavsrcOperations::ConstructL()
- {
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeConnect, KTavsrcOpConnect, KTavsrcOpConnectNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeCancel, KTavsrcOpCancel, KTavsrcOpCancelNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeDiscoverSEPs, KTavsrcOpDiscoverSEPs, KTavsrcOpDiscoverSEPsNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeCreateBearers, KTavsrcOpCreateBearers, KTavsrcOpCreateBearersNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeCloseBearers, KTavsrcOpCloseBearers, KTavsrcOpCloseBearersNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeContentProtection, KTavsrcOpContentProtection, KTavsrcOpContentProtectionNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeGetCapabilities, KTavsrcOpGetCapabilities, KTavsrcOpGetCapabilitiesNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStartStreams, KTavsrcOpStartStreams, KTavsrcOpStartStreamsNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeSuspendStreams, KTavsrcOpSuspendStreams, KTavsrcOpSuspendStreamsNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeEchoStorm, KTavsrcOpEchoStorm, KTavsrcOpEchoStormNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeAbort, KTavsrcOpAbort, KTavsrcOpAbortNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStream, KTavsrcOpStream, KTavsrcOpStreamNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStreamFaster, KTavsrcOpStreamFaster, KTavsrcOpStreamFasterNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStreamSlower, KTavsrcOpStreamSlower, KTavsrcOpStreamSlowerNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeAutoStream, KTavsrcOpAutoStream, KTavsrcOpAutoStreamNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStopStream, KTavsrcOpStopStream, KTavsrcOpStopStreamNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeRegisterSEP, KTavsrcOpRegisterSEP, KTavsrcOpRegisterSEPNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeRegisterMultipleSEPs, KTavsrcOpRegisterMultipleSEPs, KTavsrcOpRegisterMultipleSEPsNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStartSrc, KTavsrcOpStartSrc, KTavsrcOpStartSrcNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStopSrc, KTavsrcOpStopSrc, KTavsrcOpStopSrcNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeDisconnectSrc, KTavsrcOpDisconnectSrc, KTavsrcOpDisconnectSrcNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeConfigureSEP, KTavsrcOpConfigureSEP, KTavsrcOpConfigureSEPNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeReconfigureSEP, KTavsrcOpReconfigureSEP, KTavsrcOpReconfigureSEPNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodePacketDropIoctl, KTavsrcOpPacketDropIoctl, KTavsrcOpPacketDropIoctlNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeVolumeUp, KTavsrcOpVolumeUp, KTavsrcOpVolumeUpNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeVolumeDown, KTavsrcOpVolumeDown, KTavsrcOpVolumeDownNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeBackwards, KTavsrcOpBackwards, KTavsrcOpBackwardsNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeForwards, KTavsrcOpForwards, KTavsrcOpForwardsNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodePlay, KTavsrcOpPlay, KTavsrcOpPlayNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStop, KTavsrcOpStop, KTavsrcOpStopNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeExit, KTavsrcOpExit, KTavsrcOpExitNextOperations));
- iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeToggleSafeMode, KTavsrcOpToggleSafeMode, KTavsrcOpToggleSafeModeNextOperations));
-
- // tavsrc always starts the src initially
- iLastOperationIndex = GetAllowedOperationIndex(KTavsrcOpStartSrc, KTavsrcOpCodeAll);
- User::LeaveIfError(iLastOperationIndex);
- }
-
-CTavsrcOperations::CTavsrcOperations()
- : iPendingOperationIndex(KErrNotFound), iSafeMode(ETrue)
- {
- }
-
-CTavsrcOperations::~CTavsrcOperations()
- {
- iOperations.Close();
- }
-
-// Returns the index into iOperations array if aOperation is allowed as the next operation
-// according to aAllowedNextOpcodes or an error
-TInt CTavsrcOperations::GetAllowedOperationIndex(TChar aOperation, TInt aAllowedNextOpcodes)
- {
- TIdentityRelation<TTavsrcOperation> matchFunc(TTavsrcOperation::OperationMatchesAndAllowed);
- return (iOperations.Find(TTavsrcOperation(0, aOperation, aAllowedNextOpcodes), matchFunc));
- }
-
-TBool CTavsrcOperations::IsOperationAllowed(TChar aOperation)
- {
- TBool ret = EFalse;
-
- if (!SafeMode())
- {
- // if we are not in safe mode then any operation is allowed
- ret = ETrue;
- }
- else
- {
- ret = (GetAllowedOperationIndex(aOperation, iOperations[iLastOperationIndex].GetNextOpCodes()) >= 0);
- }
- return ret;
- }
-
-TInt CTavsrcOperations::BeginOperation(TChar aOperation)
- {
- TInt rerr = KErrNone;
-
- if ((iPendingOperationIndex >= 0) && (aOperation != KTavsrcOpCancel))
- {
- // an operation is in progress, block until it has completed
- rerr = KErrNotReady;
- }
- else
- {
- TInt allowedNextOpCodes = iOperations[iLastOperationIndex].GetNextOpCodes();
-
- if (!SafeMode())
- {
- // not in safe mode so any operation should be allowed
- allowedNextOpCodes = KTavsrcOpCodeAll;
- }
-
- TInt index = GetAllowedOperationIndex(aOperation, allowedNextOpCodes);
-
- if (index >= 0)
- {
- // we have a valid operation
- iPendingOperationIndex = index;
- }
- else
- {
- // aOperation is not a supported command, return error
- rerr = index;
- }
- }
- return rerr;
- }
-
-void CTavsrcOperations::EndOperation(TChar aOperation, TInt aError)
- {
- // if an error has occured the state hasn't moved on
- if (!aError)
- {
- // check to see if there is an outstanding operation
- if (iPendingOperationIndex < 0)
- {
- // we have no pending operation, this means that the remote has moved our state on,
- // to keep the allowed operations in step pretend that we moved the state on ourselves
- iPendingOperationIndex = GetAllowedOperationIndex(aOperation, KTavsrcOpCodeAll);
- }
-
- // update current state if there is any valid operations in the pending operation
- if (iOperations[iPendingOperationIndex].GetNextOpCodes() != 0)
- {
- iLastOperationIndex = iPendingOperationIndex;
- }
- }
- iPendingOperationIndex = KErrNotFound;
- }
-
-TBool CTavsrcOperations::SafeMode()
- {
- return iSafeMode;
- }
-
-void CTavsrcOperations::SetSafeMode(TBool aSafeMode)
- {
- iSafeMode = aSafeMode;
- }
--- a/bluetooth/gavdp/test/tavsrcOperations.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCOPERATIONS_H
-#define TAVSRCOPERATIONS_H
-
-#include <e32def.h>
-#include <e32cmn.h>
-#include <e32base.h>
-#include <e32keys.h>
-
-// all key operations available for user input
-static const TInt KTavsrcOpConnect = ']';
-static const TInt KTavsrcOpCancel = '[';
-static const TInt KTavsrcOpDiscoverSEPs = 'd';
-static const TInt KTavsrcOpCreateBearers = '1';
-static const TInt KTavsrcOpCloseBearers = '!';
-static const TInt KTavsrcOpContentProtection = 'p';
-static const TInt KTavsrcOpGetCapabilities = 'g';
-static const TInt KTavsrcOpStartStreams = 's';
-static const TInt KTavsrcOpSuspendStreams = 'e';
-static const TInt KTavsrcOpEchoStorm = 'E';
-static const TInt KTavsrcOpAbort = 'a';
-static const TInt KTavsrcOpStream = '@';
-static const TInt KTavsrcOpStreamFaster = '+';
-static const TInt KTavsrcOpStreamSlower = '-';
-static const TInt KTavsrcOpAutoStream = 'A';
-static const TInt KTavsrcOpStopStream = '\'';
-static const TInt KTavsrcOpRegisterSEP = 't';
-static const TInt KTavsrcOpRegisterMultipleSEPs = 'T';
-static const TInt KTavsrcOpStartSrc = 'o';
-static const TInt KTavsrcOpStopSrc = 'c';
-static const TInt KTavsrcOpDisconnectSrc = 'f';
-static const TInt KTavsrcOpConfigureSEP = 'x';
-static const TInt KTavsrcOpReconfigureSEP = 'x';
-static const TInt KTavsrcOpPacketDropIoctl = 'i';
-static const TInt KTavsrcOpVolumeUp = EKeyUpArrow;
-static const TInt KTavsrcOpVolumeDown = EKeyDownArrow;
-static const TInt KTavsrcOpBackwards = EKeyLeftArrow;
-static const TInt KTavsrcOpForwards = EKeyRightArrow;
-static const TInt KTavsrcOpPlay = '}';
-static const TInt KTavsrcOpStop = '{';
-static const TInt KTavsrcOpExit = EKeyEscape;
-static const TInt KTavsrcOpToggleSafeMode = 'W';
-
-// describes one operation including key to press and next possible operations
-class TTavsrcOperation
- {
-public:
- TTavsrcOperation(TInt aOpCode, TChar aOperation, TInt aNextOpCodes);
-
- static TBool OperationMatchesAndAllowed(const TTavsrcOperation& aOpA, const TTavsrcOperation& aOpB);
- TInt GetNextOpCodes() const;
-
-private:
- // iOpCode is the internal representation of the operation and can be used in a bitmask to define
- // all possible next operations
- TInt iOpCode;
-
- // iOperation is the external representation of the operation, i.e. the key pressed by the user defined
- // above
- TChar iOperation;
-
- // iNextOpCodes is a bitmask of all the next possible operations after this operation
- TInt iNextOpCodes;
- };
-
-// describes all operations and is used to only allow acceptable, as defined by GAVDP, operations
-// to be selected by the user. All checking of whether an operation is allowed can be disabled
-// by turning off safe mode.
-class CTavsrcOperations : public CBase
- {
-public:
- static CTavsrcOperations* NewL();
- ~CTavsrcOperations();
-
- TBool IsOperationAllowed(TChar aOperation);
- TInt BeginOperation(TChar aOperation);
- void EndOperation(TChar aOperation, TInt aError);
-
- TBool SafeMode();
- void SetSafeMode(TBool aSafeMode);
-
-private:
- CTavsrcOperations();
- void ConstructL();
-
- TInt GetAllowedOperationIndex(TChar aOperation, TInt aAllowedNextOpcodes);
- TBool IsOperationAllowed(TInt aIndex);
-
-private:
- TInt iLastOperationIndex;
- TInt iPendingOperationIndex;
-
- TBool iSafeMode;
-
- RArray<TTavsrcOperation> iOperations;
- };
-
-#endif // TAVSRCOPERATIONS_H
--- a/bluetooth/gavdp/test/tavsrcSDP.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-// Copyright (c) 2005-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:
-//
-
-#include "tavsrc.h"
-
-void CAVTestApp::RegisterSinkSDPRecordL(RSdpDatabase& aDB, TBool aHeadphone,
- TBool aSpeaker,TBool aRecorder,TBool aAmp)
- {
- CSdpAttrValue* attrVal = 0;
- CSdpAttrValueDES* attrValDES = 0;
-
- // Set Attr 1 (service class list) to list with UUID = Audio Sink
- aDB.CreateServiceRecordL(TUUID(KAudioSinkUUID), iSnkHandle);
-
- // Protocol Descriptor List
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP
- ->BuildUintL(TSdpIntBuf<TUint16>(KAVDTP)) // PSM = AVDTP
- ->EndListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // Version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- //BrowseGroupList
- /*
- This has been added in order to be interoperable with remote devices which only look for the
- service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature.
- */
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root)
- ->EndListL();
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = NULL;
-
- // Language
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUintL(TSdpIntBuf<TUint16>(KLanguageEnglish))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdCharacterEncodingUTF8))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdBasePrimaryLanguage))
- ->EndListL();
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- // BT Profile Description
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()->StartListL()
- ->BuildUUIDL(KAdvancedAudioDistributionUUID)
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES);
-
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
-
- // provider name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution sink"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service description
- attrVal = CSdpAttrValueString::NewStringL(_L8("kick back and listen to some fine tunes with this neat service"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // supported features
- TUint16 supportedFeatures = aHeadphone ? 1:0;
- supportedFeatures|=aSpeaker ? 2:0;
- supportedFeatures|=aRecorder ? 4:0;
- supportedFeatures|=aAmp ? 8:0;
- attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf<TUint16>(supportedFeatures));
- CleanupStack::PushL(attrVal);
-
- aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdSupportedFeatures, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
- }
-
-
-void CAVTestApp::RegisterSourceSDPRecordL(RSdpDatabase& aDB, TBool aPlayer,
- TBool aMic,TBool aTuner,TBool aMixer)
- {
- CSdpAttrValue* attrVal = 0;
- CSdpAttrValueDES* attrValDES = 0;
-
- // Set Attr 1 (service class list) to list with UUID = Audio Sink
- aDB.CreateServiceRecordL(TUUID(KAudioSourceUUID), iSrcHandle);
-
- // Protocol Descriptor List
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP
- ->BuildUintL(TSdpIntBuf<TUint16>(KAVDTP)) // PSM = AVDTP
- ->EndListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // Version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- //BrowseGroupList
- /*
- This has been added in order to be interoperable with remote devices which only look for the
- service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature.
- */
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root)
- ->EndListL();
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = NULL;
-
- // Language
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUintL(TSdpIntBuf<TUint16>(KLanguageEnglish))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdCharacterEncodingUTF8))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdBasePrimaryLanguage))
- ->EndListL();
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- // BT Profile Description
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()->StartListL()
- ->BuildUUIDL(KAdvancedAudioDistributionUUID)
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES);
-
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
-
- // provider name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution source"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service description
- attrVal = CSdpAttrValueString::NewStringL(_L8("plug your wireless cans into me!"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // supported features
-
- TUint16 supportedFeatures = aPlayer ? 1:0;
- supportedFeatures|=aMic ? 2:0;
- supportedFeatures|=aTuner ? 4:0;
- supportedFeatures|=aMixer ? 8:0;
- attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf<TUint16>(supportedFeatures));
- CleanupStack::PushL(attrVal);
-
- aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdSupportedFeatures, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
- }
-
--- a/bluetooth/gavdp/test/tavsrcSock.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcSock.h"
-#include "tavsrc.h"
-
-#ifdef __WINS__
-static const TSize KReaderConsole(55,10);
-static const TSize KWriterConsole(55,12);
-#else
-static const TSize KReaderConsole(KConsFullScreen,KConsFullScreen);
-static const TSize KWriterConsole(KConsFullScreen,KConsFullScreen);
-#endif
-
-//
-// class CActivePacketDropIoctl
-//
-CActivePacketDropIoctl* CActivePacketDropIoctl::NewL(CActiveConsole* aLogConsole, RSocketArray aPendingSockets)
- {
- CActivePacketDropIoctl* self = new (ELeave) CActivePacketDropIoctl(aLogConsole, aPendingSockets);
- return self;
- }
-
-CActivePacketDropIoctl::CActivePacketDropIoctl(CActiveConsole* aLogConsole, RSocketArray aPendingSockets) : CActive(0)
- {
- iPendingSockets = aPendingSockets;
- iLogConsole = aLogConsole;
- CActiveScheduler::Add(this);
- }
-
-CActivePacketDropIoctl::~CActivePacketDropIoctl()
- {
- }
-
-void CActivePacketDropIoctl::DoCancel()
- {
- Cancel();
- }
-
-void CActivePacketDropIoctl::Start()
- {
- iPendingSockets[0].Ioctl(ENotifyAvdtpMediaPacketDropped, iStatus, &iPacketsLostPkgBuf, KSolBtAVDTPMedia);
- SetActive();
- }
-
-void CActivePacketDropIoctl::RunL()
- {
- __LOG(_L("\n**Packets Dropped Notification! %d packets lost.\n"), iPacketsLostPkgBuf());
- }
-
-//
-// class CActiveSockReader
-//
-CActiveSockReader* CActiveSockReader::NewL(RSocket aSock, TAvdtpTransportSessionType aType)
- {
- CActiveSockReader* self = new (ELeave) CActiveSockReader(aSock);
- CleanupStack::PushL(self);
- self->ConstructL(aType);
- CleanupStack::Pop(self);
- return self;
- }
-
-CActiveSockReader::CActiveSockReader(RSocket aSock)
-: CActive(0), iSock(aSock), iBufferDes(NULL, NULL)
- {
- CActiveScheduler::Add(this);
- }
-
-void CActiveSockReader::Start()
- {
- iSock.Read(iBufferDes,iStatus);
- SetActive();
- }
-
-void CActiveSockReader::ConstructL(TAvdtpTransportSessionType aType)
- {
- iType = aType;
- switch (aType)
- {
- case EMedia:
- iConsole = Console::NewL(_L("Incoming Sink Data"),KReaderConsole);
- break;
- case EReporting:
- iConsole = Console::NewL(_L("Incoming Reporting Channel Data"),KReaderConsole);
- break;
- case ERecovery:
- iConsole = Console::NewL(_L("Incoming Recovery Channel Data"),KReaderConsole);
- break;
- }
-
- iBuffer = HBufC8::NewL(40);
- iBuffer->Des().SetMax();
- iBufferDes.Set(iBuffer->Des());
- }
-
-CActiveSockReader::~CActiveSockReader()
- {
- Cancel();
- delete iConsole;
- iSock.Close();
- }
-
-void CActiveSockReader::DoCancel()
- {
- iSock.CancelAll();
- }
-
-void CActiveSockReader::RunL()
- {
- if (iStatus.Int()==KErrNone)
- {
- iConsole->Printf(_L("length: [%04d]\n"),iBufferDes.Length());
- for (TInt i=0;i<=iBufferDes.Length()-1;i++)
- {
- iConsole->Printf(_L("%c"),iBufferDes[i]);
- }
- iConsole->Printf(_L("\n\n"));
- iBuffer->Des().SetMax();
- iBufferDes.Set(iBuffer->Des());
- iSock.Read(iBufferDes,iStatus);
- SetActive();
- }
- else
- {
- iConsole->Printf(_L("SOCKET ERROR: %d"),iStatus.Int());
- }
-
- }
-
-//
-// class CActiveSockWriter
-//
-CActiveSockWriter* CActiveSockWriter::NewL(RSocket aSock,
- TAvdtpTransportSessionType aType)
- {
- CActiveSockWriter* writer = new (ELeave) CActiveSockWriter(aSock);
- CleanupStack::PushL(writer);
- writer->ConstructL(aType);
- CleanupStack::Pop();
- return writer;
- }
-
-CActiveSockWriter::~CActiveSockWriter()
- {
- delete iSendBuffer;
- delete iConsole;
- // test for normal shutdown on media socket
- TRequestStatus stat;
- iSock.Shutdown(RSocket::ENormal, stat);
- User::WaitForRequest(stat);
- iSock.Close();
- }
-
-void CActiveSockWriter::Send()
- {
- // periodic callback to send from app
- if (IsActive())
- {
- iConsole->Printf(_L("Info: Transport session %d tried to send, but active\n"), iType);
- }
- else
- {
- iSock.Write(*iSendBuffer, iStatus);
- SetActive();
- }
- }
-
-CActiveSockWriter::CActiveSockWriter(RSocket aSock)
-: CActive(-1), iSock(aSock)
- {
- CActiveScheduler::Add(this);
- }
-
-void CActiveSockWriter::ConstructL(TAvdtpTransportSessionType aType)
- {
- // Writer console to be used in the future if necessary for debugging
- // iConsole = Console::NewL(_L("Writer"), KWriterConsole);
-
- iSendBuffer = HBufC8::NewL(512);
- TPtr8 des = iSendBuffer->Des();
- iType = aType;
- switch (aType)
- {
- case EMedia:
- des.Copy(_L("Media channel connected!"));
- break;
- case EReporting:
- des.Copy(_L("Reporting channel connected!"));
- break;
- case ERecovery:
- des.Copy(_L("Recovery channel connected!"));
- break;
- default:
- des.Copy(_L("Unknown channel "));
- des.AppendNum(aType);
- des.Append(_L(" connected!"));
- break;
- }
- }
-
-void CActiveSockWriter::DoCancel()
- {
- iSock.CancelWrite();
- }
-
-void CActiveSockWriter::RunL()
- {
- // iConsole->Printf(_L("Info: Transport session %d SENT, result %d"), iType, iStatus.Int());
- }
--- a/bluetooth/gavdp/test/tavsrcSock.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCSOCK_H
-#define TAVSRCSOCK_H
-
-#include "tavsrc.h"
-#include "tavsrcConsole.h"
-
-#include <e32base.h>
-
-class CActivePacketDropIoctl : public CActive
- {
-public:
- static CActivePacketDropIoctl* NewL(CActiveConsole* aLogConsole, RSocketArray aPendingSockets);
- ~CActivePacketDropIoctl();
- void DoCancel();
- void RunL();
- void Start();
-
-private:
- CActivePacketDropIoctl(CActiveConsole* aLogConsole, RSocketArray aPendingSockets);
-
-private:
- CActiveConsole* iLogConsole;
- RSocketArray iPendingSockets;
- TPckgBuf<TInt> iPacketsLostPkgBuf;
- };
-
-class CActiveSockWriter : public CActive
- {
-public:
- static CActiveSockWriter* NewL(RSocket aSock, TAvdtpTransportSessionType aType);
- ~CActiveSockWriter();
- void Send();
- void DoCancel();
- void RunL();
-
-private:
- CActiveSockWriter(RSocket aSock);
- void ConstructL(TAvdtpTransportSessionType aType);
-
-private:
- RSocket iSock;
- CConsoleBase* iConsole;
- HBufC8* iSendBuffer;
- TAvdtpTransportSessionType iType;
- };
-
-class CActiveSockReader : public CActive
- {
-public:
- static CActiveSockReader* NewL(RSocket aSock, TAvdtpTransportSessionType aType);
- ~CActiveSockReader();
- void Start();
-
-private:
- CActiveSockReader(RSocket aSock);
- void ConstructL(TAvdtpTransportSessionType aType);
- void DoCancel();
- void RunL();
-
-private:
- RSocket iSock;
- CConsoleBase* iConsole;
- HBufC8* iBuffer;
- TPtr8 iBufferDes;
- TSockXfrLength iLen;
- TAvdtpTransportSessionType iType;
- };
-
-#endif // TAVSRCSOCK_H
--- a/bluetooth/gavdp/test/tavsrcStreamer.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,830 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcStreamer.h"
-#include "tavsrcUI.h"
-#include "tavsrcUtils.h"
-
-#include <bluetoothav.h>
-
-static const TSize KStreamerConsole(55,12);
-
-using namespace SymbianBluetoothAV;
-using namespace SymbianSBC;
-
-//
-// class CSbcTrackInfo
-//
-CSbcTrackInfo::~CSbcTrackInfo()
- {
- iFrameInfo.Close();
- }
-
-TInt CSbcTrackInfo::GetLastFrameSize()
- {
- TInt frameSize = KErrNotFound;
- TInt count = iFrameInfo.Count();
-
- if (count > 0)
- {
- frameSize = iFrameInfo[count - 1].iFrameSize;
- }
- return frameSize;
- }
-
-TInt CSbcTrackInfo::AddNewFrame(TInt aFrameSize)
- {
- TInt rerr = KErrNone;
- TInt count = iFrameInfo.Count();
-
- if ((count > 0) && (iFrameInfo[count - 1].iFrameSize == aFrameSize))
- {
- // another frame of the same size
- iFrameInfo[count - 1].iFrameCount++;
- }
- else
- {
- // add new frame info
- rerr = iFrameInfo.Append(TSbcTrackFrameInfo());
- if (rerr == KErrNone)
- {
- iFrameInfo[count].iFrameSize = aFrameSize;
- iFrameInfo[count].iFrameCount = 1;
- }
- }
- return rerr;
- }
-
-TInt CSbcTrackInfo::RemoveLastFrame()
- {
- TInt rerr = KErrNotFound;
- TInt count = iFrameInfo.Count();
-
- if (count > 0)
- {
- if (iFrameInfo[count - 1].iFrameCount > 1)
- {
- // remove one of the instances of the last frame size
- iFrameInfo[count - 1].iFrameCount--;
- }
- else
- {
- // remove the last frame info
- iFrameInfo.Remove(count - 1);
- }
- rerr = KErrNone;
- }
- return rerr;
- }
-
-void CSbcTrackInfo::Reset()
- {
- iFrameInfo.Reset();
- }
-
-//
-// class CActiveStreamer
-//
-CActiveStreamer* CActiveStreamer::NewL(RSocketArray aSockets,
- CConsoleBase& aConsole,
- MActiveStreamerUser& aUser,
- TUint aDisplayMode,
- TBool aPreloadFile)
- {
- CActiveStreamer* self = new (ELeave) CActiveStreamer (aConsole, aUser, aDisplayMode, aPreloadFile);
- CleanupStack::PushL(self);
- self->ConstructL(aSockets);
- CleanupStack::Pop();
- return self;
- }
-
-CActiveStreamer::CActiveStreamer(CConsoleBase& aConsole, MActiveStreamerUser& aUser, TUint aDisplayMode, TBool aPreloadFile)
-: iConsole(aConsole), iUser(aUser), iDisplayMode(aDisplayMode), iPreloadFile(aPreloadFile), iSbcFrameRate(1), iDirectionForward(ETrue)
- {
- iRTPCanSend = ETrue;
- }
-
-CActiveStreamer::~CActiveStreamer()
- {
- delete iTimer;
-
- iSendSource.Close();
- iSession.Close();
- iSockets[0].Close();
- delete iFiles;
- iFile.Close();
- iRFs.Close();
-
- delete iProgressBar;
- DestroyBucket();
- delete iStreamingInfoConsole;
-
- delete iFileBuf;
- iFileBuf = NULL;
-
- delete iStreamerUI;
- iStreamerUI = NULL;
- }
-
-void CActiveStreamer::Stream(TBool aIsSink)
- {
-
- if (!aIsSink)
- {
- iStartedTime.UniversalTime();
- iTimer->Start(iNominalSendClockInterval);
- Drip();
- }
- else
- {
- //as sink, we do want to start up rtp and await its notification of a NewSource
- //Nothing to do at the moment, because when INT is a SNK,
- //it just needs to get the RTP packets running and wait for notification.
- //This has already been done in constructor of the class.
- }
- iStreamerUI->Play();
- }
-
-void CActiveStreamer::Suspend()
- {
- iTimer->Cancel(); // stop callbacks to send
- iStreamerUI->Pause();
- }
-
-void CActiveStreamer::ReStream()
- {
-
-
- iTimer->Start(iNominalSendClockInterval);
- Drip();
- iStreamerUI->Play();
- }
-
-
-void CActiveStreamer::Stop()
- {
- iTimer->Cancel();
- iStreamerUI->Stop();
-
- iFillLevel = 0;
- iPos = 0;
- }
-
-void CActiveStreamer::Pause()
- {
- iTimer->Cancel();
- iStreamerUI->Pause();
- }
-
-
-void CActiveStreamer::NextTrack()
- {
- iPos=0;
- if (iCurrentFile < iFiles->Count() - 1)
- {
- iCurrentFile++;
- iStreamerUI->Next();
- }
- else
- {
- iCurrentFile = 0;
- iStreamerUI->First();
- }
- TRAPD(err, InitL());
- if (err)
- {
- iConsole.Printf(_L("InitL failed with error: %d"),err);
- }
- }
-
-void CActiveStreamer::PrevTrack()
- {
- iPos=0;
- if (iCurrentFile>0)
- {
- iCurrentFile--;
- iStreamerUI->Prev();
- }
- TRAPD(err, InitL());
- if (err)
- {
- iConsole.Printf(_L("InitL failed with error: %d"),err);
- }
- }
-
-void CActiveStreamer::InitL()
- {
- // close current file
- iFile.Close();
- delete iProgressBar;
- iProgressBar = NULL;
-
- // get file details
- RBuf filename;
- filename.Create(100);
- filename.Append(KSBCFileRoot);
- filename.Append(iFiles->operator[](iCurrentFile).iName);
-
- User::LeaveIfError(iFile.Open(iRFs,filename,EFileRead | EFileShareReadersOnly));
-
- TInt numChannels, chMode, numSubbands, blkLen, bitPool, freq, allocMethod;
- User::LeaveIfError(TTavsrcUtils::GetCodecSettingsFromSBCFile(filename, chMode, numChannels, numSubbands, blkLen, bitPool, freq, allocMethod));
-
- if (iStreamingInfoConsole)
- {
- iStreamingInfoConsole->Printf(_L("\nFirst SBC frame info for: %S...\n"), &filename);
- }
-
- filename.Close();
-
- // determine if a re-configuration is required
- if ((iNumChannels != numChannels) || (iFreq != freq) ||
- (iChMode != chMode) || (iBitPool != bitPool) ||
- (iBlkLen != blkLen) || (iNumSubbands != numSubbands) ||
- (iAllocMethod != allocMethod))
- {
- iNumChannels = numChannels;
- iChMode = chMode;
- iNumSubbands = numSubbands;
- iBlkLen = blkLen;
- iBitPool = bitPool;
- iFreq = freq;
- iAllocMethod = allocMethod;
-
- // configuration is set first time around
- if (iSBCFrameSize != 0)
- {
- TSBCCodecCapabilities cfg;
-
- TSBCSubbandsBitmask subbands = numSubbands == 8 ? EEightSubbands : EFourSubbands;
- TSBCAllocationMethodBitmask alloc = allocMethod == 0 ? ELoudness : ESNR;
-
- TSBCSamplingFrequencyBitmask freqs(0);
- if (freq == 48000) freqs = E48kHz;
- else if (freq == 44100) freqs = E44100Hz; // note else if now as only select one
- else if (freq == 32000) freqs = E32kHz;
- else if (freq == 16000) freqs = E16kHz;
-
- TSBCChannelModeBitmask chs(0); // set it to anything to prevent warning
- if (chMode == 0) chs=EMono;
- else if (chMode == 1) chs=EDualChannel;
- else if (chMode == 2) chs=EStereo;
- else if (chMode == 3) chs=EJointStereo;
-
- TSBCBlockLengthBitmask blkLens(0); // set it to anything to prevent warning
- if (blkLen == 4) blkLens = EBlockLenFour;
- else if (blkLen == 8) blkLens = EBlockLenEight;
- else if (blkLen == 12) blkLens = EBlockLenTwelve;
- else if (blkLen == 16) blkLens = EBlockLenSixteen;
-
- cfg.SetSamplingFrequencies(freqs);
- cfg.SetChannelModes(chs);
- cfg.SetBlockLengths(blkLens);
- cfg.SetSubbands(subbands);
- cfg.SetAllocationMethods(alloc);
-
- // reconfig required
- iUser.MediaCodecConfigurationRequired(cfg);
-
- // ensure no more timer events until we have finished reconfiguring
- iTimer->Cancel();
- }
-
- if (chMode == 0 || chMode == 1)
- {
- iSBCFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal(blkLen*numChannels*bitPool)/8);
- }
- else
- {
- TBool join = chMode == 0x03;
-
- iSBCFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal((join*numSubbands+blkLen*bitPool))/8);
- }
-
- iSBCBitrate = 8*iSBCFrameSize*freq/(numSubbands*blkLen);
- TUint64 numerator = TUint64(8000000)*iSBCFrameSize;
- iSBCFrameInterval = (numerator)/iSBCBitrate; //microsecs
- }
-
- iSbcTrackInfo.Reset();
- iSbcTrackInfo.AddNewFrame(iSBCFrameSize);
-
- iDirectionForward = ETrue;
- iSbcFrameRate = 1;
-
- User::LeaveIfError(iFile.Size(iFileSize));
-
- if (iStreamingInfoConsole)
- {
- iStreamingInfoConsole->Printf(_L("Sampling Frequency: %d Hz\n"), iFreq);
- iStreamingInfoConsole->Printf(_L("Subbands: %d\n"), iNumSubbands);
- iStreamingInfoConsole->Printf(_L("BlkLen: %d\n"), iBlkLen);
- iStreamingInfoConsole->Printf(_L("ChannelMode: %d\n"), iChMode);
- iStreamingInfoConsole->Printf(_L("AllocMethod: %d\n"), iAllocMethod);
- iStreamingInfoConsole->Printf(_L("Bitpool: %d\n"), iBitPool);
- iStreamingInfoConsole->Printf(_L("SBC Frame size: %d bytes\n"), iSBCFrameSize);
- iStreamingInfoConsole->Printf(_L("Bitrate: %d bps\n"), iSBCBitrate);
- }
-
- TInt err = LoadFile();
- if(err==KErrNone)
- {
- if (iDisplayMode & EProgressBarWindow)
- {
- iProgressBar = CProgressBar::NewL(iFileSize);
- }
- FillBucket();
- }
- else
- {
- User::Leave(err);
- }
- // start the timer for this file
- iStartTime.UniversalTime();
- }
-
-void CActiveStreamer::UpdateFrameInfo()
- {
- TInt numChannels, chMode, numSubbands, blkLen, bitPool, freq, allocMethod;
- User::LeaveIfError(TTavsrcUtils::GetCodecSettingsFromSBCFile(iFile, iPos, chMode, numChannels, numSubbands, blkLen, bitPool, freq, allocMethod));
-
- // determine if a re-configuration is required
- if ((iNumChannels != numChannels)|| (iFreq != freq) ||
- (iChMode != chMode) || (iBitPool != bitPool) ||
- (iBlkLen != blkLen) || (iNumSubbands != numSubbands) ||
- (iAllocMethod != allocMethod))
- {
- iNumChannels = numChannels;
- iChMode = chMode;
- iNumSubbands = numSubbands;
- iBlkLen = blkLen;
- iBitPool = bitPool;
- iFreq = freq;
- iAllocMethod = allocMethod;
-
- TInt newFrameSize = 0;
- if (chMode == 0 || chMode == 1)
- {
- newFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal(blkLen*numChannels*bitPool)/8);
- }
- else
- {
- TBool join = chMode == 0x03;
-
- newFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal((join*numSubbands+blkLen*bitPool))/8);
- }
-
- if (newFrameSize != iSBCFrameSize)
- {
- // work out timer for SBC frame
- iSBCBitrate = 8*newFrameSize*freq/(numSubbands*blkLen);
-
- TUint64 numerator = TUint64(8000000)*iSBCFrameSize;
- iSBCFrameInterval = (numerator)/iSBCBitrate; //microsecs
- }
- iSBCFrameSize = newFrameSize;
- }
- }
-
-void CActiveStreamer::TimerEvent(CAdaptiveHighResPeriodic& /*aTimer*/)
- {
- if (iRTPCanSend)
- {
- iSent++;
- }
- else
- {
- // move iPos on anyway?
- iFailedSend++;
- }
- DoTimerEvent();
- }
-
-void CActiveStreamer::TimerError(CAdaptiveHighResPeriodic& /*aTimer*/, TInt aError)
- {
- iConsole.Printf(_L("*ERROR %d*\n"), aError);
- __DEBUGGER();
- }
-
-
-void CActiveStreamer::DoTimerEvent()
- {
- FillBucket();
- Drip();
- CheckJammed();
- }
-
-void CActiveStreamer::FillBucket()
- {
- // fill up bucket - it may be fully empty or partially full, but top it up in all cases
- if (iFillLevel < KLowTidemark)
- {
- for (/*iFillLevel*/; iFillLevel < KSendBucketSize; iFillLevel++)
- {
- // get the next RTP packet to send
- RRtpSendPacket& sendPacket = iSendPackets[iFillLevel];
- TDes8& payload = sendPacket.WritePayload();
- payload.Zero();
- payload.Append(0); // update this later with number of frames in packet.
-
- TInt spaceInRtpPacket = iSBCFrameBytesPerRTP;
- TInt framesAdded = 0;
- TInt packetInterval = 0;
-
- TInt nextFrameSize = iDirectionForward ? iSBCFrameSize : iSbcTrackInfo.GetLastFrameSize();
-
- TBool moreFrames = ETrue;
- while ((nextFrameSize > 0) && (nextFrameSize <= spaceInRtpPacket) && (framesAdded <= 15) && moreFrames)
- {
- // add frame
- if (iPreloadFile)
- {
- TPtrC8 ptr(iFileBuf->Des().Ptr()+iPos, nextFrameSize);
- payload.Append(ptr);
- }
- else
- {
- TPtr8 ptr(const_cast<TUint8*>(iFileBuf->Des().Ptr()), 0, nextFrameSize);
- iFile.Read(iPos, ptr);
- payload.Append(ptr);
- }
- framesAdded++;
- packetInterval+=iSBCFrameInterval;
- spaceInRtpPacket-=nextFrameSize;
-
- // get next frame information
- for (TInt count = 0; (count != iSbcFrameRate) && moreFrames; count++)
- {
- iPos = iDirectionForward ? iPos + nextFrameSize : iPos - nextFrameSize;
-
- // determine if we are done with the current file
- if ((iPos >= iFileSize) || (iPos < 0))
- {
- moreFrames = EFalse;
- }
- else
- {
- TInt err = KErrNone;
- if (iDirectionForward)
- {
- // keep track of the frame sizes as we go, this is used to rewind,
- // i.e. iDirectionForward = EFalse
- if ((err = iSbcTrackInfo.AddNewFrame(iSBCFrameSize)) != KErrNone)
- {
- iConsole.Printf(_L("Error adding SBC frame information: %d\n"), err);
- __DEBUGGER();
- }
- }
- else
- {
- if ((err = iSbcTrackInfo.RemoveLastFrame()) != KErrNone)
- {
- // this should never happen as we always check the length first
- iConsole.Printf(_L("Error removing SBC frame information: %d\n"), err);
- __DEBUGGER();
- }
- }
- UpdateFrameInfo();
- nextFrameSize = iDirectionForward ? iSBCFrameSize : iSbcTrackInfo.GetLastFrameSize();
- }
- }
- }
-
- // has the interval changed since last time we set the timer
- if ((iNominalSendClockInterval != packetInterval) && moreFrames)
- {
- // adjust timer
- if (iStreamingInfoConsole)
- {
- iStreamingInfoConsole->Printf(_L("Interval change from: %d to %d\n"), iNominalSendClockInterval, packetInterval);
- }
- iNominalSendClockInterval = packetInterval;
- iTimer->SetInterval(iNominalSendClockInterval);
- }
-
- // write number of SBC frames into packet
- payload[0] = TChar(framesAdded);
-
- //DrawBucket(); //<--- to animate the display
-
- if (iPos > iFileSize)
- {
- // time to do some metrics, and loop back to beginning
- TTime finTime;
- finTime.UniversalTime();
-
- TInt64 secs;
- secs = (finTime.MicroSecondsFrom(iStartTime)).Int64();
-
- TInt bps = (iFileSize*8LL*1000000LL)/secs;
- iConsole.Printf(_L("Looping. fail=%d, sent=%d, bytes=%d, secs=%Ld"), iFailedSend, iSent, iFileSize, secs);
- iConsole.Printf(_L(" bps=%d\n"), bps);
-
- iFailedSend=0;
- iSent=0;
- iPos=0; // loop
-
- RDebug::Printf("Looping");
- NextTrack();
-
- // restart the timer
- iTimer->Start(iNominalSendClockInterval);
- }
- else if (iPos <= 0)
- {
- PrevTrack();
- }
- else if (iProgressBar)
- {
- iProgressBar->Increment(iPos-iProgressBarPos);
- iProgressBarPos = iPos;
- }
- }
- iPreviousFillLevel = iFillLevel;
- }
- }
-
-void CActiveStreamer::DrawBucket()
- {
- if (iStreamingInfoConsole)
- {
- iStreamingInfoConsole->SetPos(1,1);
-
- TBuf<KSendBucketSize> bar;
- bar.AppendFill('#',iFillLevel);
- bar.AppendFill('.',KSendBucketSize-iFillLevel);
-
- iStreamingInfoConsole->Printf(bar);
- }
- }
-
-void CActiveStreamer::Drip()
- {
- // take head packet
- RRtpSendPacket& packet = iSendPackets[0]; //packet=oldpacket
-
- // move previous packet to back - it is reusable, so we don't close
- // instead just move to back so that the packet to send is at head
- iSendPackets.Remove(0);
- iSendPackets.Append(packet);
-
- if (iRTPCanSend && iFillLevel > 0)
- {
- // take oldest packet and give to RTP
- packet.Send();
- iRTPCanSend = EFalse;
- iFillLevel--;
- //DrawBucket(); //<--- to animate the display
- }
- else
- {
- // not ready to send yet but when we are send straight away
- iBonusDrip = ETrue;
-
- // remember this as a fail to measure
- // let code beneath recycle packet
- iFailedSend++;
- }
- }
-
-void CActiveStreamer::ConstructL(RSocketArray aSockets)
- {
- iTimer = CAdaptiveHighResPeriodic::NewL(*this);
-
- if (iDisplayMode & EStreamerInfoWindow)
- {
- iStreamingInfoConsole = Console::NewL(_L("Streamer"), KStreamerConsole);
- }
-
- User::LeaveIfError(iRFs.Connect());
-
- iSockets = aSockets;
-
- TPckgBuf<TInt> mruBuf;
- iSockets[0].GetOpt(EAvdtpMediaGetMaximumReceivePacketSize, KSolBtAVDTPMedia, mruBuf);
-
- // donate media socket to rtp
- iSession.OpenL(iSockets[0], mruBuf());
-
- // we get all RTP events in one place (could have them separately)
- iSession.RegisterEventCallbackL(ERtpAnyEvent,
- RTPCallbackL,
- this);
-
- iSendSource = iSession.NewSendSourceL();
-
- iSendSource.RegisterEventCallbackL(ERtpAnyEvent,
- RTPCallbackL,
- this);
-
- iStreamerUI = CStreamerUI::NewL((iDisplayMode & EPlaylistWindow), (iDisplayMode & EChunkyIconWindow));
-
- TInt err = iRFs.GetDir(KSBCFiles, KEntryAttNormal, ESortByName, iFiles);
-
- // set playlist
- for (TInt i=0; i<iFiles->Count(); i++)
- {
- iStreamerUI->AddTitle(iFiles->operator[](i).iName);
- }
-
- err = aSockets[0].GetOpt(EAvdtpMediaGetMaximumPacketSize, KSolBtAVDTPMedia, iMTU);
-
- iSBCFrameBytesPerRTP = iMTU - 12 - 1;
- iSendSource.SetDefaultPayloadSize(iSBCFrameBytesPerRTP+1);
-
- CreateBucketL();
- InitL();
- }
-
-void CActiveStreamer::CreateBucketL()
- {
- if (iSendPackets.Count() == KSendBucketSize)
- {
- RDebug::Printf("Bucket already created");
- }
- else
- {
- RDebug::Printf("Creating bucket");
- // create all the RTP send packets now
- for (TInt i=0; i<KSendBucketSize ; i++)
- {
- User::LeaveIfError(iSendPackets.Append(iSendSource.NewSendPacketL()));
- RDebug::Printf("Adding Sendpacket 0x%08x in bucket", &iSendPackets[i]);
- }
- }
- }
-
-void CActiveStreamer::DestroyBucket()
- {
- RDebug::Printf("Destroying bucket");
-
- // rtp bug closing these packets?
- iSendPackets.Reset();
- }
-
-/*static*/ void CActiveStreamer::RTPCallbackL(CActiveStreamer* aStreamer, const TRtpEvent& aEvent)
- {
- switch (aEvent.Type())
- {
- case ERtpSendFail:
- if (aStreamer->iStreamingInfoConsole)
- {
- aStreamer->iStreamingInfoConsole->Printf(_L("\n**RTP SEND FAILURE**"));
- }
- break;
-
- case ERtpSendSucceeded:
- aStreamer->iRTPCanSend = ETrue;
- if (aStreamer->iBonusDrip)
- {
- aStreamer->Drip();
- aStreamer->iBonusDrip = EFalse;
- }
- break;
-
- case ERtpSourceFail:
- if (aStreamer->iStreamingInfoConsole)
- {
- aStreamer->iStreamingInfoConsole->Printf(_L("\n**RTP SOURCE FAILURE**"));
- }
- break;
-
-
- case ERtpNewSource:
- if (aStreamer->iStreamingInfoConsole)
- {
- aStreamer->iStreamingInfoConsole->Printf(_L("\n**NEW SOURCE!\n"));
- }
- aStreamer->StartSinkL();
- break;
-
- case ERtpPacketReceived:
- RRtpPacket packet = aStreamer->iReceiveSource.Packet();
- if (aStreamer->iStreamingInfoConsole)
- {
- aStreamer->iStreamingInfoConsole->Printf(_L("SNK Rxd packet "));
- aStreamer->iStreamingInfoConsole->Printf(_L("SeqNo %d\n"),packet.SequenceNumber());
- }
- break;
- }
- }
-
-void CActiveStreamer::StartSinkL()
- {
- iReceiveSource = iSession.NewReceiveSourceL();
- iReceiveSource.RegisterEventCallbackL(ERtpAnyEvent,
- RTPCallbackL,
- this);
- }
-
-TInt CActiveStreamer::LoadFile()
- {
- RDebug::Printf("Loading file");
- delete iFileBuf;
- iFileBuf = NULL;
-
- TInt err = KErrNone;
-
- if (iPreloadFile)
- {
- if (iStreamingInfoConsole)
- {
- iStreamingInfoConsole->Printf(_L("Preloading SBC file\n"));
- }
-
- // max heap is something or other
- const TInt KMaxHeap = 4000000;
- TInt size = iFileSize;
- size = Min(iFileSize, KMaxHeap);
- TRAP(err, iFileBuf = HBufC8::NewL(size));
- if (err)
- {
- return err;
- }
- iFileSize = Min(KMaxHeap, iFileSize);
-
- TPtr8 ptr(const_cast<TUint8*>(iFileBuf->Des().Ptr()), 0, iFileSize);
-
- const TEntry& entry = iFiles->operator[](iCurrentFile);
- RFile test;
- test.Open(iRFs, entry.iName, EFileRead);
-
- ptr.Zero();
- err=iFile.Read(ptr);
- }
- else
- {
- if (iStreamingInfoConsole)
- {
- iStreamingInfoConsole->Printf(_L("Streaming from file\n"));
- }
-
- // read from file to be more "streaming"-like
- TRAP(err, iFileBuf = HBufC8::NewL(Min(iFileSize, iSBCFrameBytesPerRTP)));
- }
- return err;
- }
-
-void CActiveStreamer::Faster()
- {
- // limit the speed
- if (iSbcFrameRate < 5)
- {
- iSbcFrameRate++;
- }
- }
-
-void CActiveStreamer::Slower()
- {
- if (iSbcFrameRate > 1)
- {
- iSbcFrameRate--;
- }
- }
-
-void CActiveStreamer::Backward()
- {
- iDirectionForward=EFalse;
- }
-
-void CActiveStreamer::Forward()
- {
- iDirectionForward=ETrue;
- }
-
-void CActiveStreamer::CheckJammed()
- {
- if (iFillLevel==iPreviousFillLevel)
- {
- if ((iBucketAppearsJammed++ > 500) && iStreamingInfoConsole)
- {
- iStreamingInfoConsole->Printf(_L("BUCKET JAMMED\n"));
- iStreamingInfoConsole->Printf(_L("iFillLevel %d "),iFillLevel);
- iStreamingInfoConsole->Printf(_L("iRTPCanSend %d "),iRTPCanSend);
- iStreamingInfoConsole->Printf(_L("iFailedSend %d "),iFailedSend);
- iStreamingInfoConsole->Printf(_L("iPos %d "),iPos);
-
- TTime now;
- now.UniversalTime();
-
- TInt millisecs = now.MicroSecondsFrom(iLastPacketSentTime).Int64()/1000;
- iStreamingInfoConsole->Printf(_L("time since last send %d ms "),millisecs);
- }
- }
- else
- {
- iBucketAppearsJammed = 0;
- }
- }
--- a/bluetooth/gavdp/test/tavsrcStreamer.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCSTREAMER_H
-#define TAVSRCSTREAMER_H
-
-#include "tavsrc.h"
-#include "tavsrcTimer.h"
-#include "tavsrcStreamerUser.h"
-
-#include <f32file.h>
-#include <rtp.h>
-
-static const TInt KLowTidemark = 2;
-static const TInt KSendBucketSize = 2;
-
-#ifdef __WINS__
-_LIT(KSBCFileRoot, "c:\\");
-_LIT(KSBCFiles, "c:\\*.sbc");
-#else
-//For reference boards, use the MMC drive, because C: is formatted every reboot
-_LIT(KSBCFileRoot, "e:\\");
-_LIT(KSBCFiles, "e:\\*.sbc");
-#endif
-
-class CProgressBar;
-class CStreamerUI;
-class CActiveSockWriter;
-class CActiveSockReader;
-
-class TSbcTrackFrameInfo
- {
-public:
- TInt iFrameSize;
- TUint iFrameCount;
- };
-
-// used to keep track of the sizes of the SBC frames to allow going backwards through
-// an SBC file on a frame by frame basis. This is require to support VBR where the
-// frame sizes can change for a single track.
-class CSbcTrackInfo : public CBase
- {
-public:
- ~CSbcTrackInfo();
-
- TInt GetLastFrameSize();
- TInt AddNewFrame(TInt aFrameSize);
- TInt RemoveLastFrame();
- void Reset();
-
-private:
- RArray<TSbcTrackFrameInfo> iFrameInfo;
- };
-
-class CActiveStreamer : public CBase, private MAdaptiveHighResPeriodicClient
- {
-public:
- static CActiveStreamer* NewL(RSocketArray aSockets,
- CConsoleBase& aConsole,
- MActiveStreamerUser& aUser,
- TUint aDisplayMode,
- TBool aPreloadFile);
-
- ~CActiveStreamer();
-
- static void RTPCallbackL(CActiveStreamer* aStreamer, const TRtpEvent& aEvent);
-
- // streamer operations
- void Stream(TBool aIsSink);
- void Suspend();
- void ReStream();
- void Stop();
- void Pause();
- void Faster();
- void Slower();
- void Backward();
- void Forward();
- void NextTrack();
- void PrevTrack();
-
-private:
- enum TDisplayMode
- {
- EStatusCommandWindows = 0x00,
- EStreamerInfoWindow = 0x01,
- EProgressBarWindow = 0x02,
- EPlaylistWindow = 0x04,
- EChunkyIconWindow = 0x08,
- };
-
-private:
- CActiveStreamer(CConsoleBase& aConsole, MActiveStreamerUser& aUser, TUint aDisplayMode, TBool aPreloadFile);
-
- void TimerEvent(CAdaptiveHighResPeriodic& aTimer);
- void TimerError(CAdaptiveHighResPeriodic& aTimer, TInt aError);
- void StartSinkL();
-
- void ConstructL(RSocketArray aSockets);
- TInt LoadFile();
- void DoTimerEvent();
- void DestroyBucket();
- void InitL();
-
- void CreateBucketL();
- void FillBucket();
- void Drip();
- void DrawBucket();
- void CheckJammed();
-
- void UpdateFrameInfo();
-
-private:
- CConsoleBase& iConsole;
- TInt iProgressBarPos;
- CProgressBar* iProgressBar;
- CStreamerUI* iStreamerUI;
- CConsoleBase* iStreamingInfoConsole;
- CAdaptiveHighResPeriodic* iTimer;
-
- RFile iFile;
- RFs iRFs;
- CDir* iFiles;
- TInt iCurrentFile;
- RSocketArray iSockets;
- TInt iMTU;
- TInt iFileSize;
- TTime iStartTime;
-
- RRtpSession iSession;
- RRtpSendSource iSendSource;
- RRtpReceiveSource iReceiveSource;
-
- RArray<RRtpSendPacket> iSendPackets; // used like a queue sometimes
- TRtpEventType iEventType;
- TBool iRTPCanSend;
-
- TInt iSBCFrameBytesPerRTP;
- TInt iSBCFrameSize;
- TInt iSBCFrameInterval;
- TInt iNumSBCFramesInRTP;
- TInt iSBCBitrate;
- TInt iSendClockInterval; // microsecs
- TInt iNominalSendClockInterval;// microsecs
- TBool iBonusDrip;
- TTime iStartedTime; // for "absolute" timing style
-
- // checking for jammed streamer, and leaky mbufs
- TInt iBucketAppearsJammed;
- TBool iBucketJammed;
- TTime iLastPacketSentTime;
- TInt iPreviousFillLevel;
-
- TInt iPos;
- TInt iFailedSend;
- TInt iSent;
- TInt iFillLevel;
-
- HBufC8* iFileBuf;
-
- // current SEP configuration
- TInt iNumChannels;
- TInt iChMode;
- TInt iNumSubbands;
- TInt iBlkLen;
- TInt iBitPool;
- TInt iFreq;
- TInt iAllocMethod;
-
- MActiveStreamerUser& iUser;
-
- TUint iDisplayMode;
- TBool iPreloadFile;
-
- CSbcTrackInfo iSbcTrackInfo;
-
- TInt iSbcFrameRate;
-
- TBool iDirectionForward;
- };
-
-#endif // TAVSRCSTREAMER_H
--- a/bluetooth/gavdp/test/tavsrcStreamerUser.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCSTREAMERUSER_H
-#define TAVSRCSTREAMERUSER_H
-
-#include <bluetoothav.h>
-
-// used to notify changes to the configuration of the media being streamed
-class MActiveStreamerUser
- {
-public:
- virtual void MediaCodecConfigurationRequired(TSBCCodecCapabilities& aConfig)=0;
- };
-
-#endif // TAVSRCSTREAMERUSER_H
--- a/bluetooth/gavdp/test/tavsrcTimer.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include <hal.h>
-#include <hal_data.h>
-
-#include "tavsrcTimer.h"
-#include "tavsrc.h"
-
-static const TUint KMillion = 1000000;
-
-CAdaptiveHighResPeriodic* CAdaptiveHighResPeriodic::NewL(MAdaptiveHighResPeriodicClient& aClient)
- {
- CAdaptiveHighResPeriodic* p = new (ELeave) CAdaptiveHighResPeriodic(aClient);
- CleanupStack::PushL(p);
- p->ConstructL();
- CleanupStack::Pop(p);
- return p;
- }
-
-CAdaptiveHighResPeriodic::~CAdaptiveHighResPeriodic()
- {
- Cancel();
- }
-
-CAdaptiveHighResPeriodic::CAdaptiveHighResPeriodic(MAdaptiveHighResPeriodicClient& aClient)
-: CTimer(EPriorityStandard+1), iClient(aClient)
- {
- CActiveScheduler::Add(this);
- }
-
-void CAdaptiveHighResPeriodic::ConstructL()
- {
- CTimer::ConstructL();
-
- HAL::Get(HALData::EFastCounterFrequency, iFastCounterFreq);
- HAL::Get(HALData::EFastCounterCountsUp, iFastCounterIncreases);
-
- RDebug::Printf("Timer HAL: FC Freq %d", iFastCounterFreq);
-
- if (iFastCounterIncreases)
- {
- RDebug::Printf("Timer HAL: FC increases");
- }
- else
- {
- RDebug::Printf("Timer HAL: FC decreases");
- }
-
- iFastCounterFreqUs = (TReal)iFastCounterFreq / KMillion;
- }
-
-
-void CAdaptiveHighResPeriodic::Start(TTimeIntervalMicroSeconds32 aInterval)
- {
- RDebug::Printf("*** Start Timer");
- iInterval = aInterval;
-
- // calculate the number of fast counter ticks for the interval
- TReal intervalInCounts = iInterval.Int()*iFastCounterFreqUs;
- TInt countChangeExpected = (TInt) intervalInCounts;
-
- // store any extra fractions of fast counter ticks
- iExtraCounts = intervalInCounts - countChangeExpected;
-
- iIntendedCountOnCallback = iFastCounterIncreases
- ? User::FastCounter() + countChangeExpected
- : User::FastCounter() - countChangeExpected;
-
- StartTimer(aInterval);
- }
-
-void CAdaptiveHighResPeriodic::RunL()
- {
- User::LeaveIfError(iStatus.Int());
- iClient.TimerEvent(*this);
-
- if (!IsActive())
- {
- TUint endCount = User::FastCounter();
-
- // are we fast or slow? positive = late, negative = early
- TInt varianceCount = iFastCounterIncreases
- ? (TInt)((endCount - iIntendedCountOnCallback))
- : (TInt)((iIntendedCountOnCallback - endCount));
-
- // convert count to microsecs
- TInt varianceUs = varianceCount/iFastCounterFreqUs;
-
- TInt nextInterval = iInterval.Int() - varianceUs; // in musecs
-
- if (nextInterval < 0)
- {
- nextInterval = 0;
- }
-
- // calculate the number of fast counter ticks for the interval
- TReal intervalInCounts = nextInterval*iFastCounterFreqUs;
- TInt countChangeExpected = (TInt) intervalInCounts;
-
- // update extra fractions of fast counter ticks
- iExtraCounts += intervalInCounts - countChangeExpected;
-
- if (iExtraCounts >= 1)
- {
- // we have more than a whole tick, do the adjustment
- countChangeExpected++;
- iExtraCounts--;
- nextInterval = countChangeExpected/iFastCounterFreqUs;
- }
-
- iIntendedCountOnCallback = iFastCounterIncreases
- ? User::FastCounter() + countChangeExpected
- : User::FastCounter() - countChangeExpected;
-
- StartTimer(nextInterval);
- }
- }
-
-TInt CAdaptiveHighResPeriodic::RunError(TInt aError)
- {
- iClient.TimerError(*this, aError);
- return KErrNone;
- }
-
-void CAdaptiveHighResPeriodic::SetInterval(TTimeIntervalMicroSeconds32 aInterval)
- {
- iInterval = aInterval;
- }
-
-void CAdaptiveHighResPeriodic::StartTimer(TTimeIntervalMicroSeconds32 aInterval)
- {
- HighRes(aInterval);
- }
--- a/bluetooth/gavdp/test/tavsrcTimer.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCTIMER_H
-#define TAVSRCTIMER_H
-
-#include <e32base.h>
-
-class CAdaptiveHighResPeriodic;
-
-class MAdaptiveHighResPeriodicClient
- {
-public:
- virtual void TimerEvent(CAdaptiveHighResPeriodic& aTimer)=0;
- virtual void TimerError(CAdaptiveHighResPeriodic& aTimer, TInt aError)=0;
- };
-
-//adapts the callback to counter drift
-class CAdaptiveHighResPeriodic : public CTimer
- {
-public:
- static CAdaptiveHighResPeriodic* NewL(MAdaptiveHighResPeriodicClient& aClient);
- ~CAdaptiveHighResPeriodic();
- void Start(TTimeIntervalMicroSeconds32 aPeriod);
-
- void SetInterval(TTimeIntervalMicroSeconds32 aInterval);
-
-private:
- CAdaptiveHighResPeriodic(MAdaptiveHighResPeriodicClient& aClient);
- void ConstructL();
- void RunL();
- TInt RunError(TInt aError);
- void StartTimer(TTimeIntervalMicroSeconds32 aInterval);
-
-private:
- MAdaptiveHighResPeriodicClient& iClient;
-
- // HAL stuff
- TBool iFastCounterIncreases;
- TInt iFastCounterFreq;
- TReal iFastCounterFreqUs;
- TReal iExtraCounts;
-
- // what the client asked for in musecs
- TTimeIntervalMicroSeconds32 iInterval;
-
- TUint iIntendedCountOnCallback ; // the hoped for fast counter reading on callback
- };
-
-#endif // TAVSRCTIMER_H
--- a/bluetooth/gavdp/test/tavsrcUI.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcUI.h"
-
-//
-// class CStreamerUI
-//
-CStreamerUI* CStreamerUI::NewL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon)
- {
- CStreamerUI* ui = new (ELeave) CStreamerUI ();
- CleanupStack::PushL(ui);
- ui->ConstructL(aDisplayPlaylist, aDisplayChunkyIcon);
- CleanupStack::Pop(ui);
- return ui;
- }
-
-CStreamerUI::CStreamerUI()
- {
- }
-
-void CStreamerUI::ConstructL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon)
- {
- if (aDisplayChunkyIcon)
- {
- iIconConsole = Console::NewL(_L("Icon"), TSize(-1,-1));
- }
-
- if (aDisplayPlaylist)
- {
- iPlayListConsole = Console::NewL(_L("Play List"), TSize(-1,-1));
- }
- }
-
-CStreamerUI::~CStreamerUI()
- {
- delete iIconConsole;
- iIconConsole = NULL;
- delete iPlayListConsole;
- iPlayListConsole = NULL;
- }
-
-void CStreamerUI::Play()
- {
- if (iIconConsole)
- {
- TBuf<KIconSize> line;
-
- iIconConsole->ClearScreen();
-
- for (TInt len=1; len<=KIconSize/2; len++)
- {
- line.AppendFill('*',len*2);
- iIconConsole->SetPos(KIconIndent,len);
- iIconConsole->Printf(line);
- iIconConsole->SetPos(KIconIndent,KIconSize-len);
- iIconConsole->Printf(line);
- line.Zero();
- }
- }
- DrawPointer();
- }
-
-void CStreamerUI::Pause()
- {
- if (iIconConsole)
- {
- TBuf<KIconSize> line;
-
- iIconConsole->ClearScreen();
- line.AppendFill('*',KIconSize/3);
- line.AppendFill(' ',KIconSize/3);
- line.AppendFill('*',KIconSize/3);
-
- for (TInt len=1; len<=KIconSize; len++)
- {
- iIconConsole->SetPos(KIconIndent,len);
- iIconConsole->Printf(line);
- }
- }
- }
-
-void CStreamerUI::Stop()
- {
- if (iIconConsole)
- {
- TBuf<KIconSize> line;
-
- iIconConsole->ClearScreen();
- line.AppendFill('*',KIconSize);
-
- for (TInt len=1; len<=KIconSize; len++)
- {
- iIconConsole->SetPos(KIconIndent,len);
- iIconConsole->Printf(line);
- }
- }
- }
-
-void CStreamerUI::AddTitle(const TDesC& aTitle)
- {
- if (iPlayListConsole)
- {
- iPlayListConsole->SetPos(KPlayListX+2);
- iPlayListConsole->Printf(_L("%S\n"), &aTitle);
- }
- }
-
-void CStreamerUI::Next()
- {
- ClearPointer();
- ++iPlayListY;
- DrawPointer();
- }
-
-void CStreamerUI::Prev()
- {
- ClearPointer();
- --iPlayListY;
- DrawPointer();
- }
-
-void CStreamerUI::First()
- {
- ClearPointer();
- iPlayListY = 0;
- DrawPointer();
- }
-
-void CStreamerUI::ClearPointer()
- {
- if (iPlayListConsole)
- {
- iPlayListConsole->SetPos(KPlayListX, iPlayListY);
- iPlayListConsole->Printf(_L(" "));
- }
- }
-
-void CStreamerUI::DrawPointer()
- {
- if (iPlayListConsole)
- {
- iPlayListConsole->SetPos(KPlayListX, iPlayListY);
- iPlayListConsole->Printf(_L(">"));
- }
- }
-
-static const TInt KProgressBarSize = 70;
-
-//
-// class CProgressBar
-//
-CProgressBar::CProgressBar(TInt aMaximum) : iMax(aMaximum)
- {
- }
-
-CProgressBar::~CProgressBar()
- {
- delete iConsole;
- }
-
-CProgressBar* CProgressBar::NewL(TInt aMaximum)
- {
- CProgressBar* p = new (ELeave) CProgressBar(aMaximum);
- CleanupStack::PushL(p);
- p->ConstructL();
- CleanupStack::Pop(p);
- return p;
- }
-
-void CProgressBar::Increment(TInt aStep)
- {
- iValue+=aStep;
- if (iValue < 0)
- {
- iValue = 0;
- }
-#ifdef __WINS__
- Redraw();
-#endif
- }
-
-void CProgressBar::ConstructL()
- {
-#ifdef __WINS__
- iConsole = Console::NewL(_L("Progress"), TSize(KProgressBarSize+5,1));
- Redraw();
-#endif
- }
-
-void CProgressBar::Redraw()
- {
- iConsole->SetPos(0);
-
- TBuf<KProgressBarSize> bar;
- TInt numDone = ((iValue*KProgressBarSize) /iMax);
- TInt numToDo = 0;
-
- if (numDone<bar.MaxLength())
- {
- bar.AppendFill('|',numDone);
- numToDo = KProgressBarSize - numDone;
- }
- bar.AppendFill('-',numToDo);
-
- iConsole->Printf(bar);
- }
--- a/bluetooth/gavdp/test/tavsrcUI.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCUI_H
-#define TAVSRCUI_H
-
-#include <e32base.h>
-#include <e32cons.h>
-
-static const TUint KIconSize = 36;
-static const TUint KIconIndent = 36;
-static const TUint KPlayListX = 2;
-
-class CStreamerUI : public CBase
- {
-public:
- static CStreamerUI* NewL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon);
- ~CStreamerUI();
- void Play();
- void Pause();
- void Stop();
- void AddTitle(const TDesC& aTitle);
- void Next();
- void Prev();
- void First();
-
-private:
- CStreamerUI();
- void ConstructL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon);
- void ClearPointer();
- void DrawPointer();
-
-private:
- CConsoleBase* iIconConsole;
- CConsoleBase* iPlayListConsole;
- TInt iPlayListY;
- };
-
-class CProgressBar : public CBase
- {
-public:
- static CProgressBar* NewL(TInt aMaximum);
- void Increment(TInt aStep);
- ~CProgressBar();
-
-private:
- CProgressBar(TInt aMaximum);
- void ConstructL();
- void Redraw();
-
-private:
- TInt iMax;
- TInt iValue;
- CConsoleBase* iConsole;
- };
-
-#endif // TAVSRCUI_H
--- a/bluetooth/gavdp/test/tavsrcUtils.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,394 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include "tavsrcUtils.h"
-#include "tavsrcConsole.h"
-
-#include <bluetoothav.h>
-#include <btextnotifiers.h>
-
-#include <f32file.h>
-#include <e32math.h>
-
-void TTavsrcUtils::RegisterSinkSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle,
- TBool aHeadphone, TBool aSpeaker, TBool aRecorder,
- TBool aAmp)
- {
- CSdpAttrValue* attrVal = 0;
- CSdpAttrValueDES* attrValDES = 0;
-
- // Set Attr 1 (service class list) to list with UUID = Audio Sink
- aDB.CreateServiceRecordL(TUUID(KAudioSinkUUID), aRecHandle);
-
- // Protocol Descriptor List
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP
- ->BuildUintL(TSdpIntBuf<TUint16>(KAVDTP)) // PSM = AVDTP
- ->EndListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // Version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- //BrowseGroupList
- /*
- This has been added in order to be interoperable with remote devices which only look for the
- service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature.
- */
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root)
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = NULL;
-
- // Language
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUintL(TSdpIntBuf<TUint16>(KLanguageEnglish))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdCharacterEncodingUTF8))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdBasePrimaryLanguage))
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- // BT Profile Description
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()->StartListL()
- ->BuildUUIDL(KAdvancedAudioDistributionUUID)
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES);
-
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- // provider name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution sink"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service description
- attrVal = CSdpAttrValueString::NewStringL(_L8("kick back and listen to some fine tunes with this neat service"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // supported features
- TUint16 supportedFeatures = aHeadphone ? 1:0;
- supportedFeatures|=aSpeaker ? 2:0;
- supportedFeatures|=aRecorder ? 4:0;
- supportedFeatures|=aAmp ? 8:0;
- attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf<TUint16>(supportedFeatures));
- CleanupStack::PushL(attrVal);
-
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdSupportedFeatures, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
- }
-
-void TTavsrcUtils::RegisterSourceSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle,
- TBool aPlayer, TBool aMic, TBool aTuner, TBool aMixer)
- {
- CSdpAttrValue* attrVal = 0;
- CSdpAttrValueDES* attrValDES = 0;
-
- // Set Attr 1 (service class list) to list with UUID = Audio Sink
- aDB.CreateServiceRecordL(TUUID(KAudioSourceUUID), aRecHandle);
-
- // Protocol Descriptor List
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP
- ->BuildUintL(TSdpIntBuf<TUint16>(KAVDTP)) // PSM = AVDTP
- ->EndListL()
- ->BuildDESL()
- ->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // Version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- //BrowseGroupList
- /*
- This has been added in order to be interoperable with remote devices which only look for the
- service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature.
- */
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root)
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = NULL;
-
- // Language
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildUintL(TSdpIntBuf<TUint16>(KLanguageEnglish))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdCharacterEncodingUTF8))
- ->BuildUintL(TSdpIntBuf<TUint16>(KSdpAttrIdBasePrimaryLanguage))
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES);
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- // BT Profile Description
- attrValDES = CSdpAttrValueDES::NewDESL(0);
- CleanupStack::PushL(attrValDES);
-
- attrValDES->StartListL()
- ->BuildDESL()->StartListL()
- ->BuildUUIDL(KAdvancedAudioDistributionUUID)
- ->BuildUintL(TSdpIntBuf<TUint16>(0x0100)) // version
- ->EndListL()
- ->EndListL();
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES);
-
- CleanupStack::PopAndDestroy(attrValDES);
- attrValDES = 0;
-
- // provider name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service name
- attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution source"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // service description
- attrVal = CSdpAttrValueString::NewStringL(_L8("plug your wireless cans into me!"));
- CleanupStack::PushL(attrVal);
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
-
- // supported features
- TUint16 supportedFeatures = aPlayer ? 1:0;
- supportedFeatures|=aMic ? 2:0;
- supportedFeatures|=aTuner ? 4:0;
- supportedFeatures|=aMixer ? 8:0;
- attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf<TUint16>(supportedFeatures));
- CleanupStack::PushL(attrVal);
-
- aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdSupportedFeatures, *attrVal);
- CleanupStack::PopAndDestroy(attrVal);
- attrVal = 0;
- }
-
-TInt TTavsrcUtils::GetIntFromUser(CConsoleBase& aConsole)
- {
- TBuf<4> inpb;
- aConsole.Printf(_L(":"));
- TInt x = aConsole.WhereX();
- TInt y = aConsole.WhereY();
- TRequestStatus stat;
-
- TChar ch(0); // set it to anything to prevent warning
- while ((ch!='\n')&&(ch!='\r') && inpb.Length()==0)
- {
- aConsole.Read(stat);
- User::WaitForRequest(stat);
- ch = aConsole.KeyCode();
-
- if ((ch=='\b') && (inpb.Length()>0))
- {
- inpb.Delete(inpb.Length()-1,1);
- }
-
- if ((inpb.Length()<4)&&((ch>='0')&&(ch<='9')))
- {
- inpb.Append(ch);
- }
-
- aConsole.SetPos(x,y);
- aConsole.Printf(_L("%S"),&inpb);
- }
-
- TLex lex(inpb);
- TInt res;
- return (lex.Val(res)==KErrNone) ? res : 0;
- }
-
-TBool TTavsrcUtils::GetYNFromUser(CConsoleBase& aConsole, const TDesC& aDes)
- {
- TBuf<4> inpb;
- aConsole.Printf(_L("%S (y/n):"),&aDes);
- TRequestStatus stat;
-
- TChar ch(0); // set it to anything to prevent warning
- while ((ch!='n')&&(ch!='y'))
- {
- aConsole.Read(stat);
- User::WaitForRequest(stat);
- ch = aConsole.KeyCode();
- }
- aConsole.Printf(_L("%c"), static_cast<TUint>(ch));
- return (ch=='y') ? ETrue : EFalse;
- }
-
-void TTavsrcUtils::GetDeviceAddressL(TBTDevAddr& aAddr)
- {
- //Ask user which device address we should connect to...
- RNotifier notify;
- User::LeaveIfError(notify.Connect());
- TBTDeviceSelectionParamsPckg pckg;
- TBTDeviceResponseParamsPckg resPckg;
- TRequestStatus stat;
- notify.StartNotifierAndGetResponse(stat, KDeviceSelectionNotifierUid, pckg, resPckg);
- User::WaitForRequest(stat);
- notify.CancelNotifier(KDeviceSelectionNotifierUid);
- notify.Close();
- User::LeaveIfError(stat.Int());
-
- aAddr = resPckg().BDAddr();
- }
-
-TInt TTavsrcUtils::GetCodecSettingsFromSBCFile(RFile& aFile, TInt aPos, TInt& aChannelMode,
- TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen,
- TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod)
- {
- TInt err = KErrNone;
-
- TBuf8<4> header;
- aFile.Read(aPos, header);
- TInt syncWord = header[0];
- __ASSERT_ALWAYS(syncWord==0x9C, User::Invariant());
-
- TInt sampleFreq = (header[1]&0xC0)>>6;
- TInt blockLen = (header[1]&0x30)>>4;
- aChannelMode = (header[1]&0x0C)>>2;
- aAllocMethod = (header[1]&0x02)>>1;
- TInt subBands = (header[1]&0x01);
- aBitPool = header[2];
-
- aNumChannels = (aChannelMode==0) ? 1 : 2;
- aNumSubbands = (subBands==1) ? 8 : 4;
-
- switch (sampleFreq)
- {
- case 0x00:
- aFreq = 16000;
- break;
- case 0x01:
- aFreq = 32000;
- break;
- case 0x02:
- aFreq = 44100;
- break;
- case 0x03:
- aFreq = 48000;
- break;
- }
-
- switch (blockLen)
- {
- case 0x00:
- aBlkLen = 4;
- break;
- case 0x01:
- aBlkLen = 8;
- break;
- case 0x02:
- aBlkLen = 12;
- break;
- case 0x03:
- aBlkLen = 16;
- break;
- }
-
- return err;
- }
-
-TInt TTavsrcUtils::GetCodecSettingsFromSBCFile(const TDesC& aFileName, TInt& aChannelMode,
- TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen,
- TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod)
- {
- TInt err = KErrNone;
-
- RFs fileserver;
- RFile file;
-
- err = fileserver.Connect();
- if (!err)
- {
- err = file.Open(fileserver,aFileName,EFileRead | EFileShareReadersOnly);
- }
- if (err)
- {
- return err;
- }
-
- err = GetCodecSettingsFromSBCFile(file, 0, aChannelMode, aNumChannels, aNumSubbands,
- aBlkLen, aBitPool, aFreq, aAllocMethod);
- file.Close();
- fileserver.Close();
-
- return err;
- }
-
-TInt TTavsrcUtils::CEIL(TReal aX)
- {
- TReal frac;
- Math::Frac(frac,aX);
- return (frac < 0.5) ? aX :aX+1;
- }
--- a/bluetooth/gavdp/test/tavsrcUtils.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#ifndef TAVSRCUTILS_H
-#define TAVSRCUTILS_H
-
-#include <e32def.h>
-#include <btsdp.h>
-#include <f32file.h>
-
-class TTavsrcUtils
- {
-public:
- // SDP helper functions
- static void RegisterSinkSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle,
- TBool aHeadphone, TBool aSpeaker,TBool aRecorder,TBool aAmp);
- static void RegisterSourceSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle,
- TBool aPlayer, TBool aMic, TBool aTuner, TBool aMixer);
-
- // User input helper functions
- static TInt GetIntFromUser(CConsoleBase& aConsole);
- static TBool GetYNFromUser(CConsoleBase& aConsole, const TDesC& aDes);
-
- static void GetDeviceAddressL(TBTDevAddr& aAddr);
-
- static TInt GetCodecSettingsFromSBCFile(RFile& aFile, TInt aPos, TInt& aChannelMode,
- TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen,
- TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod);
-
- static TInt GetCodecSettingsFromSBCFile(const TDesC& aFileName, TInt& aChannelMode,
- TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen,
- TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod);
-
- static TInt CEIL(TReal aX);
- };
-
-#endif // TAVSRCUTILS_H
-
--- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseaware.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,981 +0,0 @@
-// Copyright (c) 2007-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:
-//
-
-#include <e32property.h>
-#include <f32file.h>
-#include <e32debug.h>
-#include <barsc2.h>
-#include <remcondatabaseawarenowplayingtarget.h>
-#include <remcondatabaseawaremediabrowsetarget.h>
-#include <remcondatabaseawaremedialibrarybrowse.h>
-#include <remcondatabaseawarenowplayingbrowse.h>
-#include <remconmediaerror.h>
-#include <reftsp/reftspactiveplayerobserver.h>
-
-#include "browsingframe.h"
-
-#include "tavsrc.h"
-#include "tavsrcmtupdaterdatabaseaware.h"
-#include "activecallbackconsole.h"
-
-#ifdef __WINS__
-GLDEF_D TSize gUpdaterConsole(75,30);
-GLDEF_D TSize gBrowseConsole(75,30);
-#else
-GLDEF_D TSize gUpdaterConsole(KConsFullScreen,KConsFullScreen);
-GLDEF_D TSize gBrowseConsole(KConsFullScreen,KConsFullScreen);
-#endif
-
-
-#define BROWSE_CONSOLE iMtBrowseConsole
-
-const TRemConItemUid KUidMarker = 0xc0ffeeee00000000ull;
-const TRemConItemUid KFolderMarker = 0x0000000100000000ull;
-const TInt KNumberFolderItemsInFolder = 1;
-const TInt KNumberMediaItemsInFolder = 1502;
-const TInt KNumberItemsInFolder = KNumberMediaItemsInFolder + KNumberFolderItemsInFolder;
-const TInt KMaxFolderDepth = 10;
-
-_LIT8(KFolderName, "Folder%08x");
-
-CTavsrcMtUpdater* CTavsrcMtUpdater::NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces)
- {
- CTavsrcMtUpdater* mt = new(ELeave)CTavsrcMtUpdater();
- CleanupStack::PushL(mt);
- mt->ConstructL(aIfSel, aRemConInterfaces);
- CleanupStack::Pop();
- return mt;
- }
-
-struct TMediaBrowseThreadParams
- {
- CRemConInterfaceSelector* iIfSel;
- CTavsrcMtUpdater* iUpdater;
- };
-
-TInt CTavsrcMtUpdater::MediaBrowseThread(TAny* aPtr)
- {
- TMediaBrowseThreadParams* params = reinterpret_cast<TMediaBrowseThreadParams*>(aPtr);
-
- CTrapCleanup* cleanupStack = CTrapCleanup::New();
- CActiveScheduler* activescheduler = new CActiveScheduler;
- CActiveScheduler::Install(activescheduler);
-
- TInt err = KErrNoMemory;
- if(cleanupStack && activescheduler)
- {
- CTavsrcMtUpdater* self = params->iUpdater;
- TRAP(err, self->BrowseSetupL(*(params->iIfSel)))
- RThread().Rendezvous(err);
- if(err == KErrNone)
- {
- CActiveScheduler::Start();
- }
- self->BrowseCleanup();
- }
-
- delete activescheduler;
- delete cleanupStack;
-
- return err;
- }
-
-void CTavsrcMtUpdater::BrowseSetupL(CRemConInterfaceSelector& aIfSel)
- {
- iMtBrowseConsole = CActiveCallBackConsole::NewL(BrowseKeyPressed, this, _L("MtBrowse"),gBrowseConsole);
- BrowseMenu();
-
- iMtBrowseStopper = CStopBrowseWatcher::NewL();
- iMediaBrowse = CRemConDatabaseAwareMediaBrowseTarget::NewL(aIfSel,
- *this, *this, EFalse, iMediaBrowseInterface,
- iNowPlayingBrowseInterface,
- iUidCounter);
- iMtBrowseStopper->Start();
- }
-
-void CTavsrcMtUpdater::BrowseCleanup()
- {
- delete iMtBrowseStopper; iMtBrowseStopper = NULL;
- delete iMtBrowseConsole; iMtBrowseConsole = NULL;
- }
-
-
-void CTavsrcMtUpdater::ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces)
- {
- if (aRemConInterfaces & EPlayerInformation)
- {
- iPlayerInformation = CPlayerInfoTarget::NewL(aIfSel,
- iPlayerCapabilitiesObserver,
- iPlayerApplicationSettingsObserver,
- iPlayerEventsObserver,
- *this);
- }
-
- if (aRemConInterfaces & ENowPlaying)
- {
- iNowPlaying = CRemConDatabaseAwareNowPlayingTarget::NewL(aIfSel, *this);
- }
-
- if (aRemConInterfaces & EMediaBrowse)
- {
- // Create media browse thread (and wait until it is running)...
- TMediaBrowseThreadParams params;
- params.iIfSel = &aIfSel;
- params.iUpdater = this;
- TRequestStatus status;
- User::LeaveIfError(iMediaBrowseThread.Create(KNullDesC, CTavsrcMtUpdater::MediaBrowseThread, KDefaultStackSize, NULL, ¶ms));
- iMediaBrowseThread.Rendezvous(status);
- iMediaBrowseThread.Resume();
- User::WaitForRequest(status);
- User::LeaveIfError(status.Int());
- iMediaBrowseThreadOpen = ETrue;
- }
-
- iMtUpdaterConsole = CActiveConsole::NewL(*this,_L("MtUpdater"),gUpdaterConsole);
-
-
- // configure the PlayerInformation from resource file
- ReadAVRCPSettingsFile(KAVRCPSettingsResourceFilename);
-
- // We don't need to call AddEvent() for PlaybackStatusChanged or TrackChanged
- // since these are mandatory events which must be supported. A KErrAlreadyExists
- // error is returned if these are called from here.
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackStatusChanged);
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackChanged);
-
- // configure the interface with the events supported by tavsrc
- // This cannot fail as we constructed the iNotificationEvents array to have a granularity sufficient to
- // contain all events without having to grow
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedEnd));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedEnd);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedStart));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedStart);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlaybackPosChanged));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationBatteryStatusChanged));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationBatteryStatusChanged);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlayerApplicationSettingChanged));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlayerApplicationSettingChanged);
-
- // save a Company ID
- iPlayerCapabilitiesObserver->AddCompanyId(0x4321);
- iCompanyIds.InsertInOrderL(0x4321);
-
- // set the player events to some test values
- iPlayerEventsObserver->TrackReachedEnd();
-
- // playing 12, which is 2:30 long with a low battery
- iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EStopped);
- iPlaybackStatus = MPlayerEventsObserver::EStopped;
-
- iPlayerEventsObserver->TrackChanged(12, 150*1000);
- iLength = 150*1000;
-
- iPlayerEventsObserver->SetBatteryStatus(MPlayerEventsObserver::ECritical);
- iBatteryStatus = MPlayerEventsObserver::ECritical;
-
- // current position is 1 minute 10 secs though track 12
- iPlayerEventsObserver->SetPlaybackPosition(70000);
- iPosition = 70000;
-
- _LIT_SECURITY_POLICY_PASS(KPassPolicy);
- TInt err = RProperty::Define(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProperty::EInt, KPassPolicy, KPassPolicy);
- if(err != KErrNone && err != KErrAlreadyExists)
- {
- User::Leave(err);
- }
-
- MtMenu();
- }
-
-CTavsrcMtUpdater::CTavsrcMtUpdater()
- : iNotificationEvents(ERegisterNotificationReservedLast),
- iUidCounter(1)
- {
- }
-
-CTavsrcMtUpdater::~CTavsrcMtUpdater()
- {
- delete iMtUpdaterConsole;
- iNotificationEvents.Close();
- iCompanyIds.Close();
- if(iMediaBrowseThreadOpen)
- {
- TRequestStatus status;
- iMediaBrowseThread.Logon(status);
- iMtBrowseStopper->Complete();
- User::WaitForRequest(status);
- // the browse thread should not be running now.
- }
- iMediaBrowseThread.Close();
- }
-
-void CTavsrcMtUpdater::ReadAVRCPSettingsFile(const TDesC& aResourceFileName)
-/**
- - Creates the resource reader.
- - Reads the default policy evaluator and dialog creator UIDs.
- - Reads the number of policies in the resource file.
-
-@param aRFs The file server session used by the resource parser.
-@param aResourceFileName The name of the AVRCP settings file to read.
-*/
- {
- RFs rfs;
- rfs.Connect();
- RFile r;
- User::LeaveIfError(r.Open(rfs, aResourceFileName, EFileRead | EFileShareReadersOnly));
- CleanupClosePushL(r);
- TInt size;
- User::LeaveIfError(r.Size(size));
- CleanupStack::PopAndDestroy(&r);
-
- CResourceFile* resourceFile = CResourceFile::NewLC(rfs, aResourceFileName, 0, size);
- PlayerApplicationSettingsResourceInit::DefineAttributesL(*iPlayerApplicationSettingsObserver, *resourceFile);
- CleanupStack::PopAndDestroy(resourceFile);
- }
-
-void CTavsrcMtUpdater::KeyPressed(TChar aKey)
- {
-
- switch(aKey)
- {
- case 'e':
- {
- AddEvent(ERegisterNotificationPlaybackPosChanged);
- iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged);
- iMtUpdaterConsole->Console().Printf(_L("Add event EPlaybackPosChanged\n"));
- break;
- }
- case 'c':
- {
- AddCompanyId(0x5678);
- (void)iCompanyIds.InsertInOrder(0x5678);
- iMtUpdaterConsole->Console().Printf(_L("Add CompanyId 0x5678\n"));
- break;
- }
- case '1':
- {
- PlackbackStatusChanged(NextPlaybackStatus());
- iMtUpdaterConsole->Console().Printf(_L("Playback status changed %d\n"),iPlaybackStatus);
- break;
- }
- case '2':
- {
- TrackChanged(++iIndex, KDefaultLength);
- iMtUpdaterConsole->Console().Printf(_L("Track changed\n"));
- break;
- }
- case '3':
- {
- TrackReachedEnd();
- iMtUpdaterConsole->Console().Printf(_L("Track reached end\n"));
- break;
- }
- case '4':
- {
- TrackReachedStart();
- iMtUpdaterConsole->Console().Printf(_L("Track reached end\n"));
- break;
- }
- case '5':
- {
- iPosition += KPositionIncrement;
- SetPlaybackPosition(iPosition);
- iMtUpdaterConsole->Console().Printf(_L("Position %d\n"),iPosition );
- break;
- case '6':
- {
- SetBatteryStatus(NextBatteryStatus());
- iMtUpdaterConsole->Console().Printf(_L("BatteryStatus %d\n"),iBatteryStatus );
- break;
- }
- }
- case '8':
- {
- // change an application setting,
- // increment the value if attribute ID no 1 for example
- // CPlayerInfoTarget
- iPlayerApplicationSettingsObserver->SetAttributeL(1, 2);
- iMtUpdaterConsole->Console().Printf(_L("Increment the value if attribute ID no 1\n") );
- break;
- }
- case '9':
- {
- // Update NowPlayingList
- iNowPlaying->NowPlayingContentChanged();
-
- iMtUpdaterConsole->Console().Printf(_L("Now Playing List updated\n") );
- break;
- }
- case '0':
- {
- User::SafeInc(*reinterpret_cast<TInt*>(&iUidCounter)); // Might get dodgy when reaching 0x80000000
- iMediaBrowseInterface->MrcdamlbMediaLibraryStateChange(iUidCounter);
- iMtUpdaterConsole->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter);
- break;
- }
- case 'a':
- {
- SetAsActivePlayer();
- break;
- }
- default:
- iMtUpdaterConsole->Console().Printf(_L("No such command\n"));
- break;
- };
-
- MtMenu();
- }
-
-void CTavsrcMtUpdater::MtMenu()
- {
- DisplayCurrentState();
-
- iMtUpdaterConsole->Console().Printf(_L("e.\tAddEvent\n"));
- iMtUpdaterConsole->Console().Printf(_L("c.\tAddCompanyId\n"));
- iMtUpdaterConsole->Console().Printf(_L("1.\tPlaybackStatusChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("2.\tTrackChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("3.\tTrackReachedEnd\n"));
- iMtUpdaterConsole->Console().Printf(_L("4.\tTrackReachedStart\n"));
- iMtUpdaterConsole->Console().Printf(_L("5.\tPlaybackPositionChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("6.\tSetBatteryStatus\n"));
- iMtUpdaterConsole->Console().Printf(_L("8.\tAttributeChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("9.\tNowPlayingContentChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("0.\tUIDsChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("\n"));
-
- iMtUpdaterConsole->RequestKey();
- }
-
-TInt CTavsrcMtUpdater::BrowseKeyPressed(TAny* aPtr, TChar aKey)
- {
- TRAPD(err, static_cast<CTavsrcMtUpdater*>(aPtr)->BrowseKeyPressedL(aKey));
- return err;
- }
-
-void CTavsrcMtUpdater::BrowseKeyPressedL(TChar aKey)
- {
- switch(aKey)
- {
- case '0':
- {
- User::SafeInc(*reinterpret_cast<TInt*>(&iUidCounter)); // Might get dodgy when reaching 0x80000000
- iMediaBrowseInterface->MrcdamlbMediaLibraryStateChange(iUidCounter);
- BROWSE_CONSOLE->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter);
- break;
- }
- default:
- BROWSE_CONSOLE->Console().Printf(_L("No such command\n"));
- break;
- };
-
- BrowseMenu();
- }
-
-void CTavsrcMtUpdater::BrowseMenu()
- {
- BROWSE_CONSOLE->Console().Printf(_L("0.\tUIDsChanged\n"));
- BROWSE_CONSOLE->Console().Printf(_L("\n"));
-
- BROWSE_CONSOLE->RequestKey();
- }
-
-void CTavsrcMtUpdater::AddEvent(TRegisterNotificationEvent aEvent)
- {
- iPlayerCapabilitiesObserver->AddEvent(aEvent);
- }
-
-void CTavsrcMtUpdater::AddCompanyId(TInt aCompanyId)
- {
- // save a Company ID
- iPlayerCapabilitiesObserver->AddCompanyId(aCompanyId);
- }
-
-void CTavsrcMtUpdater::TrackReachedEnd()
- {
- iPlayerEventsObserver->TrackReachedEnd();
- }
-
-void CTavsrcMtUpdater::TrackReachedStart()
- {
- iPlayerEventsObserver->TrackReachedStart();
- }
-
-void CTavsrcMtUpdater::PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus)
- {
- iPlayerEventsObserver->PlaybackStatusChanged(aPlaybackStatus);
- }
-
-void CTavsrcMtUpdater::TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds)
- {
- iPlayerEventsObserver->TrackChanged(aIndex, aLengthInMilliseconds);
- }
-
-void CTavsrcMtUpdater::SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus)
- {
- iPlayerEventsObserver->SetBatteryStatus(aStatus);
- }
-
-void CTavsrcMtUpdater::SetPlaybackPosition(TUint32 aPosition)
- {
- iPlayerEventsObserver->SetPlaybackPosition(aPosition);
- }
-
-void CTavsrcMtUpdater::SetAsActivePlayer()
- {
- TInt err = RProperty::Set(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProcess().Id());
- iMtUpdaterConsole->Console().Printf(_L("Set as active player %d\n"), err);
- }
-
-MPlayerEventsObserver::TPlaybackStatus CTavsrcMtUpdater::NextPlaybackStatus()
- {
- if(iPlaybackStatus == MPlayerEventsObserver::EStopped)
- {
- iPlaybackStatus = MPlayerEventsObserver::EPlaying;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::EPlaying)
- {
- iPlaybackStatus = MPlayerEventsObserver::EPaused;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::EPaused)
- {
- iPlaybackStatus = MPlayerEventsObserver::EFwdSeek;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::EFwdSeek)
- {
- iPlaybackStatus = MPlayerEventsObserver::ERevSeek;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::ERevSeek)
- {
- iPlaybackStatus = MPlayerEventsObserver::EStopped;
- }
-
- return iPlaybackStatus;
- }
-
-MPlayerEventsObserver::TTargetBatteryStatus CTavsrcMtUpdater::NextBatteryStatus()
- {
- if(iBatteryStatus == MPlayerEventsObserver::ENormal)
- {
- iBatteryStatus = MPlayerEventsObserver::EWarning;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::EWarning)
- {
- iBatteryStatus = MPlayerEventsObserver::ECritical;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::ECritical)
- {
- iBatteryStatus = MPlayerEventsObserver::EExternal;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::EExternal)
- {
- iBatteryStatus = MPlayerEventsObserver::EFullCharge;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::EFullCharge)
- {
- iBatteryStatus = MPlayerEventsObserver::ENormal;
- }
-
- return iBatteryStatus;
- }
-
-// from MPlayerApplicationSettingsNotify
-void CTavsrcMtUpdater::MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue)
-
- {
- for (TInt i=0; i < aAttributeID.Count(); i++)
- {
- iMtUpdaterConsole->Console().Printf(_L("SetPlayerApplication attribute:%d value:%d \n"),aAttributeID[i], aAttributeValue[i]);
- }
- }
-
-void CTavsrcMtUpdater::MrcdanptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter)
- {
- iMtUpdaterConsole->Console().Printf(_L("* PlayItem %08x %08x\t scope %d remote uidcounter %d\n"), aItem>>32, aItem & 0xffffffff, aScope, aUidCounter);
-
- if(iUidCounter != aUidCounter)
- {
- iMtUpdaterConsole->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter);
- iNowPlaying->PlayItemResponse(KErrInvalidMediaLibraryStateCookie);
- }
- else
- {
- iNowPlaying->PlayItemResponse(KErrNone);
- }
- }
-
-void CTavsrcMtUpdater::MrcdanptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter)
- {
- iMtUpdaterConsole->Console().Printf(_L("* AddToNowPlaying %08x%08x\t scope %d uidcounter %d\n"), aItem>>32, aItem, aScope, aUidCounter);
-
- if(iUidCounter != aUidCounter)
- {
- iMtUpdaterConsole->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter);
- iNowPlaying->AddToNowPlayingResponse(KErrInvalidMediaLibraryStateCookie);
- }
- else
- {
- iNowPlaying->AddToNowPlayingResponse(KErrNone);
- }
- }
-
-void CTavsrcMtUpdater::MrcdamlboGetFolderListing(TRemConFolderScope aScope, TUint aStartItem, TUint aEndItem)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* GetFolderItems scope %d, start item %d, end item %d\n"), aScope, aStartItem, aEndItem);
- // FIXME handle scopes
- TInt err = aStartItem < KNumberItemsInFolder ? KErrNone : KErrMediaBrowseInvalidOffset;
-
- TInt numberItems = (iFolderDepth == KMaxFolderDepth) ? KNumberMediaItemsInFolder : KNumberItemsInFolder;
- TInt numberFolderItems = (iFolderDepth == KMaxFolderDepth) ? 0 : KNumberFolderItemsInFolder;
-
- RArray<TRemConItem> folderListing;
- if(!err)
- {
- for(TInt i = aStartItem; (i <= aEndItem) && (i < numberItems) && !err; i++)
- {
- // FIXME handle erro
- TRemConItem item;
- item.iUid = static_cast<TRemConItemUid>(i) | KUidMarker;
- item.iType = ERemConMediaItem;
- if(i < numberFolderItems)
- {
- item.iUid = static_cast<TRemConItemUid>(i) | KFolderMarker;
- item.iType = ERemConFolderItem;
- }
-
- err = folderListing.Append(item);
- }
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing"));
- }
- iMediaBrowseInterface->MrcdamlbFolderListing(folderListing.Array(), iUidCounter, err);
-
- folderListing.Close();
- }
-
-void CTavsrcMtUpdater::SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid)
- {
- _LIT8(KTestTitle, "Test Title 0x%08x%08x");
- aAttribute.iCharset = KUtf8MibEnum;
-
- switch(aAttribute.iAttributeId)
- {
- case ETitleOfMedia:
- {
- //buffer.Copy(KMediaTitle);
- aAttribute.iString = HBufC8::NewL(29);
- TPtr8 namePtr = aAttribute.iString->Des();
- namePtr.AppendFormat(KTestTitle, (aUid >> 32), aUid);
- aAttribute.iStringLen = namePtr.Length();
- break;
- }
- /*
- case ENameOfArtist:
- buffer.Copy(KArtistName);
- break;
- case ENameOfAlbum:
- buffer.Copy(KAlbumName);
- break;
- case ETrackNumber:
- buffer.Copy(KTrackNumber);
- break;
- case ENumberOfTracks:
- buffer.Copy(KNumberOfTracks);
- break;
- case EGenre:
- buffer.Copy(KGenre);
- break;
- case EPlayingTime:
- buffer.Copy(KPlayingTime);
- break;
- */
- default:
- // __DEBUGGER();
- User::Leave(KErrNotFound);
- break;
- }
- }
-
-void CTavsrcMtUpdater::MrcdamlboFolderUp(TUint16 aMediaLibraryStateCookie)
- {
- TInt err = (aMediaLibraryStateCookie == iUidCounter) ? KErrNone : KErrInvalidMediaLibraryStateCookie;
-
- if(!err && --iFolderDepth < 0)
- {
- iFolderDepth = 0;
- err = KErrMediaBrowseNotADirectory;
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Folder Up\n"));
- }
- else if(err == KErrInvalidMediaLibraryStateCookie)
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error: remote uidcounter (%d) does not match local(%d)\n"), aMediaLibraryStateCookie, iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err);
- }
- iMediaBrowseInterface->MrcdamlbFolderUpResult(KNumberItemsInFolder, err);
- }
-
-void CTavsrcMtUpdater::MrcdamlboFolderDown(const TRemConItemUid& aFolder, TUint16 aMediaLibraryStateCookie)
- {
- TInt err = (aMediaLibraryStateCookie == iUidCounter) ? KErrNone : KErrInvalidMediaLibraryStateCookie;
-
- if(!(aFolder & KFolderMarker))
- {
- err = KErrMediaBrowseNotADirectory;
- }
- else if(!err && ++iFolderDepth > KMaxFolderDepth)
- {
- iFolderDepth = KMaxFolderDepth;
- err = KErrNotSupported;
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Folder down %08x %08x\n"), aFolder >> 32, aFolder);
- }
- else if(err == KErrInvalidMediaLibraryStateCookie)
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error: remote uidcounter (%d) does not match local(%d)\n"), aMediaLibraryStateCookie, iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err);
- }
- iMediaBrowseInterface->MrcdamlbFolderDownResult(KNumberItemsInFolder, err);
- }
-
-void CTavsrcMtUpdater::MrcdamlboGetPath(RPointerArray<HBufC8>& aPath)
- {
- TInt err = KErrNone;
- for(TInt i = 0; (i < iFolderDepth) && (err == KErrNone); i++)
- {
- HBufC8* name = HBufC8::NewL(14);
- name->Des().AppendFormat(KFolderName, iFolderDepth);
- err = aPath.Append(name);
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Player set as browsed: folder items = %d, uid counter = %d\n"), KNumberItemsInFolder, iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Error %d setting as browsed player"), err);
- }
- iMediaBrowseInterface->MrcdamlbGetPathResult(KNumberItemsInFolder, iUidCounter, err);
- }
-
-void CTavsrcMtUpdater::MrcdamlboSearch(const TDesC8& /*aSearch*/)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Search (returning not supported)"));
-
- iMediaBrowseInterface->MrcdamlbSearchResult(0, iUidCounter, KErrAvrcpAirSearchNotSupported);
- }
-
-void CTavsrcMtUpdater::DisplayCurrentState()
- {
- iMtUpdaterConsole->Console().Printf(_L("**************************************************\n"));
- iMtUpdaterConsole->Console().Printf(_L("* CURRENT STATE\n*\n"));
-
- iMtUpdaterConsole->Console().Printf(_L("* Supported Events:\t"));
- for(TInt i=0; i<iNotificationEvents.Count(); i++)
- {
- iMtUpdaterConsole->Console().Printf(_L("0x%.8x\t"), iNotificationEvents[i]);
- }
- iMtUpdaterConsole->Console().Printf(_L("\n"));
-
- iMtUpdaterConsole->Console().Printf(_L("* Supported Company Ids:\t"));
- for(TInt i=0; i<iCompanyIds.Count(); i++)
- {
- iMtUpdaterConsole->Console().Printf(_L("0x%.8x\t"), iCompanyIds[i]);
- }
- iMtUpdaterConsole->Console().Printf(_L("\n"));
-
- iMtUpdaterConsole->Console().Printf(_L("* Playback Status: "));
- switch(iPlaybackStatus)
- {
- case MPlayerEventsObserver::EStopped:
- iMtUpdaterConsole->Console().Printf(_L("STOPPED\n"));
- break;
- case MPlayerEventsObserver::EPlaying:
- iMtUpdaterConsole->Console().Printf(_L("PLAYING\n"));
- break;
- case MPlayerEventsObserver::EPaused:
- iMtUpdaterConsole->Console().Printf(_L("PAUSED\n"));
- break;
- case MPlayerEventsObserver::EFwdSeek:
- iMtUpdaterConsole->Console().Printf(_L("FWD_SEEK\n"));
- break;
- case MPlayerEventsObserver::ERevSeek:
- iMtUpdaterConsole->Console().Printf(_L("REV_SEEK\n"));
- break;
- default:
- ASSERT(EFalse);
- break;
- }
-
- iMtUpdaterConsole->Console().Printf(_L("* Position: %d\n"), iPosition);
- iMtUpdaterConsole->Console().Printf(_L("* Length: %d\n"), iLength);
-
- iMtUpdaterConsole->Console().Printf(_L("* Battery Status: "), iBatteryStatus);
- switch(iBatteryStatus)
- {
- case MPlayerEventsObserver::ENormal:
- iMtUpdaterConsole->Console().Printf(_L("NORMAL \n"));
- break;
- case MPlayerEventsObserver::EWarning:
- iMtUpdaterConsole->Console().Printf(_L("WARNING \n"));
- break;
- case MPlayerEventsObserver::ECritical:
- iMtUpdaterConsole->Console().Printf(_L("CRITICAL \n"));
- break;
- case MPlayerEventsObserver::EExternal:
- iMtUpdaterConsole->Console().Printf(_L("EXTERNAL \n"));
- break;
- case MPlayerEventsObserver::EFullCharge:
- iMtUpdaterConsole->Console().Printf(_L("FULL CHARGE \n"));
- break;
- case MPlayerEventsObserver::EUnknown:
- iMtUpdaterConsole->Console().Printf(_L("Unknown\n"));
- default:
- ASSERT(EFalse);
- break;
- }
-
- iMtUpdaterConsole->Console().Printf(_L("**************************************************\n\n"));
- }
-
-void CTavsrcMtUpdater::MrcdanpboGetFolderListing(TUint aStartItem, TUint aEndItem)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* GetFolderItems NowPlaying start item %d, end item %d\n"), aStartItem, aEndItem);
-
- TInt err = aStartItem < KNumberItemsInFolder ? KErrNone : KErrMediaBrowseInvalidOffset;
-
- RArray<TRemConItem> folderListing;
- if(!err)
- {
- for(TInt i = aStartItem; (i <= aEndItem) && (i < KNumberItemsInFolder) && !err; i++)
- {
- // FIXME handle erro
- TRemConItem item;
- item.iUid = static_cast<TRemConItemUid>(i) | KUidMarker;
- item.iType = ERemConMediaItem;
- err = folderListing.Append(item);
- }
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing"));
- }
-
- iNowPlayingBrowseInterface->MrcdanpbFolderListing(folderListing.Array(), iUidCounter, err);
- }
-
-TInt CTavsrcMtUpdater::PrepareItemDataL(
- TMediaAttributeIter& aIter,
- const TRemConItemUid& aItemId,
- HBufC8* &aItemName,
- RArray<TMediaElementAttribute>& aItemAttributes)
- {
- /**
- First, construct the name of the media item.
- */
- _LIT8(KMediaItemName, "MediaItem 0x%08x%08x");
- _LIT8(KFolderItemName, "FolderItem 0x%08x%08x");
- HBufC8* itemName = HBufC8::NewL(30);
- TPtr8 namePtr = itemName->Des();
- TUint upper = aItemId >> 32;
- TUint lower = aItemId & 0xffffffff;
- if (aItemId & KUidMarker)
- {
- namePtr.AppendFormat(KMediaItemName, upper, lower);
- }
- else if(aItemId & KFolderMarker)
- {
- namePtr.AppendFormat(KFolderItemName, upper, lower);
- }
- else
- {
- ASSERT(NULL);
- }
- aItemName = itemName;
- /**
- Second, construct attributes of the item.
- */
- _LIT8(KAttributeName, "Attibute 0x%02x");
- TMediaElementAttribute attribute;
- TMediaAttributeId id;
- aIter.Start();
- while(aIter.Next(id))
- {
- //API takes the ownership.
- HBufC8* attributeName = HBufC8::NewL(30);
- TPtr8 attributeNamePtr = attributeName->Des();
- attributeNamePtr.AppendFormat(KAttributeName, id);
-
- attribute.iAttributeId = id;
- attribute.iString = attributeName;
- aItemAttributes.Append(attribute);
- }
-
- return KErrNone;
- }
-
-TInt CTavsrcMtUpdater::MrcdamlboGetItem(TRemConFolderScope /*aScope*/,
- const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter,
- TUint16 aMediaLibraryStateCookie)
- {
- if(iUidCounter != aMediaLibraryStateCookie)
- {
- BROWSE_CONSOLE->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter);
- return KErrInvalidMediaLibraryStateCookie;
- }
-
- TInt error = KErrNone;
- RArray<TMediaElementAttribute> itemAttributes;
- HBufC8* itemName = NULL;
- if (aItemId & KUidMarker)
- {
- PrepareItemDataL(aIter, aItemId, itemName, itemAttributes);
- iMediaBrowseInterface->MrcdamlbMediaElementItemResult(aItemId,
- *itemName,
- AvrcpBrowsing::KAudio,
- itemAttributes.Array(),
- KErrNone);
- }
- else if(aItemId & KFolderMarker)
- {
- PrepareItemDataL(aIter, aItemId, itemName, itemAttributes);
- iMediaBrowseInterface->MrcdamlbFolderItemResult(aItemId,
- *itemName,
- EFolderPlaylists,
- KFolderNotPlayable,
- itemAttributes.Array(),
- KErrNone);
- }
- else
- {
- error = KErrInvalidUid;
- }
-
- delete itemName;
- return error;
- }
-
-
-TInt CTavsrcMtUpdater::MrcdanpboGetItem(const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter,
- TUint16 aMediaLibraryStateCookie)
- {
- if(iUidCounter != aMediaLibraryStateCookie)
- {
- BROWSE_CONSOLE->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter);
- return KErrInvalidMediaLibraryStateCookie;
- }
-
- TInt error = KErrNone;
- RArray<TMediaElementAttribute> itemAttributes;
- if (aItemId & KUidMarker)
- {
- HBufC8* itemName;
- PrepareItemDataL(aIter, aItemId, itemName, itemAttributes);
- iNowPlayingBrowseInterface->MrcdanpbMediaElementItemResult(aItemId,
- *itemName,
- AvrcpBrowsing::KAudio,
- itemAttributes.Array(),
- KErrNone);
- delete itemName;
- }
- else
- {
- error = KErrInvalidUid;
- }
-
- return error;
- }
-
-CStopBrowseWatcher* CStopBrowseWatcher::NewL()
- {
- CStopBrowseWatcher* self = new(ELeave) CStopBrowseWatcher;
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-CStopBrowseWatcher::CStopBrowseWatcher()
- : CActive(EPriorityStandard)
- {
- CActiveScheduler::Add(this);
- }
-
-void CStopBrowseWatcher::ConstructL()
- {
- User::LeaveIfError(iThread.Open(RThread().Id()));
- }
-
-CStopBrowseWatcher::~CStopBrowseWatcher()
- {
- Cancel();
- iThread.Close();
- }
-
-void CStopBrowseWatcher::Start()
- {
- iStatus = KRequestPending;
- SetActive();
- }
-
-void CStopBrowseWatcher::Complete()
- {
- TRequestStatus* status = &iStatus;
- iThread.RequestComplete(status, KErrNone);
- }
-
-void CStopBrowseWatcher::RunL()
- {
- CActiveScheduler::Stop();
- }
-
-void CStopBrowseWatcher::DoCancel()
- {
- TRequestStatus* status = &iStatus;
- iThread.RequestComplete(status, KErrCancel);
- }
-
-
--- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseaware.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-// Copyright (c) 2007-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:
-// tavsrcmtupdater.h
-//
-
-#ifndef TAVSRCMTUPDATER_H
-#define TAVSRCMTUPDATER_H
-
-#include <remconmediainformationtargetobserver.h>
-#include <playerinformationtargetobserver.h>
-#include <remcondatabaseawarenowplayingtargetobserver.h>
-#include <remcondatabaseawarenowplayingbrowseobserver.h>
-#include <remcondatabaseawaremedialibrarybrowseobserver.h>
-#include <remcon/avrcpspec.h>
-#include "mediainformation.h"
-
-_LIT(KAVRCPSettingsResourceFilename, "z:\\bluetooth\\avrcp\\avrcp-settings.rsc");
-const TInt KDefaultLength = 120000;
-const TInt KPositionIncrement = 5000;
-
-class CStopBrowseWatcher
- : public CActive
- {
-public:
- static CStopBrowseWatcher* NewL();
- ~CStopBrowseWatcher();
-
- void Start();
- void Complete();
-
-private:
- CStopBrowseWatcher();
- void ConstructL();
-
-private: // from CActive
- void RunL();
- void DoCancel();
-
-private:
- RThread iThread;
- };
-
-class CActiveCallBackConsole;
-class CRemConDatabaseAwareNowPlayingTarget;
-class CRemConDatabaseAwareMediaBrowseTarget;
-class MRemConDatabaseAwareMediaLibraryBrowse;
-class MRemConDatabaseAwareNowPlayingBrowse;
-class CTavsrcMtUpdater : public CBase, public MActiveConsoleNotify,
- public MPlayerApplicationSettingsNotify,
- public MRemConDatabaseAwareMediaLibraryBrowseObserver,
- public MRemConDatabaseAwareNowPlayingBrowseObserver,
- public MRemConDatabaseAwareNowPlayingTargetObserver
- {
-public:
- static CTavsrcMtUpdater* NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces);
- ~CTavsrcMtUpdater();
-
-private:
- CTavsrcMtUpdater();
- void ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces);
-
- void KeyPressed(TChar aKey);
- void MtMenu();
-
- void ReadAVRCPSettingsFile(const TDesC& aResourceFileName);
-
- void AddEvent(TRegisterNotificationEvent aEvent);
- void AddCompanyId(TInt aCompanyId);
- void TrackReachedEnd();
- void TrackReachedStart();
- void PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus);
- void TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds);
- void SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus);
- void SetPlaybackPosition(TUint32 aPosition);
- void SetAsActivePlayer();
-
- MPlayerEventsObserver::TPlaybackStatus NextPlaybackStatus();
- MPlayerEventsObserver::TTargetBatteryStatus NextBatteryStatus();
-
-private:
- // from MPlayerApplicationSettingsNotify
- void MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue);
-
- // from MRemConDatabaseAwareNowPlayingTargetObserver
- void MrcdanptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter);
- void MrcdanptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter);
-
- // from MRemConDatabaseAwareMediaLibraryBrowseTargetObserver
- void MrcdamlboGetFolderListing(TRemConFolderScope aScope, TUint aStartItem, TUint aEndItem);
- void MrcdamlboFolderUp(TUint16 aMediaLibraryStateCookie);
- void MrcdamlboFolderDown(const TRemConItemUid& aFolder, TUint16 aMediaLibraryStateCookie);
- void MrcdamlboGetPath(RPointerArray<HBufC8>& aPath);
- void MrcdamlboSearch(const TDesC8& aSearch);
- TInt MrcdamlboGetItem(TRemConFolderScope aScope,
- const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter,
- TUint16 aMediaLibraryStateCookie);
-
- // from MRemConDatabaseAwareNowPlayingBrowseObserver
- void MrcdanpboGetFolderListing(TUint aStartItem, TUint aEndItem);
- TInt MrcdanpboGetItem(const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter,
- TUint16 aMediaLibraryStateCookie);
-
- void DisplayCurrentState();
- void SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid);
-
-private: // Utility functions
- TInt PrepareItemDataL(TMediaAttributeIter& aIter,
- const TRemConItemUid& aItemId,
- HBufC8* &aItemName,
- RArray<TMediaElementAttribute>& aItemAttributes);
-
-private: // second thread functions
- static TInt MediaBrowseThread(TAny* aPtr);
- void BrowseSetupL(CRemConInterfaceSelector& aIfSel);
- void BrowseCleanup();
-
- static TInt BrowseKeyPressed(TAny* aPtr, TChar aKey);
- void BrowseKeyPressedL(TChar aKey);
- void BrowseMenu();
-
-private:
- CPlayerInfoTarget* iPlayerInformation;
- MPlayerCapabilitiesObserver* iPlayerCapabilitiesObserver;
- MPlayerApplicationSettingsObserver* iPlayerApplicationSettingsObserver;
- MPlayerEventsObserver* iPlayerEventsObserver;
-
- CRemConDatabaseAwareMediaBrowseTarget* iMediaBrowse;
- MRemConDatabaseAwareMediaLibraryBrowse* iMediaBrowseInterface;
- MRemConDatabaseAwareNowPlayingBrowse* iNowPlayingBrowseInterface;
- CRemConDatabaseAwareNowPlayingTarget* iNowPlaying;
-
- CActiveConsole* iMtUpdaterConsole;
-
- CActiveCallBackConsole* iMtBrowseConsole;
-
- TInt iIndex;
- MPlayerEventsObserver::TPlaybackStatus iPlaybackStatus;
- MPlayerEventsObserver::TTargetBatteryStatus iBatteryStatus;
- TUint32 iPosition;
- TUint32 iLength;
-
-
- RArray<TInt> iNotificationEvents;
- RArray<TInt> iCompanyIds;
-
- TInt iFolderDepth;
-
- TUint iUidCounter;
-
- TBool iMediaBrowseThreadOpen;
- RThread iMediaBrowseThread;
- CStopBrowseWatcher* iMtBrowseStopper;
- };
-
-#endif //TAVSRCMTUPDATER_H
--- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseunaware.cpp Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,929 +0,0 @@
-// Copyright (c) 2007-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:
-// tavsrcmtupdater.cpp
-//
-
-#include <e32property.h>
-#include <f32file.h>
-#include <e32debug.h>
-#include <barsc2.h>
-#include <remcondatabaseunawarenowplayingtarget.h>
-#include <remcondatabaseunawaremediabrowsetarget.h>
-#include <remcondatabaseunawaremedialibrarybrowse.h>
-#include <remcondatabaseunawarenowplayingbrowse.h>
-#include <remconmediaerror.h>
-#include <reftsp/reftspactiveplayerobserver.h>
-
-#include "tavsrc.h"
-#include "tavsrcmtupdaterdatabaseunaware.h"
-#include "activecallbackconsole.h"
-
-#ifdef __WINS__
-GLDEF_D TSize gUpdaterConsole(75,30);
-GLDEF_D TSize gBrowseConsole(75,30);
-#else
-GLDEF_D TSize gUpdaterConsole(KConsFullScreen,KConsFullScreen);
-GLDEF_D TSize gBrowseConsole(KConsFullScreen,KConsFullScreen);
-#endif
-
-
-#define BROWSE_CONSOLE iMtBrowseConsole
-
-const TRemConItemUid KUidMarker = 0xc0ffeeee00000000ull;
-const TRemConItemUid KFolderMarker = 0x0000000100000000ull;
-const TInt KNumberFolderItemsInFolder = 1;
-const TInt KNumberMediaItemsInFolder = 1501;
-const TInt KNumberItemsInFolder = KNumberMediaItemsInFolder + KNumberFolderItemsInFolder;
-
-_LIT8(KFolderName, "Folder%08x");
-
-CTavsrcMtUpdater* CTavsrcMtUpdater::NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces)
- {
- CTavsrcMtUpdater* mt = new(ELeave)CTavsrcMtUpdater();
- CleanupStack::PushL(mt);
- mt->ConstructL(aIfSel, aRemConInterfaces);
- CleanupStack::Pop();
- return mt;
- }
-
-struct TMediaBrowseThreadParams
- {
- CRemConInterfaceSelector* iIfSel;
- CTavsrcMtUpdater* iUpdater;
- };
-
-TInt CTavsrcMtUpdater::MediaBrowseThread(TAny* aPtr)
- {
- TMediaBrowseThreadParams* params = reinterpret_cast<TMediaBrowseThreadParams*>(aPtr);
-
- CTrapCleanup* cleanupStack = CTrapCleanup::New();
- CActiveScheduler* activescheduler = new CActiveScheduler;
- CActiveScheduler::Install(activescheduler);
-
- TInt err = KErrNoMemory;
- if(cleanupStack && activescheduler)
- {
- CTavsrcMtUpdater* self = params->iUpdater;
- TRAP(err, self->BrowseSetupL(*(params->iIfSel)))
- RThread().Rendezvous(err);
- if(err == KErrNone)
- {
- CActiveScheduler::Start();
- }
- self->BrowseCleanup();
- }
-
- delete activescheduler;
- delete cleanupStack;
-
- return err;
- }
-
-void CTavsrcMtUpdater::BrowseSetupL(CRemConInterfaceSelector& aIfSel)
- {
- iMtBrowseConsole = CActiveCallBackConsole::NewL(BrowseKeyPressed, this, _L("MtBrowse"),gBrowseConsole);
- BrowseMenu();
-
- iMtBrowseStopper = CStopBrowseWatcher::NewL();
- iMediaBrowse = CRemConDatabaseUnawareMediaBrowseTarget::NewL(aIfSel,
- *this, *this, ETrue, iMediaBrowseInterface,
- iNowPlayingBrowseInterface);
- iMtBrowseStopper->Start();
- }
-
-void CTavsrcMtUpdater::BrowseCleanup()
- {
- delete iMtBrowseStopper; iMtBrowseStopper = NULL;
- delete iMtBrowseConsole; iMtBrowseConsole = NULL;
- }
-
-
-void CTavsrcMtUpdater::ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces)
- {
- if (aRemConInterfaces & EPlayerInformation)
- {
- iPlayerInformation = CPlayerInfoTarget::NewL(aIfSel,
- iPlayerCapabilitiesObserver,
- iPlayerApplicationSettingsObserver,
- iPlayerEventsObserver,
- *this);
- }
-
- if (aRemConInterfaces & ENowPlaying)
- {
- iNowPlaying = CRemConDatabaseUnawareNowPlayingTarget::NewL(aIfSel, *this);
- }
-
- if (aRemConInterfaces & EMediaBrowse)
- {
- // Create media browse thread (and wait until it is running)...
- TMediaBrowseThreadParams params;
- params.iIfSel = &aIfSel;
- params.iUpdater = this;
- TRequestStatus status;
- User::LeaveIfError(iMediaBrowseThread.Create(KNullDesC, CTavsrcMtUpdater::MediaBrowseThread, KDefaultStackSize, NULL, ¶ms));
- iMediaBrowseThread.Rendezvous(status);
- iMediaBrowseThread.Resume();
- User::WaitForRequest(status);
- User::LeaveIfError(status.Int());
- iMediaBrowseThreadOpen = ETrue;
- }
-
- iMtUpdaterConsole = CActiveConsole::NewL(*this,_L("MtUpdater"),gUpdaterConsole);
-
- // configure the PlayerInformation from resource file
- ReadAVRCPSettingsFile(KAVRCPSettingsResourceFilename);
-
- // We don't need to call AddEvent() for PlaybackStatusChanged or TrackChanged
- // since these are mandatory events which must be supported. A KErrAlreadyExists
- // error is returned if these are called from here.
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackStatusChanged);
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackChanged);
-
- // configure the interface with the events supported by tavsrc
- // This cannot fail as we constructed the iNotificationEvents array to have a granularity sufficient to
- // contain all events without having to grow
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedEnd));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedEnd);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedStart));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedStart);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlaybackPosChanged));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationBatteryStatusChanged));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationBatteryStatusChanged);
-
- User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlayerApplicationSettingChanged));
- (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlayerApplicationSettingChanged);
-
- // save a Company ID
- iPlayerCapabilitiesObserver->AddCompanyId(0x4321);
- iCompanyIds.InsertInOrderL(0x4321);
-
- // set the player events to some test values
- iPlayerEventsObserver->TrackReachedEnd();
-
- // playing 12, which is 2:30 long with a low battery
- iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EStopped);
- iPlaybackStatus = MPlayerEventsObserver::EStopped;
-
- iPlayerEventsObserver->TrackChanged(12, 150*1000);
- iLength = 150*1000;
-
- iPlayerEventsObserver->SetBatteryStatus(MPlayerEventsObserver::ECritical);
- iBatteryStatus = MPlayerEventsObserver::ECritical;
-
- // current position is 1 minute 10 secs though track 12
- iPlayerEventsObserver->SetPlaybackPosition(70000);
- iPosition = 70000;
-
- _LIT_SECURITY_POLICY_PASS(KPassPolicy);
- TInt err = RProperty::Define(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProperty::EInt, KPassPolicy, KPassPolicy);
- if(err != KErrNone && err != KErrAlreadyExists)
- {
- User::Leave(err);
- }
-
- MtMenu();
- }
-
-CTavsrcMtUpdater::CTavsrcMtUpdater()
- : iNotificationEvents(ERegisterNotificationReservedLast),
- iUidCounter(0)
- {
- }
-
-CTavsrcMtUpdater::~CTavsrcMtUpdater()
- {
- delete iMtUpdaterConsole;
- iNotificationEvents.Close();
- iCompanyIds.Close();
- if(iMediaBrowseThreadOpen)
- {
- TRequestStatus status;
- iMediaBrowseThread.Logon(status);
- iMtBrowseStopper->Complete();
- User::WaitForRequest(status);
- // the browse thread should not be running now.
- }
- iMediaBrowseThread.Close();
- }
-
-void CTavsrcMtUpdater::ReadAVRCPSettingsFile(const TDesC& aResourceFileName)
-/**
- - Creates the resource reader.
- - Reads the default policy evaluator and dialog creator UIDs.
- - Reads the number of policies in the resource file.
-
-@param aRFs The file server session used by the resource parser.
-@param aResourceFileName The name of the AVRCP settings file to read.
-*/
- {
- RFs rfs;
- rfs.Connect();
- RFile r;
- User::LeaveIfError(r.Open(rfs, aResourceFileName, EFileRead | EFileShareReadersOnly));
- CleanupClosePushL(r);
- TInt size;
- User::LeaveIfError(r.Size(size));
- CleanupStack::PopAndDestroy(&r);
-
- CResourceFile* resourceFile = CResourceFile::NewLC(rfs, aResourceFileName, 0, size);
- PlayerApplicationSettingsResourceInit::DefineAttributesL(*iPlayerApplicationSettingsObserver, *resourceFile);
- CleanupStack::PopAndDestroy(resourceFile);
- }
-
-void CTavsrcMtUpdater::KeyPressed(TChar aKey)
- {
-
- switch(aKey)
- {
- case 'e':
- {
- AddEvent(ERegisterNotificationPlaybackPosChanged);
- iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged);
- iMtUpdaterConsole->Console().Printf(_L("Add event EPlaybackPosChanged\n"));
- break;
- }
- case 'c':
- {
- AddCompanyId(0x5678);
- (void)iCompanyIds.InsertInOrder(0x5678);
- iMtUpdaterConsole->Console().Printf(_L("Add CompanyId 0x5678\n"));
- break;
- }
- case '1':
- {
- PlackbackStatusChanged(NextPlaybackStatus());
- iMtUpdaterConsole->Console().Printf(_L("Playback status changed %d\n"),iPlaybackStatus);
- break;
- }
- case '2':
- {
- TrackChanged(++iIndex, KDefaultLength);
- iMtUpdaterConsole->Console().Printf(_L("Track changed\n"));
- break;
- }
- case '3':
- {
- TrackReachedEnd();
- iMtUpdaterConsole->Console().Printf(_L("Track reached end\n"));
- break;
- }
- case '4':
- {
- TrackReachedStart();
- iMtUpdaterConsole->Console().Printf(_L("Track reached end\n"));
- break;
- }
- case '5':
- {
- iPosition += KPositionIncrement;
- SetPlaybackPosition(iPosition);
- iMtUpdaterConsole->Console().Printf(_L("Position %d\n"),iPosition );
- break;
- case '6':
- {
- SetBatteryStatus(NextBatteryStatus());
- iMtUpdaterConsole->Console().Printf(_L("BatteryStatus %d\n"),iBatteryStatus );
- break;
- }
- }
- case '8':
- {
- // change an application setting,
- // increment the value if attribute ID no 1 for example
- // CPlayerInfoTarget
- iPlayerApplicationSettingsObserver->SetAttributeL(1, 2);
- iMtUpdaterConsole->Console().Printf(_L("Increment the value if attribute ID no 1\n") );
- break;
- }
- case '9':
- {
- // Update NowPlayingList
- iNowPlaying->NowPlayingContentChanged();
-
- iMtUpdaterConsole->Console().Printf(_L("Now Playing List updated\n") );
- break;
- }
- case '0':
- {
- iMediaBrowseInterface->MrcdumlbMediaLibraryStateChange();
-
- iMtUpdaterConsole->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter);
- break;
- }
- case 'a':
- {
- SetAsActivePlayer();
- break;
- }
- default:
- iMtUpdaterConsole->Console().Printf(_L("No such command\n"));
- break;
- };
-
- MtMenu();
- }
-
-void CTavsrcMtUpdater::MtMenu()
- {
- DisplayCurrentState();
-
- iMtUpdaterConsole->Console().Printf(_L("e.\tAddEvent\n"));
- iMtUpdaterConsole->Console().Printf(_L("c.\tAddCompanyId\n"));
- iMtUpdaterConsole->Console().Printf(_L("1.\tPlaybackStatusChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("2.\tTrackChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("3.\tTrackReachedEnd\n"));
- iMtUpdaterConsole->Console().Printf(_L("4.\tTrackReachedStart\n"));
- iMtUpdaterConsole->Console().Printf(_L("5.\tPlaybackPositionChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("6.\tSetBatteryStatus\n"));
- iMtUpdaterConsole->Console().Printf(_L("8.\tAttributeChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("9.\tNowPlayingContentChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("0.\tUIDsChanged\n"));
- iMtUpdaterConsole->Console().Printf(_L("\n"));
-
- iMtUpdaterConsole->RequestKey();
- }
-
-TInt CTavsrcMtUpdater::BrowseKeyPressed(TAny* aPtr, TChar aKey)
- {
- TRAPD(err, static_cast<CTavsrcMtUpdater*>(aPtr)->BrowseKeyPressedL(aKey));
- return err;
- }
-
-void CTavsrcMtUpdater::BrowseKeyPressedL(TChar aKey)
- {
- switch(aKey)
- {
- case '0':
- {
- iMediaBrowseInterface->MrcdumlbMediaLibraryStateChange();
- BROWSE_CONSOLE->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter);
- break;
- }
- default:
- BROWSE_CONSOLE->Console().Printf(_L("No such command\n"));
- break;
- };
-
- BrowseMenu();
- }
-
-void CTavsrcMtUpdater::BrowseMenu()
- {
- BROWSE_CONSOLE->Console().Printf(_L("0.\tUIDsChanged\n"));
- BROWSE_CONSOLE->Console().Printf(_L("\n"));
-
- BROWSE_CONSOLE->RequestKey();
- }
-
-void CTavsrcMtUpdater::AddEvent(TRegisterNotificationEvent aEvent)
- {
- iPlayerCapabilitiesObserver->AddEvent(aEvent);
- }
-
-void CTavsrcMtUpdater::AddCompanyId(TInt aCompanyId)
- {
- // save a Company ID
- iPlayerCapabilitiesObserver->AddCompanyId(aCompanyId);
- }
-
-void CTavsrcMtUpdater::TrackReachedEnd()
- {
- iPlayerEventsObserver->TrackReachedEnd();
- }
-
-void CTavsrcMtUpdater::TrackReachedStart()
- {
- iPlayerEventsObserver->TrackReachedStart();
- }
-
-void CTavsrcMtUpdater::PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus)
- {
- iPlayerEventsObserver->PlaybackStatusChanged(aPlaybackStatus);
- }
-
-void CTavsrcMtUpdater::TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds)
- {
- iPlayerEventsObserver->TrackChanged(aIndex, aLengthInMilliseconds);
- }
-
-void CTavsrcMtUpdater::SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus)
- {
- iPlayerEventsObserver->SetBatteryStatus(aStatus);
- }
-
-void CTavsrcMtUpdater::SetPlaybackPosition(TUint32 aPosition)
- {
- iPlayerEventsObserver->SetPlaybackPosition(aPosition);
- }
-
-void CTavsrcMtUpdater::SetAsActivePlayer()
- {
- TInt err = RProperty::Set(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProcess().Id());
- iMtUpdaterConsole->Console().Printf(_L("Set as active player %d\n"), err);
- }
-
-MPlayerEventsObserver::TPlaybackStatus CTavsrcMtUpdater::NextPlaybackStatus()
- {
- if(iPlaybackStatus == MPlayerEventsObserver::EStopped)
- {
- iPlaybackStatus = MPlayerEventsObserver::EPlaying;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::EPlaying)
- {
- iPlaybackStatus = MPlayerEventsObserver::EPaused;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::EPaused)
- {
- iPlaybackStatus = MPlayerEventsObserver::EFwdSeek;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::EFwdSeek)
- {
- iPlaybackStatus = MPlayerEventsObserver::ERevSeek;
- }
- else if(iPlaybackStatus == MPlayerEventsObserver::ERevSeek)
- {
- iPlaybackStatus = MPlayerEventsObserver::EStopped;
- }
-
- return iPlaybackStatus;
- }
-
-MPlayerEventsObserver::TTargetBatteryStatus CTavsrcMtUpdater::NextBatteryStatus()
- {
- if(iBatteryStatus == MPlayerEventsObserver::ENormal)
- {
- iBatteryStatus = MPlayerEventsObserver::EWarning;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::EWarning)
- {
- iBatteryStatus = MPlayerEventsObserver::ECritical;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::ECritical)
- {
- iBatteryStatus = MPlayerEventsObserver::EExternal;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::EExternal)
- {
- iBatteryStatus = MPlayerEventsObserver::EFullCharge;
- }
- else if(iBatteryStatus == MPlayerEventsObserver::EFullCharge)
- {
- iBatteryStatus = MPlayerEventsObserver::ENormal;
- }
-
- return iBatteryStatus;
- }
-
-// from MPlayerApplicationSettingsNotify
-void CTavsrcMtUpdater::MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue)
-
- {
- for (TInt i=0; i < aAttributeID.Count(); i++)
- {
- iMtUpdaterConsole->Console().Printf(_L("SetPlayerApplication attribute:%d value:%d \n"),aAttributeID[i], aAttributeValue[i]);
- }
- }
-
-void CTavsrcMtUpdater::MrcdunptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope)
- {
- iMtUpdaterConsole->Console().Printf(_L("* PlayItem 0x%08x%08x\t scope %d \n"), aItem>>32, aItem, aScope);
- iNowPlaying->PlayItemResponse(0x11);
- }
-
-void CTavsrcMtUpdater::MrcdunptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope)
- {
- iMtUpdaterConsole->Console().Printf(_L("* AddToNowPlaying 0x%08x%08x\t scope %d\n"), aItem>>32, aItem, aScope);
- iNowPlaying->AddToNowPlayingResponse(KErrNone);
- }
-
-void CTavsrcMtUpdater::MrcdumlboGetFolderListing(TRemConFolderScope /*aScope*/, TUint aStartItem, TUint aEndItem)
- {
- // FIXME handle scopes
- TInt err = KErrNone;
-
- RArray<TRemConItem> folderListing;
- for(TInt i = aStartItem; (i <= aEndItem) && (i < KNumberItemsInFolder) && !err; i++)
- {
- // FIXME handle erro
- TRemConItem item;
- item.iUid = static_cast<TRemConItemUid>(i) | KUidMarker;
- item.iType = ERemConMediaItem;
- if(i < KNumberFolderItemsInFolder)
- {
- item.iUid = static_cast<TRemConItemUid>(i) | KFolderMarker;
- item.iType = ERemConFolderItem;
- }
-
- err = folderListing.Append(item);
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing"));
- }
- iMediaBrowseInterface->MrcdumlbFolderListing(folderListing.Array(), err);
-
- folderListing.Close();
- }
-
-void CTavsrcMtUpdater::SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid)
- {
- _LIT8(KTestTitle, "Test Title 0x%08x%08x");
- aAttribute.iCharset = KUtf8MibEnum;
-
- switch(aAttribute.iAttributeId)
- {
- case ETitleOfMedia:
- {
- //buffer.Copy(KMediaTitle);
- aAttribute.iString = HBufC8::NewL(29);
- TPtr8 namePtr = aAttribute.iString->Des();
- namePtr.AppendFormat(KTestTitle, (aUid >> 32), aUid);
- aAttribute.iStringLen = namePtr.Length();
- break;
- }
- /*
- case ENameOfArtist:
- buffer.Copy(KArtistName);
- break;
- case ENameOfAlbum:
- buffer.Copy(KAlbumName);
- break;
- case ETrackNumber:
- buffer.Copy(KTrackNumber);
- break;
- case ENumberOfTracks:
- buffer.Copy(KNumberOfTracks);
- break;
- case EGenre:
- buffer.Copy(KGenre);
- break;
- case EPlayingTime:
- buffer.Copy(KPlayingTime);
- break;
- */
- default:
- // __DEBUGGER();
- User::Leave(KErrNotFound);
- break;
- }
- }
-
-void CTavsrcMtUpdater::MrcdumlboFolderUp()
- {
- TInt err = KErrNone;
-
- if(!err && --iFolderDepth < 0)
- {
- iFolderDepth = 0;
- err = KErrNotSupported;
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Folder Up\n"));
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err);
- }
- iMediaBrowseInterface->MrcdumlbFolderUpResult(KNumberItemsInFolder, err);
- }
-
-void CTavsrcMtUpdater::MrcdumlboFolderDown(const TRemConItemUid& aFolder)
- {
- TInt err = KErrNone;
-
- if(!(aFolder & KFolderMarker))
- {
- err = KErrNotFound;
- }
- else if(!err && ++iFolderDepth > 10)
- {
- iFolderDepth = 10;
- err = KErrNotSupported;
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Folder down %08x %08x\n"), aFolder >> 32, aFolder);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err);
- }
- iMediaBrowseInterface->MrcdumlbFolderDownResult(KNumberItemsInFolder, err);
- }
-
-void CTavsrcMtUpdater::MrcdumlboGetPath(RPointerArray<HBufC8>& aPath)
- {
- TInt err = KErrNone;
- for(TInt i = 0; (i < iFolderDepth) && (err == KErrNone); i++)
- {
- HBufC8* name = HBufC8::NewL(14);
- name->Des().AppendFormat(KFolderName, iFolderDepth);
- err = aPath.Append(name);
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Player set as browsed: folder items = %d, uid counter = %d\n"), KNumberItemsInFolder, iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Error %d setting as browsed player"), err);
- }
- iMediaBrowseInterface->MrcdumlbGetPathResult(KNumberItemsInFolder, err);
- }
-
-void CTavsrcMtUpdater::MrcdumlboSearch(const TDesC8& /*aSearch*/)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* Search (returning not supported)"));
-
- iMediaBrowseInterface->MrcdumlbSearchResult(0, KErrNotSupported);
- }
-
-void CTavsrcMtUpdater::DisplayCurrentState()
- {
- iMtUpdaterConsole->Console().Printf(_L("**************************************************\n"));
- iMtUpdaterConsole->Console().Printf(_L("* CURRENT STATE\n*\n"));
-
- iMtUpdaterConsole->Console().Printf(_L("* Supported Events:\t"));
- for(TInt i=0; i<iNotificationEvents.Count(); i++)
- {
- iMtUpdaterConsole->Console().Printf(_L("0x%.8x\t"), iNotificationEvents[i]);
- }
- iMtUpdaterConsole->Console().Printf(_L("\n"));
-
- iMtUpdaterConsole->Console().Printf(_L("* Supported Company Ids:\t"));
- for(TInt i=0; i<iCompanyIds.Count(); i++)
- {
- iMtUpdaterConsole->Console().Printf(_L("0x%.8x\t"), iCompanyIds[i]);
- }
- iMtUpdaterConsole->Console().Printf(_L("\n"));
-
- iMtUpdaterConsole->Console().Printf(_L("* Playback Status: "));
- switch(iPlaybackStatus)
- {
- case MPlayerEventsObserver::EStopped:
- iMtUpdaterConsole->Console().Printf(_L("STOPPED\n"));
- break;
- case MPlayerEventsObserver::EPlaying:
- iMtUpdaterConsole->Console().Printf(_L("PLAYING\n"));
- break;
- case MPlayerEventsObserver::EPaused:
- iMtUpdaterConsole->Console().Printf(_L("PAUSED\n"));
- break;
- case MPlayerEventsObserver::EFwdSeek:
- iMtUpdaterConsole->Console().Printf(_L("FWD_SEEK\n"));
- break;
- case MPlayerEventsObserver::ERevSeek:
- iMtUpdaterConsole->Console().Printf(_L("REV_SEEK\n"));
- break;
- default:
- ASSERT(EFalse);
- break;
- }
-
- iMtUpdaterConsole->Console().Printf(_L("* Position: %d\n"), iPosition);
- iMtUpdaterConsole->Console().Printf(_L("* Length: %d\n"), iLength);
-
- iMtUpdaterConsole->Console().Printf(_L("* Battery Status: "), iBatteryStatus);
- switch(iBatteryStatus)
- {
- case MPlayerEventsObserver::ENormal:
- iMtUpdaterConsole->Console().Printf(_L("NORMAL \n"));
- break;
- case MPlayerEventsObserver::EWarning:
- iMtUpdaterConsole->Console().Printf(_L("WARNING \n"));
- break;
- case MPlayerEventsObserver::ECritical:
- iMtUpdaterConsole->Console().Printf(_L("CRITICAL \n"));
- break;
- case MPlayerEventsObserver::EExternal:
- iMtUpdaterConsole->Console().Printf(_L("EXTERNAL \n"));
- break;
- case MPlayerEventsObserver::EFullCharge:
- iMtUpdaterConsole->Console().Printf(_L("FULL CHARGE \n"));
- break;
- case MPlayerEventsObserver::EUnknown:
- iMtUpdaterConsole->Console().Printf(_L("Unknown\n"));
- default:
- ASSERT(EFalse);
- break;
- }
-
- iMtUpdaterConsole->Console().Printf(_L("**************************************************\n\n"));
- }
-
-void CTavsrcMtUpdater::MrcdunpboGetFolderListing(TUint aStartItem, TUint aEndItem)
- {
- BROWSE_CONSOLE->Console().Printf(_L("* GetFolderItems NowPlaying start item %d, end item %d\n"), aStartItem, aEndItem);
-
- TInt err = KErrNone;
-
- RArray<TRemConItem> folderListing;
- for(TInt i = aStartItem; (i <= aEndItem) && (i < KNumberItemsInFolder) && !err; i++)
- {
- // FIXME handle erro
- TRemConItem item;
- item.iUid = static_cast<TRemConItemUid>(i) | KUidMarker;
- item.iType = ERemConMediaItem;
- err = folderListing.Append(item);
- }
-
- if(!err)
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter);
- }
- else
- {
- BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing"));
- }
-
- iNowPlayingBrowseInterface->MrcdunpbFolderListing(folderListing.Array(), err);
- }
-
-TInt CTavsrcMtUpdater::PrepareItemDataL(
- TMediaAttributeIter& aIter,
- const TRemConItemUid& aItemId,
- HBufC8* &aItemName,
- RArray<TMediaElementAttribute>& aItemAttributes)
- {
- /**
- First, construct the name of the media item.
- */
- _LIT8(KMediaItemName, "MediaItem 0x%08x%08x");
- _LIT8(KFolderItemName, "FolderItem 0x%08x%08x");
- HBufC8* itemName = HBufC8::NewL(30);
- TPtr8 namePtr = itemName->Des();
- TUint upper = aItemId >> 32;
- TUint lower = aItemId & 0xffffffff;
- if (aItemId & KUidMarker)
- {
- namePtr.AppendFormat(KMediaItemName, upper, lower);
- }
- else if(aItemId & KFolderMarker)
- {
- namePtr.AppendFormat(KFolderItemName, upper, lower);
- }
- else
- {
- ASSERT(NULL);
- }
- aItemName = itemName;
- /**
- Second, construct attributes of the item.
- */
- _LIT8(KAttributeName, "Attibute 0x%02x");
- TMediaElementAttribute attribute;
- TMediaAttributeId id;
- aIter.Start();
- while(aIter.Next(id))
- {
- //API takes the ownership.
- HBufC8* attributeName = HBufC8::NewL(30);
- TPtr8 attributeNamePtr = attributeName->Des();
- attributeNamePtr.AppendFormat(KAttributeName, id);
-
- attribute.iAttributeId = id;
- attribute.iString = attributeName;
- aItemAttributes.Append(attribute);
- }
-
- return KErrNone;
- }
-
-TInt CTavsrcMtUpdater::MrcdumlboGetItem(TRemConFolderScope aScope,
- const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter)
- {
- //FIXME handle the error: uidcounter doesn't match
-
- TInt error = KErrNone;
- RArray<TMediaElementAttribute> itemAttributes;
- HBufC8* itemName;
- if (aItemId & KUidMarker)
- {
- PrepareItemDataL(aIter, aItemId, itemName, itemAttributes);
- iMediaBrowseInterface->MrcdumlbMediaElementItemResult(aItemId,
- *itemName,
- AvrcpBrowsing::KAudio,
- itemAttributes.Array(),
- KErrNone);
- }
- else if(aItemId & KFolderMarker)
- {
- PrepareItemDataL(aIter, aItemId, itemName, itemAttributes);
- iMediaBrowseInterface->MrcdumlbFolderItemResult(aItemId,
- *itemName,
- EFolderPlaylists,
- KFolderNotPlayable,
- itemAttributes.Array(),
- KErrNone);
- }
- else
- {
- error = KErrInvalidUid;
- }
-
- delete itemName;
- return error;
- }
-
-TInt CTavsrcMtUpdater::MrcdunpboGetItem(const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter)
- {
- //FIXME handle the error: uidcounter doesn't match.
-
- TInt error = KErrNone;
- RArray<TMediaElementAttribute> itemAttributes;
- HBufC8* itemName;
- if (aItemId & KUidMarker)
- {
- PrepareItemDataL(aIter, aItemId, itemName, itemAttributes);
- iNowPlayingBrowseInterface->MrcdunpbMediaElementItemResult(aItemId,
- *itemName,
- AvrcpBrowsing::KAudio,
- itemAttributes.Array(),
- KErrNone);
- }
- else
- {
- error = KErrInvalidUid;
- }
-
- delete itemName;
- return error;
- }
-
-CStopBrowseWatcher* CStopBrowseWatcher::NewL()
- {
- CStopBrowseWatcher* self = new(ELeave) CStopBrowseWatcher;
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-CStopBrowseWatcher::CStopBrowseWatcher()
- : CActive(EPriorityStandard)
- {
- CActiveScheduler::Add(this);
- }
-
-void CStopBrowseWatcher::ConstructL()
- {
- User::LeaveIfError(iThread.Open(RThread().Id()));
- }
-
-CStopBrowseWatcher::~CStopBrowseWatcher()
- {
- Cancel();
- iThread.Close();
- }
-
-void CStopBrowseWatcher::Start()
- {
- iStatus = KRequestPending;
- SetActive();
- }
-
-void CStopBrowseWatcher::Complete()
- {
- TRequestStatus* status = &iStatus;
- iThread.RequestComplete(status, KErrNone);
- }
-
-void CStopBrowseWatcher::RunL()
- {
- CActiveScheduler::Stop();
- }
-
-void CStopBrowseWatcher::DoCancel()
- {
- TRequestStatus* status = &iStatus;
- iThread.RequestComplete(status, KErrCancel);
- }
-
-
--- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseunaware.h Tue Jul 06 15:33:04 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-// Copyright (c) 2007-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:
-// tavsrcmtupdater.h
-//
-
-#ifndef TAVSRCMTUPDATER_H
-#define TAVSRCMTUPDATER_H
-
-#include <remconmediainformationtargetobserver.h>
-#include <playerinformationtargetobserver.h>
-#include <remcondatabaseunawarenowplayingtargetobserver.h>
-#include <remcondatabaseunawarenowplayingbrowseobserver.h>
-#include <remcondatabaseunawaremedialibrarybrowseobserver.h>
-#include <remcon/avrcpspec.h>
-#include "mediainformation.h"
-
-_LIT(KAVRCPSettingsResourceFilename, "z:\\bluetooth\\avrcp\\avrcp-settings.rsc");
-const TInt KDefaultLength = 120000;
-const TInt KPositionIncrement = 5000;
-
-class CStopBrowseWatcher
- : public CActive
- {
-public:
- static CStopBrowseWatcher* NewL();
- ~CStopBrowseWatcher();
-
- void Start();
- void Complete();
-
-private:
- CStopBrowseWatcher();
- void ConstructL();
-
-private: // from CActive
- void RunL();
- void DoCancel();
-
-private:
- RThread iThread;
- };
-
-class CActiveCallBackConsole;
-class CRemConDatabaseUnawareMediaBrowseTarget;
-class MRemConDatabaseUnawareMediaLibraryBrowse;
-class MRemConDatabaseUnawareNowPlayingBrowse;
-class CRemConDatabaseUnawareNowPlayingTarget;
-class CTavsrcMtUpdater : public CBase, public MActiveConsoleNotify,
- public MPlayerApplicationSettingsNotify,
- public MRemConDatabaseUnawareMediaLibraryBrowseObserver,
- public MRemConDatabaseUnawareNowPlayingBrowseObserver,
- public MRemConDatabaseUnawareNowPlayingTargetObserver
- {
-public:
- static CTavsrcMtUpdater* NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces);
- ~CTavsrcMtUpdater();
-
-private:
- CTavsrcMtUpdater();
- void ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces);
-
- void KeyPressed(TChar aKey);
- void MtMenu();
-
- void ReadAVRCPSettingsFile(const TDesC& aResourceFileName);
-
- void AddEvent(TRegisterNotificationEvent aEvent);
- void AddCompanyId(TInt aCompanyId);
- void TrackReachedEnd();
- void TrackReachedStart();
- void PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus);
- void TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds);
- void SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus);
- void SetPlaybackPosition(TUint32 aPosition);
- void SetAsActivePlayer();
-
- MPlayerEventsObserver::TPlaybackStatus NextPlaybackStatus();
- MPlayerEventsObserver::TTargetBatteryStatus NextBatteryStatus();
-
-private:
- // from MPlayerApplicationSettingsNotify
- void MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue);
-
- // from MRemConDatabaseUnawareNowPlayingTargetObserver
- void MrcdunptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope);
- void MrcdunptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope);
-
- // from MRemConDatabaseUnawareMediaLibraryBrowseObserver
- void MrcdumlboGetFolderListing(TRemConFolderScope aScope, TUint aStartItem, TUint aEndItem);
- void MrcdumlboFolderUp();
- void MrcdumlboFolderDown(const TRemConItemUid& aFolder);
- void MrcdumlboGetPath(RPointerArray<HBufC8>& aPath);
- void MrcdumlboSearch(const TDesC8& aSearch);
- TInt MrcdumlboGetItem(TRemConFolderScope aScope,
- const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter);
-
- // from MRemConDatabaseUnawareNowPlayingBrowseObserver
- void MrcdunpboGetFolderListing(TUint aStartItem, TUint aEndItem);
- TInt MrcdunpboGetItem(const TRemConItemUid& aItemId,
- TMediaAttributeIter& aIter);
-
- void DisplayCurrentState();
- void SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid);
-
-private: // Utility functions
- TInt PrepareItemDataL(TMediaAttributeIter& aIter,
- const TRemConItemUid& aItemId,
- HBufC8* &aItemName,
- RArray<TMediaElementAttribute>& aItemAttributes);
-
-private: // second thread functions
- static TInt MediaBrowseThread(TAny* aPtr);
- void BrowseSetupL(CRemConInterfaceSelector& aIfSel);
- void BrowseCleanup();
-
- static TInt BrowseKeyPressed(TAny* aPtr, TChar aKey);
- void BrowseKeyPressedL(TChar aKey);
- void BrowseMenu();
-
-private:
- CPlayerInfoTarget* iPlayerInformation;
- MPlayerCapabilitiesObserver* iPlayerCapabilitiesObserver;
- MPlayerApplicationSettingsObserver* iPlayerApplicationSettingsObserver;
- MPlayerEventsObserver* iPlayerEventsObserver;
-
- CRemConDatabaseUnawareMediaBrowseTarget* iMediaBrowse;
- MRemConDatabaseUnawareMediaLibraryBrowse* iMediaBrowseInterface;
- MRemConDatabaseUnawareNowPlayingBrowse* iNowPlayingBrowseInterface;
- CRemConDatabaseUnawareNowPlayingTarget* iNowPlaying;
-
- CActiveConsole* iMtUpdaterConsole;
- CActiveCallBackConsole* iMtBrowseConsole;
-
- TInt iIndex;
- MPlayerEventsObserver::TPlaybackStatus iPlaybackStatus;
- MPlayerEventsObserver::TTargetBatteryStatus iBatteryStatus;
- TUint32 iPosition;
- TUint32 iLength;
-
-
- RArray<TInt> iNotificationEvents;
- RArray<TInt> iCompanyIds;
-
- TInt iFolderDepth;
-
- TUint iUidCounter;
-
- TBool iMediaBrowseThreadOpen;
- RThread iMediaBrowseThread;
- CStopBrowseWatcher* iMtBrowseStopper;
- };
-
-#endif //TAVSRCMTUPDATER_H
--- a/bluetoothcommsprofiles/btpan/panagt/panagtremdev.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetoothcommsprofiles/btpan/panagt/panagtremdev.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -93,7 +93,7 @@
{
iRemSockAddr.SetBTAddr(aRemDevAddr);
iRemSockAddr.SetPort(KBnepPsm);
- iSockServ.Connect();
+ User::LeaveIfError(iSockServ.Connect());
#ifdef __FLOG_ACTIVE
TBuf<KMaxBtAddrSize> tempDevAddrBuf;
@@ -138,7 +138,7 @@
// make a note of the remote device address
iSocket.RemoteName(iRemSockAddr);
- iSockServ.Connect();
+ User::LeaveIfError(iSockServ.Connect());
#ifdef __FLOG_ACTIVE
TBuf<KMaxBtAddrSize> tempDevAddrBuf;
--- a/bluetoothcommsprofiles/btpan/refBnepPacketNotifier/src/refBnepPacketNotifier.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetoothcommsprofiles/btpan/refBnepPacketNotifier/src/refBnepPacketNotifier.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -82,7 +82,7 @@
devByteCount.iByteCount=0;
devByteCount.iTickCount=0;
devByteCount.iAddr=aAddr;
- iCounter.Append(devByteCount);
+ (void)iCounter.Append(devByteCount);
}
void CRefBnepPacketNotifier::MbpnDeviceRemoved(const TBTDevAddr& aAddr)
--- a/bluetoothmgmt/bluetoothclientlib/btlib/btsynclink.cpp Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/btlib/btsynclink.cpp Wed Aug 18 10:54:44 2010 +0300
@@ -160,7 +160,6 @@
// This needs to be a macro or the 'return' won't return properly
#define CLOSE_RETURN_IF_ERROR(error) if (error) { LinkDown(); SCOSocket().Close(); ESCOSocket().Close(); return error; }
-#define CLOSE_LISTENER_RETURN_IF_ERROR(error) if (error) { ListeningSCOSocket().Close(); ListeningESCOSocket().Close(); return error; }
EXPORT_C TInt CBluetoothSynchronousLink::SetupConnection(const TBTDevAddr& aBDAddr, const TBTSyncPackets& aPacketTypes)
{
@@ -191,23 +190,17 @@
if (packetsESCO)
{
iSCOTypes |= EeSCO;
- openESCO = ETrue;
+ openESCO = ETrue;
}
// but must be one
__ASSERT_ALWAYS(packetsSCO || packetsESCO, Panic(EBadSyncPacketTypes));
- if (iBTSynchronousLinkAttacherSCO->IsActive())
+ if (iBTSynchronousLinkAttacherSCO->IsActive() || iBTSynchronousLinkAttacherESCO->IsActive())
{
FLOG(_L("Link attacher already active"));
return KErrInUse;
}
-
- if (iBTSynchronousLinkAttacherESCO->IsActive())
- {
- FLOG(_L("Link attacher already active"));
- return KErrInUse;
- }
TInt linkState = LinkUp(aBDAddr);
if (linkState != KErrNone)
@@ -337,16 +330,12 @@
*/
EXPORT_C TInt CBluetoothSynchronousLink::Disconnect()
{
- if (!SCOSocket().SubSessionHandle())
+ if (!SCOSocket().SubSessionHandle() && !ESCOSocket().SubSessionHandle())
{
- if(!ESCOSocket().SubSessionHandle())
- {
- return KErrDisconnected;
- }
+ return KErrDisconnected;
}
- if (iBTSynchronousLinkDetacherSCO->IsActive() ||
- iBTSynchronousLinkDetacherESCO->IsActive())
+ if (iBTSynchronousLinkDetacherSCO->IsActive() || iBTSynchronousLinkDetacherESCO->IsActive())
{
return KErrInUse;
}
@@ -499,6 +488,12 @@
*/
EXPORT_C TInt CBluetoothSynchronousLink::AcceptConnection(const TBTSyncPackets& aPacketTypes)
{
+ TRAPD(err, AcceptConnectionL(aPacketTypes));
+ return err;
+ }
+
+void CBluetoothSynchronousLink::AcceptConnectionL(const TBTSyncPackets& aPacketTypes)
+ {
TBool listenForSCO = EFalse;
TBool listenForESCO = EFalse;
@@ -506,41 +501,30 @@
TBTSyncPacketTypes packets = aPacketTypes();
-
__ASSERT_ALWAYS(packets, Panic(EBadSyncPacketTypes));
packets &= (TBTSyncPackets::ESyncAnySCOPacket | TBTSyncPackets::ESyncAnyESCOPacket);
if (!packets)
{
- return KErrNotSupported;
+ User::Leave(KErrNotSupported);
}
- if (iBTSynchronousLinkAccepterSCO->IsActive())
+ if (iBTSynchronousLinkAccepterSCO->IsActive() || iBTSynchronousLinkAccepterESCO->IsActive())
{
- return KErrInUse;
- }
-
- if (iBTSynchronousLinkAccepterESCO->IsActive())
- {
- return KErrInUse;
+ User::Leave(KErrInUse);
}
- TInt err = ListeningSCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeSCO, KBTLinkManager);
- if(err)
- {
- return err;
- }
+ User::LeaveIfError(ListeningSCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeSCO, KBTLinkManager));
+ CleanupClosePushL(ListeningSCOSocket());
- err = ListeningESCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeESCO, KBTLinkManager);
- if(err)
- {
- ListeningSCOSocket().Close();
- return err;
- }
+ User::LeaveIfError(ListeningESCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeESCO, KBTLinkManager));
+ CleanupClosePushL(ListeningESCOSocket());
+
+ CleanupStack::PushL(TCleanupItem(StaticResetScoTypes, this)); // we want to clear any setting of SCO types upon leaving
TBTSyncPacketTypes packetsSCO = packets & TBTSyncPackets::ESyncAnySCOPacket;
if (packetsSCO)
{
- err = ListeningSCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsSCO);
+ TInt err = ListeningSCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsSCO);
if(!err)
{
iSCOTypes |= ESCO;
@@ -551,17 +535,15 @@
TBTSyncPacketTypes packetsESCO = packets & TBTSyncPackets::ESyncAnyESCOPacket;
if (packetsESCO)
{
- err = ListeningESCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsESCO);
+ TInt err = ListeningESCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsESCO);
if (!err)
{
iSCOTypes |= EeSCO;
listenForESCO = ETrue;
+
+ TPckgC<TBTeSCOLinkParams> options(iRequestedLink);
+ User::LeaveIfError(ListeningESCOSocket().SetOpt(EeSCOExtOptions, KSolBtESCO, options));
}
-
- TPckgBuf<TBTeSCOLinkParams> options;
- options() = iRequestedLink;
- err = ListeningESCOSocket().SetOpt(EeSCOExtOptions, KSolBtESCO, options);
- CLOSE_LISTENER_RETURN_IF_ERROR(err);
}
__ASSERT_ALWAYS(listenForSCO || listenForESCO, Panic(EBadSyncPacketTypes));
@@ -580,62 +562,57 @@
if (listenForSCO)
{
- err = ListeningSCOSocket().Bind(sa);
- CLOSE_LISTENER_RETURN_IF_ERROR(err);
-
- err = ListeningSCOSocket().Listen(KSCOListenQueSize);
- CLOSE_LISTENER_RETURN_IF_ERROR(err);
-
- err = SCOSocket().Open(SocketServer());
- if(err)
- {
- return err;
- }
+ User::LeaveIfError(ListeningSCOSocket().Bind(sa));
+ User::LeaveIfError(ListeningSCOSocket().Listen(KSCOListenQueSize));
+ User::LeaveIfError(SCOSocket().Open(SocketServer()));
+ CleanupClosePushL(SCOSocket());
}
if(listenForESCO)
{
- err = ListeningESCOSocket().Bind(sa);
- CLOSE_LISTENER_RETURN_IF_ERROR(err);
-
- err = ListeningESCOSocket().Listen(KSCOListenQueSize);
- CLOSE_LISTENER_RETURN_IF_ERROR(err);
+ User::LeaveIfError(ListeningESCOSocket().Bind(sa));
+ User::LeaveIfError(ListeningESCOSocket().Listen(KSCOListenQueSize));
+ User::LeaveIfError(ESCOSocket().Open(SocketServer()));
+ }
+
+ // Now we can't fail synchronously, so we're ready to begin the accept.
+ if(listenForESCO)
+ {
+ iBTSynchronousLinkAccepterESCO->Accept();
+ }
- err = ESCOSocket().Open(SocketServer());
- if(err)
- {
- return err;
- }
- }
-
if (listenForSCO)
{
- iBTSynchronousLinkAccepterSCO->Accept(ListeningSCOSocket());
+ CleanupStack::Pop(&SCOSocket());
+ iBTSynchronousLinkAccepterSCO->Accept();
}
- if(listenForESCO)
- {
- iBTSynchronousLinkAccepterESCO->Accept(ListeningESCOSocket());
- }
+ CleanupStack::Pop(3); // StaticResetScoTypes, ListeningESCOSocket(), ListeningSCOSocket()
+ }
- return err;
+void CBluetoothSynchronousLink::StaticResetScoTypes(TAny* aThis)
+ {
+ static_cast<CBluetoothSynchronousLink*>(aThis)->iSCOTypes = 0;
}
/**
Cancel ability to respond to a remote request to set up a synchronous link.
-It is possible for a race condition to mean that a connection has been established,
-but as this call consumes the callback, for this fact not to reach the caller.
-For this reason, it may be desirable to follow a call to CancelAccept with a call
-to Disconnect.
-@see CBluetoothSynchronousLink::Disconnect
+
+It is possible for a race condition to mean that a connection has been established
+but the notifier has not yet received the call-back. In this case no call-back will
+be received and the link (if established) will be immediately shutdown.
*/
EXPORT_C void CBluetoothSynchronousLink::CancelAccept()
{
iBTSynchronousLinkAccepterSCO->Cancel();
iBTSynchronousLinkAccepterESCO->Cancel();
iBTSynchronousLinkBaseband->StopAll();
-
+
+ iSCOTypes = 0;
+
+ LinkDown();
+
ListeningSCOSocket().Close();
ListeningESCOSocket().Close();
SCOSocket().Close();
@@ -896,36 +873,48 @@
if (aSCOType & ESCO)
{
iBTSynchronousLinkAccepterESCO->Cancel();
+ ListeningESCOSocket().Close();
+ ESCOSocket().Close();
+
SCOSocket().RemoteName(sockAddr);
}
else
{
iBTSynchronousLinkAccepterSCO->Cancel();
+ ListeningSCOSocket().Close();
+ SCOSocket().Close();
+
ESCOSocket().RemoteName(sockAddr);
}
if(sockAddr.Family() == KBTAddrFamily)
{
- TBTSockAddr& btSockAddr = static_cast<TBTSockAddr&>(sockAddr); // subclasses of TSockAddr are forbidden to add members
+ TBTSockAddr& btSockAddr = static_cast<TBTSockAddr&>(sockAddr);
TBTDevAddr da = btSockAddr.BTAddr();
- TInt linkState = LinkUp(da);
-
- __ASSERT_ALWAYS((linkState == KErrNone), Panic(EBasebandFailedConnect));
-
- iBTSynchronousLinkBaseband->PreventPark();
- iBTSynchronousLinkBaseband->CatchEvents();
- UpdateLinkParams(aSCOType);
+ aErr = LinkUp(da);
+ if(aErr == KErrNone)
+ {
+ iBTSynchronousLinkBaseband->PreventPark();
+ iBTSynchronousLinkBaseband->CatchEvents();
+ UpdateLinkParams(aSCOType);
+ }
+ else
+ {
+ FTRACE(FPrint(_L("Failed to \"LinkUp\" the synchronous link (aErr %d)"), aErr));
+ }
}
else
{
// reading RemoteName has failed, probably socket state is already closed
// for example after quick disconnection initiated from remote side
- aErr = KErrDisconnected;
+ aErr = KErrDisconnected;
}
}
- else
+
+ if(aErr != KErrNone)
{
iNegotiatedLink = TBTeSCOLinkParams(0, 0, 0, 0);
+ CancelAccept(); // makes sure everything is cleaned up.
}
#ifdef __FLOGGING__
@@ -935,9 +924,6 @@
#else
Notifier().HandleAcceptConnectionCompleteL(aErr);
#endif
-
- ListeningSCOSocket().Close();
- ListeningESCOSocket().Close();
}
@@ -1034,24 +1020,16 @@
CBTSynchronousLinkBaseband* CBTSynchronousLinkBaseband::NewL(CBluetoothSynchronousLink& aParent)
{
CBTSynchronousLinkBaseband* self = new(ELeave) CBTSynchronousLinkBaseband(aParent);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
return self;
}
CBTSynchronousLinkBaseband::CBTSynchronousLinkBaseband(CBluetoothSynchronousLink& aParent)
: CActive(CActive::EPriorityStandard), iParent(aParent)
- {}
-
-
-void CBTSynchronousLinkBaseband::ConstructL()
{
CActiveScheduler::Add(this);
}
-
CBTSynchronousLinkBaseband::~CBTSynchronousLinkBaseband()
{
StopAll();
@@ -1093,7 +1071,7 @@
Cancel();
}
-
+
void CBTSynchronousLinkBaseband::DoCancel()
{
iParent.Baseband().CancelNextBasebandChangeEventNotifier();
@@ -1104,20 +1082,12 @@
CBTSynchronousLinkAttacher* CBTSynchronousLinkAttacher::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
{
CBTSynchronousLinkAttacher* self = new (ELeave) CBTSynchronousLinkAttacher(aParent, aSCOType);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
return self;
}
-
CBTSynchronousLinkAttacher::CBTSynchronousLinkAttacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
: CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType)
{
- }
-
-void CBTSynchronousLinkAttacher::ConstructL()
- {
CActiveScheduler::Add(this);
}
@@ -1155,7 +1125,6 @@
return KErrNone;
}
-
void CBTSynchronousLinkAttacher::DoCancel()
{
FLOG(_L("CBTSynchronousLinkAttacher cancel attach sync link"));
@@ -1174,20 +1143,12 @@
CBTSynchronousLinkDetacher* CBTSynchronousLinkDetacher::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
{
CBTSynchronousLinkDetacher* self = new (ELeave) CBTSynchronousLinkDetacher(aParent, aSCOType);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
return self;
}
-
CBTSynchronousLinkDetacher::CBTSynchronousLinkDetacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
: CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType)
{
- }
-
-void CBTSynchronousLinkDetacher::ConstructL()
- {
CActiveScheduler::Add(this);
}
@@ -1240,9 +1201,6 @@
CBTSynchronousLinkAccepter* CBTSynchronousLinkAccepter::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
{
CBTSynchronousLinkAccepter* self = new (ELeave) CBTSynchronousLinkAccepter(aParent, aSCOType);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
return self;
}
@@ -1250,10 +1208,6 @@
CBTSynchronousLinkAccepter::CBTSynchronousLinkAccepter(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
: CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType)
{
- }
-
-void CBTSynchronousLinkAccepter::ConstructL()
- {
CActiveScheduler::Add(this);
}
@@ -1262,7 +1216,7 @@
Cancel();
}
-void CBTSynchronousLinkAccepter::Accept(RSocket& aSocket)
+void CBTSynchronousLinkAccepter::Accept()
{
__ASSERT_ALWAYS(!IsActive(), Panic(EUnfinishedBusiness));
@@ -1270,11 +1224,11 @@
FLOG(_L("CBTSynchronousLinkAccepter accept sync link"));
if (iSCOType == ESCO)
{
- aSocket.Accept(iParent.SCOSocket(), iStatus);
+ iParent.ListeningSCOSocket().Accept(iParent.SCOSocket(), iStatus);
}
else
{
- aSocket.Accept(iParent.ESCOSocket(), iStatus);
+ iParent.ListeningESCOSocket().Accept(iParent.ESCOSocket(), iStatus);
}
SetActive();
}
@@ -1315,9 +1269,6 @@
CBTSynchronousLinkSender* CBTSynchronousLinkSender::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
{
CBTSynchronousLinkSender* self = new (ELeave) CBTSynchronousLinkSender(aParent, aSCOType);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
return self;
}
@@ -1325,10 +1276,6 @@
CBTSynchronousLinkSender::CBTSynchronousLinkSender(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
: CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType)
{
- }
-
-void CBTSynchronousLinkSender::ConstructL()
- {
CActiveScheduler::Add(this);
}
@@ -1403,9 +1350,6 @@
CBTSynchronousLinkReceiver* CBTSynchronousLinkReceiver::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
{
CBTSynchronousLinkReceiver* self = new (ELeave) CBTSynchronousLinkReceiver(aParent, aSCOType);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
return self;
}
@@ -1413,10 +1357,6 @@
CBTSynchronousLinkReceiver::CBTSynchronousLinkReceiver(CBluetoothSynchronousLink& aParent, TSCOType aSCOType)
: CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType)
{
- }
-
-void CBTSynchronousLinkReceiver::ConstructL()
- {
CActiveScheduler::Add(this);
}
--- a/bluetoothmgmt/bluetoothclientlib/btlib/btsynclinkhelpers.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/btlib/btsynclinkhelpers.h Wed Aug 18 10:54:44 2010 +0300
@@ -32,7 +32,6 @@
private:
CBTSynchronousLinkBaseband(CBluetoothSynchronousLink& aParent);
- void ConstructL();
void DoCancel();
void RunL();
TInt RunError(TInt aError);
@@ -41,7 +40,7 @@
TBTBasebandEvent iEvent;
};
-//CBluetoothSynchronousLink Active Objects...
+
NONSHARABLE_CLASS(CBTSynchronousLinkAttacher) : public CActive
{
public:
@@ -53,7 +52,6 @@
private:
CBTSynchronousLinkAttacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOTypes);
- void ConstructL();
void DoCancel();
void RunL();
TInt RunError(TInt aError);
@@ -75,7 +73,6 @@
private:
CBTSynchronousLinkDetacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOTypes);
- void ConstructL();
void DoCancel();
void RunL();
TInt RunError(TInt aError);
@@ -93,12 +90,11 @@
static CBTSynchronousLinkAccepter* NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType);
~CBTSynchronousLinkAccepter();
- void Accept(RSocket& aSocket);
+ void Accept();
private:
CBTSynchronousLinkAccepter(CBluetoothSynchronousLink& aParent, TSCOType aSCOType);
- void ConstructL();
void DoCancel();
void RunL();
TInt RunError(TInt aError);
@@ -120,7 +116,6 @@
private:
CBTSynchronousLinkSender(CBluetoothSynchronousLink& aParent, TSCOType aSCOType);
- void ConstructL();
void DoCancel();
void RunL();
TInt RunError(TInt aError);
@@ -142,7 +137,6 @@
private:
CBTSynchronousLinkReceiver(CBluetoothSynchronousLink& aParent, TSCOType aSCOTypes);
- void ConstructL();
void DoCancel();
void RunL();
TInt RunError(TInt aError);
--- a/bluetoothmgmt/bluetoothclientlib/inc/bt_sock.h Tue Jul 06 15:33:04 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/inc/bt_sock.h Wed Aug 18 10:54:44 2010 +0300
@@ -1424,6 +1424,8 @@
void UpdateLinkParams(TSCOType aSCOType);
TInt LinkUp(TBTDevAddr aAddr);
void LinkDown();
+ void AcceptConnectionL(const TBTSyncPackets& aPacketTypes);
+ static void StaticResetScoTypes(TAny* aThis);
private:
CBTSynchronousLinkSender* iBTSynchronousLinkSenderSCO;
--- a/package_definition.xml Tue Jul 06 15:33:04 2010 +0300
+++ b/package_definition.xml Wed Aug 18 10:54:44 2010 +0300
@@ -1,103 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<SystemDefinition schema="3.0.0">
- <package id="bt" name="Bluetooth" levels="adaptation hw-if plugin framework server app-if">
+ <package id="bt" name="Bluetooth" levels="adaptation hw-if plugin framework server app-if">
<collection id="bt_plat" name="Bluetooth Platform Interfaces" level="app-if">
- <component id="bluetooth_audio_adaptation_api" name="Bluetooth Audio Adaptation API" class="api" filter="s60">
- <meta rel="Api" href="bt_plat/bluetooth_audio_adaptation_api/bluetooth_audio_adaptation_api.metaxml"/>
- <unit bldFile="bt_plat/bluetooth_audio_adaptation_api/group"/>
- </component>
- <component id="bluetooth_power_management_api" name="Bluetooth Power Management API" class="api" filter="s60">
- <meta rel="Api" href="bt_plat/bluetooth_power_management_api/bluetooth_power_management_api.metaxml"/>
- <unit bldFile="bt_plat/bluetooth_power_management_api/group"/>
- </component>
- <component id="at_command_handler_plugin_api" name="AT Command Handler Plugin API" class="api" filter="s60">
- <meta rel="Api" href="bt_plat/at_command_handler_plugin_api/at_command_handler_plugin_api.metaxml"/>
- <unit bldFile="bt_plat/at_command_handler_plugin_api/group"/>
- </component>
+ <component id="bluetooth_audio_adaptation_api" name="Bluetooth Audio Adaptation API" class="api" filter="s60">
+ <meta rel="Api" href="bt_plat/bluetooth_audio_adaptation_api/bluetooth_audio_adaptation_api.metaxml"/>
+ <unit bldFile="bt_plat/bluetooth_audio_adaptation_api/group"/>
+ </component>
+ <component id="bluetooth_power_management_api" name="Bluetooth Power Management API" class="api" filter="s60">
+ <meta rel="Api" href="bt_plat/bluetooth_power_management_api/bluetooth_power_management_api.metaxml"/>
+ <unit bldFile="bt_plat/bluetooth_power_management_api/group"/>
+ </component>
+ <component id="at_command_handler_plugin_api" name="AT Command Handler Plugin API" class="api" filter="s60">
+ <meta rel="Api" href="bt_plat/at_command_handler_plugin_api/at_command_handler_plugin_api.metaxml"/>
+ <unit bldFile="bt_plat/at_command_handler_plugin_api/group"/>
+ </component>
+ </collection>
+ <collection id="bluetooth" name="Bluetooth Core" level="framework">
+ <component id="btstack" name="Bluetooth Stack" introduced="6.0" purpose="optional">
+ <unit bldFile="bluetooth/btstack" mrp="bluetooth/btstack/bluetooth_stack.mrp"/>
+ </component>
+ <component id="btcomm" name="Bluetooth CSY" introduced="6.0" purpose="optional" class="plugin">
+ <unit bldFile="bluetooth/btcomm" mrp="bluetooth/btcomm/bluetooth_btcomm.mrp"/>
+ </component>
+ <component id="btsdp" name="Bluetooth SDP" introduced="6.1" purpose="optional">
+ <unit bldFile="bluetooth/btsdp" mrp="bluetooth/btsdp/bluetooth_sdp.mrp"/>
+ </component>
+ <component id="btextnotifiers" name="Bluetooth Notifiers Support" introduced="6.1" purpose="optional">
+ <unit bldFile="bluetooth/btextnotifiers" mrp="bluetooth/btextnotifiers/bluetooth_btextnotifiers.mrp"/>
+ </component>
+ <component id="gavdp" name="Bluetooth GAVDP" introduced="8.1" purpose="optional">
+ <unit bldFile="bluetooth/gavdp/group" mrp="bluetooth/gavdp/group/bluetooth_gavdp.mrp"/>
+ </component>
+ <component id="btexample" name="Bluetooth Examples and Tests" introduced="6.1" purpose="development" filter="test">
+ <unit mrp="bluetooth/btexample/test/bluetooth_tests_examples.mrp" bldFile="bluetooth/btexample/test/group"/>
+ </component>
+ <component id="btlogger" name="Bluetooth Logging Engine" introduced="9.2" purpose="optional">
+ <unit bldFile="bluetooth/btlogger/group" mrp="bluetooth/btlogger/group/bluetooth_logger.mrp"/>
+ </component>
+ <component id="btdocs" name="Bluetooth Documentation" purpose="development" class="doc">
+ <unit mrp="bluetooth/btdocs/bluetooth_documentation.mrp"/>
+ </component>
</collection>
- <collection id="bluetooth" name="Bluetooth Core" level="framework">
- <component id="btstack" name="Bluetooth Stack" introduced="6.0" purpose="optional">
- <unit bldFile="bluetooth/btstack" mrp="bluetooth/btstack/bluetooth_stack.mrp"/>
- </component>
- <component id="btcomm" name="Bluetooth CSY" introduced="6.0" purpose="optional" class="plugin">
- <unit bldFile="bluetooth/btcomm" mrp="bluetooth/btcomm/bluetooth_btcomm.mrp"/>
- </component>
- <component id="btsdp" name="Bluetooth SDP" introduced="6.1" purpose="optional">
- <unit bldFile="bluetooth/btsdp" mrp="bluetooth/btsdp/bluetooth_sdp.mrp"/>
- </component>
- <component id="btextnotifiers" name="Bluetooth Notifiers Support" introduced="6.1" purpose="optional">
- <unit bldFile="bluetooth/btextnotifiers" mrp="bluetooth/btextnotifiers/bluetooth_btextnotifiers.mrp"/>
- </component>
- <component id="gavdp" name="Bluetooth GAVDP" introduced="8.1" purpose="optional">
- <unit bldFile="bluetooth/gavdp/group" mrp="bluetooth/gavdp/group/bluetooth_gavdp.mrp"/>
- </component>
- <component id="btexample" name="Bluetooth Examples and Tests" introduced="6.1" purpose="development" filter="test">
- <unit mrp="bluetooth/btexample/test/bluetooth_tests_examples.mrp" bldFile="bluetooth/btexample/test/group"/>
- </component>
- <component id="btlogger" name="Bluetooth Logging Engine" introduced="9.2" purpose="optional">
- <unit bldFile="bluetooth/btlogger/group" mrp="bluetooth/btlogger/group/bluetooth_logger.mrp"/>
- </component>
- <component id="btdocs" name="Bluetooth Documentation" purpose="development" class="doc">
- <unit mrp="bluetooth/btdocs/bluetooth_documentation.mrp"/>
- </component>
- </collection>
- <collection id="bluetoothmgmt" name="Bluetooth Management" level="plugin">
- <component id="btmgr" name="Bluetooth Manager" introduced="6.0" purpose="optional">
- <unit bldFile="bluetoothmgmt/btmgr" mrp="bluetoothmgmt/btmgr/bluetooth_manager.mrp"/>
- </component>
- <component id="btconfig" name="Bluetooth Config" purpose="optional" class="config">
- <unit bldFile="bluetoothmgmt/btconfig" mrp="bluetoothmgmt/btconfig/bluetooth_config.mrp"/>
- </component>
- <component id="btrom" name="Bluetooth ROM" introduced="9.1" purpose="optional">
- <unit bldFile="bluetoothmgmt/btrom" mrp="bluetoothmgmt/btrom/bluetooth_rom.mrp"/>
- </component>
- <component id="bluetoothclientlib" name="Bluetooth Client Library" introduced="6.0" purpose="optional">
- <unit bldFile="bluetoothmgmt/bluetoothclientlib" mrp="bluetoothmgmt/bluetoothclientlib/bluetooth_user.mrp"/>
- </component>
- <component id="btcommon" name="Bluetooth Build Utilities" purpose="optional" filter="test">
- <unit mrp="bluetoothmgmt/btcommon/bluetooth_common.mrp" bldFile="bluetoothmgmt/btcommon"/>
- </component>
- </collection>
- <collection id="bluetoothcommsprofiles" name="Bluetooth Comms Profiles" level="app-if">
- <component id="btpan" name="Bluetooth PAN Profile" introduced="8.1" purpose="optional" class="plugin">
- <unit bldFile="bluetoothcommsprofiles/btpan/group" mrp="bluetoothcommsprofiles/btpan/group/bluetooth_pan.mrp"/>
- </component>
- </collection>
- <collection id="bthci" name="Host Controller Interface" level="server">
- <component id="bthci2" name="Bluetooth HCI Framework 2" introduced="9.2" purpose="optional">
- <unit bldFile="bthci/bthci2/group" mrp="bthci/bthci2/group/bluetooth_hci_v2_framework.mrp"/>
- </component>
- <component id="hciextensioninterface" name="Bluetooth HCI Extension Interface" introduced="6.1" purpose="optional">
- <unit bldFile="bthci/hciextensioninterface" mrp="bthci/hciextensioninterface/bluetooth_hciproxy.mrp"/>
- </component>
- <component id="hci2implementations" name="Bluetooth HCI 2 Reference Implementations" introduced="9.2" purpose="optional" class="plugin">
- <unit bldFile="bthci/hci2implementations/group" mrp="bthci/hci2implementations/group/bluetooth_hci_v2_implementations.mrp"/>
- </component>
- </collection>
- <collection id="irda" name="IrDA" level="plugin">
- <component id="irdastack" name="IrDA Stack" purpose="optional">
- <unit bldFile="irda/irdastack/group" mrp="irda/irdastack/group/infra-red_irda.mrp"/>
- </component>
- </collection>
- <collection id="bluetoothapitest" name="Bluetooth API Tests" level="app-if">
- <component id="bluetoothsvs" name="Bluetooth Verification Suite" introduced="^3" purpose="development" filter="test">
- <unit mrp="bluetoothapitest/bluetoothsvs/group/bluetoothsvs.mrp" bldFile="bluetoothapitest/bluetoothsvs/group"/>
- </component>
- </collection>
- <collection id="atext" name="AT Extensions" level="server">
- <component id="atext_build" name="AT Extension Build" introduced="^3" purpose="optional" filter="s60">
- <unit bldFile="atext/group"/>
- </component>
- </collection>
- <collection id="bt_info" name="Bluetooth Info" level="app-if">
- <component id="bt_metadata" name="Bluetooth Metadata" class="config" introduced="^3" purpose="development" target="desktop">
- <unit mrp="bt_info/bt_metadata/bt_metadata.mrp"/>
- </component>
- </collection>
- <collection id="btsimulator" name="Bluetooth Simulator" level="internal-utils">
- <component id="btaudioadaptation_stub" name="Bluetooth Audio Adaption Stub" introduced="^3" purpose="optional" filter="s60">
- <unit bldFile="btsimulator/btaudioadaptation_stub/group"/>
- </component>
- </collection>
- </package>
+ <collection id="bluetoothmgmt" name="Bluetooth Management" level="plugin">
+ <component id="btmgr" name="Bluetooth Manager" introduced="6.0" purpose="optional">
+ <unit bldFile="bluetoothmgmt/btmgr" mrp="bluetoothmgmt/btmgr/bluetooth_manager.mrp"/>
+ </component>
+ <component id="btconfig" name="Bluetooth Config" purpose="optional" class="config">
+ <unit bldFile="bluetoothmgmt/btconfig" mrp="bluetoothmgmt/btconfig/bluetooth_config.mrp"/>
+ </component>
+ <component id="btrom" name="Bluetooth ROM" introduced="9.1" purpose="optional">
+ <unit bldFile="bluetoothmgmt/btrom" mrp="bluetoothmgmt/btrom/bluetooth_rom.mrp"/>
+ </component>
+ <component id="bluetoothclientlib" name="Bluetooth Client Library" introduced="6.0" purpose="optional">
+ <unit bldFile="bluetoothmgmt/bluetoothclientlib" mrp="bluetoothmgmt/bluetoothclientlib/bluetooth_user.mrp"/>
+ </component>
+ <component id="btcommon" name="Bluetooth Build Utilities" purpose="optional" filter="test">
+ <unit mrp="bluetoothmgmt/btcommon/bluetooth_common.mrp" bldFile="bluetoothmgmt/btcommon"/>
+ </component>
+ </collection>
+ <collection id="bluetoothcommsprofiles" name="Bluetooth Comms Profiles" level="app-if">
+ <component id="btpan" name="Bluetooth PAN Profile" introduced="8.1" purpose="optional" class="plugin">
+ <unit bldFile="bluetoothcommsprofiles/btpan/group" mrp="bluetoothcommsprofiles/btpan/group/bluetooth_pan.mrp"/>
+ </component>
+ </collection>
+ <collection id="bthci" name="Host Controller Interface" level="server">
+ <component id="bthci2" name="Bluetooth HCI Framework 2" introduced="9.2" purpose="optional">
+ <unit bldFile="bthci/bthci2/group" mrp="bthci/bthci2/group/bluetooth_hci_v2_framework.mrp"/>
+ </component>
+ <component id="hciextensioninterface" name="Bluetooth HCI Extension Interface" introduced="6.1" purpose="optional">
+ <unit bldFile="bthci/hciextensioninterface" mrp="bthci/hciextensioninterface/bluetooth_hciproxy.mrp"/>
+ </component>
+ <component id="hci2implementations" name="Bluetooth HCI 2 Reference Implementations" introduced="9.2" purpose="optional" class="plugin">
+ <unit bldFile="bthci/hci2implementations/group" mrp="bthci/hci2implementations/group/bluetooth_hci_v2_implementations.mrp"/>
+ </component>
+ </collection>
+ <collection id="irda" name="IrDA" level="plugin">
+ <component id="irdastack" name="IrDA Stack" purpose="optional">
+ <unit bldFile="irda/irdastack/group" mrp="irda/irdastack/group/infra-red_irda.mrp"/>
+ </component>
+ </collection>
+ <collection id="bluetoothapitest" name="Bluetooth API Tests" level="app-if">
+ <component id="bluetoothsvs" name="Bluetooth Verification Suite" introduced="^3" purpose="development" filter="test">
+ <unit mrp="bluetoothapitest/bluetoothsvs/group/bluetoothsvs.mrp" bldFile="bluetoothapitest/bluetoothsvs/group"/>
+ </component>
+ </collection>
+ <collection id="atext" name="AT Extensions" level="server">
+ <!-- collection is really a component. Need to move down a directory -->
+ <component id="atext_build" name="AT Extension Build" introduced="^3" purpose="optional" filter="s60">
+ <unit bldFile="atext/group"/>
+ </component>
+ </collection>
+ <collection id="bt_info" name="Bluetooth Info" level="app-if">
+ <component id="bt_metadata" name="Bluetooth Metadata" class="config" introduced="^3" purpose="development" target="desktop">
+ <unit mrp="bt_info/bt_metadata/bt_metadata.mrp"/>
+ </component>
+ </collection>
+ <collection id="btsimulator" name="Bluetooth Simulator" level="internal-utils">
+ <component id="btaudioadaptation_stub" name="Bluetooth Audio Adaption Stub" purpose="optional" filter="oem_build">
+ <unit bldFile="btsimulator/btaudioadaptation_stub/group"/>
+ </component>
+ </collection>
+ </package>
</SystemDefinition>