diff -r 91980f93208a -r 4e39398d58ed bluetooth/btstack/linkmgr/physicallinks.cpp --- a/bluetooth/btstack/linkmgr/physicallinks.cpp Fri Jan 22 10:55:01 2010 +0200 +++ b/bluetooth/btstack/linkmgr/physicallinks.cpp Tue Jan 26 13:05:56 2010 +0200 @@ -1711,7 +1711,7 @@ } } -TInt CPhysicalLink::Arbitrate(const TBool aImmediately, const TBool aLocalPriority) +TInt CPhysicalLink::Arbitrate(TBool aImmediately, TBool aLocalPriority) { LOG_FUNC if (!IsConnected()) @@ -1720,12 +1720,26 @@ if ( aImmediately ) { iArbitrationDelay->Cancel(); + return DoArbitrate(aLocalPriority); } else if (iArbitrationDelay->IsActive()) { return KErrNone; } - + else + { + iArbitrationDelay->Start(aLocalPriority); + return KErrNone; + } + } + +TInt CPhysicalLink::DoArbitrate(TBool aLocalPriority) + { + if (!IsConnected()) + { + return KErrDisconnected; + } + //start arbitrate process with what our local controller supports TUint8 allowedModesMask = EHoldMode | EParkMode | ESniffMode; // local features sorted out later TBool roleSwitchAllowed = EFalse; @@ -3417,13 +3431,13 @@ return self; } -void CArbitrationDelayTimer::Start() - { - LOG_FUNC - if (IsActive()) - { - Cancel(); - } +void CArbitrationDelayTimer::Start(TBool aLocalPriority) + { + LOG_FUNC + // Work out what the local priority will be now + TBool localPriority = iLocalPriority || aLocalPriority; + Cancel(); // cancel current timer (will also reset priority so ... + iLocalPriority = localPriority; // set the new priority) After(KBTArbitrationDelay); } @@ -3436,10 +3450,17 @@ LOG_FUNC if (iParent) { - iParent->Arbitrate(); + iParent->DoArbitrate(iLocalPriority); } } +void CArbitrationDelayTimer::DoCancel() + { + LOG_FUNC + CTimer::DoCancel(); + iLocalPriority = EFalse; + } + TInt CPhysicalLink::GetNumPendingHandles(TInt& aConnectionHandles, TLinkType aLinkType) const { LOG_FUNC