--- a/atext/plugins/limitedpdpplugin/src/limitedpdpplugin.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/atext/plugins/limitedpdpplugin/src/limitedpdpplugin.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -23,7 +23,7 @@
// Internal constants
const TInt KDialupOverrideEnabled = 1;
const TInt KCloseTimeoutInterval = 15000000; // 15 secs
-const TInt KCleanUpWaitTimeout = 300000; // 300 ms
+const TInt KCleanUpWaitTimeout = 1000000; // 1 secs
#ifdef _DEBUG
const TInt KUsecToMSecDivider = 1000;
#endif
--- a/atext/server/src/atextmetadata.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/atext/server/src/atextmetadata.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1996,21 +1996,37 @@
TRACE_FUNC_ENTRY
// First extract the base of AT command from aAtCmdFull
// ('=' and everything after that)
- TInt newLength = aAtCmdFull.Length();
+ TInt fullLength = aAtCmdFull.Length();
+ TInt newLength = fullLength;
+ TInt findIndex = KErrNotFound;
TInt foundPos = aAtCmdFull.Locate( '=' );
+ TRACE_INFO(( _L8("Base length before = %d"), fullLength ));
if ( foundPos >= 2 ) // After "AT"
{
+ findIndex = foundPos - 1;
newLength = foundPos;
}
- else if ( newLength >= 1 )
+ else if ( fullLength >= 3 ) // At least "AT?"
{
// There was no '=' so check if the last character is '?'.
// If it is then remove it.
- if ( aAtCmdFull[newLength-1] == '?' )
+ TInt lastIndex = fullLength - 1;
+ if ( aAtCmdFull[lastIndex] == '?' )
{
- newLength--;
+ findIndex = lastIndex - 1;
+ newLength = fullLength - 1;
}
}
+ // Next correct newLength so that it doesn't contain the space(s)
+ for ( ; findIndex>=2; findIndex--,newLength-- )
+ {
+ TChar character = aAtCmdFull[findIndex];
+ if ( !(character.IsSpace()||character==0x00) )
+ {
+ break;
+ }
+ }
+ TRACE_INFO(( _L8("Base length after = %d"), newLength ));
HBufC8* baseCmd = HBufC8::NewMaxLC( newLength );
TPtr8 baseCmdPtr = baseCmd->Des();
baseCmdPtr.Copy( &aAtCmdFull[0], newLength );
--- a/bluetooth/btexample/example/btproperties/BTProperties.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btexample/example/btproperties/BTProperties.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -55,56 +55,6 @@
}
}
-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
@@ -112,22 +62,27 @@
RPointerArray<CSubscriber> subscribers;
- TRAPD(err, CreateSubscribersL(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));
test.Printf(_L("%d Subscribers\n"), subscribers.Count());
- 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();
- }
+ 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 Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btexample/example/eir/teir.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -143,13 +143,8 @@
switch(aTag)
{
case ETestDeviceName:
- {
- CActiveInquirer* inquirer = CActiveInquirer::NewL(iConsole, *this, 0, EFalse, EFalse, EFalse, EFalse);
- CleanupStack::PushL(inquirer);
- iResolvers.AppendL(inquirer);
- CleanupStack::Pop(inquirer);
+ iResolvers.Append(CActiveInquirer::NewL(iConsole, *this, 0, EFalse, EFalse, EFalse, EFalse));
iNameRequester->SetLocalNameL();
- }
break;
case ETestUuid16:
@@ -254,18 +249,12 @@
void CEirApp::NewNameRequesterL(TBool aEirInstead, TBool aIgnoreCache)
{
- CActiveNameRequester* requester = CActiveNameRequester::NewL(iConsole, *this, aEirInstead, aIgnoreCache);
- CleanupStack::PushL(requester);
- iResolvers.AppendL(requester);
- CleanupStack::Pop(requester);
+ iResolvers.Append(CActiveNameRequester::NewL(iConsole, *this, aEirInstead, aIgnoreCache));
}
void CEirApp::NewInquirerL(TUint aIAC, TBool aDoNames, TBool aIgnoreCache, TBool aDoEir, TBool forever)
{
- CActiveInquirer* inquirer = CActiveInquirer::NewL(iConsole, *this, aIAC, aDoNames, aIgnoreCache, aDoEir, forever);
- CleanupStack::PushL(inquirer);
- iResolvers.AppendL(inquirer);
- CleanupStack::Pop(inquirer);
+ iResolvers.Append(CActiveInquirer::NewL(iConsole, *this, aIAC, aDoNames, aIgnoreCache, aDoEir, forever));
}
void CEirApp::CancelInquirer()
@@ -279,10 +268,7 @@
void CEirApp::NewNameArrayRequesterL()
{
- CActiveNameArrayRequester* requester = CActiveNameArrayRequester::NewL(iConsole, *this, iDevicesFound);
- CleanupStack::PushL(requester);
- iResolvers.AppendL(requester);
- CleanupStack::Pop(requester);
+ iResolvers.Append(CActiveNameArrayRequester::NewL(iConsole, *this, iDevicesFound));
}
void CEirApp::DeviceFound(TBTDevAddr aAddress)
@@ -290,7 +276,7 @@
#if USE_SMALL_CONSOLE
iConsole.Printf(_L("App: Found device.\n"));
#endif
- (void)iDevicesFound.Append(aAddress);
+ iDevicesFound.Append(aAddress);
}
void CEirApp::InquiryComplete()
--- a/bluetooth/btextnotifiers/inc/BTExtNotifiers.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btextnotifiers/inc/BTExtNotifiers.h Wed Oct 13 15:48:34 2010 +0300
@@ -128,8 +128,8 @@
IMPORT_C TBool UplinkAccessAllowed() const;
IMPORT_C TBool IsValid() const;
- // Allows creation of default NULL instance
- IMPORT_C TPanConnection();
+ // Non-exported constructor. Allows creation of default NULL instance
+ TPanConnection();
private:
TBTDevAddr iRemoteDeviceAddress;
--- a/bluetooth/btsdp/server/epocsvr.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btsdp/server/epocsvr.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -967,12 +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.
- err = iSessionRecords.Append(newRecord);
- if(err != KErrNone)
- {
- //if append fails delete the service record created above and return the error code
- Server().DeleteServiceRecord(newRecord);
- }
+ iSessionRecords.Append(newRecord);
}
aMessage.Complete(err);
}
--- a/bluetooth/btsdp/server/protocol/listener.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btsdp/server/protocol/listener.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-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"
@@ -466,6 +466,10 @@
addr.SetSecurity(sdpSecurity);
User::LeaveIfError(iListener.Bind(addr));
+ TPckgBuf<TBool> noSecurityRequired;
+ noSecurityRequired() = ETrue;
+
+ User::LeaveIfError(iListener.SetOpt(KBTSetNoSecurityRequired, KSolBtSAPBase, noSecurityRequired));
User::LeaveIfError(iListener.Listen(iQueSize));
}
--- a/bluetooth/btstack/avctp/avctp.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avctp/avctp.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -388,6 +388,7 @@
localAddr.SetSecurity(sec);
CleanupStack::Pop(sap);
+ __ASSERT_DEBUG(!iListener, Panic(EObjectAlreadyExists));
iListener = CIncomingConnectionListener::NewL(*this, sap, localAddr, KProtocolListeningQueueSize);
CServProviderBase* sap2 =iLowerProtocol->NewSAPL(KSockSeqPacket);
--- a/bluetooth/btstack/avctp/avctpPacketMgr.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avctp/avctpPacketMgr.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -31,10 +31,6 @@
_LIT8(KLogComponent, LOG_COMPONENT_AVCTP);
#endif
-#ifdef _DEBUG
-PANICCATEGORY("pktmgr");
-#endif
-
using namespace SymbianAvctp;
/**
--- a/bluetooth/btstack/avctp/avctpmuxer.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avctp/avctpmuxer.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -37,10 +37,6 @@
_LIT8(KLogComponent, LOG_COMPONENT_AVCTP);
#endif
-#ifdef _DEBUG
-PANICCATEGORY("avctpmux");
-#endif
-
using namespace SymbianAvctp;
#ifdef __FLOG_ACTIVE
@@ -939,6 +935,7 @@
void CAvctpTransport::BindSecondaryChannelSap(CServProviderBase& aSAP)
{
+ __ASSERT_DEBUG(!iChannelSAPs[KAvctpSecondaryChannel], Panic(EObjectAlreadyExists));
iChannelSAPs[KAvctpSecondaryChannel] = &aSAP;
iChannelSAPs[KAvctpSecondaryChannel]->SetNotify(&iSecondChannelSocket);
}
--- a/bluetooth/btstack/avctp/avctpmuxerstates.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avctp/avctpmuxerstates.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -410,6 +410,7 @@
if (aAddr != TBTDevAddr(0))
{
// New this up just in time.
+ __ASSERT_DEBUG(!aTransport.iChannelSAPs[KAvctpPrimaryChannel], Panic(EObjectAlreadyExists));
TRAP(ret, aTransport.iChannelSAPs[KAvctpPrimaryChannel] = aTransport.iProtocol.LowerProtocol()->NewSAPL(KSockSeqPacket));
if (ret == KErrNone)
{
--- a/bluetooth/btstack/avctp/avctputils.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avctp/avctputils.h Wed Oct 13 15:48:34 2010 +0300
@@ -165,6 +165,7 @@
EAvctpInvalidChannelIoctl = 66,
EAvctpSapClosed = 67,
ENullAvctpProtocol = 68,
+ EObjectAlreadyExists = 69,
};
/**
--- a/bluetooth/btstack/avdtp/avdtpConfigurators.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpConfigurators.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -39,7 +39,10 @@
}
-
+CSEPConfigurator::~CSEPConfigurator()
+ {
+ LOG_FUNC
+ }
CRemoteSEPConfigurator* CRemoteSEPConfigurator::NewL(CSignallingSession& aSignallingSession,
CAvdtpProtocol& aProtocol,
--- a/bluetooth/btstack/avdtp/avdtpConfigurators.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpConfigurators.h Wed Oct 13 15:48:34 2010 +0300
@@ -33,6 +33,8 @@
public:
virtual TInt AddCapability(const TDesC8& aOption) =0;
virtual TInt Finalise() =0;
+ ~CSEPConfigurator();
+
protected:
CSEPConfigurator(CSignallingSession& aSignallingSession, CAvdtpProtocol& aProtocol);
inline CSignallingSession& SignallingSession() const
--- a/bluetooth/btstack/avdtp/avdtpDirectChannel.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpDirectChannel.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -45,28 +45,20 @@
LOG_FUNC
}
-TInt CDirectChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType /*aType*/, TL2CapConfig::TChannelPriority aPriority)
+CDirectChannel::~CDirectChannel()
+ {
+ LOG_FUNC
+ }
+
+TInt CDirectChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType /*aType*/)
{
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
@@ -149,10 +141,6 @@
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 Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpDirectChannel.h Wed Oct 13 15:48:34 2010 +0300
@@ -33,11 +33,13 @@
public:
static CDirectChannel* NewL(CAvdtpProtocol& aProtocol,
const TBTDevAddr& aRemoteDevice);
+ ~CDirectChannel();
+
//from base
// can just forward down to L2CAP...
virtual void DetachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
- virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority = TL2CapConfig::ELow);
+ virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
virtual TBool CouldAttachSession(const TAvdtpSockAddr& aAddr);
virtual TTCID TCID() const;
CServProviderBase* ObtainSAP();
@@ -48,8 +50,7 @@
private:
CDirectChannel(CAvdtpProtocol& aProtocol, const TBTDevAddr& aRemoteDevice);
- void UpdateChannelPriority();
-
+
private:
// interesting stuff from l2cap
virtual void NewData(TUint aCount);
@@ -60,7 +61,6 @@
private:
CUserPlaneTransportSession* iTransportSession; // non-owned
TBool iTransportSessionBlocked;
- TL2CapConfig::TChannelPriority iChannelPriority;
};
#endif //AVDTPDIRECTCHANNEL_H
--- a/bluetooth/btstack/avdtp/avdtpLogicalChannelFactory.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpLogicalChannelFactory.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1296,7 +1296,13 @@
TPckgBuf<TL2CapConfig> configBuf;
iLogicalChannelSAP->GetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
- if(!aPrecreatedSAP)
+
+ if(iSequenceNumber != KInitialSequenceNumber)
+ {
+ configBuf().ConfigureChannelPriority(TL2CapConfig::EHigh);
+ iLogicalChannelSAP->SetOption(KSolBtL2CAP, KL2CAPUpdateChannelConfig, configBuf);
+ }
+ else 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 Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMediaSession.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -59,6 +59,11 @@
iPacketsLost = 0;
}
+CMediaSession::~CMediaSession()
+ {
+ LOG_FUNC
+ }
+
void CMediaSession::ConstructL()
{
LOG_FUNC
@@ -76,7 +81,7 @@
__ASSERT_DEBUG(iStream, Panic(EAvdtpTransportSessionBaseNotCheckStream));
TInt ret = KErrGeneral; // may be OOM or notfound
- ret = iStream->AddSession(EMedia,*this,iTransportChannel,TL2CapConfig::EHigh);
+ ret = iStream->AddSession(EMedia,*this,iTransportChannel);
if (ret!=KErrNone)
{
// not erroring the stream, as it's not it's fault
--- a/bluetooth/btstack/avdtp/avdtpMediaSession.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMediaSession.h Wed Oct 13 15:48:34 2010 +0300
@@ -34,6 +34,7 @@
public:
static CMediaSession* NewLC(CAvdtpProtocol& aProtocol, CAvdtpSAP& aSAP, CAVStream& aStream);
static CMediaSession* NewL(CAvdtpProtocol& aProtocol, CAvdtpSAP& aSAP, CAVStream& aStream);
+ ~CMediaSession();
virtual TInt GetOption(TUint aLevel, TUint aName, TDes8& aOption) const;
virtual void Ioctl(TUint aLevel, TUint aName, const TDesC8* aOption);
--- a/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMuxChannel.cpp Wed Oct 13 15:48:34 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, TL2CapConfig::TChannelPriority aPriority)
+TInt CMuxChannel::AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)
/**
Protocol must ensure it has found appropriate muxchannel for
Recovery packets
@@ -321,45 +321,7 @@
__ASSERT_DEBUG(sessionArray, Panic(EAVDTPBadSessionAttachToTransportChannel));
- 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;
- }
- }
+ return sessionArray->Append(TUserPlaneTransportSessionState(aSession));
}
/**
@@ -457,7 +419,6 @@
}
__ASSERT_DEBUG(found==1, Panic(EAVDTPBadSessionDetachFromTransportChannel));
- UpdateChannelPriority();
CheckForClose();
}
--- a/bluetooth/btstack/avdtp/avdtpMuxChannel.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpMuxChannel.h Wed Oct 13 15:48:34 2010 +0300
@@ -134,7 +134,7 @@
TTCID aRemotelyAssignedTCID);
// management path
- virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority = TL2CapConfig::ELow);
+ virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
virtual void DetachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType);
virtual TBool CouldAttachSession(const TAvdtpSockAddr& aAddr);
virtual TTCID TCID() const;
@@ -153,9 +153,7 @@
private:
CMuxChannel(CAvdtpProtocol& aProtocol, const TBTDevAddr& aRemoteDevice);
-
- void UpdateChannelPriority();
-
+
static TInt MuxSendIntervalCb(TAny* aCMuxChannel);
void CheckForClose();
TUint DoSend();
@@ -173,15 +171,13 @@
// receive path
struct TUserPlaneTransportSessionState
{
- inline TUserPlaneTransportSessionState(CUserPlaneTransportSession& aSession, TL2CapConfig::TChannelPriority aChannelPriority);
+ inline TUserPlaneTransportSessionState(CUserPlaneTransportSession& aSession);
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
@@ -206,10 +202,8 @@
};
inline CMuxChannel::TUserPlaneTransportSessionState::TUserPlaneTransportSessionState(
- CUserPlaneTransportSession& aSession,
- TL2CapConfig::TChannelPriority aChannelPriority)
- : iSession(aSession)
- , iChannelPriority(aChannelPriority)
+ CUserPlaneTransportSession& aSession)
+: iSession(aSession)
{
}
--- a/bluetooth/btstack/avdtp/avdtpSignallingMessages.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpSignallingMessages.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -37,13 +37,23 @@
LOG_FUNC
Data().Init();
}
-
+
+CAvdtpSignallingMessage::~CAvdtpSignallingMessage()
+ {
+ LOG_FUNC
+ }
+
CAvdtpInboundSignallingMessage::CAvdtpInboundSignallingMessage(CSignallingChannel& aSignallingChannel)
: iSignallingChannel(aSignallingChannel)
{
LOG_FUNC
}
+CAvdtpInboundSignallingMessage::~CAvdtpInboundSignallingMessage()
+ {
+ LOG_FUNC
+ }
+
/*static*/ void CAvdtpOutboundSignallingMessage::PrependSignallingHeaderL(
RMBufChain& aDest,
const TAvdtpPacketType& aPacketType,
--- a/bluetooth/btstack/avdtp/avdtpSignallingMessages.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpSignallingMessages.h Wed Oct 13 15:48:34 2010 +0300
@@ -202,6 +202,7 @@
inline TAvdtpMessage Signal() const;
protected:
CAvdtpSignallingMessage();
+ ~CAvdtpSignallingMessage();
protected:
TAvdtpMessageType iMessageType;
TAvdtpMessage iSignal;
@@ -219,6 +220,7 @@
{
public:
explicit CAvdtpInboundSignallingMessage(CSignallingChannel& aSignallingChannel);
+ ~CAvdtpInboundSignallingMessage();
virtual TInt NewData(TUint aCount);
private:
static TAvdtpMessage SignalIdentifier(const RMBufChain& aMessage);
--- a/bluetooth/btstack/avdtp/avdtpStream.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStream.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -343,11 +343,10 @@
TInt CAVStream::AddSession(TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority)
+ CTransportChannel*& aChannel)
{
LOG_FUNC
- return iState->AddSession(*this, aType, aSession, aChannel, aPriority);
+ return iState->AddSession(*this, aType, aSession, aChannel);
}
void CAVStream::DropSession(TAvdtpTransportSessionType aType, CUserPlaneTransportSession& aSession)
@@ -652,7 +651,12 @@
LOG_FUNC
CActiveScheduler::Add(this);
}
-
+
+CWatchdogTimer::~CWatchdogTimer()
+ {
+ LOG_FUNC
+ }
+
void CWatchdogTimer::RunL()
{
LOG_FUNC
--- a/bluetooth/btstack/avdtp/avdtpStream.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStream.h Wed Oct 13 15:48:34 2010 +0300
@@ -149,8 +149,7 @@
TInt AddSession(TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aTransportChannel,
- TL2CapConfig::TChannelPriority aPriority = TL2CapConfig::ELow);
+ CTransportChannel*& aTransportChannel);
void DropSession(TAvdtpTransportSessionType aType, CUserPlaneTransportSession& aSession);
void ClearSession(CUserPlaneTransportSession& aSession);
@@ -254,6 +253,7 @@
{
public:
static CWatchdogTimer* NewL(CAVStream& aObserver);
+ ~CWatchdogTimer();
private:
CWatchdogTimer(CAVStream& aObserver);
void RunL();
@@ -304,8 +304,7 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aTransportChannel,
- TL2CapConfig::TChannelPriority aPriority) const;
+ CTransportChannel*& aTransportChannel) const;
virtual void DropSession(CAVStream& aStream, TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession) const;
@@ -400,8 +399,7 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority) const;
+ CTransportChannel*& aChannel) const;
virtual void DropSession(CAVStream& aStream, TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession) const;
virtual void SetConfigurationL(CAVStream& aStream,
@@ -422,8 +420,7 @@
TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aTransportChannel,
- TL2CapConfig::TChannelPriority aPriority) const;
+ CTransportChannel*& aTransportChannel) const;
virtual void Enter(CAVStream& aStream) const;
private:
void TryToOpen(CAVStream& aStream) const;
@@ -444,8 +441,7 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority) const;
+ CTransportChannel*& aChannel) const;
virtual TInt StartReceived(CAVStream& aStream) const;
virtual void Enter(CAVStream& aStream) const;
@@ -459,8 +455,7 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority) const;
+ CTransportChannel*& aChannel) const;
virtual TInt StartReceived(CAVStream& aStream) const;
virtual void Enter(CAVStream& aStream) const;
@@ -500,8 +495,7 @@
virtual TInt AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority) const;
+ CTransportChannel*& aChannel) const;
// next pertains to reconfiguration
void SetConfigurationL(CAVStream& aStream,
RBuf8& aPacketBuffer,
--- a/bluetooth/btstack/avdtp/avdtpStreamStates.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpStreamStates.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -254,8 +254,7 @@
TInt TAVStreamState::AddSession(CAVStream& /*aStream*/,
TAvdtpTransportSessionType /*aType*/,
CUserPlaneTransportSession& /*aSession*/,
- CTransportChannel*& /*aTransportChannel*/,
- TL2CapConfig::TChannelPriority /*aPriority*/) const
+ CTransportChannel*& /*aTransportChannel*/) const
{
LOG_FUNC
DEBUGPANICINSTATE(EAvdtpUnexpectedAddSessionEvent);
@@ -491,8 +490,7 @@
TInt TAVStreamStateINTConfigured::AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority) const
+ CTransportChannel*& aChannel) const
{
LOG_FUNC
TInt ret = KErrNone;
@@ -515,7 +513,7 @@
if (aChannel)
{
// bind session to channel
- ret = aChannel->AttachTransportSession(aSession, aType, aPriority);
+ ret = aChannel->AttachTransportSession(aSession, aType);
if (ret==KErrNone)
{
// keep a copy of this binding
@@ -776,8 +774,7 @@
TInt TAVStreamStateACPConfigured::AddSession(CAVStream& /*aStream*/,
TAvdtpTransportSessionType /*aType*/,
CUserPlaneTransportSession& /*aSession*/,
- CTransportChannel*& /*aTransportChannel*/,
- TL2CapConfig::TChannelPriority /*aPriority*/) const
+ CTransportChannel*& /*aTransportChannel*/) const
{
LOG_FUNC
return KErrNotReady;
@@ -831,8 +828,7 @@
TInt TAVStreamStateReady::AddSession(CAVStream& /*aStream*/,
TAvdtpTransportSessionType /*aType*/,
CUserPlaneTransportSession& /*aSession*/,
- CTransportChannel*& /*aTransportChannel*/,
- TL2CapConfig::TChannelPriority /*aPriority*/) const
+ CTransportChannel*& /*aTransportChannel*/) const
{
LOG_FUNC
#ifdef _DEBUG
@@ -923,6 +919,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);
}
@@ -1197,8 +1194,7 @@
TInt TAVStreamStateWaitForSessions::AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority) const
+ CTransportChannel*& aChannel) const
{
LOG_FUNC
TInt ret = KErrNone;
@@ -1241,7 +1237,7 @@
if (ret == KErrNone)
{
- ret = b->iChannel->AttachTransportSession(aSession, aType, aPriority);
+ ret = b->iChannel->AttachTransportSession(aSession, aType);
if (ret==KErrNone)
{
// stream needs to remember binding
@@ -1281,12 +1277,11 @@
TInt TAVStreamStateWaitForSessionsStartReceived::AddSession(CAVStream& aStream,
TAvdtpTransportSessionType aType,
CUserPlaneTransportSession& aSession,
- CTransportChannel*& aChannel,
- TL2CapConfig::TChannelPriority aPriority) const
+ CTransportChannel*& aChannel) const
{
LOG_FUNC
// Call the function from the parent class to bind the session
- TInt ret = TAVStreamStateWaitForSessions::AddSession(aStream,aType,aSession,aChannel, aPriority);
+ TInt ret = TAVStreamStateWaitForSessions::AddSession(aStream,aType,aSession,aChannel);
// 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 Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpTransportChannel.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -99,7 +99,6 @@
// take ownership
iLogicalChannel = aLogicalChannelRecord.iLogicalChannelSAP;
iLogicalChannel->SetNotify(this);
- UpdateChannelPriority();
// drain any data
if (aLogicalChannelRecord.iDataCount)
{
--- a/bluetooth/btstack/avdtp/avdtpTransportChannel.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/avdtp/avdtpTransportChannel.h Wed Oct 13 15:48:34 2010 +0300
@@ -59,7 +59,7 @@
// management path
virtual void DetachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)=0;
- virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType, TL2CapConfig::TChannelPriority aPriority)=0;
+ virtual TInt AttachTransportSession(CUserPlaneTransportSession& aSession, TAvdtpTransportSessionType aType)=0;
virtual TBool CouldAttachSession(const TAvdtpSockAddr& aAddr)=0;
virtual TTCID TCID() const=0;
inline const TBTDevAddr& RemoteAddress() const;
@@ -101,9 +101,6 @@
void CloseLogicalChannel();
inline CAvdtpProtocol& Protocol() const;
-private:
- virtual void UpdateChannelPriority() = 0;
-
protected:
RTCID iTCID;
CServProviderBase* iLogicalChannel;
--- a/bluetooth/btstack/bluetooth_stack.ini Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/bluetooth_stack.ini Wed Oct 13 15:48:34 2010 +0300
@@ -19,4 +19,6 @@
[CoreHci]
EcomUid= 0x102736DE
+[lowpowermodeconfiguration]
+overridelpmtimeout_microseconds= 0
--- a/bluetooth/btstack/common/bt.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/common/bt.h Wed Oct 13 15:48:34 2010 +0300
@@ -44,6 +44,7 @@
EPreauthoriseDevice, // used for multiple SAPs operating in one usecase (eg AVRCP and GAVDP);
ESubscribePhysicalLink,
EUnsubscribePhysicalLink,
+ EOverrideLPMWithTimeout,
EOverrideLPM,
EUndoOverrideLPM,
ETryToAndThenPreventHostEncryptionKeyRefresh,
--- a/bluetooth/btstack/common/bt_v2.mmp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/common/bt_v2.mmp Wed Oct 13 15:48:34 2010 +0300
@@ -78,8 +78,6 @@
SOURCE hcifacade_events.cpp
SOURCE physicallinks.cpp
SOURCE PhysicalLinkHelper.cpp
-SOURCE roleswitchhelper.cpp
-SOURCE encryptionkeyrefreshhelper.cpp
SOURCE basebandsap.cpp
SOURCE physicallinksmanager.cpp
SOURCE physicallinkmetrics.cpp
--- a/bluetooth/btstack/common/btprt.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/common/btprt.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -350,6 +350,7 @@
{
LOG_FUNC
CServProviderBase* sap =iLowerProtocol->NewSAPL(aSockType);
+ ASSERT_DEBUG(!iListener);
iListener=CIncomingConnectionListener::NewL(*this, sap, aPort, aQueSize, aUid);
}
--- a/bluetooth/btstack/common/btsap.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/common/btsap.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-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"
@@ -27,7 +27,7 @@
const char* const KBT_SAP_NAME_DIAG = __PLATSEC_DIAGNOSTIC_STRING("Bluetooth SAP");
CBluetoothSAP::CBluetoothSAP(CBTSecMan& aSecMan, CBTCodServiceMan& aCodMan)
-: iSecMan(aSecMan), iCodMan(aCodMan)
+: iSecMan(aSecMan), iCodMan(aCodMan), iNoSecurityRequired(EFalse)
{
}
@@ -166,6 +166,7 @@
aSAPWithSecuritySettings.Override(RemoteAddress()),
RemoteAddress(),
aSecurityModeFourOutgoing ? EGeneralBondingSecurityMode4Outgoing : EGeneralBonding, // We are doing general bonding
+ aSAPWithSecuritySettings.iNoSecurityRequired,
const_cast<MAccessRequestResponseHandler&>(handler)));
if (err != KErrNone)
@@ -273,7 +274,21 @@
rerr = SetCodServiceBits(newServiceBits); // The service bits are saved and then registered when SAP becomes live
}
break;
-
+ case KBTSetNoSecurityRequired:
+ {
+ __ASSERT_DEBUG(iSecurityChecker, User::Panic(KSECURITY_PANIC, EBTPanicNullSecurityChecker));
+ rerr = iSecurityChecker->CheckPolicy(KSDP_SID_PROT_SERV, KBT_SAP_NAME_DIAG);
+ if (rerr == KErrNone)
+ {
+ iNoSecurityRequired = *reinterpret_cast<const TBool*>(aOption.Ptr());
+ }
+ }
+ break;
+ case KBTSecurityDeviceOverride:
+ {
+ rerr = SetDeviceOverride(aOption);
+ }
+ break;
default:
// Unhandled SetOpt name
rerr = KErrNotSupported;
--- a/bluetooth/btstack/inc/BtSap.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/inc/BtSap.h Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -89,6 +89,7 @@
CBTCodServiceMan& iCodMan;
CAsyncCallBack* iAccessDeniedCallBack;
+ TBool iNoSecurityRequired;
};
--- a/bluetooth/btstack/l2cap/L2CapPDU.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/l2cap/L2CapPDU.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1252,7 +1252,7 @@
iCommands(_FOFF(HL2CapCommand, iLink)),
iCommandIter(iCommands)
{
- LOG_STATIC_FUNC
+ LOG_FUNC
L2CAP_DEBUG(ObjectAllocation(L2capDebugInfo::ECFrame,
L2capDebugInfo::EAllocated));
}
--- a/bluetooth/btstack/l2cap/l2capSAPSignalHandler.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2capSAPSignalHandler.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -813,9 +813,8 @@
{
LOG_FUNC
// The SAP is about to be detached from this signal handler.
- // Ensure no overrides are active.
+ // Ensure no park overrides are active.
UndoOverrideParkMode();
- UndoOverrideLPM();
// Check if this SH has any unsent commands
// outstanding.
@@ -917,26 +916,15 @@
iSAP->Protocol().ControlPlane().ModifyPhysicalLink(EUndoOverridePark, iSAP->RemoteDev());
}
}
-
-void CL2CapSAPSignalHandler::OverrideLPM()
+
+void CL2CapSAPSignalHandler::OverrideLPMWithTimeout()
{
LOG_FUNC
// Temporarily override all low power modes. A reference to the SAP is required
// to get the remote device address.
if(iSAP)
{
- iSAP->Protocol().ControlPlane().ModifyPhysicalLink(EOverrideLPM, iSAP->RemoteDev());
+ iSAP->Protocol().ControlPlane().ModifyPhysicalLink(EOverrideLPMWithTimeout, iSAP->RemoteDev());
}
}
-
-void CL2CapSAPSignalHandler::UndoOverrideLPM()
- {
- LOG_FUNC
- // Remove the temporary override of all low power modes. A reference to the SAP is
- // required to get the remote device address.
- if(iSAP)
- {
- iSAP->Protocol().ControlPlane().ModifyPhysicalLink(EUndoOverrideLPM, iSAP->RemoteDev());
- }
- }
-
+
--- a/bluetooth/btstack/l2cap/l2capSAPSignalHandler.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2capSAPSignalHandler.h Wed Oct 13 15:48:34 2010 +0300
@@ -141,8 +141,7 @@
void OverrideParkMode();
void UndoOverrideParkMode();
- void OverrideLPM();
- void UndoOverrideLPM();
+ void OverrideLPMWithTimeout();
inline TInt SignalHandlerErrorCode() const;
inline MSocketNotify::TOperationBitmasks SignalHandlerErrorAction() const;
--- a/bluetooth/btstack/l2cap/l2capSigStates.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2capSigStates.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -286,8 +286,6 @@
{
LOG_FUNC
// The SAP has requested a channel be opened.
- // Override all LPMs to try and avoid signalling timeouts
- aSignalHandler.OverrideLPM();
TInt err = aSignalHandler.ChannelConfig().UpdateLocalConfigWithEntityCapabilities();
if (err == KErrNone)
@@ -300,6 +298,9 @@
// Update local Port.
aSignalHandler.SetLocalPort(port);
+ // Override park to allow the connection to be made.
+ aSignalHandler.OverrideParkMode();
+
// Active connection. Send a Connect Request command.
err = aSignalHandler.ConstructConnectionRequest();
if(err == KErrNone)
@@ -329,8 +330,10 @@
// Update local Port.
aSignalHandler.SetLocalPort(port);
- // Override all LPMs to try and avoid signalling timeouts
- aSignalHandler.OverrideLPM();
+ // Override park to allow the connection to be made.
+ aSignalHandler.OverrideParkMode();
+ // Override all LPMs (if timeout not set to zero)
+ aSignalHandler.OverrideLPMWithTimeout();
// Send a response with a 'pending' result and start security procedure.
err = aSignalHandler.ConstructConnectionResponse(aSignalHandler.GetOutstandingRequestID(),
@@ -381,16 +384,10 @@
aSignalHandler.iOpenChannelRequestAwaitingPeerEntityConfig = EFalse;
- // Depending where we came from we may have applied either a
- // park override or an all LPM override. We remove both these
- // overrides because it's safe to remove an override that
- // hasn't been applied.
- // Note that although park is one of the LPMs the different
- // levels of override are managed separately, so an
- // UndoOverrideLPM does not remove an explicit park only
- // override.
+ // If Park mode has been overridden during either channel establishment or
+ // channel disconnect, remove the override.
+ // NB It is safe to call this method multiple times.
aSignalHandler.UndoOverrideParkMode();
- aSignalHandler.UndoOverrideLPM();
// If the signal handler has left the closed state, it will have been added
// to the SH list in the Muxer. Now that the closed state is being
@@ -1094,16 +1091,8 @@
}
else
{
- // Depending where we came from we may have applied either a
- // park override or an all LPM override. We remove both these
- // overrides because it's safe to remove an override that
- // hasn't been applied.
- // Note that although park is one of the LPMs the different
- // levels of override are managed separately, so an
- // UndoOverrideLPM does not remove an explicit park only
- // override.
+ // Remove and park override.
aSignalHandler.UndoOverrideParkMode();
- aSignalHandler.UndoOverrideLPM();
// Cancel the configuration timer.
aSignalHandler.CancelTimer();
@@ -1160,23 +1149,7 @@
void TL2CAPSigStateWaitDisconnect::DisconnectResponse(CL2CapSAPSignalHandler& aSignalHandler) const
{
LOG_FUNC
- // We've got a disconnect response, we're done. Any remaing stuff on the queue
- // is redundant, so ditch it and close synchronously.
- aSignalHandler.FlushAllQueues();
-
- // If an error condition has been recorded forward the error
- // to the SAP.
- if(aSignalHandler.SignalHandlerErrorCode() != KErrNone)
- {
- Error(aSignalHandler, aSignalHandler.SignalHandlerErrorCode(), aSignalHandler.SignalHandlerErrorAction());
- }
- else
- {
- // This will delete the signal handler if the SAP has detached.
- aSignalHandler.SetState(iFactory.GetState(CL2CAPSignalStateFactory::EClosed));
- aSignalHandler.SignalHandlerDisconnectedCanClose();
- }
-
+ aSignalHandler.DrainPendingCommands();
}
// "Artificial" state events
@@ -1200,9 +1173,7 @@
void TL2CAPSigStateWaitDisconnect::Enter(CL2CapSAPSignalHandler& aSignalHandler) const
{
LOG_FUNC
- // Only override park for disconnect. We need to be able
- // to send the signalling, but we don't care if it takes
- // ages. No point starting a sniff bun-fight.
+ // Override park to allow the disconnect to continue.
aSignalHandler.OverrideParkMode();
// Cancel the configuration timer.
--- a/bluetooth/btstack/l2cap/l2sap.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2sap.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -435,7 +435,7 @@
case KL2CAPUpdateChannelConfig:
{
const TL2CapConfig apiConf = *reinterpret_cast<const TL2CapConfig*>(aOption.Ptr());
- return UpdateChannelConfig(apiConf);
+ return iL2CapSAPSignalHandler->UpdateChannelConfig(apiConf);
}
// Can't set these
@@ -1084,11 +1084,6 @@
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 Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/l2cap/l2signalmgr.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1177,11 +1177,11 @@
else
{
TBool controllerAdded = EFalse;
- while(!controllerAdded && (handler = iter++) != NULL)
+ while((handler = iter++) != NULL && !controllerAdded)
{
if(channelPriority > handler->Config().ChannelPriority())
{
- aDataController.iLink.AddBefore(&handler->iLink);
+ handler->iLink.AddBefore(&(aDataController.iLink));
controllerAdded = ETrue;
}
}
--- a/bluetooth/btstack/linkmgr/MBtHostControllerEventInternalNotifier.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/MBtHostControllerEventInternalNotifier.h Wed Oct 13 15:48:34 2010 +0300
@@ -67,8 +67,6 @@
virtual void RemoteName(THCIErrorCode /*aErr*/, const TBTDevAddr& /*aAddr*/, const TBTDeviceName8& /*aName*/) {};
virtual void SimplePairingComplete(const TBTDevAddr& /*aBDAddr*/, THCIErrorCode /*aErr*/) {};
-
- virtual void EncryptionKeyRefreshComplete(THCIErrorCode /*aErr*/, THCIConnHandle /*aConnH*/) {};
};
#endif //_MBTHOSTCONTROLEREVENTINTERNALNOTIFIER_H_
--- a/bluetooth/btstack/linkmgr/PhysicalLinkHelper.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/PhysicalLinkHelper.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -22,37 +22,60 @@
#include "ProxySAP.h"
#include "linkmgr.h"
-
#ifdef __FLOG_ACTIVE
_LIT8(KLogComponent, LOG_COMPONENT_LINKMGR);
#endif
-CPhysicalLinkHelper::CPhysicalLinkHelper(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink)
- : iLinkMgr(aLinkMgr)
+CRoleSwitcher::CRoleSwitcher(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole)
+ : CTimer(CActive::EPriorityStandard)
+ , iLinkMgr(aLinkMgr)
, iLink(aLink)
+ , iRole(aRole)
+ , iIsEncryptionDisabledForRoleSwitch(EFalse)
{
LOG_FUNC
+ iState = &iLinkMgr.RoleSwitcherStateFactory().GetState(CRoleSwitcherStateFactory::EIdle);
+ }
+
+CRoleSwitcher* CRoleSwitcher::NewL(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole)
+ {
+ LOG_STATIC_FUNC
+ CRoleSwitcher* self = new(ELeave) CRoleSwitcher(aLinkMgr, aLink, aRole);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
}
-void CPhysicalLinkHelper::BaseConstructL()
+void CRoleSwitcher::ConstructL()
{
LOG_FUNC
// create Proxy telling it the possible PHY
iBTProxySAP = CBTProxySAP::NewL(iLinkMgr, &iLink);
iBTProxySAP->SetNotify(this);
-
- TCallBack ecb(EventReceivedCallBack, this);
- iEventReceivedCallBack = new (ELeave)CAsyncCallBack(ecb, EActiveHighPriority);
+
+ TCallBack cb(EventReceivedCallBack, this);
+ iEventReceivedCallBack = new (ELeave)CAsyncCallBack(cb, EActiveHighPriority);
+
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+
+ // add ourselves to the list in LinkMgr, LinkMgr will kick off the role change state machine
+ iLinkMgr.AddRoleSwitcher(*this);
+ iAddedToLinkMgr = ETrue;
}
-CPhysicalLinkHelper::~CPhysicalLinkHelper()
+CRoleSwitcher::~CRoleSwitcher()
{
LOG_FUNC
-
- RemoveTimer();
+ if (iAddedToLinkMgr)
+ {
+ iLinkMgr.RemoveRoleSwitcher(*this);
+ }
+
+ Cancel(); // watchdog timer
delete iBTProxySAP;
-
if (iEventReceivedCallBack)
{
iEventReceivedCallBack->Cancel();
@@ -60,14 +83,158 @@
}
}
-void CPhysicalLinkHelper::DisableLPM()
+void CRoleSwitcher::DisableLPM()
{
LOG_FUNC
TPckgBuf<TInt> optionBuf;
iBTProxySAP->SAPSetOption(KSolBtLMProxy, EBBRequestPreventAllLowPowerModes, optionBuf);
}
-TBool CPhysicalLinkHelper::IsEPRSupported() const
+void CRoleSwitcher::EnableLPM()
+ {
+ LOG_FUNC
+ TPckgBuf<TInt> optionBuf;
+ iBTProxySAP->SAPSetOption(KSolBtLMProxy, EBBRequestAllowAllLowPowerModes, optionBuf);
+ }
+
+void CRoleSwitcher::DisableEncryption()
+ {
+ LOG_FUNC
+ // data traffic suspended
+ iLinkMgr.LinkManagerProtocol().ACLController().SetParked(iLink.Handle(), ETrue);
+ TBTBasebandEvent event(ENotifyEncryptionChangeOff);
+ iBTProxySAP->Ioctl(KSolBtLMProxy, KLMBasebandEventOneShotNotificationIoctl, &event);
+ iLinkMgr.Encrypt(EFalse, iLink);
+
+ // set flag here, it's too late when we receive the event as AccessReqester
+ // might receive the baseband notification earlier then the flag is set!
+ iIsEncryptionDisabledForRoleSwitch = ETrue;
+ }
+
+void CRoleSwitcher::EnableEncryption()
+ {
+ LOG_FUNC
+ TBTBasebandEvent event(ENotifyEncryptionChangeOn);
+ iBTProxySAP->Ioctl(KSolBtLMProxy, KLMBasebandEventOneShotNotificationIoctl, &event);
+ iLinkMgr.Encrypt(ETrue, iLink);
+ // data traffic is enabled in IoctlComplete
+ }
+
+void CRoleSwitcher::ChangeRole()
+ {
+ LOG_FUNC
+ TBTBasebandEvent event(ENotifyAnyRole);
+ iBTProxySAP->Ioctl(KSolBtLMProxy, KLMBasebandEventOneShotNotificationIoctl, &event);
+ iLinkMgr.ChangeRole(iRole, iLink);
+ }
+
+void CRoleSwitcher::CancelIoctl()
+ {
+ LOG_FUNC
+ iBTProxySAP->CancelIoctl(KSolBtLMProxy, KLMBasebandEventOneShotNotificationIoctl);
+ }
+
+// Timer
+void CRoleSwitcher::RunL()
+ {
+ LOG_FUNC
+ iState->TimerExpired(*this);
+ }
+
+TInt CRoleSwitcher::RunError(TInt aError)
+ {
+ LOG_FUNC
+ iState->Error(*this, aError);
+ return KErrNone;
+ }
+
+// From MSocketNotify
+void CRoleSwitcher::NewData(TUint /*aCount*/)
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::CanSend()
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::ConnectComplete()
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::ConnectComplete(const TDesC8& /*aConnectData*/)
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::ConnectComplete(CServProviderBase& /*aSSP*/)
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::ConnectComplete(CServProviderBase& /*aSSP*/,const TDesC8& /*aConnectData*/)
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::CanClose(TDelete /*aDelete*/)
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::CanClose(const TDesC8& /*aDisconnectData*/,TDelete /*aDelete*/)
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::Error(TInt /*aError*/,TUint /*aOperationMask*/)
+ {
+ LOG_FUNC
+
+ }
+
+void CRoleSwitcher::Disconnect(void)
+ {
+ LOG_FUNC
+ iState->Error(*this, KErrDisconnected);
+ }
+
+void CRoleSwitcher::Disconnect(TDesC8& /*aDisconnectData*/)
+ {
+ LOG_FUNC
+ iState->Error(*this, KErrDisconnected);
+ }
+
+void CRoleSwitcher::Start()
+ {
+ LOG_FUNC
+ iState->Start(*this);
+ }
+
+void CRoleSwitcher::Finish()
+ {
+ LOG_FUNC
+ // async call to delete this class
+ iLink.AsyncDeleteRoleSwitcher();
+ }
+
+void CRoleSwitcher::SaveEncryption()
+ {
+ LOG_FUNC
+ iIsEncrypted = iLink.Encrypted();
+ }
+
+TBool CRoleSwitcher::IsEPRSupported() const
{
LOG_FUNC
// For Lisbon (Bluetooth 2.1), if EPR is supported both locally and remotely,
@@ -76,144 +243,418 @@
return iLink.IsEncryptionPauseResumeSupported();
}
-void CPhysicalLinkHelper::NotifyBasebandEvent(TNotifyEvent aEvent)
- {
- LOG_FUNC
- TBTBasebandEvent event(aEvent.NotifyEvent());
- iBTProxySAP->Ioctl(KSolBtLMProxy, KLMBasebandEventOneShotNotificationIoctl, &event);
- }
-
-void CPhysicalLinkHelper::CancelNotify()
- {
- LOG_FUNC
- iBTProxySAP->CancelIoctl(KSolBtLMProxy, KLMBasebandEventOneShotNotificationIoctl);
- }
-
-void CPhysicalLinkHelper::QueueTimer(TTimeIntervalMicroSeconds32 aTimerVal)
- {
- LOG_FUNC
-
- TCallBack cb(TimerExpiredCallBack, this);
- iTimerEntry.Set(cb);
- BTSocketTimer::Queue(aTimerVal, iTimerEntry);
- }
-
-
-void CPhysicalLinkHelper::RemoveTimer()
- {
- LOG_FUNC
-
- BTSocketTimer::Remove(iTimerEntry);
- }
-
-// From MSocketNotify
-void CPhysicalLinkHelper::NewData(TUint /*aCount*/)
- {
- LOG_FUNC
-
- }
-
-void CPhysicalLinkHelper::CanSend()
- {
- LOG_FUNC
-
- }
-
-void CPhysicalLinkHelper::ConnectComplete()
+void CRoleSwitcher::LogRoleSwitchSuccessful() const
{
LOG_FUNC
-
- }
-
-void CPhysicalLinkHelper::ConnectComplete(const TDesC8& /*aConnectData*/)
- {
- LOG_FUNC
-
- }
-
-void CPhysicalLinkHelper::ConnectComplete(CServProviderBase& /*aSSP*/)
- {
- LOG_FUNC
+ TInt eventType;
+ eventType = (iRole == EMaster ? ENotifyMaster :ENotifySlave);
- }
-
-void CPhysicalLinkHelper::ConnectComplete(CServProviderBase& /*aSSP*/,const TDesC8& /*aConnectData*/)
- {
- LOG_FUNC
-
- }
-
-void CPhysicalLinkHelper::CanClose(TDelete /*aDelete*/)
- {
- LOG_FUNC
-
+ if (iBasebandEvent.EventType()==eventType &&
+ iBasebandEvent.ErrorCode()==KErrNone)
+ {
+ LOG(_L("CRoleSwitcher RoleSwitch OK"));
+ }
+ else
+ {
+ LOG(_L("CRoleSwitcher RoleSwitch failed"));
+ }
}
-void CPhysicalLinkHelper::CanClose(const TDesC8& /*aDisconnectData*/,TDelete /*aDelete*/)
- {
- LOG_FUNC
-
- }
-
-void CPhysicalLinkHelper::Error(TInt /*aError*/,TUint /*aOperationMask*/)
- {
- LOG_FUNC
-
- }
-
-void CPhysicalLinkHelper::Disconnect(void)
- {
- LOG_FUNC
- Error(KErrDisconnected);
- }
-
-void CPhysicalLinkHelper::Disconnect(TDesC8& /*aDisconnectData*/)
- {
- LOG_FUNC
- Error(KErrDisconnected);
- }
-
-void CPhysicalLinkHelper::IoctlComplete(TDesC8 *aBuf)
+void CRoleSwitcher::IoctlComplete(TDesC8 *aBuf)
{
LOG_FUNC
const TBTBasebandEventNotification* event = reinterpret_cast<const TBTBasebandEventNotification*>(aBuf->Ptr());
iBasebandEvent = *event;
iEventReceivedCallBack->CallBack();
}
+
+/*static*/ TInt CRoleSwitcher::EventReceivedCallBack(TAny* aRoleSwitcher)
+ {
+ LOG_STATIC_FUNC
+ CRoleSwitcher* roleSwitcher = static_cast<CRoleSwitcher*>(aRoleSwitcher);
+ roleSwitcher->iState->EventReceived(*roleSwitcher);
+ return EFalse;
+ }
+
-/*static*/ TInt CPhysicalLinkHelper::EventReceivedCallBack(TAny* aThis)
+//----------------------------------------------------------------------------------
+// STATE FACTORY
+//----------------------------------------------------------------------------------
+
+CRoleSwitcherStateFactory* CRoleSwitcherStateFactory::NewL()
{
LOG_STATIC_FUNC
- CPhysicalLinkHelper* helper = static_cast<CPhysicalLinkHelper*>(aThis);
- helper->DoEventReceivedCallBack();
- return EFalse;
+ CRoleSwitcherStateFactory* ret=new (ELeave) CRoleSwitcherStateFactory();
+ CleanupStack::PushL(ret);
+ ret->ConstructL();
+ CleanupStack::Pop(ret);
+ return ret;
+ }
+
+void CRoleSwitcherStateFactory::ConstructL()
+ {
+ LOG_FUNC
+ iStates[EIdle] =new (ELeave) TRSStateIdle(*this);
+ iStates[EDisablingLPM] =new (ELeave) TRSStateDisablingLPM(*this);
+ iStates[EDisablingEncryption] =new (ELeave) TRSStateDisablingEncryption(*this);
+ iStates[EChangingRole] =new (ELeave) TRSStateChangingRole(*this);
+ iStates[EChangingRoleWithEPR] =new (ELeave) TRSStateChangingRoleWithEPR(*this);
+ iStates[EEnablingEncryption] =new (ELeave) TRSStateEnablingEncryption(*this);
+ }
+
+CRoleSwitcherStateFactory::CRoleSwitcherStateFactory()
+ {
+ LOG_FUNC
+ iStates.DeleteAll();
+ }
+
+TRoleSwitcherState& CRoleSwitcherStateFactory::GetState(CRoleSwitcherStateFactory::TRoleSwitcherStates aState)
+ {
+ LOG_FUNC
+ __ASSERT_DEBUG(iStates[aState], Panic(ERoleSwitcherInvalidState));
+ return *iStates[aState];
+ }
+
+TInt CRoleSwitcherStateFactory::StateIndex(const TRoleSwitcherState* aState) const
+ {
+ LOG_FUNC
+ TInt state;
+ for (state = 0; state < ERoleSwitcherMaxState; state++)
+ {
+ if (iStates[state] == aState)
+ {
+ return state;
+ }
+ }
+
+ return KUnknownState;
+ }
+
+
+//----------------------------------------------------------------------------------
+// STATES
+//----------------------------------------------------------------------------------
+
+TRoleSwitcherState::TRoleSwitcherState(CRoleSwitcherStateFactory& aFactory)
+: iFactory(aFactory)
+ {
+ LOG_FUNC
+ }
+
+void TRoleSwitcherState::PanicInState(TLinkPanic aPanic) const
+ {
+ LOG_FUNC
+ Panic(aPanic, iFactory.StateIndex(this));
+ }
+
+void TRoleSwitcherState::ChangeState(CRoleSwitcher& aContext, CRoleSwitcherStateFactory::TRoleSwitcherStates aState) const
+ {
+ LOG_FUNC
+
+ aContext.iState->Exit(aContext);
+
+#ifdef __FLOG_ACTIVE
+ TRoleSwitcherState* state=&iFactory.GetState(aState);
+ LOG2(_L("RoleSwitcher: State %S -> %S"), &aContext.iState->iName, &state->iName);
+#endif //__FLOG_ACTIVE
+ aContext.iState=&iFactory.GetState(aState);
+
+ aContext.iState->Enter(aContext);
+ }
+
+void TRoleSwitcherState::Enter(CRoleSwitcher& /*aContext*/) const
+ {
+ LOG_FUNC
+ // do nothing
}
-void CPhysicalLinkHelper::DoEventReceivedCallBack()
+void TRoleSwitcherState::Exit(CRoleSwitcher& /*aContext*/) const
+ {
+ LOG_FUNC
+ // do nothing
+ }
+
+void TRoleSwitcherState::Start(CRoleSwitcher& /*aContext*/) const
+ {
+ LOG_FUNC
+ PanicInState(ERoleSwitcherStateMachineInvalidEvent);
+ }
+
+void TRoleSwitcherState::Error(CRoleSwitcher& aContext, TInt /*aErr*/) const
+ {
+ LOG_FUNC
+ aContext.CancelIoctl();
+ aContext.Cancel();
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+
+void TRoleSwitcherState::EventReceived(CRoleSwitcher& /*aContext*/) const
+ {
+ LOG_FUNC
+ // do nothing
+ }
+
+void TRoleSwitcherState::TimerExpired(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+
+//----------------------------------------------------------------------------------
+
+TRSStateIdle::TRSStateIdle(CRoleSwitcherStateFactory& aFactory)
+: TRoleSwitcherState(aFactory)
+ {
+ LOG_FUNC
+ STATENAME("TRSStateIdle");
+ }
+
+void TRSStateIdle::Start(CRoleSwitcher& aContext) const
{
LOG_FUNC
- EventReceived(iBasebandEvent);
+ aContext.After(KTimeoutRoleSwitch); // watchdog timer
+ ChangeState(aContext, CRoleSwitcherStateFactory::EDisablingLPM);
+ }
+
+void TRSStateIdle::Enter(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.Finish();
+ }
+
+//----------------------------------------------------------------------------------
+
+TRSStateDisablingLPM::TRSStateDisablingLPM(CRoleSwitcherStateFactory& aFactory)
+: TRoleSwitcherState(aFactory)
+ {
+ LOG_FUNC
+ STATENAME("TRSStateDisablingLPM");
+ }
+
+void TRSStateDisablingLPM::Enter(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ // DisableLPM even if link is active to prevent possible LPM requests during encryption disabling
+
+ if (aContext.iLink.LinkMode() == EActiveMode)
+ {
+ aContext.DisableLPM();
+ if (aContext.IsEPRSupported())
+ {
+ ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRoleWithEPR);
+ }
+ else
+ {
+ ChangeState(aContext, CRoleSwitcherStateFactory::EDisablingEncryption);
+ }
+ // don't wait for notification
+ }
+ else
+ {
+ TBTBasebandEvent event(ENotifyActiveMode);
+ aContext.iBTProxySAP->Ioctl(KSolBtLMProxy, KLMBasebandEventOneShotNotificationIoctl, &event);
+ aContext.DisableLPM();
+ }
}
-/*static*/ TInt CPhysicalLinkHelper::TimerExpiredCallBack(TAny* aThis)
+void TRSStateDisablingLPM::EventReceived(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ if (aContext.iBasebandEvent.EventType()==ENotifyActiveMode &&
+ aContext.iBasebandEvent.ErrorCode()==KErrNone)
+ {
+ if (aContext.IsEPRSupported())
+ {
+ ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRoleWithEPR);
+ }
+ else
+ {
+ ChangeState(aContext, CRoleSwitcherStateFactory::EDisablingEncryption);
+ }
+ }
+ else
+ {
+ LOG(_L("CRoleSwitcher RoleSwitch failed in DisableLPM"));
+ // we can quit SM, don't need to rewind
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+ }
+
+//----------------------------------------------------------------------------------
+TRSStateDisablingEncryption::TRSStateDisablingEncryption(CRoleSwitcherStateFactory& aFactory)
+: TRoleSwitcherState(aFactory)
+ {
+ LOG_FUNC
+ STATENAME("TRSStateDisablingEncryption");
+ }
+
+void TRSStateDisablingEncryption::Enter(CRoleSwitcher& aContext) const
{
- LOG_STATIC_FUNC
- CPhysicalLinkHelper* helper = static_cast<CPhysicalLinkHelper*>(aThis);
- helper->DoTimerExpiredCallBack();
- return EFalse;
+ LOG_FUNC
+ aContext.SaveEncryption();
+ if (aContext.iIsEncrypted)
+ {
+ aContext.DisableEncryption();
+ }
+ else
+ {
+ ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRole);
+ }
+ }
+
+void TRSStateDisablingEncryption::EventReceived(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ if (aContext.iBasebandEvent.EventType()==ENotifyEncryptionChangeOff &&
+ aContext.iBasebandEvent.ErrorCode()==KErrNone)
+ {
+ ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRole);
+ }
+ else
+ {
+ LOG(_L("CRoleSwitcher RoleSwitch failed in DisableEncryption"));
+ // before quiting SM , try to enable LPM
+ aContext.EnableLPM();
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+ }
+
+void TRSStateDisablingEncryption::TimerExpired(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.CancelIoctl();
+ ChangeState(aContext, CRoleSwitcherStateFactory::EEnablingEncryption);
+ }
+
+//----------------------------------------------------------------------------------
+TRSStateChangingRole::TRSStateChangingRole(CRoleSwitcherStateFactory& aFactory)
+: TRoleSwitcherState(aFactory)
+ {
+ LOG_FUNC
+ STATENAME("TRSStateChangingRole");
+ }
+
+void TRSStateChangingRole::Enter(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.ChangeRole();
+ }
+
+void TRSStateChangingRole::EventReceived(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.Cancel(); // cancel watchdog timer
+
+ FTRACE(aContext.LogRoleSwitchSuccessful());
+
+
+ ChangeState(aContext, CRoleSwitcherStateFactory::EEnablingEncryption);
}
-void CPhysicalLinkHelper::DoTimerExpiredCallBack()
+void TRSStateChangingRole::TimerExpired(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.CancelIoctl();
+ ChangeState(aContext, CRoleSwitcherStateFactory::EEnablingEncryption);
+ }
+
+//----------------------------------------------------------------------------------
+TRSStateChangingRoleWithEPR::TRSStateChangingRoleWithEPR(CRoleSwitcherStateFactory& aFactory)
+: TRoleSwitcherState(aFactory)
+ {
+ LOG_FUNC
+ STATENAME("TRSStateChangingRoleWithEPR");
+ }
+
+void TRSStateChangingRoleWithEPR::Enter(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.ChangeRole();
+ }
+
+void TRSStateChangingRoleWithEPR::EventReceived(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.Cancel(); // cancel watchdog timer
+
+ FTRACE(aContext.LogRoleSwitchSuccessful());
+
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+
+void TRSStateChangingRoleWithEPR::TimerExpired(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.CancelIoctl();
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+
+//----------------------------------------------------------------------------------
+TRSStateEnablingEncryption::TRSStateEnablingEncryption(CRoleSwitcherStateFactory& aFactory)
+: TRoleSwitcherState(aFactory)
+ {
+ LOG_FUNC
+ STATENAME("TRSStateEnablingEncryption");
+ }
+
+void TRSStateEnablingEncryption::Enter(CRoleSwitcher& aContext) const
{
LOG_FUNC
- TimerExpired();
+ if (aContext.iIsEncrypted)
+ {
+ aContext.After(KTimeoutOneCommand);
+ aContext.EnableEncryption();
+ }
+ else
+ {
+ aContext.EnableLPM();
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+ }
+
+void TRSStateEnablingEncryption::Exit(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ if (aContext.iIsEncrypted)
+ {
+ // enable data traffic
+ aContext.iLinkMgr.LinkManagerProtocol().ACLController().SetParked(aContext.iLink.Handle(), EFalse);
+ }
}
-
+void TRSStateEnablingEncryption::EventReceived(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ aContext.Cancel(); // watchdog timer
+ if (aContext.iBasebandEvent.EventType()==ENotifyEncryptionChangeOn &&
+ aContext.iBasebandEvent.ErrorCode()==KErrNone)
+ {
+ aContext.EnableLPM();
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ aContext.iIsEncryptionDisabledForRoleSwitch = EFalse;
+ }
+ else
+ {
+ LOG(_L("CRoleSwitcher SetEncryption failed, disconnect link"));
+ if (aContext.iLink.Terminate(ERemoteUserEndedConnection) != KErrNone)
+ {
+ LOG(_L("CRoleSwitcher OOM"));
+ }
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
+ }
+
+void TRSStateEnablingEncryption::TimerExpired(CRoleSwitcher& aContext) const
+ {
+ LOG_FUNC
+ LOG(_L("CRoleSwitcher Timeout in EncryptionEnable, disconnect"));
+ aContext.CancelIoctl();
+ if (aContext.iLink.Terminate(ERemoteUserEndedConnection) != KErrNone)
+ {
+ LOG(_L("CRoleSwitcher OOM"));
+ }
+ ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
+ }
-
-
-
-
--- a/bluetooth/btstack/linkmgr/PhysicalLinkHelper.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/PhysicalLinkHelper.h Wed Oct 13 15:48:34 2010 +0300
@@ -22,25 +22,28 @@
#include "linkutil.h"
#include <bluetooth/hci/hciutil.h>
-// A struct to allow both single event and combination events to be passed for requesting
-// notification. This effectively moves the cast to a TInt to below the API rather than
-// being required by the client.
-struct TNotifyEvent
- {
-public:
- TNotifyEvent(TBTPhysicalLinkStateNotifier aSingleEvent) : iEvent(aSingleEvent) {};
- TNotifyEvent(TBTPhysicalLinkStateNotifierCombinations aComboEvent) : iEvent(aComboEvent) {};
+// watchdog for first half of the SM including:
+// DisablingLPM, DisablingEncryption, RoleSwitch
+const TUint KTimeoutRoleSwitch = 3000000; // 3 s;
+
+// watchdog for EnablingEncryption
+const TUint KTimeoutOneCommand = 2000000; // 2 s;
+
+class TRoleSwitcherState;
- TInt NotifyEvent() const {return iEvent;};
-private:
- TInt iEvent;
- };
+NONSHARABLE_CLASS(CRoleSwitcher) : public CTimer, public MSocketNotify
+ {
+ friend class TRoleSwitcherState;
+ friend class TRSStateDisablingLPM;
+ friend class TRSStateDisablingEncryption;
+ friend class TRSStateChangingRole;
+ friend class TRSStateChangingRoleWithEPR;
+ friend class TRSStateEnablingEncryption;
+public:
-NONSHARABLE_CLASS(CPhysicalLinkHelper) : public CBase, public MSocketNotify
- {
-public:
- ~CPhysicalLinkHelper();
+ static CRoleSwitcher* NewL(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole);
+ ~CRoleSwitcher();
// From MSocketNotify
void NewData(TUint aCount);
@@ -58,50 +61,196 @@
void NoBearer(const TDesC8& /*aConnectionInf*/) {};
void Bearer(const TDesC8& /*aConnectionInf*/) {};
- virtual void StartHelper() = 0;
-
+ void Start();
+ void Finish();
inline const TBTDevAddr& BDAddr() const;
+ inline TBTBasebandRole RequestedRole() const;
+ inline TBool IsEncryptionDisabledForRoleSwitch() const;
+ TBool IsEPRSupported() const;
+ void LogRoleSwitchSuccessful() const;
+ TSglQueLink iQLink;
-protected:
- CPhysicalLinkHelper(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink);
- void BaseConstructL();
+private:
+ CRoleSwitcher(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole);
+ void ConstructL();
void DisableLPM();
+ void DisableEncryption();
+ void ChangeRole();
+ void EnableEncryption();
+ void EnableLPM();
+ void CancelIoctl();
- void QueueTimer(TTimeIntervalMicroSeconds32 aTimerVal);
- void RemoveTimer();
- void NotifyBasebandEvent(TNotifyEvent aEvent);
- void CancelNotify();
+ void SaveEncryption();
+ // CTimer
+ void RunL();
+ TInt RunError(TInt aError);
- TBool IsEPRSupported() const;
+ static TInt EventReceivedCallBack(TAny* aRoleSwitcher);
+ // Async Callback to notify baseband event received.
+ CAsyncCallBack* iEventReceivedCallBack;
+ TBTBasebandEventNotification iBasebandEvent;
+ TBool iIsEncrypted;
+ TBool iIsActive; // LinkMode
+ TBool iAddedToLinkMgr;
+ CPhysicalLinksManager& iLinkMgr;
+ CPhysicalLink& iLink;
+ TBTBasebandRole iRole; // Requested role
+ CBTProxySAP* iBTProxySAP;
+ TRoleSwitcherState* iState;
+ TBool iIsEncryptionDisabledForRoleSwitch;
+ };
+
+//--------------------------------------------------
+// STATE FACTORY
+//--------------------------------------------------
+
+/**
+ Factory for the RoleSwitcher states
+
+ The states are flyweight classes
+**/
+NONSHARABLE_CLASS(CRoleSwitcherStateFactory) : public CBase
+ {
+public:
+ static CRoleSwitcherStateFactory* NewL();
+
+ enum TRoleSwitcherStates
+ {
+ EIdle,
+ EDisablingLPM,
+ EDisablingEncryption,
+ EChangingRole,
+ EChangingRoleWithEPR,
+ EEnablingEncryption,
+ // *** keep next one last ***
+ ERoleSwitcherMaxState,
+ };
- virtual void TimerExpired() = 0;
- virtual void HandleError(TInt aError) = 0;
- virtual void EventReceived(TBTBasebandEventNotification& aEvent) = 0;
+ TRoleSwitcherState& GetState(TRoleSwitcherStates aState);
+ TInt StateIndex(const TRoleSwitcherState* aState) const;
private:
- static TInt EventReceivedCallBack(TAny* aThis);
- void DoEventReceivedCallBack();
+ CRoleSwitcherStateFactory();
+ void ConstructL();
+ TFixedArray<TRoleSwitcherState*, ERoleSwitcherMaxState> iStates;
+ };
+
+
+
+//--------------------------------------------------
+// STATES, base
+//--------------------------------------------------
+
+NONSHARABLE_CLASS(TRoleSwitcherState)
+ {
+public:
+ TRoleSwitcherState(CRoleSwitcherStateFactory& aFactory);
- static TInt TimerExpiredCallBack(TAny* aThis);
- void DoTimerExpiredCallBack();
+ virtual void Enter(CRoleSwitcher& aContext) const;
+ virtual void Exit(CRoleSwitcher& aContext) const;
+
+ virtual void Start(CRoleSwitcher& aContext) const;
+ virtual void EventReceived(CRoleSwitcher& aContext) const;
+ virtual void Error(CRoleSwitcher& aContext, TInt aErr) const;
+ virtual void TimerExpired(CRoleSwitcher& aContext) const;
+
+protected:
+ // Exits old state, sets the new state, and enters it.
+ void ChangeState(CRoleSwitcher& aContext, CRoleSwitcherStateFactory::TRoleSwitcherStates aState) const;
+ void PanicInState(TLinkPanic aPanic) const;
protected:
- CPhysicalLinksManager& iLinkMgr;
- CPhysicalLink& iLink;
-
-private:
- // Async Callback to notify baseband event received.
- CAsyncCallBack* iEventReceivedCallBack;
- TBTBasebandEventNotification iBasebandEvent;
- CBTProxySAP* iBTProxySAP;
-
- TDeltaTimerEntry iTimerEntry;
+ CRoleSwitcherStateFactory& iFactory;
+#ifdef __FLOG_ACTIVE
+ TBuf<48> iName;
+#endif
+ };
+
+
+//--------------------------------------------------
+// STATES
+//--------------------------------------------------
+
+NONSHARABLE_CLASS(TRSStateIdle) : public TRoleSwitcherState
+ {
+public:
+ TRSStateIdle(CRoleSwitcherStateFactory& aFactory);
+
+ virtual void Enter(CRoleSwitcher& aContext) const;
+ virtual void Start(CRoleSwitcher& aContext) const;
+ };
+
+
+NONSHARABLE_CLASS(TRSStateDisablingLPM) : public TRoleSwitcherState
+ {
+public:
+ TRSStateDisablingLPM(CRoleSwitcherStateFactory& aFactory);
+
+ virtual void Enter(CRoleSwitcher& aContext) const;
+ virtual void EventReceived(CRoleSwitcher& aContext) const;
};
-inline const TBTDevAddr& CPhysicalLinkHelper::BDAddr() const
+NONSHARABLE_CLASS(TRSStateDisablingEncryption) : public TRoleSwitcherState
+ {
+public:
+ TRSStateDisablingEncryption(CRoleSwitcherStateFactory& aFactory);
+
+ virtual void Enter(CRoleSwitcher& aContext) const;
+ virtual void EventReceived(CRoleSwitcher& aContext) const;
+ virtual void TimerExpired(CRoleSwitcher& aContext) const;
+ };
+
+NONSHARABLE_CLASS(TRSStateChangingRole) : public TRoleSwitcherState
+ {
+public:
+ TRSStateChangingRole(CRoleSwitcherStateFactory& aFactory);
+
+ virtual void Enter(CRoleSwitcher& aContext) const;
+ virtual void EventReceived(CRoleSwitcher& aContext) const;
+ virtual void TimerExpired(CRoleSwitcher& aContext) const;
+ };
+
+NONSHARABLE_CLASS(TRSStateChangingRoleWithEPR) : public TRoleSwitcherState
+ {
+public:
+ TRSStateChangingRoleWithEPR(CRoleSwitcherStateFactory& aFactory);
+
+ virtual void Enter(CRoleSwitcher& aContext) const;
+ virtual void EventReceived(CRoleSwitcher& aContext) const;
+ virtual void TimerExpired(CRoleSwitcher& aContext) const;
+ };
+
+NONSHARABLE_CLASS(TRSStateEnablingEncryption) : public TRoleSwitcherState
+ {
+public:
+ TRSStateEnablingEncryption(CRoleSwitcherStateFactory& aFactory);
+
+ virtual void Enter(CRoleSwitcher& aContext) const;
+ virtual void Exit(CRoleSwitcher& aContext) const;
+ virtual void EventReceived(CRoleSwitcher& aContext) const;
+ virtual void TimerExpired(CRoleSwitcher& aContext) const;
+ };
+
+#ifdef __FLOG_ACTIVE
+#define STATENAME(x) iName=_L(x)
+#else
+#define STATENAME(x)
+#endif
+
+inline const TBTDevAddr& CRoleSwitcher::BDAddr() const
{
return iLink.BDAddr();
}
+inline TBTBasebandRole CRoleSwitcher::RequestedRole() const
+ {
+ return iRole;
+ }
+
+inline TBool CRoleSwitcher::IsEncryptionDisabledForRoleSwitch() const
+ {
+ return iIsEncryptionDisabledForRoleSwitch;
+ }
+
#endif //PHYSICALLINKHELPER_H_
--- a/bluetooth/btstack/linkmgr/basebandsap.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/basebandsap.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -47,6 +47,11 @@
CBluetoothSAP::ConstructL();
}
+CBTBasebandSAP::~CBTBasebandSAP()
+ {
+ LOG_FUNC
+ }
+
// from CServProviderBase - the saps will not do all of these
void CBTBasebandSAP::Start()
{
--- a/bluetooth/btstack/linkmgr/basebandsap.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/basebandsap.h Wed Oct 13 15:48:34 2010 +0300
@@ -142,7 +142,9 @@
virtual TBool IsIdle() const;
virtual TPhysicalLinkObserverQLink& ObserverQLink() {return iQueLink;};
virtual void ParentClosing();
-
+
+ ~CBTBasebandSAP();
+
protected:
CBTBasebandSAP(CPhysicalLinksManager& aConnectionMan, CPhysicalLink* aConnection);
void ConstructL();
--- a/bluetooth/btstack/linkmgr/eSCOSAP.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/eSCOSAP.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -52,6 +52,7 @@
CeSCOLink::CeSCOLink(CPhysicalLinksManager& aLinksMan, CPhysicalLink* aPhysicalLink)
: CBTSynchronousLink(aLinksMan, aPhysicalLink, EeSCOLink)
{
+ LOG_FUNC
iUserPacketTypes = TBTSyncPackets::ESyncAnyESCOPacket;
}
@@ -62,6 +63,7 @@
CeSCOLink::~CeSCOLink()
{
+ LOG_FUNC
}
TInt CeSCOLink::GetOption(TUint aLevel, TUint aName, TDes8& aOption) const
--- a/bluetooth/btstack/linkmgr/encryptionkeyrefreshhelper.cpp Wed Sep 15 13:27:26 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Symbian Foundation License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#include <bluetooth/logger.h>
-
-#include "encryptionkeyrefreshhelper.h"
-#include "hcifacade.h"
-#include "linkmgr.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, LOG_COMPONENT_LINKMGR);
-#endif
-
-CEncryptionKeyRefresher::CEncryptionKeyRefresher(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink)
- : CPhysicalLinkHelper(aLinkMgr, aLink)
- {
- LOG_FUNC
- }
-
-CEncryptionKeyRefresher* CEncryptionKeyRefresher::NewL(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink)
- {
- LOG_STATIC_FUNC
- CEncryptionKeyRefresher* self = new(ELeave) CEncryptionKeyRefresher(aLinkMgr, aLink);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-void CEncryptionKeyRefresher::ConstructL()
- {
- LOG_FUNC
-
- BaseConstructL();
-
- iStateFactory = CEncryptionKeyRefresherStateFactory::NewL();
- iState = &(iStateFactory->GetState(CEncryptionKeyRefresherStateFactory::EIdle));
- }
-
-CEncryptionKeyRefresher::~CEncryptionKeyRefresher()
- {
- LOG_FUNC
- }
-
-void CEncryptionKeyRefresher::EncryptionKeyRefreshComplete(TInt aError)
- {
- LOG_FUNC
- iState->EncryptionKeyRefreshComplete(*this, aError);
- }
-
-void CEncryptionKeyRefresher::TimerExpired()
- {
- LOG_FUNC
- iState->TimerExpired(*this);
- }
-
-void CEncryptionKeyRefresher::HandleError( TInt aError)
- {
- LOG_FUNC
- iState->Error(*this, aError);
- }
-
-void CEncryptionKeyRefresher::StartHelper()
- {
- LOG_FUNC
- iState->Start(*this);
- }
-
-void CEncryptionKeyRefresher::EventReceived(TBTBasebandEventNotification& aEvent)
- {
- LOG_FUNC
- iState->EventReceived(*this, aEvent);
- }
-
-
-//----------------------------------------------------------------------------------
-// STATE FACTORY
-//----------------------------------------------------------------------------------
-
-CEncryptionKeyRefresherStateFactory* CEncryptionKeyRefresherStateFactory::NewL()
- {
- LOG_STATIC_FUNC
- CEncryptionKeyRefresherStateFactory* ret=new (ELeave) CEncryptionKeyRefresherStateFactory();
- CleanupStack::PushL(ret);
- ret->ConstructL();
- CleanupStack::Pop(ret);
- return ret;
- }
-
-void CEncryptionKeyRefresherStateFactory::ConstructL()
- {
- LOG_FUNC
- iStates[EIdle] =new (ELeave) TEkrStateIdle(*this);
- iStates[EDisablingLPM] =new (ELeave) TEkrStateDisablingLPM(*this);
- iStates[ERefreshingKey] =new (ELeave) TEkrStateRefreshingKey(*this);
- }
-
-CEncryptionKeyRefresherStateFactory::CEncryptionKeyRefresherStateFactory()
- {
- LOG_FUNC
- iStates.DeleteAll();
- }
-
-const TEncryptionKeyRefresherState& CEncryptionKeyRefresherStateFactory::GetState(CEncryptionKeyRefresherStateFactory::TEncryptionKeyRefresherStates aState) const
- {
- LOG_FUNC
- __ASSERT_DEBUG(iStates[aState], Panic(EEncryptionKeyRefresherInvalidState));
- return *iStates[aState];
- }
-
-TInt CEncryptionKeyRefresherStateFactory::StateIndex(const TEncryptionKeyRefresherState* aState) const
- {
- LOG_FUNC
- TInt state;
- for (state = 0; state < EEncryptionKeyRefresherMaxState; state++)
- {
- if (iStates[state] == aState)
- {
- return state;
- }
- }
-
- return KUnknownState;
- }
-
-
-//----------------------------------------------------------------------------------
-// STATES
-//----------------------------------------------------------------------------------
-
-TEncryptionKeyRefresherState::TEncryptionKeyRefresherState(CEncryptionKeyRefresherStateFactory& aFactory)
-: iFactory(aFactory)
- {
- LOG_FUNC
- }
-
-void TEncryptionKeyRefresherState::PanicInState(TLinkPanic aPanic) const
- {
- LOG_FUNC
- Panic(aPanic, iFactory.StateIndex(this));
- }
-
-void TEncryptionKeyRefresherState::ChangeState(CEncryptionKeyRefresher& aContext, CEncryptionKeyRefresherStateFactory::TEncryptionKeyRefresherStates aState) const
- {
- LOG_FUNC
-
- aContext.iState->Exit(aContext);
-
-#ifdef __FLOG_ACTIVE
- const TEncryptionKeyRefresherState* state=&iFactory.GetState(aState);
- LOG2(_L("EncryptionKeyRefresher: State %S -> %S"), &aContext.iState->iName, &state->iName);
-#endif //__FLOG_ACTIVE
- aContext.iState=&iFactory.GetState(aState);
-
- aContext.iState->Enter(aContext);
- }
-
-void TEncryptionKeyRefresherState::Enter(CEncryptionKeyRefresher& /*aContext*/) const
- {
- LOG_FUNC
- // do nothing
- }
-
-void TEncryptionKeyRefresherState::Exit(CEncryptionKeyRefresher& /*aContext*/) const
- {
- LOG_FUNC
- // do nothing
- }
-
-void TEncryptionKeyRefresherState::Start(CEncryptionKeyRefresher& /*aContext*/) const
- {
- LOG_FUNC
- PanicInState(EEncryptionKeyRefresherStateMachineInvalidEvent);
- }
-
-void TEncryptionKeyRefresherState::Error(CEncryptionKeyRefresher& aContext, TInt /*aErr*/) const
- {
- LOG_FUNC
- aContext.CancelNotify();
- aContext.RemoveTimer();
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::EIdle);
- }
-
-void TEncryptionKeyRefresherState::EventReceived(CEncryptionKeyRefresher& /*aContext*/, TBTBasebandEventNotification& /*aEvent*/) const
- {
- LOG_FUNC
- // do nothing
- }
-
-void TEncryptionKeyRefresherState::TimerExpired(CEncryptionKeyRefresher& aContext) const
- {
- LOG_FUNC
- aContext.CancelNotify();
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::EIdle);
- }
-
-void TEncryptionKeyRefresherState::EncryptionKeyRefreshComplete(CEncryptionKeyRefresher& /*aContext*/, TInt /*aError*/) const
- {
- LOG_FUNC
- // do nothing
- }
-
-//----------------------------------------------------------------------------------
-
-TEkrStateIdle::TEkrStateIdle(CEncryptionKeyRefresherStateFactory& aFactory)
-: TEncryptionKeyRefresherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TEkrStateIdle");
- }
-
-void TEkrStateIdle::Start(CEncryptionKeyRefresher& aContext) const
- {
- LOG_FUNC
- aContext.QueueTimer(KTimeoutEncryptionKeyRefresh); // watchdog timer
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::EDisablingLPM);
- }
-
-void TEkrStateIdle::Enter(CEncryptionKeyRefresher& aContext) const
- {
- LOG_FUNC
- // async call to delete the helper
- aContext.iLink.AsyncDeleteKeyRefresher();
- }
-
-//----------------------------------------------------------------------------------
-
-TEkrStateDisablingLPM::TEkrStateDisablingLPM(CEncryptionKeyRefresherStateFactory& aFactory)
-: TEncryptionKeyRefresherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TEkrStateDisablingLPM");
- }
-
-void TEkrStateDisablingLPM::Enter(CEncryptionKeyRefresher& aContext) const
- {
- LOG_FUNC
-
- if (aContext.iLink.LinkMode() == EActiveMode)
- {
- // Skip straight on to refresh the key
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::ERefreshingKey);
- }
- else
- {
- aContext.NotifyBasebandEvent(ENotifyActiveMode);
- }
-
- // DisableLPM even if link is active to prevent possible LPM requests during key refresh
- aContext.DisableLPM();
- }
-
-void TEkrStateDisablingLPM::EventReceived(CEncryptionKeyRefresher& aContext, TBTBasebandEventNotification& aEvent) const
- {
- LOG_FUNC
- if (aEvent.EventType()==ENotifyActiveMode && aEvent.ErrorCode()==KErrNone)
- {
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::ERefreshingKey);
- }
- else
- {
- LOG(_L("CEncryptionKeyRefresher failed in DisableLPM"));
- // If we can't put ourselves into active mode then don't bother with
- // refresh, it'll probably cause more problems than it would solve
- // we can quit SM, don't need to rewind
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::EIdle);
- }
- }
-
-//----------------------------------------------------------------------------------
-TEkrStateRefreshingKey::TEkrStateRefreshingKey(CEncryptionKeyRefresherStateFactory& aFactory)
-: TEncryptionKeyRefresherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TEkrStateRefreshingKey");
- }
-
-void TEkrStateRefreshingKey::Enter(CEncryptionKeyRefresher& aContext) const
- {
- LOG_FUNC
-
- TRAPD(err, aContext.iLinkMgr.HCIFacade().RefreshEncryptionKeyL(aContext.iLink.Handle()));
-
- if(err)
- {
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::EIdle);
- }
- }
-
-void TEkrStateRefreshingKey::EncryptionKeyRefreshComplete(CEncryptionKeyRefresher& aContext, TInt __DEBUG_ONLY(aError)) const
- {
- LOG_FUNC
- LOG1(_L("EncryptionKeyRefresh completed with error %d"), aError);
-
- // Don't really care what the error is, this is just a best effort service
- // anyway
- ChangeState(aContext, CEncryptionKeyRefresherStateFactory::EIdle);
- }
-
--- a/bluetooth/btstack/linkmgr/encryptionkeyrefreshhelper.h Wed Sep 15 13:27:26 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Symbian Foundation License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef ENCRYPTIONKEYREFRESHHELPER_H
-#define ENCRYPTIONKEYREFRESHHELPER_H
-
-
-#include <bt_sock.h>
-#include <bluetooth/hci/hciutil.h>
-
-#include "debug.h"
-#include "linkutil.h"
-#include "physicallinkhelper.h"
-#include "physicallinks.h"
-
-// watchdog
-const TUint KTimeoutEncryptionKeyRefresh = 3000000; // 3 s;
-
-class TEncryptionKeyRefresherState;
-class CEncryptionKeyRefresherStateFactory;
-NONSHARABLE_CLASS(CEncryptionKeyRefresher) : public CPhysicalLinkHelper
- {
- friend class TEncryptionKeyRefresherState;
- friend class TEkrStateIdle;
- friend class TEkrStateDisablingLPM;
- friend class TEkrStateRefreshingKey;
-
-public:
- static CEncryptionKeyRefresher* NewL(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink);
- ~CEncryptionKeyRefresher();
-
- virtual void StartHelper();
-
- void EncryptionKeyRefreshComplete(TInt aError);
-
-private:
- CEncryptionKeyRefresher(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink);
- void ConstructL();
-
- virtual void TimerExpired();
- virtual void HandleError(TInt aError);
- virtual void EventReceived(TBTBasebandEventNotification& aEvent);
-
-private:
- CEncryptionKeyRefresherStateFactory* iStateFactory;
- const TEncryptionKeyRefresherState* iState;
- };
-
-//--------------------------------------------------
-// STATE FACTORY
-//--------------------------------------------------
-
-/**
- Factory for the EncryptionKeyRefresher states
-
- The states are flyweight classes
-**/
-NONSHARABLE_CLASS(CEncryptionKeyRefresherStateFactory) : public CBase
- {
-public:
- static CEncryptionKeyRefresherStateFactory* NewL();
-
- enum TEncryptionKeyRefresherStates
- {
- EIdle,
- EDisablingLPM,
- ERefreshingKey,
- // Note that we don't need a state to enable LPM again
- // as this will happen implicitly when we close our
- // proxy SAP.
- // *** keep next one last ***
- EEncryptionKeyRefresherMaxState,
- };
-
- const TEncryptionKeyRefresherState& GetState(TEncryptionKeyRefresherStates aState) const;
- TInt StateIndex(const TEncryptionKeyRefresherState* aState) const;
-
-private:
- CEncryptionKeyRefresherStateFactory();
- void ConstructL();
- TFixedArray<TEncryptionKeyRefresherState*, EEncryptionKeyRefresherMaxState> iStates;
- };
-
-
-
-//--------------------------------------------------
-// STATES, base
-//--------------------------------------------------
-
-NONSHARABLE_CLASS(TEncryptionKeyRefresherState)
- {
-public:
- TEncryptionKeyRefresherState(CEncryptionKeyRefresherStateFactory& aFactory);
-
- virtual void Enter(CEncryptionKeyRefresher& aContext) const;
- virtual void Exit(CEncryptionKeyRefresher& aContext) const;
-
- virtual void Start(CEncryptionKeyRefresher& aContext) const;
- virtual void EventReceived(CEncryptionKeyRefresher& aContext, TBTBasebandEventNotification& aEvent) const;
- virtual void Error(CEncryptionKeyRefresher& aContext, TInt aErr) const;
- virtual void TimerExpired(CEncryptionKeyRefresher& aContext) const;
- virtual void EncryptionKeyRefreshComplete(CEncryptionKeyRefresher& aContext, TInt aError) const;
-
-protected:
- // Exits old state, sets the new state, and enters it.
- void ChangeState(CEncryptionKeyRefresher& aContext, CEncryptionKeyRefresherStateFactory::TEncryptionKeyRefresherStates aState) const;
- void PanicInState(TLinkPanic aPanic) const;
-
-protected:
- CEncryptionKeyRefresherStateFactory& iFactory;
-#ifdef __FLOG_ACTIVE
- TBuf<48> iName;
-#endif
- };
-
-
-//--------------------------------------------------
-// STATES
-//--------------------------------------------------
-
-NONSHARABLE_CLASS(TEkrStateIdle) : public TEncryptionKeyRefresherState
- {
-public:
- TEkrStateIdle(CEncryptionKeyRefresherStateFactory& aFactory);
-
- virtual void Enter(CEncryptionKeyRefresher& aContext) const;
- virtual void Start(CEncryptionKeyRefresher& aContext) const;
- };
-
-
-NONSHARABLE_CLASS(TEkrStateDisablingLPM) : public TEncryptionKeyRefresherState
- {
-public:
- TEkrStateDisablingLPM(CEncryptionKeyRefresherStateFactory& aFactory);
-
- virtual void Enter(CEncryptionKeyRefresher& aContext) const;
- virtual void EventReceived(CEncryptionKeyRefresher& aContext, TBTBasebandEventNotification& aEvent) const;
- };
-
-NONSHARABLE_CLASS(TEkrStateRefreshingKey) : public TEncryptionKeyRefresherState
- {
-public:
- TEkrStateRefreshingKey(CEncryptionKeyRefresherStateFactory& aFactory);
-
- virtual void Enter(CEncryptionKeyRefresher& aContext) const;
- virtual void EncryptionKeyRefreshComplete(CEncryptionKeyRefresher& aContext, TInt aError) const;
- };
-
-
-#ifdef __FLOG_ACTIVE
-#define STATENAME(x) iName=_L(x)
-#else
-#define STATENAME(x)
-#endif
-
-
-#endif /* ENCRYPTIONKEYREFRESHHELPER_H */
--- a/bluetooth/btstack/linkmgr/hcifacade.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hcifacade.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -175,6 +175,19 @@
iAFHTimer=CAFHTimer::NewL(*this);
+ // Read low power mode override timeout from the configuration file
+ _LIT(KLPMSection, "lowpowermodeconfiguration");
+ _LIT(KLPMTag, "overridelpmtimeout_microseconds");
+
+ TUint overrideLPMTimeout = 0;
+ TRAP(err, overrideLPMTimeout = iHciUtil->GetValueFromFileL(KLPMSection, KLPMTag));
+
+ if (err == KErrNone)
+ {
+ // LPM override timeout found, pass the value into link manager
+ iLinkMgrProtocol.SetOverrideLPMTimeout(overrideLPMTimeout);
+ }
+
iLastPowerState = EBTOn;
// used later to ensure that we have enough data to call SetEventMask
--- a/bluetooth/btstack/linkmgr/hcifacade.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hcifacade.h Wed Oct 13 15:48:34 2010 +0300
@@ -310,7 +310,6 @@
void LinkKeyRequestEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand);
void LinkKeyNotificationEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand);
void MaxSlotsChangeEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand);
- void EncryptionKeyRefreshCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* aRelatedCommand);
// Data event processing functions
void NumberOfCompletedPacketsEvent(THCIEventBase& aEvent);
--- a/bluetooth/btstack/linkmgr/hcifacade_commands.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hcifacade_commands.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -559,7 +559,7 @@
for (TInt count = 0; count < aNumCurrentIAC; count++)
{
- iacLap.AppendL(aIAC_LAP[count]);
+ iacLap.Append(aIAC_LAP[count]);
}
CWriteCurrentIACLAPCommand* cmd = CWriteCurrentIACLAPCommand::NewL(aNumCurrentIAC, iacLap);
--- a/bluetooth/btstack/linkmgr/hcifacade_events.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hcifacade_events.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -80,7 +80,6 @@
#include <bluetooth/hci/vendordebugcompleteevent.h>
#include <bluetooth/hci/writesimplepairingmodecommand.h>
#include <bluetooth/hci/readlocalsupportedcommandscommand.h>
-#include <bluetooth/hci/encryptionkeyrefreshcompleteevent.h>
// Command Complete Events
@@ -1221,14 +1220,6 @@
iLinksMgr->MaxSlotsChange(maxSlotsChangeEvent.ConnectionHandle(), maxSlotsChangeEvent.LMPMaxSlots());
}
-void CHCIFacade::EncryptionKeyRefreshCompleteEvent(const THCIEventBase& aEvent, const CHCICommandBase* /*aRelatedCommand*/)
- {
- LOG_FUNC
- const TEncryptionKeyRefreshCompleteEvent& refreshCompleteEvent = TEncryptionKeyRefreshCompleteEvent::Cast(aEvent);
-
- iLinksMgr->EncryptionKeyRefreshComplete(aEvent.ErrorCode(), refreshCompleteEvent.ConnectionHandle());
- }
-
// ----------------------------------------------------------------------------
// Data event processing functions
// ----------------------------------------------------------------------------
@@ -1356,10 +1347,6 @@
case EVendorDebugEvent:
VendorDebugEvent(aEvent, aRelatedCommand);
break;
-
- case EEncryptionKeyRefreshCompleteEvent:
- EncryptionKeyRefreshCompleteEvent(aEvent, aRelatedCommand);
- break;
// Inquiry based events.
// By default these should be caused by the inquiry manager and so be returned to it.
@@ -1395,6 +1382,7 @@
case EPageScanModeChangeEvent:
case EPageScanRepetitionModeChangeEvent:
case EUserPasskeyRequestEvent:
+ case EEncryptionKeyRefreshCompleteEvent:
LOG1(_L("Warning!! Unhandled Command Event (event code:%d)"), aEvent.EventCode());
break;
--- a/bluetooth/btstack/linkmgr/hostresolver.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hostresolver.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -2284,7 +2284,7 @@
TInquiryCacheAge ageInfo;
ageInfo.iIAC = aIAC;
ageInfo.iCacheAge = aAge;
- (void)iCacheAge.Append(ageInfo);
+ 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/linkmgr.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/linkmgr.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -800,6 +800,12 @@
}
}
+void CLinkMgrProtocol::SetOverrideLPMTimeout(TUint aOverrideLPMTimeout)
+ {
+ LOG_FUNC
+ iOverrideLPMTimeout =aOverrideLPMTimeout;
+ }
+
TInt CLinkMgrProtocol::StartProtocolListening()
{
LOG_FUNC
@@ -1359,6 +1365,9 @@
case EUndoOverridePark:
rerr = con->UndoOverridePark();
break;
+ case EOverrideLPMWithTimeout:
+ rerr = con->OverrideLPMWithTimeout(iOverrideLPMTimeout);
+ break;
case EOverrideLPM:
rerr = con->OverrideLPM();
break;
--- a/bluetooth/btstack/linkmgr/linkmgr.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/linkmgr.h Wed Oct 13 15:48:34 2010 +0300
@@ -182,6 +182,7 @@
void SetLimitedDiscoverableIfChangedL(TBool aOn);
void SetLocalVersion(THCIErrorCode aErr, TBTDevHCIVersion aHCIVersion, TBTDevLMPVersion aLMPVersion);
+ void SetOverrideLPMTimeout(TUint aOverrideLPMTimeout);
void SetLocalFeatures(THCIErrorCode aErr, const TBTFeatures& aMask);
void SetLocalCommands(THCIErrorCode aErr, const TBluetoothHciCommands& aMask);
void SetDeviceClassL(TUint32 aCod);
@@ -266,6 +267,8 @@
RPointerArray<CSubscriber> iSubscribers;
+ TUint iOverrideLPMTimeout;
+
// protocol state objects
TBool iClosePending; // the protocol is closing
TDeltaTimerEntry iIdleTimerEntry;
--- a/bluetooth/btstack/linkmgr/linkutil.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/linkutil.h Wed Oct 13 15:48:34 2010 +0300
@@ -193,8 +193,6 @@
EBTACLSAPUnexpectedSecurityResult =252,
ELinkMgrFlowControlUnexpectedUpdate =253,
ELinkMgrFlowControlChangeOfMind =254,
- EEncryptionKeyRefresherInvalidState =255,
- EEncryptionKeyRefresherStateMachineInvalidEvent = 256,
};
/**
--- a/bluetooth/btstack/linkmgr/physicallinks.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinks.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -25,11 +25,10 @@
#include "linkconsts.h"
#include "hcifacade.h"
#include "hostresolver.h"
-#include "roleswitchhelper.h"
+#include "PhysicalLinkHelper.h"
#include "pairingscache.h"
#include "oobdata.h"
#include "pairingserver.h"
-#include "encryptionkeyrefreshhelper.h"
#include <bt_sock.h>
@@ -59,7 +58,7 @@
static const THCIErrorCode KDefaultRejectReason = EHostSecurityRejection; // see spec Error Codes
#ifdef _DEBUG
-#define __CHECK_CONNECTION_HANDLE(aHandle) __ASSERT_DEBUG(HasHandle(aHandle), Panic(EBTLinkMgrConnectionEventInWrongSAP));
+#define __CHECK_CONNECTION_HANDLE(aHandle) __ASSERT_DEBUG(aHandle==iHandle, Panic(EBTLinkMgrConnectionEventInWrongSAP));
#else
#define __CHECK_CONNECTION_HANDLE(aHandle) aHandle=aHandle; // to suppress warnings
#endif
@@ -92,6 +91,7 @@
, iProxySAPs(_FOFF(CBTProxySAP, iQueueLink))
, iOverrideParkRequests(EFalse)
, iOverrideLPMRequests(EFalse)
+ , iLPMOverrideTimerQueued(EFalse)
, iConnectionPacketTypeChanged(EFalse)
, iLowPowModeCtrl(*this, iLinksMan.HCIFacade().CommandQController())
, iDisconnectCtrl(*this, iLinksMan.HCIFacade().CommandQController())
@@ -119,6 +119,11 @@
iACLLogicalLinks.Close();
RemoveIdleTimer();
+ if (iLPMOverrideTimerQueued)
+ {
+ BTSocketTimer::Remove(iOverrideLPMTimerEntry);
+ iLPMOverrideTimerQueued = EFalse;
+ }
LOG(_L("sec\tClosing subscribers..."))
@@ -144,11 +149,9 @@
delete iPasskeyEntry;
delete iArbitrationDelay;
delete iRoleSwitchCompleteCallBack;
- delete iKeyRefreshCompleteCallBack;
delete iEncryptionEnforcer;
DeleteRoleSwitcher();
- DeleteKeyRefresher();
}
void CPhysicalLink::ConstructL()
@@ -161,9 +164,9 @@
TCallBack cb1(RoleSwitchCompleteCallBack, this);
iRoleSwitchCompleteCallBack = new (ELeave)CAsyncCallBack(cb1, EActiveHighPriority);
- TCallBack cb2(KeyRefreshCompleteCallBack, this);
- iKeyRefreshCompleteCallBack = new (ELeave)CAsyncCallBack(cb2, EActiveHighPriority);
-
+ TCallBack cb2(OverrideLPMTimeoutCallback, this);
+ iOverrideLPMTimerEntry.Set(cb2);
+
iPhysicalLinkMetrics = CPhysicalLinkMetrics::NewL(*this, iLinksMan.HCIFacade().CommandQController());
}
@@ -219,48 +222,11 @@
TInt CPhysicalLink::TryToAndThenPreventHostEncryptionKeyRefresh(TAny* aOutToken)
{
LOG_FUNC
- TInt err = KErrNone;
- // The handling of the TAny* parameter seems a bit wacky - but it makes sense as follows
- // this call handles a call from the bluetooth control plane (which passes
- // only a TAny* as a parameter). We need to return a value back through as well, so we need
- // a pointer to a pointer (so after using the input it can be modified to point to the
- // output). We need a Bluetooth device address so a pointer to a pointer to a TBTDevAddr
- // is passed down. Then the pointer to a pointer is used to update the pointer to a control
- // plane token (which represents a handle preventing host encryption key refreshes).
- if (!IsEncryptionPauseResumeSupported())
- {
- err = KErrNotSupported;
- *reinterpret_cast<MBluetoothControlPlaneToken**>(aOutToken) = NULL;
- }
- else
- {
- // Only refresh the key if no-one is preventing it and we aren't still
- // refreshing the key from a previous request. Note that although
- // the previous key refresh may actually have finished if the key
- // refresher is waiting for async delete we have only just refreshed
- // the key and there's no point doing it again.
- if (iAutoKeyRefreshQue.IsEmpty() && !iKeyRefresher)
- {
- TRAPD(err, iKeyRefresher = CEncryptionKeyRefresher::NewL(iLinksMan, *this));
- if(!err)
- {
- // Kick off the helper state machine
- iKeyRefresher->StartHelper();
- }
- // If we can't refresh the encryption key, there's not much we can do
- }
- XAutoKeyRefreshToken* token = new XAutoKeyRefreshToken();
- if (token)
- {
- iAutoKeyRefreshQue.AddLast(*token);
- }
- else
- {
- err = KErrNoMemory;
- }
- *reinterpret_cast<MBluetoothControlPlaneToken**>(aOutToken) = token;
- }
- return err;
+ // Currently the host encryption key refresh functionality is not supported
+ // as to work smoothly it relies on changes to disable low power modes that
+ // are not present in this codeline.
+ *reinterpret_cast<MBluetoothControlPlaneToken**>(aOutToken) = NULL;
+ return KErrNotSupported;
}
void CPhysicalLink::RegistryTaskComplete(CBTRegistryHelperBase* aHelper, TInt /*aResult*/)
@@ -1371,17 +1337,6 @@
nameChanger->Start(BDAddr(), aName);
}
-void CPhysicalLink::EncryptionKeyRefreshComplete(THCIErrorCode aErr, THCIConnHandle aConnH)
- {
- LOG_FUNC
- __CHECK_CONNECTION_HANDLE(aConnH);
-
- if(iKeyRefresher)
- {
- iKeyRefresher->EncryptionKeyRefreshComplete(aErr);
- }
- }
-
void CPhysicalLink::Disconnection(THCIErrorCode aErr, THCIConnHandle aConnH, THCIErrorCode aResult)
{
LOG_FUNC
@@ -1844,36 +1799,63 @@
return KErrNone;
}
- TBTLinkMode targetMode = EActiveMode;
+ TBTLinkMode nextMode = EActiveMode;
// Determine which LPM we should be in (if any)
if(modeChangeMask & KExplicitActiveMode)
{
- targetMode = EActiveMode;
+ nextMode = EActiveMode;
}
else if(modeChangeMask & EHoldMode)
{
- targetMode = EHoldMode;
+ nextMode = EHoldMode;
}
else if(modeChangeMask & ESniffMode)
{
- targetMode = ESniffMode;
+ nextMode = ESniffMode;
}
else if(modeChangeMask & EParkMode)
{
- targetMode = EParkMode;
+ nextMode = EParkMode;
}
- LOG2(_L8("Arbitration: Arbitrating mode 0x%02x -> 0x%02x"), currentMode, targetMode);
+ LOG2(_L8("Arbitration: Arbitrating mode 0x%02x -> 0x%02x"), currentMode, nextMode);
- if(IsConnected())
- {
- TInt err = iLowPowModeCtrl.ExecuteModeChange(targetMode);
- LOG1(_L8("Arbitration: iLowPowModeCtrl.ExecuteModeChange: err:%d"), err);
- return err;
- }
- else
- {
- return KErrDisconnected;
- }
+ 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;
}
void CPhysicalLink::SetPassKey(const TDesC8& aPassKey)
@@ -2245,6 +2227,22 @@
iIdleTimerQueued = EFalse;
}
+void CPhysicalLink::QueueLPMOverrideTimer(TInt aTimeout)
+/**
+ Queue LPM Override timer entry.
+ When this timer expires, it'll call UndoLPMOverride.
+**/
+ {
+ LOG_FUNC
+ __ASSERT_DEBUG(aTimeout!=0, Panic(EBTPhysicalLinksInvalidArgument));
+ if (iLPMOverrideTimerQueued)
+ {
+ BTSocketTimer::Remove(iOverrideLPMTimerEntry);
+ }
+ BTSocketTimer::Queue(aTimeout, iOverrideLPMTimerEntry);
+ iLPMOverrideTimerQueued = ETrue;
+ }
+
void CPhysicalLink::NotifyStateChange(TBTBasebandEventNotification& aEvent)
{
LOG_FUNC
@@ -2588,6 +2586,29 @@
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
@@ -2666,27 +2687,6 @@
iRoleSwitcher = NULL;
}
-void CPhysicalLink::AsyncDeleteKeyRefresher()
- {
- LOG_FUNC
- iKeyRefreshCompleteCallBack->CallBack();
- }
-
-/*static*/ TInt CPhysicalLink::KeyRefreshCompleteCallBack(TAny* aPhysicalLink)
- {
- LOG_STATIC_FUNC
- CPhysicalLink* physicalLink = static_cast<CPhysicalLink*>(aPhysicalLink);
- physicalLink->DeleteKeyRefresher();
- return EFalse;
- }
-
-void CPhysicalLink::DeleteKeyRefresher()
- {
- LOG_FUNC
- delete iKeyRefresher;
- iKeyRefresher = NULL;
- }
-
TBool CPhysicalLink::IsEncryptionDisabledForRoleSwitch() const
/**
If link is encrypted, but role switcher temporarily disabled encryption, returns true.
@@ -2734,6 +2734,20 @@
return Arbitrate();
}
+TInt CPhysicalLink::OverrideLPMWithTimeout(TUint aTimeout)
+ {
+ LOG_FUNC
+ if(aTimeout == 0)
+ {
+ return KErrNone; //facility not wanted
+ }
+
+ TInt rerr = OverrideLPM();
+ QueueLPMOverrideTimer(aTimeout);
+
+ return rerr;
+ }
+
TInt CPhysicalLink::OverrideLPM()
/**
A request has come in that requires us to ensure we are not using
@@ -2748,6 +2762,20 @@
return Arbitrate();
}
+/*static*/ TInt CPhysicalLink::OverrideLPMTimeoutCallback(TAny* aCPhysicalLink)
+ {
+ LOG_STATIC_FUNC
+ CPhysicalLink* c = reinterpret_cast<CPhysicalLink*>(aCPhysicalLink);
+ TInt err = c->UndoOverrideLPM();
+ //we deliberately ignore this return value because we can't do anything to correct the error situation
+ if (KErrNone != err)
+ {
+ LOG2(_L("Physical link: UndoOverrideLPM returned an error %d on the connection 0x%08x"), err, c);
+ }
+ c->iLPMOverrideTimerQueued = EFalse;
+ return KErrNone;
+ }
+
TInt CPhysicalLink::UndoOverrideLPM()
/**
A need to ensure we are not in LPM has gone.
@@ -3088,14 +3116,29 @@
AuthenticationComplete(EPinRequestPending);
}
+
TInt CPhysicalLink::RequestHold()
{
LOG_FUNC
- if (!IsConnected())
- {
- return KErrDisconnected;
- }
- return iLowPowModeCtrl.ChangeMode(EHoldMode, iHandle);
+ 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);
}
void CPhysicalLink::ReadNewPhysicalLinkMetricValue(TUint aIoctlName, CBTProxySAP& aSAP, TInt aCurrentValue)
@@ -3342,6 +3385,11 @@
CActiveScheduler::Add(this);
}
+CArbitrationDelayTimer::~CArbitrationDelayTimer()
+ {
+ LOG_FUNC
+ }
+
void CArbitrationDelayTimer::ConstructL()
{
LOG_FUNC
@@ -3363,21 +3411,21 @@
LOG_FUNC
// Work out what the local priority will be now
iLocalPriority = iLocalPriority || aLocalPriority;
- LOG1(_L8("Arbitration: Local Priority now %d"), iLocalPriority);
+ LOG1(_L8("Arbitraion: Local Priority now %d"), iLocalPriority);
if(aImmediate)
{
- LOG(_L8("Arbitration: Immediate Arbitration Requested..."));
+ LOG(_L8("Arbitraion: Immediate Arbitration Requested..."));
CancelButPreserveLocalPriority();
return DoArbitrate();
}
else if(!IsActive())
{
- LOG(_L8("Arbitration: Arbitration requested, will execute after delay timer..."));
+ LOG(_L8("Arbitraion: Arbitration requested, will execute after delay timer..."));
After(KBTArbitrationDelay);
}
else // timer is already on its way
{
- LOG(_L8("Arbitration: Arbitration delay timer still pending..."));
+ LOG(_L8("Arbitraion: Arbitration delay timer still pending..."));
}
return KErrNone;
}
@@ -3385,7 +3433,7 @@
void CArbitrationDelayTimer::Restart()
{
LOG_FUNC
- LOG(_L8("Arbitration: Arbitration timer restarted..."));
+ LOG(_L8("Arbitraion: Arbitration timer restarted..."));
CancelButPreserveLocalPriority();
After(KBTArbitrationDelay);
}
@@ -3405,7 +3453,7 @@
**/
{
LOG_FUNC
- LOG(_L8("Arbitration: Delayed Arbitration executing..."));
+ LOG(_L8("Arbitraion: Delayed Arbitration executing..."));
static_cast<void>(DoArbitrate()); // ignore the error (always has been...)
}
@@ -3943,46 +3991,6 @@
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
@@ -4052,36 +4060,29 @@
LOG2(_L("TLowPowModeCmdController::MhcqcCommandEventReceived: event:%d opcode:0x%x"), code, aRelatedCommand->Opcode());
const TModeChangeEvent& modeChangeEvent = TModeChangeEvent::Cast(aEvent);
- TBTLinkMode currentmode = EActiveMode;
+ TBTLinkMode mode = EActiveMode;
switch(modeChangeEvent.CurrentMode())
{
// Mode 0, as defined for the Mode Change Event, is Active Mode
case 0:
break;
case 1:
- currentmode = EHoldMode;
+ mode = EHoldMode;
break;
case 2:
- currentmode = ESniffMode;
+ mode = ESniffMode;
break;
case 3:
- currentmode = EParkMode;
+ mode = 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(), 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);
- }
+ // 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());
}
}
--- a/bluetooth/btstack/linkmgr/physicallinks.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinks.h Wed Oct 13 15:48:34 2010 +0300
@@ -46,7 +46,6 @@
class CRoleSwitcher;
class CBTNumericComparator;
class CBTPasskeyEntry;
-class CEncryptionKeyRefresher;
enum TPhysicalLinkSimplePairingMode
{
@@ -71,6 +70,7 @@
{
public:
static CArbitrationDelayTimer* NewL(CPhysicalLink* aParent);
+ ~CArbitrationDelayTimer();
TInt Start(TBool aImmediate, TBool aLocalPriority);
void Restart();
@@ -114,8 +114,6 @@
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);
@@ -130,12 +128,11 @@
void HoldL(THCIConnHandle aHandle);
void ParkL(THCIConnHandle aHandleToRemote);
void ExitParkL(THCIConnHandle aHandleToRemote);
-
+
private:
CPhysicalLink& iParent;
MHCICommandQueue& iCmdController;
TBool iOutstandingCmd;
- TBTLinkMode iTargetMode;
};
/**
@@ -336,13 +333,18 @@
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);
TInt OverridePark();
TInt UndoOverridePark();
+ TInt OverrideLPMWithTimeout(TUint aTimeout);
TInt OverrideLPM();
TInt UndoOverrideLPM();
inline TBool IsParked() const;
@@ -375,8 +377,7 @@
virtual void RoleChange(THCIErrorCode aErr, const TBTDevAddr& aAddr, TBTBasebandRole aRole);
virtual void ClockOffset(THCIErrorCode aErr, THCIConnHandle aConnH, TBasebandTime aClockOffset);
virtual void RemoteName(THCIErrorCode aErr, const TBTDevAddr& aAddr, const TBTDeviceName8& aName);
- virtual void EncryptionKeyRefreshComplete(THCIErrorCode aErr, THCIConnHandle aConnH);
-
+
void ConnectionComplete(TInt aResult, const TBTConnect& aConn);
TBool LinkKeyRequestPending();
@@ -413,7 +414,6 @@
TBTLinkMode LinkMode() const;
void AsyncDeleteRoleSwitcher();
- void AsyncDeleteKeyRefresher();
inline const TLinkPolicy& LinkPolicy() const;
inline const TBTFeatures& RemoteFeatures() const;
@@ -487,9 +487,11 @@
void QueueIdleTimer(TInt aTime);
void RemoveIdleTimer();
+ void QueueLPMOverrideTimer(TInt aTimeout);
void NotifyStateChange(TBTBasebandEventNotification & aEvent);
TBool IsPhysicalLinkIdle() const;
+ TInt RequestMode(TBTLinkMode aMode);
TBasebandTime CalculatePageTimeout(TBasebandPageTimePolicy aPolicy, TUint8 aRepMode, TBool aValidClockOffset);
TBool IsPasskeyMinLengthOK();
TBool PeerSupportsLinkKeyRegeneration() const;
@@ -497,9 +499,6 @@
void DeleteRoleSwitcher();
static TInt RoleSwitchCompleteCallBack(TAny* CPhysicalLink);
TInt ManageEncryptionEnforcement(THCIEncryptModeFlag aEnable);
-
- void DeleteKeyRefresher();
- static TInt KeyRefreshCompleteCallBack(TAny* CPhysicalLink);
void HandlePrefetch();
void PINCodeRequestReply(const TBTDevAddr& aDevAddr,const TDesC8& aPin);
@@ -556,11 +555,13 @@
TSglQue<CBTProxySAP> iProxySAPs; // the proxies bound to us
TDeltaTimerEntry iIdleTimerEntry;
TBool iIdleTimerQueued;
+ TDeltaTimerEntry iOverrideLPMTimerEntry;
TLinkPolicy iLinkPolicy;
TUint16 iPreviousRequestedModeMask;
TBool iOverrideParkRequests; //for maybe temporary unpark
TBool iOverrideLPMRequests; //for maybe temporary force active
+ TBool iLPMOverrideTimerQueued;
TBool iConnectionPacketTypeChanged; //for triggering h/w
TBool iPreventLinkKeyUpdateReg; //for case e.g. user has called unpair when there is a paired logical channel
@@ -572,8 +573,6 @@
CArbitrationDelayTimer* iArbitrationDelay; //for lower power modes
CRoleSwitcher* iRoleSwitcher; //class handles role switch, prevents LPM, removes encryption
CAsyncCallBack* iRoleSwitchCompleteCallBack;// Async Callback to delete role swticher class.
- CEncryptionKeyRefresher* iKeyRefresher; //class handles key refresh
- CAsyncCallBack* iKeyRefreshCompleteCallBack;// Async Callback to delete key refresher class.
TLowPowModeCmdController iLowPowModeCtrl;
CPhysicalLinkMetrics* iPhysicalLinkMetrics;
--- a/bluetooth/btstack/linkmgr/physicallinksmanager.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinksmanager.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -23,7 +23,7 @@
#include "ProxySAP.h"
#include <bt_sock.h>
-#include "roleswitchhelper.h"
+#include "PhysicalLinkHelper.h"
#include "hostresolver.h"
#include <bluetooth/hci/writepagetimeoutcommand.h>
@@ -583,13 +583,6 @@
found->MaxSlotsChange(aConnH, aSlots);
}
-void CPhysicalLinksManager::EncryptionKeyRefreshComplete(THCIErrorCode aErr, THCIConnHandle aConnH)
- {
- CPhysicalLink* found = FindPhysicalLink(aConnH);
- RETURN_IF_NULL_CONNECTION(found);
- found->EncryptionKeyRefreshComplete(aErr, aConnH);
- }
-
void CPhysicalLinksManager::ModeChange(THCIErrorCode aErr, THCIConnHandle aConnH, TBTLinkMode aMode, TBasebandTime aInterval)
{
CPhysicalLink* found = FindPhysicalLink(aConnH);
@@ -1003,7 +996,7 @@
// this the only role request, it's safe to kick off the state machine
// first suspend host resolver
LinkManagerProtocol().InquiryMgr().Suspend();
- aRoleSwitcher.StartHelper();
+ aRoleSwitcher.Start();
}
}
@@ -1023,7 +1016,7 @@
if (startNextRoleSwitcher && !iRoleSwitchersQ.IsEmpty())
{
- iRoleSwitchersQ.First()->StartHelper();
+ iRoleSwitchersQ.First()->Start();
}
else
{
--- a/bluetooth/btstack/linkmgr/physicallinksmanager.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/linkmgr/physicallinksmanager.h Wed Oct 13 15:48:34 2010 +0300
@@ -204,8 +204,6 @@
virtual void ClockOffset(THCIErrorCode aErr, THCIConnHandle aConnH, TBasebandTime aClockOffset);
virtual void RemoteName(THCIErrorCode aErr, const TBTDevAddr& aAddr, const TBTDeviceName8& aName);
virtual void SimplePairingComplete(const TBTDevAddr& aBDAddr, THCIErrorCode aErr);
- virtual void EncryptionKeyRefreshComplete(THCIErrorCode aErr, THCIConnHandle aConnH);
-
// events from MBTPairingsCacheObserver
virtual void MbpcoDeferredDecisionResolved(TInt aError);
--- a/bluetooth/btstack/linkmgr/roleswitchhelper.cpp Wed Sep 15 13:27:26 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,518 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Symbian Foundation License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-
-#include <bluetooth/logger.h>
-#include "roleswitchhelper.h"
-#include "physicallinksmanager.h"
-#include "AclDataQController.h"
-#include "ProxySAP.h"
-#include "linkmgr.h"
-
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, LOG_COMPONENT_LINKMGR);
-#endif
-
-CRoleSwitcher::CRoleSwitcher(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole)
- : CPhysicalLinkHelper(aLinkMgr, aLink)
- , iRole(aRole)
- , iIsEncryptionDisabledForRoleSwitch(EFalse)
- {
- LOG_FUNC
- iState = &iLinkMgr.RoleSwitcherStateFactory().GetState(CRoleSwitcherStateFactory::EIdle);
- }
-
-CRoleSwitcher* CRoleSwitcher::NewL(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole)
- {
- LOG_STATIC_FUNC
- CRoleSwitcher* self = new(ELeave) CRoleSwitcher(aLinkMgr, aLink, aRole);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-void CRoleSwitcher::ConstructL()
- {
- LOG_FUNC
-
- BaseConstructL();
-
- // add ourselves to the list in LinkMgr, LinkMgr will kick off the role change state machine
- iLinkMgr.AddRoleSwitcher(*this);
- iAddedToLinkMgr = ETrue;
- }
-
-CRoleSwitcher::~CRoleSwitcher()
- {
- LOG_FUNC
- if (iAddedToLinkMgr)
- {
- iLinkMgr.RemoveRoleSwitcher(*this);
- }
- }
-
-void CRoleSwitcher::TimerExpired()
- {
- LOG_FUNC
-
- iState->TimerExpired(*this);
- }
-
-void CRoleSwitcher::HandleError( TInt aError)
- {
- LOG_FUNC
-
- iState->Error(*this, aError);
- }
-
-void CRoleSwitcher::DisableEncryption()
- {
- LOG_FUNC
- // data traffic suspended
- iLinkMgr.LinkManagerProtocol().ACLController().SetParked(iLink.Handle(), ETrue);
- NotifyBasebandEvent(ENotifyEncryptionChangeOff);
- iLinkMgr.Encrypt(EFalse, iLink);
-
- // set flag here, it's too late when we receive the event as AccessReqester
- // might receive the baseband notification earlier then the flag is set!
- iIsEncryptionDisabledForRoleSwitch = ETrue;
- }
-
-void CRoleSwitcher::EnableEncryption()
- {
- LOG_FUNC
- NotifyBasebandEvent(ENotifyEncryptionChangeOn);
- iLinkMgr.Encrypt(ETrue, iLink);
- // data traffic is enabled in IoctlComplete
- }
-
-void CRoleSwitcher::ChangeRole()
- {
- LOG_FUNC
- NotifyBasebandEvent(ENotifyAnyRole);
- iLinkMgr.ChangeRole(iRole, iLink);
- }
-
-void CRoleSwitcher::StartHelper()
- {
- LOG_FUNC
- iState->Start(*this);
- }
-
-void CRoleSwitcher::SaveEncryption()
- {
- LOG_FUNC
- iIsEncrypted = iLink.Encrypted();
- }
-
-void CRoleSwitcher::LogRoleSwitchSuccessful(TBTBasebandEventNotification& aEvent) const
- {
- LOG_FUNC
- TInt eventType;
- eventType = (iRole == EMaster ? ENotifyMaster :ENotifySlave);
-
- if (aEvent.EventType()==eventType && aEvent.ErrorCode()==KErrNone)
- {
- LOG(_L("CRoleSwitcher RoleSwitch OK"));
- }
- else
- {
- LOG(_L("CRoleSwitcher RoleSwitch failed"));
- }
- }
-
-void CRoleSwitcher::EventReceived(TBTBasebandEventNotification& aEvent)
- {
- LOG_FUNC
- iState->EventReceived(*this, aEvent);
- }
-
-
-//----------------------------------------------------------------------------------
-// STATE FACTORY
-//----------------------------------------------------------------------------------
-
-CRoleSwitcherStateFactory* CRoleSwitcherStateFactory::NewL()
- {
- LOG_STATIC_FUNC
- CRoleSwitcherStateFactory* ret=new (ELeave) CRoleSwitcherStateFactory();
- CleanupStack::PushL(ret);
- ret->ConstructL();
- CleanupStack::Pop(ret);
- return ret;
- }
-
-void CRoleSwitcherStateFactory::ConstructL()
- {
- LOG_FUNC
- iStates[EIdle] =new (ELeave) TRSStateIdle(*this);
- iStates[EDisablingLPM] =new (ELeave) TRSStateDisablingLPM(*this);
- iStates[EDisablingEncryption] =new (ELeave) TRSStateDisablingEncryption(*this);
- iStates[EChangingRole] =new (ELeave) TRSStateChangingRole(*this);
- iStates[EChangingRoleWithEPR] =new (ELeave) TRSStateChangingRoleWithEPR(*this);
- iStates[EEnablingEncryption] =new (ELeave) TRSStateEnablingEncryption(*this);
- }
-
-CRoleSwitcherStateFactory::CRoleSwitcherStateFactory()
- {
- LOG_FUNC
- iStates.DeleteAll();
- }
-
-TRoleSwitcherState& CRoleSwitcherStateFactory::GetState(CRoleSwitcherStateFactory::TRoleSwitcherStates aState)
- {
- LOG_FUNC
- __ASSERT_DEBUG(iStates[aState], Panic(ERoleSwitcherInvalidState));
- return *iStates[aState];
- }
-
-TInt CRoleSwitcherStateFactory::StateIndex(const TRoleSwitcherState* aState) const
- {
- LOG_FUNC
- TInt state;
- for (state = 0; state < ERoleSwitcherMaxState; state++)
- {
- if (iStates[state] == aState)
- {
- return state;
- }
- }
-
- return KUnknownState;
- }
-
-
-//----------------------------------------------------------------------------------
-// STATES
-//----------------------------------------------------------------------------------
-
-TRoleSwitcherState::TRoleSwitcherState(CRoleSwitcherStateFactory& aFactory)
-: iFactory(aFactory)
- {
- LOG_FUNC
- }
-
-void TRoleSwitcherState::PanicInState(TLinkPanic aPanic) const
- {
- LOG_FUNC
- Panic(aPanic, iFactory.StateIndex(this));
- }
-
-void TRoleSwitcherState::ChangeState(CRoleSwitcher& aContext, CRoleSwitcherStateFactory::TRoleSwitcherStates aState) const
- {
- LOG_FUNC
-
- aContext.iState->Exit(aContext);
-
-#ifdef __FLOG_ACTIVE
- TRoleSwitcherState* state=&iFactory.GetState(aState);
- LOG2(_L("RoleSwitcher: State %S -> %S"), &aContext.iState->iName, &state->iName);
-#endif //__FLOG_ACTIVE
- aContext.iState=&iFactory.GetState(aState);
-
- aContext.iState->Enter(aContext);
- }
-
-void TRoleSwitcherState::Enter(CRoleSwitcher& /*aContext*/) const
- {
- LOG_FUNC
- // do nothing
- }
-
-void TRoleSwitcherState::Exit(CRoleSwitcher& /*aContext*/) const
- {
- LOG_FUNC
- // do nothing
- }
-
-void TRoleSwitcherState::Start(CRoleSwitcher& /*aContext*/) const
- {
- LOG_FUNC
- PanicInState(ERoleSwitcherStateMachineInvalidEvent);
- }
-
-void TRoleSwitcherState::Error(CRoleSwitcher& aContext, TInt /*aErr*/) const
- {
- LOG_FUNC
- aContext.CancelNotify();
- aContext.RemoveTimer();
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
-
-void TRoleSwitcherState::EventReceived(CRoleSwitcher& /*aContext*/, TBTBasebandEventNotification& /*aEvent*/) const
- {
- LOG_FUNC
- // do nothing
- }
-
-void TRoleSwitcherState::TimerExpired(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
-
-//----------------------------------------------------------------------------------
-
-TRSStateIdle::TRSStateIdle(CRoleSwitcherStateFactory& aFactory)
-: TRoleSwitcherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TRSStateIdle");
- }
-
-void TRSStateIdle::Start(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- aContext.QueueTimer(KTimeoutRoleSwitch); // watchdog timer
- ChangeState(aContext, CRoleSwitcherStateFactory::EDisablingLPM);
- }
-
-void TRSStateIdle::Enter(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- // async call to delete the helper
- aContext.iLink.AsyncDeleteRoleSwitcher();
- }
-
-//----------------------------------------------------------------------------------
-
-TRSStateDisablingLPM::TRSStateDisablingLPM(CRoleSwitcherStateFactory& aFactory)
-: TRoleSwitcherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TRSStateDisablingLPM");
- }
-
-void TRSStateDisablingLPM::Enter(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- // DisableLPM even if link is active to prevent possible LPM requests during encryption disabling
-
- if (aContext.iLink.LinkMode() == EActiveMode)
- {
- aContext.DisableLPM();
- if (aContext.IsEPRSupported())
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRoleWithEPR);
- }
- else
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EDisablingEncryption);
- }
- // don't wait for notification
- }
- else
- {
- aContext.NotifyBasebandEvent(ENotifyActiveMode);
- aContext.DisableLPM();
- }
- }
-
-void TRSStateDisablingLPM::EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const
- {
- LOG_FUNC
- if (aEvent.EventType()==ENotifyActiveMode && aEvent.ErrorCode()==KErrNone)
- {
- if (aContext.IsEPRSupported())
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRoleWithEPR);
- }
- else
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EDisablingEncryption);
- }
- }
- else
- {
- LOG(_L("CRoleSwitcher RoleSwitch failed in DisableLPM"));
- // we can quit SM, don't need to rewind
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
- }
-
-//----------------------------------------------------------------------------------
-TRSStateDisablingEncryption::TRSStateDisablingEncryption(CRoleSwitcherStateFactory& aFactory)
-: TRoleSwitcherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TRSStateDisablingEncryption");
- }
-
-void TRSStateDisablingEncryption::Enter(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- aContext.SaveEncryption();
- if (aContext.iIsEncrypted)
- {
- aContext.DisableEncryption();
- }
- else
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRole);
- }
- }
-
-void TRSStateDisablingEncryption::EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const
- {
- LOG_FUNC
- if (aEvent.EventType()==ENotifyEncryptionChangeOff && aEvent.ErrorCode()==KErrNone)
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EChangingRole);
- }
- else
- {
- LOG(_L("CRoleSwitcher RoleSwitch failed in DisableEncryption"));
- // before quiting SM , try to enable LPM
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
- }
-
-void TRSStateDisablingEncryption::TimerExpired(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- aContext.CancelNotify();
- ChangeState(aContext, CRoleSwitcherStateFactory::EEnablingEncryption);
- }
-
-//----------------------------------------------------------------------------------
-TRSStateChangingRole::TRSStateChangingRole(CRoleSwitcherStateFactory& aFactory)
-: TRoleSwitcherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TRSStateChangingRole");
- }
-
-void TRSStateChangingRole::Enter(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- aContext.ChangeRole();
- }
-
-void TRSStateChangingRole::EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& __DEBUG_ONLY(aEvent)) const
- {
- LOG_FUNC
- aContext.RemoveTimer(); // cancel watchdog timer
-
- FTRACE(aContext.LogRoleSwitchSuccessful(aEvent));
-
-
- ChangeState(aContext, CRoleSwitcherStateFactory::EEnablingEncryption);
- }
-
-void TRSStateChangingRole::TimerExpired(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- aContext.CancelNotify();
- ChangeState(aContext, CRoleSwitcherStateFactory::EEnablingEncryption);
- }
-
-//----------------------------------------------------------------------------------
-TRSStateChangingRoleWithEPR::TRSStateChangingRoleWithEPR(CRoleSwitcherStateFactory& aFactory)
-: TRoleSwitcherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TRSStateChangingRoleWithEPR");
- }
-
-void TRSStateChangingRoleWithEPR::Enter(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- aContext.ChangeRole();
- }
-
-void TRSStateChangingRoleWithEPR::EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& __DEBUG_ONLY(aEvent)) const
- {
- LOG_FUNC
- aContext.RemoveTimer(); // cancel watchdog timer
-
- FTRACE(aContext.LogRoleSwitchSuccessful(aEvent));
-
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
-
-void TRSStateChangingRoleWithEPR::TimerExpired(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- aContext.CancelNotify();
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
-
-//----------------------------------------------------------------------------------
-TRSStateEnablingEncryption::TRSStateEnablingEncryption(CRoleSwitcherStateFactory& aFactory)
-: TRoleSwitcherState(aFactory)
- {
- LOG_FUNC
- STATENAME("TRSStateEnablingEncryption");
- }
-
-void TRSStateEnablingEncryption::Enter(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- if (aContext.iIsEncrypted)
- {
- aContext.QueueTimer(KTimeoutOneCommand);
- aContext.EnableEncryption();
- }
- else
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
- }
-
-void TRSStateEnablingEncryption::Exit(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- if (aContext.iIsEncrypted)
- {
- // enable data traffic
- aContext.iLinkMgr.LinkManagerProtocol().ACLController().SetParked(aContext.iLink.Handle(), EFalse);
- }
- }
-
-void TRSStateEnablingEncryption::EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const
- {
- LOG_FUNC
- aContext.RemoveTimer(); // watchdog timer
- if (aEvent.EventType()==ENotifyEncryptionChangeOn && aEvent.ErrorCode()==KErrNone)
- {
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- aContext.iIsEncryptionDisabledForRoleSwitch = EFalse;
- }
- else
- {
- LOG(_L("CRoleSwitcher SetEncryption failed, disconnect link"));
- if (aContext.iLink.Terminate(ERemoteUserEndedConnection) != KErrNone)
- {
- LOG(_L("CRoleSwitcher OOM"));
- }
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
- }
-
-void TRSStateEnablingEncryption::TimerExpired(CRoleSwitcher& aContext) const
- {
- LOG_FUNC
- LOG(_L("CRoleSwitcher Timeout in EncryptionEnable, disconnect"));
- aContext.CancelNotify();
- if (aContext.iLink.Terminate(ERemoteUserEndedConnection) != KErrNone)
- {
- LOG(_L("CRoleSwitcher OOM"));
- }
- ChangeState(aContext, CRoleSwitcherStateFactory::EIdle);
- }
-
-
-
--- a/bluetooth/btstack/linkmgr/roleswitchhelper.h Wed Sep 15 13:27:26 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Symbian Foundation License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef ROLESWITCHHELPER_H
-#define ROLESWITCHHELPER_H
-
-#include <bt_sock.h>
-#include <bluetooth/hci/hciutil.h>
-
-#include "debug.h"
-#include "linkutil.h"
-#include "physicallinkhelper.h"
-#include "physicallinks.h"
-
-// watchdog for first half of the SM including:
-// DisablingLPM, DisablingEncryption, RoleSwitch
-const TUint KTimeoutRoleSwitch = 3000000; // 3 s;
-
-// watchdog for EnablingEncryption
-const TUint KTimeoutOneCommand = 2000000; // 2 s;
-
-class TRoleSwitcherState;
-
-NONSHARABLE_CLASS(CRoleSwitcher) : public CPhysicalLinkHelper
- {
- friend class TRoleSwitcherState;
- friend class TRSStateIdle;
- friend class TRSStateDisablingLPM;
- friend class TRSStateDisablingEncryption;
- friend class TRSStateChangingRole;
- friend class TRSStateChangingRoleWithEPR;
- friend class TRSStateEnablingEncryption;
-
-public:
- static CRoleSwitcher* NewL(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole);
- ~CRoleSwitcher();
-
- virtual void StartHelper();
-
- inline TBool IsEncryptionDisabledForRoleSwitch() const;
- inline TBTBasebandRole RequestedRole() const;
-
- TSglQueLink iQLink;
-
-private:
- CRoleSwitcher(CPhysicalLinksManager& aLinkMgr, CPhysicalLink& aLink, TBTBasebandRole aRole);
- void ConstructL();
-
- virtual void TimerExpired();
- virtual void HandleError(TInt aError);
- virtual void EventReceived(TBTBasebandEventNotification& aEvent);
-
- void DisableEncryption();
- void ChangeRole();
- void EnableEncryption();
- void SaveEncryption();
-
- void LogRoleSwitchSuccessful(TBTBasebandEventNotification& aEvent) const;
-
- TBool iIsEncrypted;
- TBool iIsActive; // LinkMode
- TBool iAddedToLinkMgr;
- TBTBasebandRole iRole; // Requested role
- TRoleSwitcherState* iState;
- TBool iIsEncryptionDisabledForRoleSwitch;
- };
-
-//--------------------------------------------------
-// STATE FACTORY
-//--------------------------------------------------
-
-/**
- Factory for the RoleSwitcher states
-
- The states are flyweight classes
-**/
-NONSHARABLE_CLASS(CRoleSwitcherStateFactory) : public CBase
- {
-public:
- static CRoleSwitcherStateFactory* NewL();
-
- enum TRoleSwitcherStates
- {
- EIdle,
- EDisablingLPM,
- EDisablingEncryption,
- EChangingRole,
- EChangingRoleWithEPR,
- EEnablingEncryption,
- // Note that we don't need a state to enable LPM again
- // as this will happen implicitly when we close our
- // proxy SAP.
- // *** keep next one last ***
- ERoleSwitcherMaxState,
- };
-
- TRoleSwitcherState& GetState(TRoleSwitcherStates aState);
- TInt StateIndex(const TRoleSwitcherState* aState) const;
-
-private:
- CRoleSwitcherStateFactory();
- void ConstructL();
- TFixedArray<TRoleSwitcherState*, ERoleSwitcherMaxState> iStates;
- };
-
-
-
-//--------------------------------------------------
-// STATES, base
-//--------------------------------------------------
-
-NONSHARABLE_CLASS(TRoleSwitcherState)
- {
-public:
- TRoleSwitcherState(CRoleSwitcherStateFactory& aFactory);
-
- virtual void Enter(CRoleSwitcher& aContext) const;
- virtual void Exit(CRoleSwitcher& aContext) const;
-
- virtual void Start(CRoleSwitcher& aContext) const;
- virtual void EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const;
- virtual void Error(CRoleSwitcher& aContext, TInt aErr) const;
- virtual void TimerExpired(CRoleSwitcher& aContext) const;
-
-protected:
- // Exits old state, sets the new state, and enters it.
- void ChangeState(CRoleSwitcher& aContext, CRoleSwitcherStateFactory::TRoleSwitcherStates aState) const;
- void PanicInState(TLinkPanic aPanic) const;
-
-protected:
- CRoleSwitcherStateFactory& iFactory;
-#ifdef __FLOG_ACTIVE
- TBuf<48> iName;
-#endif
- };
-
-
-//--------------------------------------------------
-// STATES
-//--------------------------------------------------
-
-NONSHARABLE_CLASS(TRSStateIdle) : public TRoleSwitcherState
- {
-public:
- TRSStateIdle(CRoleSwitcherStateFactory& aFactory);
-
- virtual void Enter(CRoleSwitcher& aContext) const;
- virtual void Start(CRoleSwitcher& aContext) const;
- };
-
-
-NONSHARABLE_CLASS(TRSStateDisablingLPM) : public TRoleSwitcherState
- {
-public:
- TRSStateDisablingLPM(CRoleSwitcherStateFactory& aFactory);
-
- virtual void Enter(CRoleSwitcher& aContext) const;
- virtual void EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const;
- };
-
-NONSHARABLE_CLASS(TRSStateDisablingEncryption) : public TRoleSwitcherState
- {
-public:
- TRSStateDisablingEncryption(CRoleSwitcherStateFactory& aFactory);
-
- virtual void Enter(CRoleSwitcher& aContext) const;
- virtual void EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const;
- virtual void TimerExpired(CRoleSwitcher& aContext) const;
- };
-
-NONSHARABLE_CLASS(TRSStateChangingRole) : public TRoleSwitcherState
- {
-public:
- TRSStateChangingRole(CRoleSwitcherStateFactory& aFactory);
-
- virtual void Enter(CRoleSwitcher& aContext) const;
- virtual void EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const;
- virtual void TimerExpired(CRoleSwitcher& aContext) const;
- };
-
-NONSHARABLE_CLASS(TRSStateChangingRoleWithEPR) : public TRoleSwitcherState
- {
-public:
- TRSStateChangingRoleWithEPR(CRoleSwitcherStateFactory& aFactory);
-
- virtual void Enter(CRoleSwitcher& aContext) const;
- virtual void EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const;
- virtual void TimerExpired(CRoleSwitcher& aContext) const;
- };
-
-NONSHARABLE_CLASS(TRSStateEnablingEncryption) : public TRoleSwitcherState
- {
-public:
- TRSStateEnablingEncryption(CRoleSwitcherStateFactory& aFactory);
-
- virtual void Enter(CRoleSwitcher& aContext) const;
- virtual void Exit(CRoleSwitcher& aContext) const;
- virtual void EventReceived(CRoleSwitcher& aContext, TBTBasebandEventNotification& aEvent) const;
- virtual void TimerExpired(CRoleSwitcher& aContext) const;
- };
-
-#ifdef __FLOG_ACTIVE
-#define STATENAME(x) iName=_L(x)
-#else
-#define STATENAME(x)
-#endif
-
-inline TBTBasebandRole CRoleSwitcher::RequestedRole() const
- {
- return iRole;
- }
-
-inline TBool CRoleSwitcher::IsEncryptionDisabledForRoleSwitch() const
- {
- return iIsEncryptionDisabledForRoleSwitch;
- }
-
-#endif /* ROLESWITCHHELPER_H */
--- a/bluetooth/btstack/rfcomm/rfcommstates.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/rfcomm/rfcommstates.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -99,6 +99,7 @@
if(aType & MSocketNotify::EErrorFatal)
{
+ aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EUndoOverridePark, aSAP.iRemoteDev);
ChangeState(aSAP, CRfcommStateFactory::EError);
}
return aErr;
@@ -656,16 +657,6 @@
don't want to get any more notifications from the mux
**/
{
- // Depending where we came from we may have applied either a
- // park override or an all LPM override. We remove both these
- // overrides because it's safe to remove an override that
- // hasn't been applied.
- // Note that although park is one of the LPMs the different
- // levels of override are managed separately, so an
- // UndoOverrideLPM does not remove an explicit park only
- // override.
- aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EUndoOverridePark, aSAP.iRemoteDev);
- aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EUndoOverrideLPM, aSAP.iRemoteDev);
aSAP.DeregisterCodService(); // See if there is a Service to remove for CodMan
@@ -703,23 +694,13 @@
}
aSAP.iNewDataToNotify=0;
aSAP.iDataBuffer.Reset();
-
- // Depending where we came from we may have applied either a
- // park override or an all LPM override. We remove both these
- // overrides because it's safe to remove an override that
- // hasn't been applied.
- // Note that although park is one of the LPMs the different
- // levels of override are managed separately, so an
- // UndoOverrideLPM does not remove an explicit park only
- // override.
aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EUndoOverridePark, aSAP.iRemoteDev);
- aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EUndoOverrideLPM, aSAP.iRemoteDev);
-
if(aSAP.iMux)
{
aSAP.iMux->DetachSAP(aSAP);
}
aSAP.DeregisterCodService(); // See if there is a Service to remove for CodMan
+
}
void TRfcommStateClosed::Error(CRfcommSAP& /*aSAP*/, TInt /*aErr*/,
@@ -750,11 +731,7 @@
}
aSAP.RegisterCodService(); // See if there is a Service set for CodMan
-
- // Override LPM while we do some sigalling to ensure it can complete in
- // a timely fashion.
- aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EOverrideLPM, aSAP.iRemoteDev);
-
+
// First get a Mux.
ChangeState(aSAP, CRfcommStateFactory::EWaitForMux);
}
@@ -1336,7 +1313,7 @@
newSAP->iRemoteDev=aMux.RemoteBTAddr();
// Must come after registering the remote address with the new SAP because we will need
// the remote address to find a link in LinkMgrProtocol to override LPM on
- newSAP->iProtocol.ControlPlane().ModifyPhysicalLink(EOverrideLPM, newSAP->iRemoteDev);
+ newSAP->iProtocol.ControlPlane().ModifyPhysicalLink(EOverrideLPMWithTimeout, newSAP->iRemoteDev);
newSAP->iUserDefinedMTU=aSAP.iUserDefinedMTU; // We take our cues as
// regards max MTU from
// the listening SAP.
@@ -1761,17 +1738,7 @@
return;
}
- // Depending where we came from we may have applied either a
- // park override or an all LPM override. We remove both these
- // overrides because it's safe to remove an override that
- // hasn't been applied.
- // Note that although park is one of the LPMs the different
- // levels of override are managed separately, so an
- // UndoOverrideLPM does not remove an explicit park only
- // override.
aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EUndoOverridePark, aSAP.iRemoteDev);
- aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EUndoOverrideLPM, aSAP.iRemoteDev);
-
aSAP.iSocket->ConnectComplete();
aSAP.CTS(EFalse); // So that we block should anyone try to write
// anything through this SAP before we get MSC
@@ -1812,9 +1779,6 @@
Shutdown the open channel gracefully
**/
{
- // Only override park for disconnect. We need to be able
- // to send the signalling, but we don't care if it takes
- // ages. No point starting a sniff bun-fight.
aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EOverridePark, aSAP.iRemoteDev);
aSAP.iClosePending=ETrue;
ChangeState(aSAP, CRfcommStateFactory::EDisconnect);
@@ -1832,10 +1796,6 @@
// the queued DISC frame does not get deleted when the SAP gets
// removed from the muxer
__ASSERT_DEBUG(aSAP.iMux!=NULL,PanicInState(ERfcommNullMux));
-
- // Only override park for disconnect. We need to be able
- // to send the signalling, but we don't care if it takes
- // ages. No point starting a sniff bun-fight.
aSAP.iProtocol.ControlPlane().ModifyPhysicalLink(EOverridePark, aSAP.iRemoteDev);
aSAP.iMux->SendDISC(aSAP.DLCI()); // Disassociated from the SAP
ChangeState(aSAP, CRfcommStateFactory::EClosed);
--- a/bluetooth/btstack/sdp/sdpclient.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/sdp/sdpclient.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-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"
@@ -40,6 +40,7 @@
{
iBoundSAP=iL2CAP.NewSAPL(KSockSeqPacket);
iBoundSAP->SetNotify(this);
+ iBoundSAP->SecurityCheck(this);
CheckForIdle(KSDPIdleTimeout*4);// No point hanging about if no one connects
}
@@ -93,6 +94,13 @@
{
Panic(ESdpErrorSettingAddress);
}
+ TPckgBuf<TBool> noSecurityRequired;
+ noSecurityRequired() = ETrue;
+
+ if(iBoundSAP->SetOption(KSolBtSAPBase, KBTSetNoSecurityRequired, noSecurityRequired)!=KErrNone)
+ {
+ Panic(ESdpAgentErrorSettingNoSecurity);
+ }
iBoundSAP->ActiveOpen(); // Signals ConnectComplete eventually!
}
@@ -650,3 +658,7 @@
return FALSE;
}
+TInt CSdpClient::CheckPolicy(const TSecurityPolicy& /*aPolicy*/, const char* /*aDiagnostic*/)
+ {
+ return KErrNone;
+ }
--- a/bluetooth/btstack/sdp/sdpclient.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/sdp/sdpclient.h Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-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"
@@ -32,7 +32,7 @@
acts as an internal socket binding to a lower level SAP. Thus we
derive from MSocketNotify so that the SAP can directly notify us of events.
**/
-NONSHARABLE_CLASS(CSdpClient) : public CBase, private MSocketNotify
+NONSHARABLE_CLASS(CSdpClient) : public CBase, private MSocketNotify, private MProvdSecurityChecker
{
friend class CSdpProtocol;
public:
@@ -72,6 +72,9 @@
void Bearer(const TDesC8& /*aConnectionInf*/) {};
private:
+ // From MProvdSecurityChecker
+ TInt CheckPolicy(const TSecurityPolicy& aPolicy, const char *aDiagnostic);
+
// Create/destroy
CSdpClient(CSdpProtocol& aProtocol, CProtocolBase& aL2CAP);
void ConstructL();
--- a/bluetooth/btstack/sdp/sdpstackutil.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/sdp/sdpstackutil.h Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-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"
@@ -31,7 +31,8 @@
ESdpTwoQuerys, // 8
ESdpNoRequestPdu, // 9
ESdpBadUUID, // 10
- ESdpAgentBadResultLength // 11
+ ESdpAgentBadResultLength, // 11
+ ESdpAgentErrorSettingNoSecurity, // 12
};
void Panic(TSdpPanic aPanic);
--- a/bluetooth/btstack/secman/btaccessrequester.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/secman/btaccessrequester.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -51,10 +51,11 @@
const TBTServiceSecurityPerDevice* const aOverride,
MAccessRequestResponseHandler& aRequester,
TAccessType aAccessType,
+ TBool aNoSecurityRequired,
CBTSecMan& aParent)
{
LOG_STATIC_FUNC
- CBTAccessRequester* s = new(ELeave) CBTAccessRequester(aConnection, aSecurityRequired, aOverride, aRequester, aAccessType, aParent);
+ CBTAccessRequester* s = new(ELeave) CBTAccessRequester(aConnection, aSecurityRequired, aOverride, aRequester, aAccessType, aNoSecurityRequired, aParent);
CleanupStack::PushL(s);
s->ConstructL();
return s;
@@ -66,6 +67,7 @@
const TBTServiceSecurityPerDevice* const aOverride,
MAccessRequestResponseHandler& aRequester,
TAccessType aAccessType,
+ TBool aNoSecurityRequired,
CBTSecMan& aParent)
: iRequester(aRequester)
, iSecMan(aParent)
@@ -81,6 +83,7 @@
, iAccessType(aAccessType)
, iRemoteIndicatedNoBonding(EFalse)
, iCurrentState(EBTUninitialised)
+ , iNoSecurityRequired(aNoSecurityRequired)
{
LOG_FUNC
// try to get name for UI dialogs
@@ -911,7 +914,13 @@
// Here we determine if authentication is required on the link.
TBool authenticationRequired = EFalse;
- if(iBaseband->SimplePairingMode() == EPhySimplePairingEnabled)
+ if (iNoSecurityRequired)
+ {
+ // This is used for Security Mode 4 "no security required", e.g. SDP,
+ // which we never authenticate
+ // <NOP> // authenticationRequired is already EFalse
+ }
+ else if(iBaseband->SimplePairingMode() == EPhySimplePairingEnabled)
{
// If operating in simple pairing mode then authentication is always required
// due to security mode 4.
@@ -948,7 +957,7 @@
{
LOG_FUNC
TBool authenticationRecommended = AuthenticationRequired();
- if(!authenticationRecommended && LinkKeyGoodEnough())
+ if(!authenticationRecommended && LinkKeyGoodEnough() && !iNoSecurityRequired)
{
// If the current link key is good enough then we should be able to use that
// if it is available.
@@ -984,7 +993,7 @@
{
// Otherwise dedicated bonding is incidental...so only for general bonding accesses
// do we consider enabling encryption.
- if(iBaseband->SimplePairingMode() == EPhySimplePairingEnabled)
+ if(iBaseband->SimplePairingMode() == EPhySimplePairingEnabled && !iNoSecurityRequired)
{
// If the link is SSP capable then for security mode 4 we must encrypt the link
// for general bonding requests.
--- a/bluetooth/btstack/secman/pairingserver.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/secman/pairingserver.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-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"
@@ -788,6 +788,7 @@
TBTSockAddr addr;
addr.SetBTAddr(addrBuf());
+ __ASSERT_DEBUG(!iProxySap, PANIC(KPairingServerFaultCat, EPairingServerObjectAlreadyExists));
iProxySap = CBTProxySAP::NewL(iPhysicalLinksManager, NULL);
iStartBondingMsg = aMessage;
@@ -812,7 +813,7 @@
security.SetAuthentication(EMitmDesired);
security.SetUid(KBluetoothDedicatedBondingUid);
- iPhysicalLinksManager.SecMan().AccessRequestL(security, NULL, iProxySap->RemoteAddress(), EDedicatedBonding, *this);
+ iPhysicalLinksManager.SecMan().AccessRequestL(security, NULL, iProxySap->RemoteAddress(), EDedicatedBonding, EFalse, *this);
}
void CDedicatedBondingSession::AccessRequestComplete(TInt aResult)
--- a/bluetooth/btstack/secman/public/pairingservershared.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/secman/public/pairingservershared.h Wed Oct 13 15:48:34 2010 +0300
@@ -72,6 +72,7 @@
EPairingServerUnexpectedAccessCallback,
EPairingServerBadShutdownState,
EPairingServerMessageShouldBeNull,
+ EPairingServerObjectAlreadyExists,
};
#endif // PAIRINGSERVERSHARED_H
--- a/bluetooth/btstack/secman/secman.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/secman/secman.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -266,6 +266,7 @@
const TBTServiceSecurityPerDevice* const aOverride,
const TBTDevAddr& aBDAddr,
TAccessType aAccessType,
+ TBool aNoSecurityRequired,
MAccessRequestResponseHandler& aRequester)
/**
Handle an access request...
@@ -288,6 +289,7 @@
aOverride,
aRequester,
aAccessType,
+ aNoSecurityRequired,
*this);
CBTAccessRequester* requester = FindActiveAccessRequester(aBDAddr);
--- a/bluetooth/btstack/secman/secman.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/btstack/secman/secman.h Wed Oct 13 15:48:34 2010 +0300
@@ -244,6 +244,7 @@
const TBTServiceSecurityPerDevice* const aOverride,
const TBTDevAddr& aBDAddr,
TAccessType aAccessType,
+ TBool aNoSecurityRequired,
MAccessRequestResponseHandler& aRequester);
void AccessRequestComplete(CBTAccessRequester* aRequester, TInt aResult);
@@ -328,6 +329,7 @@
const TBTServiceSecurityPerDevice* const aOverride,
MAccessRequestResponseHandler& aRequester,
TAccessType aAccessType,
+ TBool aNoSecurityRequired,
CBTSecMan& aParent);
~CBTAccessRequester();
@@ -394,6 +396,7 @@
const TBTServiceSecurityPerDevice* const aOverride,
MAccessRequestResponseHandler& aRequester,
TAccessType aDedicatedBonding,
+ TBool aNoSecurityRequired,
CBTSecMan& aParent);
void ConstructL();
void SubscribeToLinkObserver();
@@ -451,6 +454,8 @@
CAuthenticationTimer* iTimer;
TBTAccessRequesterState iCurrentState;
+
+ TBool iNoSecurityRequired; //< Security mode 4 "no security required" - do not do any authentiction, not even just works
};
--- a/bluetooth/gavdp/inc/gavdpInternal.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/gavdp/inc/gavdpInternal.h Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -301,17 +301,16 @@
NONSHARABLE_CLASS(CGavdpConnector) : public CGavdpHelper
{
public:
- static CGavdpConnector* NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive = EFalse);
+ static CGavdpConnector* NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr);
virtual void Begin();
~CGavdpConnector();
private:
- CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive);
+ CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr);
void RunL();
void DoCancel();
private:
TAvdtpSockAddr iSocketAddress;
- TBool iIsPassiveConnector; //true when listening
};
class CGavdpUPlaneConnector;
--- a/bluetooth/gavdp/source/gavdpHelpers.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/gavdp/source/gavdpHelpers.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -473,17 +473,16 @@
-CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive)
+CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr)
{
- return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr, aPassive);
+ return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr);
}
-
-CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive)
+
+CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr)
: CGavdpHelper(aGavdp, aUser)
{
iSocketAddress.SetBTAddr(aAddr);
iSocketAddress.SetSession(ESignalling);
- iIsPassiveConnector = aPassive;
}
CGavdpConnector::~CGavdpConnector()
@@ -493,13 +492,10 @@
void CGavdpConnector::DoCancel()
{
- //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.
- }
+ AvdtpRequester().CancelAll(); // ESOCK has better semantics to SAP than CancelConnect.
}
+
void CGavdpConnector::Begin()
{
// Ensure that once this is completed the RunL is scheduled
@@ -511,6 +507,7 @@
void CGavdpConnector::RunL()
{
+
// Do not call CGavdpHelper::CheckFailedL() here - avdtp will indicate a failure to connect,
// and GAVDP is informed via CGavdpIndicator::RunL().
@@ -754,14 +751,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 Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetooth/gavdp/source/gavdpImp.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -445,37 +445,12 @@
void CGavdp::Error(TInt aError)
{
- //here we do whatever we need to tidy ourselves
+ // helper tells user - here we do whatever we need to tidy ourselves
delete iRequesterHelper;
iRequesterHelper = NULL;
-
- 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;
- }
+ iState = EIdle;
+ // and tell the user
+ iServiceUser.GAVDP_Error(aError, KNullDesC8);
}
void CGavdp::FatalError()
@@ -501,12 +476,10 @@
// eg Abort, Config
User::Leave(KErrInUse);
}
-
- //create a passive connector helper
- iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddress, ETrue);
+ iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddress);
iRequesterHelper->Begin();
}
-
+
/*
Forms the binding between passively created transport sessions and sockets
*/
--- a/bluetoothcommsprofiles/btpan/refBnepPacketNotifier/src/refBnepPacketNotifier.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothcommsprofiles/btpan/refBnepPacketNotifier/src/refBnepPacketNotifier.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -82,7 +82,7 @@
devByteCount.iByteCount=0;
devByteCount.iTickCount=0;
devByteCount.iAddr=aAddr;
- (void)iCounter.Append(devByteCount);
+ iCounter.Append(devByteCount);
}
void CRefBnepPacketNotifier::MbpnDeviceRemoved(const TBTDevAddr& aAddr)
--- a/bluetoothmgmt/bluetoothclientlib/inc/bt_sock.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothmgmt/bluetoothclientlib/inc/bt_sock.h Wed Oct 13 15:48:34 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-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"
@@ -102,9 +102,9 @@
/** BT options. */
enum TBTOptions
{
- /** Override device security */
- KBTRegisterCodService = 0x998, /*!< Set a CoD Service bit(s) */
- KBTSecurityDeviceOverride = 0x999,
+ KBTSetNoSecurityRequired = 0x997, /*!< Set No security required for Security Mode 4*/
+ KBTRegisterCodService = 0x998, /*!< Set a CoD Service bit(s) */
+ KBTSecurityDeviceOverride = 0x999, /*!< Override device security */
};
typedef TPckgBuf<TBTServiceSecurityPerDevice> TBTServiceSecurityPerDeviceBuf; /*!< Package definition for securty settings */
--- a/bluetoothmgmt/btcommon/inc/BTSec.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothmgmt/btcommon/inc/BTSec.h Wed Oct 13 15:48:34 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"
@@ -26,6 +26,7 @@
#include <e32std.h>
const TUint32 KBTManServerSID = 0x100069cc;
+const TUint32 KSdpServerSID = 0x10009220;
_LIT_SECURITY_POLICY_C1(KLOCAL_SERVICES,ECapabilityLocalServices);
_LIT_SECURITY_POLICY_S1(KBTMAN_SID_PROT_SERV,KBTManServerSID,ECapabilityProtServ);
@@ -33,6 +34,7 @@
_LIT_SECURITY_POLICY_C1(KNETWORK_CONTROL, ECapabilityNetworkControl);
_LIT_SECURITY_POLICY_C2(KLOCAL_SERVICES_AND_READ_DEVICE_DATA,ECapabilityLocalServices,ECapabilityReadDeviceData);
_LIT_SECURITY_POLICY_C2(KLOCAL_SERVICES_AND_WRITE_DEVICE_DATA,ECapabilityLocalServices,ECapabilityWriteDeviceData);
+_LIT_SECURITY_POLICY_S1(KSDP_SID_PROT_SERV, KSdpServerSID,ECapabilityProtServ);
_LIT_SECURITY_POLICY_C1(KCOMMDD,ECapabilityCommDD);
--- a/bluetoothmgmt/btconfig/esock_bt.cmi Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothmgmt/btconfig/esock_bt.cmi Wed Oct 13 15:48:34 2010 +0300
@@ -26,7 +26,7 @@
ScaledStartupState=0x3080
HeapOption=ENewHeap
MinHeapSize=256
-MaxHeapSize=524288
+MaxHeapSize=1048576
SystemCritical=0
SystemCriticalAfterInit=1
Binding0=ESock_Bt:2,ESock_Main:0,ECustom,42,42
--- a/bluetoothmgmt/btconfig/esock_bt_399.cmi Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothmgmt/btconfig/esock_bt_399.cmi Wed Oct 13 15:48:34 2010 +0300
@@ -26,7 +26,7 @@
ScaledStartupState=0x3080
HeapOption=ENewHeap
MinHeapSize=256
-MaxHeapSize=524288
+MaxHeapSize=1048576
SystemCritical=0
SystemCriticalAfterInit=1
Binding0=ESock_Bt:2,ESock_Main:0,ECustom,20,20
--- a/bluetoothmgmt/btmgr/BTManServer/BTManServer.cpp Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothmgmt/btmgr/BTManServer/BTManServer.cpp Wed Oct 13 15:48:34 2010 +0300
@@ -1187,6 +1187,11 @@
LOG_FUNC
}
+CBTManSubSession::~CBTManSubSession()
+ {
+ LOG_FUNC
+ }
+
void CBTManSubSession::NotifyChange(TUint aTableChanged)
{
LOG_FUNC
--- a/bluetoothmgmt/btmgr/Inc/BTManServer.h Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothmgmt/btmgr/Inc/BTManServer.h Wed Oct 13 15:48:34 2010 +0300
@@ -228,6 +228,7 @@
virtual void Cleanup(TInt aError)=0;
virtual TBool IsOverlappingView(const TDesC& aViewDescriptor);
virtual void SetViewChangeNotificationMessage(const RMessage2& aMessage);
+ ~CBTManSubSession();
protected:
CBTManSubSession(CBTManSession& aSession, CBTRegistry& aRegistry);
--- a/bluetoothmgmt/btrom/bluetooth.iby Wed Sep 15 13:27:26 2010 +0300
+++ b/bluetoothmgmt/btrom/bluetooth.iby Wed Oct 13 15:48:34 2010 +0300
@@ -58,7 +58,7 @@
file=ABI_DIR\BT_DIR\sdpagent.dll System\Libs\sdpagent.dll
REM Bluetooth AV user libraries
-file=ABI_DIR\BT_DIR\bluetoothav.dll System\Libs\bluetoothAV.dll
+file=ABI_DIR\BT_DIR\bluetoothAV.dll System\Libs\bluetoothAV.dll
file=ABI_DIR\BT_DIR\gavdp.dll System\Libs\gavdp.dll
REM Generic Remote Control Framework
@@ -88,7 +88,7 @@
data=ZPRIVATE\100069cc\backup_registration.xml Private\100069cc\backup_registration.xml
REM default is to run Esock_BT thread in DealerPlayer role
-data=ZPRIVATE\101f7988\esock_bt.cmi private\101F7988\esock_bt.cmi
+data=ZPRIVATE\101F7988\esock_bt.cmi private\101F7988\esock_bt.cmi
file=ABI_DIR\BT_DIR\btcomm.csy System\Libs\btcomm.csy
@@ -102,8 +102,8 @@
REM Bluetooth using HCI API Version 2
file=ABI_DIR\BT_DIR\bt_v2.prt System\Libs\bt_v2.prt
REM Stack configuration files
-data=ZPRIVATE\101f7989\esock\bt.bt_v2.esk Private\101f7989\ESock\bt.bt_v2.esk
-data=ZPRIVATE\101f7989\bluetooth\bluetooth_stack.ini Private\101F7989\Bluetooth\bluetooth_stack.ini
+data=ZPRIVATE\101f7989\ESock\bt.bt_v2.esk Private\101f7989\ESock\bt.bt_v2.esk
+data=ZPRIVATE\101F7989\Bluetooth\bluetooth_stack.ini Private\101F7989\Bluetooth\bluetooth_stack.ini
REM HCI Shared binary
file=ABI_DIR\BT_DIR\hcishared.dll System\Libs\hcishared.dll
--- a/bthci/bthci2/group/hci_framework.iby Wed Sep 15 13:27:26 2010 +0300
+++ b/bthci/bthci2/group/hci_framework.iby Wed Oct 13 15:48:34 2010 +0300
@@ -32,6 +32,6 @@
file=ABI_DIR\HCIF_DIR\hcicmdq.dll System\Libs\hcicmdq.dll
REM Command Queue configuration file
-data=ZPRIVATE\101f7989\bluetooth\cmdq.ini Private\101F7989\Bluetooth\cmdq.ini
+data=ZPRIVATE\101F7989\Bluetooth\cmdq.ini Private\101F7989\Bluetooth\cmdq.ini
#endif // HCI_FRAMEWORK_IBY
--- a/bthci/hciextensioninterface/tsrc/tproxycorehci/group/bluetooth_stack.ini Wed Sep 15 13:27:26 2010 +0300
+++ b/bthci/hciextensioninterface/tsrc/tproxycorehci/group/bluetooth_stack.ini Wed Oct 13 15:48:34 2010 +0300
@@ -18,3 +18,6 @@
[CoreHci]
EcomUid= 0x10286A7B
+
+[lowpowermodeconfiguration]
+overridelpmtimeout_microseconds= 0
\ No newline at end of file