# HG changeset patch # User hgs # Date 1279716125 -10800 # Node ID 14e279d2bbb775350651b8746ceaf86359a2bd6f # Parent 9d84592f503607098f3b85c52948ceaa4244f78c 201029_01 diff -r 9d84592f5036 -r 14e279d2bbb7 bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp --- a/bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetooth/btstack/l2cap/L2CapFecNegotiator.cpp Wed Jul 21 15:42:05 2010 +0300 @@ -558,6 +558,14 @@ ProcessPeerValue(response, EFalse); } +void TL2CapIncomingFecNegotiator::DowngradeToBasic() + { + LOG_FUNC + iPreferred = TRetransmissionAndFlowControlOption(); + iConfigStatus = EOptionConfigComplete; + } + + void TL2CapIncomingFecNegotiator::BuildRequest(TL2CapChannelMode aMode, TRetransmissionAndFlowControlOption& aFecOption) { LOG_FUNC @@ -761,9 +769,7 @@ iIncomingNegotiator.Preferred().LinkMode() != EL2CAPBasicMode) { LOG(_L("\tReceived Basic mode Config Request, downgrading incoming channel mode to Basic")); - // Downgrade incoming FEC to be basic mode. - TRetransmissionAndFlowControlOption basicFec; - iIncomingNegotiator.SetPreferred(basicFec); + iIncomingNegotiator.DowngradeToBasic(); } } diff -r 9d84592f5036 -r 14e279d2bbb7 bluetooth/btstack/l2cap/L2CapFecNegotiator.h --- a/bluetooth/btstack/l2cap/L2CapFecNegotiator.h Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetooth/btstack/l2cap/L2CapFecNegotiator.h Wed Jul 21 15:42:05 2010 +0300 @@ -207,6 +207,7 @@ void ProcessPeerValue(const TRetransmissionAndFlowControlOption& aFecOption, TBool aIsUnacceptableParameters); void ProcessImplicitPeerValue(); + void DowngradeToBasic(); void Setup(); protected: void BuildRequest(TL2CapChannelMode aMode, TRetransmissionAndFlowControlOption& aFecOption); diff -r 9d84592f5036 -r 14e279d2bbb7 bluetooth/btstack/linkmgr/physicallinks.cpp --- a/bluetooth/btstack/linkmgr/physicallinks.cpp Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetooth/btstack/linkmgr/physicallinks.cpp Wed Jul 21 15:42:05 2010 +0300 @@ -58,7 +58,7 @@ static const THCIErrorCode KDefaultRejectReason = EHostSecurityRejection; // see spec Error Codes #ifdef _DEBUG -#define __CHECK_CONNECTION_HANDLE(aHandle) __ASSERT_DEBUG(aHandle==iHandle, Panic(EBTLinkMgrConnectionEventInWrongSAP)); +#define __CHECK_CONNECTION_HANDLE(aHandle) __ASSERT_DEBUG(HasHandle(aHandle), Panic(EBTLinkMgrConnectionEventInWrongSAP)); #else #define __CHECK_CONNECTION_HANDLE(aHandle) aHandle=aHandle; // to suppress warnings #endif diff -r 9d84592f5036 -r 14e279d2bbb7 bluetooth/gavdp/inc/gavdpInternal.h --- a/bluetooth/gavdp/inc/gavdpInternal.h Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetooth/gavdp/inc/gavdpInternal.h Wed Jul 21 15:42:05 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -301,16 +301,17 @@ NONSHARABLE_CLASS(CGavdpConnector) : public CGavdpHelper { public: - static CGavdpConnector* NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr); + static CGavdpConnector* NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive = EFalse); virtual void Begin(); ~CGavdpConnector(); private: - CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr); + CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive); void RunL(); void DoCancel(); private: TAvdtpSockAddr iSocketAddress; + TBool iIsPassiveConnector; //true when listening }; class CGavdpUPlaneConnector; diff -r 9d84592f5036 -r 14e279d2bbb7 bluetooth/gavdp/source/gavdpHelpers.cpp --- a/bluetooth/gavdp/source/gavdpHelpers.cpp Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetooth/gavdp/source/gavdpHelpers.cpp Wed Jul 21 15:42:05 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -473,16 +473,17 @@ -CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr) +CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive) { - return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr); + return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr, aPassive); } - -CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr) + +CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive) : CGavdpHelper(aGavdp, aUser) { iSocketAddress.SetBTAddr(aAddr); iSocketAddress.SetSession(ESignalling); + iIsPassiveConnector = aPassive; } CGavdpConnector::~CGavdpConnector() @@ -492,10 +493,13 @@ void CGavdpConnector::DoCancel() { - AvdtpRequester().CancelAll(); // ESOCK has better semantics to SAP than CancelConnect. + //don't call cancel on the socket for passive connectors to prevent cancelling a listening socket + if (!iIsPassiveConnector) + { + AvdtpRequester().CancelAll(); // ESOCK has better semantics to SAP than CancelConnect. + } } - void CGavdpConnector::Begin() { // Ensure that once this is completed the RunL is scheduled @@ -507,7 +511,6 @@ void CGavdpConnector::RunL() { - // Do not call CGavdpHelper::CheckFailedL() here - avdtp will indicate a failure to connect, // and GAVDP is informed via CGavdpIndicator::RunL(). @@ -751,14 +754,14 @@ } }; } + + // This service is never complete, reissue ioctl. We do this once we have finished using + // the iIndication data as once the ioctl has been issued the data may be overwritten. + // If AVDTP has an indication to pass to us and an ioctl has not been issued the + // indication will be queued within AVDTP until we have issued the ioctl again. + Begin(); + } - // This service is never complete, reissue ioctl. We do this once we have finished using - // the iIndication data as once the ioctl has been issued the data may be overwritten. - // If AVDTP has an indication to pass to us and an ioctl has not been issued the - // indication will be queued within AVDTP until we have issued the ioctl again. - Begin(); - } - /** RunError overriden for CGavdpIndicator only. This GAVDP helper is used in its own right by GAVDP. It is not treated as a 'general' GAVDP helper, and, unlike a 'general' GAVDP helper, diff -r 9d84592f5036 -r 14e279d2bbb7 bluetooth/gavdp/source/gavdpImp.cpp --- a/bluetooth/gavdp/source/gavdpImp.cpp Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetooth/gavdp/source/gavdpImp.cpp Wed Jul 21 15:42:05 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -445,12 +445,37 @@ void CGavdp::Error(TInt aError) { - // helper tells user - here we do whatever we need to tidy ourselves + //here we do whatever we need to tidy ourselves delete iRequesterHelper; iRequesterHelper = NULL; - iState = EIdle; - // and tell the user - iServiceUser.GAVDP_Error(aError, KNullDesC8); + + if (iState == EListening) + { + //if we're in the listening state and we get a KErrDisconnected error, this is + //because a connection completed and was disconnected straight away before we got + //the chance to pickup the connection indicator. We need to re-listen and throw + //away this error. Let's replace the error with the result of the re-listen. + if (aError == KErrDisconnected) + { + aError = Listen(); + } + + //when listening, it doesn't make sense to pass this error to the user + if (aError == KErrCouldNotConnect) + { + aError = KErrNone; + } + } + + //the error might have been replaced due to the condition mentioned above so + //this needs to be checked. + if (aError != KErrNone) + { + iServiceUser.GAVDP_Error(aError, KNullDesC8); + + //update the state because an error did occur + iState = EIdle; + } } void CGavdp::FatalError() @@ -476,10 +501,12 @@ // eg Abort, Config User::Leave(KErrInUse); } - iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddress); + + //create a passive connector helper + iRequesterHelper = CGavdpConnector::NewL(*this, iServiceUser, aRemoteAddress, ETrue); iRequesterHelper->Begin(); } - + /* Forms the binding between passively created transport sessions and sockets */ diff -r 9d84592f5036 -r 14e279d2bbb7 bluetoothmgmt/bluetoothclientlib/btlib/btsynclink.cpp --- a/bluetoothmgmt/bluetoothclientlib/btlib/btsynclink.cpp Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/btlib/btsynclink.cpp Wed Jul 21 15:42:05 2010 +0300 @@ -160,7 +160,6 @@ // This needs to be a macro or the 'return' won't return properly #define CLOSE_RETURN_IF_ERROR(error) if (error) { LinkDown(); SCOSocket().Close(); ESCOSocket().Close(); return error; } -#define CLOSE_LISTENER_RETURN_IF_ERROR(error) if (error) { ListeningSCOSocket().Close(); ListeningESCOSocket().Close(); return error; } EXPORT_C TInt CBluetoothSynchronousLink::SetupConnection(const TBTDevAddr& aBDAddr, const TBTSyncPackets& aPacketTypes) { @@ -191,23 +190,17 @@ if (packetsESCO) { iSCOTypes |= EeSCO; - openESCO = ETrue; + openESCO = ETrue; } // but must be one __ASSERT_ALWAYS(packetsSCO || packetsESCO, Panic(EBadSyncPacketTypes)); - if (iBTSynchronousLinkAttacherSCO->IsActive()) + if (iBTSynchronousLinkAttacherSCO->IsActive() || iBTSynchronousLinkAttacherESCO->IsActive()) { FLOG(_L("Link attacher already active")); return KErrInUse; } - - if (iBTSynchronousLinkAttacherESCO->IsActive()) - { - FLOG(_L("Link attacher already active")); - return KErrInUse; - } TInt linkState = LinkUp(aBDAddr); if (linkState != KErrNone) @@ -337,16 +330,12 @@ */ EXPORT_C TInt CBluetoothSynchronousLink::Disconnect() { - if (!SCOSocket().SubSessionHandle()) + if (!SCOSocket().SubSessionHandle() && !ESCOSocket().SubSessionHandle()) { - if(!ESCOSocket().SubSessionHandle()) - { - return KErrDisconnected; - } + return KErrDisconnected; } - if (iBTSynchronousLinkDetacherSCO->IsActive() || - iBTSynchronousLinkDetacherESCO->IsActive()) + if (iBTSynchronousLinkDetacherSCO->IsActive() || iBTSynchronousLinkDetacherESCO->IsActive()) { return KErrInUse; } @@ -499,6 +488,12 @@ */ EXPORT_C TInt CBluetoothSynchronousLink::AcceptConnection(const TBTSyncPackets& aPacketTypes) { + TRAPD(err, AcceptConnectionL(aPacketTypes)); + return err; + } + +void CBluetoothSynchronousLink::AcceptConnectionL(const TBTSyncPackets& aPacketTypes) + { TBool listenForSCO = EFalse; TBool listenForESCO = EFalse; @@ -506,41 +501,30 @@ TBTSyncPacketTypes packets = aPacketTypes(); - __ASSERT_ALWAYS(packets, Panic(EBadSyncPacketTypes)); packets &= (TBTSyncPackets::ESyncAnySCOPacket | TBTSyncPackets::ESyncAnyESCOPacket); if (!packets) { - return KErrNotSupported; + User::Leave(KErrNotSupported); } - if (iBTSynchronousLinkAccepterSCO->IsActive()) + if (iBTSynchronousLinkAccepterSCO->IsActive() || iBTSynchronousLinkAccepterESCO->IsActive()) { - return KErrInUse; - } - - if (iBTSynchronousLinkAccepterESCO->IsActive()) - { - return KErrInUse; + User::Leave(KErrInUse); } - TInt err = ListeningSCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeSCO, KBTLinkManager); - if(err) - { - return err; - } + User::LeaveIfError(ListeningSCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeSCO, KBTLinkManager)); + CleanupClosePushL(ListeningSCOSocket()); - err = ListeningESCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeESCO, KBTLinkManager); - if(err) - { - ListeningSCOSocket().Close(); - return err; - } + User::LeaveIfError(ListeningESCOSocket().Open(iSockServer, KBTAddrFamily, KSockBluetoothTypeESCO, KBTLinkManager)); + CleanupClosePushL(ListeningESCOSocket()); + + CleanupStack::PushL(TCleanupItem(StaticResetScoTypes, this)); // we want to clear any setting of SCO types upon leaving TBTSyncPacketTypes packetsSCO = packets & TBTSyncPackets::ESyncAnySCOPacket; if (packetsSCO) { - err = ListeningSCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsSCO); + TInt err = ListeningSCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsSCO); if(!err) { iSCOTypes |= ESCO; @@ -551,17 +535,15 @@ TBTSyncPacketTypes packetsESCO = packets & TBTSyncPackets::ESyncAnyESCOPacket; if (packetsESCO) { - err = ListeningESCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsESCO); + TInt err = ListeningESCOSocket().SetOpt(ESyncUserPacketTypes, KSolBtSCO, packetsESCO); if (!err) { iSCOTypes |= EeSCO; listenForESCO = ETrue; + + TPckgC options(iRequestedLink); + User::LeaveIfError(ListeningESCOSocket().SetOpt(EeSCOExtOptions, KSolBtESCO, options)); } - - TPckgBuf options; - options() = iRequestedLink; - err = ListeningESCOSocket().SetOpt(EeSCOExtOptions, KSolBtESCO, options); - CLOSE_LISTENER_RETURN_IF_ERROR(err); } __ASSERT_ALWAYS(listenForSCO || listenForESCO, Panic(EBadSyncPacketTypes)); @@ -580,62 +562,57 @@ if (listenForSCO) { - err = ListeningSCOSocket().Bind(sa); - CLOSE_LISTENER_RETURN_IF_ERROR(err); - - err = ListeningSCOSocket().Listen(KSCOListenQueSize); - CLOSE_LISTENER_RETURN_IF_ERROR(err); - - err = SCOSocket().Open(SocketServer()); - if(err) - { - return err; - } + User::LeaveIfError(ListeningSCOSocket().Bind(sa)); + User::LeaveIfError(ListeningSCOSocket().Listen(KSCOListenQueSize)); + User::LeaveIfError(SCOSocket().Open(SocketServer())); + CleanupClosePushL(SCOSocket()); } if(listenForESCO) { - err = ListeningESCOSocket().Bind(sa); - CLOSE_LISTENER_RETURN_IF_ERROR(err); - - err = ListeningESCOSocket().Listen(KSCOListenQueSize); - CLOSE_LISTENER_RETURN_IF_ERROR(err); + User::LeaveIfError(ListeningESCOSocket().Bind(sa)); + User::LeaveIfError(ListeningESCOSocket().Listen(KSCOListenQueSize)); + User::LeaveIfError(ESCOSocket().Open(SocketServer())); + } + + // Now we can't fail synchronously, so we're ready to begin the accept. + if(listenForESCO) + { + iBTSynchronousLinkAccepterESCO->Accept(); + } - err = ESCOSocket().Open(SocketServer()); - if(err) - { - return err; - } - } - if (listenForSCO) { - iBTSynchronousLinkAccepterSCO->Accept(ListeningSCOSocket()); + CleanupStack::Pop(&SCOSocket()); + iBTSynchronousLinkAccepterSCO->Accept(); } - if(listenForESCO) - { - iBTSynchronousLinkAccepterESCO->Accept(ListeningESCOSocket()); - } + CleanupStack::Pop(3); // StaticResetScoTypes, ListeningESCOSocket(), ListeningSCOSocket() + } - return err; +void CBluetoothSynchronousLink::StaticResetScoTypes(TAny* aThis) + { + static_cast(aThis)->iSCOTypes = 0; } /** Cancel ability to respond to a remote request to set up a synchronous link. -It is possible for a race condition to mean that a connection has been established, -but as this call consumes the callback, for this fact not to reach the caller. -For this reason, it may be desirable to follow a call to CancelAccept with a call -to Disconnect. -@see CBluetoothSynchronousLink::Disconnect + +It is possible for a race condition to mean that a connection has been established +but the notifier has not yet received the call-back. In this case no call-back will +be received and the link (if established) will be immediately shutdown. */ EXPORT_C void CBluetoothSynchronousLink::CancelAccept() { iBTSynchronousLinkAccepterSCO->Cancel(); iBTSynchronousLinkAccepterESCO->Cancel(); iBTSynchronousLinkBaseband->StopAll(); - + + iSCOTypes = 0; + + LinkDown(); + ListeningSCOSocket().Close(); ListeningESCOSocket().Close(); SCOSocket().Close(); @@ -896,36 +873,48 @@ if (aSCOType & ESCO) { iBTSynchronousLinkAccepterESCO->Cancel(); + ListeningESCOSocket().Close(); + ESCOSocket().Close(); + SCOSocket().RemoteName(sockAddr); } else { iBTSynchronousLinkAccepterSCO->Cancel(); + ListeningSCOSocket().Close(); + SCOSocket().Close(); + ESCOSocket().RemoteName(sockAddr); } if(sockAddr.Family() == KBTAddrFamily) { - TBTSockAddr& btSockAddr = static_cast(sockAddr); // subclasses of TSockAddr are forbidden to add members + TBTSockAddr& btSockAddr = static_cast(sockAddr); TBTDevAddr da = btSockAddr.BTAddr(); - TInt linkState = LinkUp(da); - - __ASSERT_ALWAYS((linkState == KErrNone), Panic(EBasebandFailedConnect)); - - iBTSynchronousLinkBaseband->PreventPark(); - iBTSynchronousLinkBaseband->CatchEvents(); - UpdateLinkParams(aSCOType); + aErr = LinkUp(da); + if(aErr == KErrNone) + { + iBTSynchronousLinkBaseband->PreventPark(); + iBTSynchronousLinkBaseband->CatchEvents(); + UpdateLinkParams(aSCOType); + } + else + { + FTRACE(FPrint(_L("Failed to \"LinkUp\" the synchronous link (aErr %d)"), aErr)); + } } else { // reading RemoteName has failed, probably socket state is already closed // for example after quick disconnection initiated from remote side - aErr = KErrDisconnected; + aErr = KErrDisconnected; } } - else + + if(aErr != KErrNone) { iNegotiatedLink = TBTeSCOLinkParams(0, 0, 0, 0); + CancelAccept(); // makes sure everything is cleaned up. } #ifdef __FLOGGING__ @@ -935,9 +924,6 @@ #else Notifier().HandleAcceptConnectionCompleteL(aErr); #endif - - ListeningSCOSocket().Close(); - ListeningESCOSocket().Close(); } @@ -1034,24 +1020,16 @@ CBTSynchronousLinkBaseband* CBTSynchronousLinkBaseband::NewL(CBluetoothSynchronousLink& aParent) { CBTSynchronousLinkBaseband* self = new(ELeave) CBTSynchronousLinkBaseband(aParent); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); return self; } CBTSynchronousLinkBaseband::CBTSynchronousLinkBaseband(CBluetoothSynchronousLink& aParent) : CActive(CActive::EPriorityStandard), iParent(aParent) - {} - - -void CBTSynchronousLinkBaseband::ConstructL() { CActiveScheduler::Add(this); } - CBTSynchronousLinkBaseband::~CBTSynchronousLinkBaseband() { StopAll(); @@ -1093,7 +1071,7 @@ Cancel(); } - + void CBTSynchronousLinkBaseband::DoCancel() { iParent.Baseband().CancelNextBasebandChangeEventNotifier(); @@ -1104,20 +1082,12 @@ CBTSynchronousLinkAttacher* CBTSynchronousLinkAttacher::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) { CBTSynchronousLinkAttacher* self = new (ELeave) CBTSynchronousLinkAttacher(aParent, aSCOType); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); return self; } - CBTSynchronousLinkAttacher::CBTSynchronousLinkAttacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) : CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType) { - } - -void CBTSynchronousLinkAttacher::ConstructL() - { CActiveScheduler::Add(this); } @@ -1155,7 +1125,6 @@ return KErrNone; } - void CBTSynchronousLinkAttacher::DoCancel() { FLOG(_L("CBTSynchronousLinkAttacher cancel attach sync link")); @@ -1174,20 +1143,12 @@ CBTSynchronousLinkDetacher* CBTSynchronousLinkDetacher::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) { CBTSynchronousLinkDetacher* self = new (ELeave) CBTSynchronousLinkDetacher(aParent, aSCOType); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); return self; } - CBTSynchronousLinkDetacher::CBTSynchronousLinkDetacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) : CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType) { - } - -void CBTSynchronousLinkDetacher::ConstructL() - { CActiveScheduler::Add(this); } @@ -1240,9 +1201,6 @@ CBTSynchronousLinkAccepter* CBTSynchronousLinkAccepter::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) { CBTSynchronousLinkAccepter* self = new (ELeave) CBTSynchronousLinkAccepter(aParent, aSCOType); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); return self; } @@ -1250,10 +1208,6 @@ CBTSynchronousLinkAccepter::CBTSynchronousLinkAccepter(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) : CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType) { - } - -void CBTSynchronousLinkAccepter::ConstructL() - { CActiveScheduler::Add(this); } @@ -1262,7 +1216,7 @@ Cancel(); } -void CBTSynchronousLinkAccepter::Accept(RSocket& aSocket) +void CBTSynchronousLinkAccepter::Accept() { __ASSERT_ALWAYS(!IsActive(), Panic(EUnfinishedBusiness)); @@ -1270,11 +1224,11 @@ FLOG(_L("CBTSynchronousLinkAccepter accept sync link")); if (iSCOType == ESCO) { - aSocket.Accept(iParent.SCOSocket(), iStatus); + iParent.ListeningSCOSocket().Accept(iParent.SCOSocket(), iStatus); } else { - aSocket.Accept(iParent.ESCOSocket(), iStatus); + iParent.ListeningESCOSocket().Accept(iParent.ESCOSocket(), iStatus); } SetActive(); } @@ -1315,9 +1269,6 @@ CBTSynchronousLinkSender* CBTSynchronousLinkSender::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) { CBTSynchronousLinkSender* self = new (ELeave) CBTSynchronousLinkSender(aParent, aSCOType); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); return self; } @@ -1325,10 +1276,6 @@ CBTSynchronousLinkSender::CBTSynchronousLinkSender(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) : CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType) { - } - -void CBTSynchronousLinkSender::ConstructL() - { CActiveScheduler::Add(this); } @@ -1403,9 +1350,6 @@ CBTSynchronousLinkReceiver* CBTSynchronousLinkReceiver::NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) { CBTSynchronousLinkReceiver* self = new (ELeave) CBTSynchronousLinkReceiver(aParent, aSCOType); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); return self; } @@ -1413,10 +1357,6 @@ CBTSynchronousLinkReceiver::CBTSynchronousLinkReceiver(CBluetoothSynchronousLink& aParent, TSCOType aSCOType) : CActive(CActive::EPriorityStandard), iParent(aParent), iSCOType(aSCOType) { - } - -void CBTSynchronousLinkReceiver::ConstructL() - { CActiveScheduler::Add(this); } diff -r 9d84592f5036 -r 14e279d2bbb7 bluetoothmgmt/bluetoothclientlib/btlib/btsynclinkhelpers.h --- a/bluetoothmgmt/bluetoothclientlib/btlib/btsynclinkhelpers.h Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/btlib/btsynclinkhelpers.h Wed Jul 21 15:42:05 2010 +0300 @@ -32,7 +32,6 @@ private: CBTSynchronousLinkBaseband(CBluetoothSynchronousLink& aParent); - void ConstructL(); void DoCancel(); void RunL(); TInt RunError(TInt aError); @@ -41,7 +40,7 @@ TBTBasebandEvent iEvent; }; -//CBluetoothSynchronousLink Active Objects... + NONSHARABLE_CLASS(CBTSynchronousLinkAttacher) : public CActive { public: @@ -53,7 +52,6 @@ private: CBTSynchronousLinkAttacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOTypes); - void ConstructL(); void DoCancel(); void RunL(); TInt RunError(TInt aError); @@ -75,7 +73,6 @@ private: CBTSynchronousLinkDetacher(CBluetoothSynchronousLink& aParent, TSCOType aSCOTypes); - void ConstructL(); void DoCancel(); void RunL(); TInt RunError(TInt aError); @@ -93,12 +90,11 @@ static CBTSynchronousLinkAccepter* NewL(CBluetoothSynchronousLink& aParent, TSCOType aSCOType); ~CBTSynchronousLinkAccepter(); - void Accept(RSocket& aSocket); + void Accept(); private: CBTSynchronousLinkAccepter(CBluetoothSynchronousLink& aParent, TSCOType aSCOType); - void ConstructL(); void DoCancel(); void RunL(); TInt RunError(TInt aError); @@ -120,7 +116,6 @@ private: CBTSynchronousLinkSender(CBluetoothSynchronousLink& aParent, TSCOType aSCOType); - void ConstructL(); void DoCancel(); void RunL(); TInt RunError(TInt aError); @@ -142,7 +137,6 @@ private: CBTSynchronousLinkReceiver(CBluetoothSynchronousLink& aParent, TSCOType aSCOTypes); - void ConstructL(); void DoCancel(); void RunL(); TInt RunError(TInt aError); diff -r 9d84592f5036 -r 14e279d2bbb7 bluetoothmgmt/bluetoothclientlib/inc/bt_sock.h --- a/bluetoothmgmt/bluetoothclientlib/inc/bt_sock.h Mon Jul 12 07:06:31 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/inc/bt_sock.h Wed Jul 21 15:42:05 2010 +0300 @@ -1424,6 +1424,8 @@ void UpdateLinkParams(TSCOType aSCOType); TInt LinkUp(TBTDevAddr aAddr); void LinkDown(); + void AcceptConnectionL(const TBTSyncPackets& aPacketTypes); + static void StaticResetScoTypes(TAny* aThis); private: CBTSynchronousLinkSender* iBTSynchronousLinkSenderSCO; diff -r 9d84592f5036 -r 14e279d2bbb7 package_definition.xml --- a/package_definition.xml Mon Jul 12 07:06:31 2010 +0300 +++ b/package_definition.xml Wed Jul 21 15:42:05 2010 +0300 @@ -1,103 +1,104 @@ - + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +