--- a/bluetoothengine/btaudioman/src/basrvaccman.cpp Tue Feb 02 00:20:42 2010 +0200
+++ b/bluetoothengine/btaudioman/src/basrvaccman.cpp Fri Feb 19 22:59:18 2010 +0200
@@ -12,13 +12,14 @@
* Contributors:
*
* Description: Implementation of an accessory management.
-* Version : %version: 14.1.8 %
+* Version : %version: 14.1.10 %
*
*/
// INCLUDE FILES
#include <centralrepository.h>
+#include <btengdomaincrkeys.h>
#include "basrvaccman.h"
#include "BTAccSession.h"
#include "BTAccClientSrv.h"
@@ -44,6 +45,28 @@
return self;
}
+void CBasrvAccMan::ConstructL()
+ {
+ iAsyncHandlingActive =
+ CBasrvActive::NewL(*this, CActive::EPriorityStandard, KAsyncHandlingRequest);
+
+ CRepository* cenrep = NULL;
+ TRAP_IGNORE(cenrep = CRepository::NewL(KCRUidBluetoothEngine));
+ TInt avrcpVol = EBTAvrcpVolCTNotSupported;
+ TInt autoDisconnect = EBTDisconnectIfAudioOpenFails;
+ if (cenrep)
+ {
+ cenrep->Get(KBTAvrcpVolCTLV, avrcpVol);
+ cenrep->Get(KBTDisconnectIfAudioOpenFailsLV, autoDisconnect);
+ delete cenrep;
+ }
+ iAvrcpVolCTSupported = (avrcpVol == EBTAvrcpVolCTSupported);
+ iDisconnectIfAudioOpenFails = (autoDisconnect == EBTDisconnectIfAudioOpenFails);
+ TRACE_INFO((_L("[AVRCP_Vol_CT] %d [DisconnectIfAudioOpenFails] %d"),
+ iAvrcpVolCTSupported, iDisconnectIfAudioOpenFails))
+ LoadServicesL();
+ }
+
CBasrvAccMan::~CBasrvAccMan()
{
delete iOpenListener;
@@ -77,7 +100,6 @@
iNotifierArray.ResetAndDestroy();
iNotifierArray.Close();
iClientRequests.Close();
- DestructVariant();
TRACE_FUNC
}
@@ -152,7 +174,14 @@
request.iRequest = EBTAccSrvDisconnectAccessory;
request.iAddr = aAddr;
iClientRequests.AppendL(request);
+
+ //remove the last item from the RArray if a leave occurs later
+ TCleanupItem cleanupItem(CleanupLastItemFromClientRequestsArray, &iClientRequests);
+ CleanupStack::PushL(cleanupItem);
+
iAccs[idx]->DisconnectL();
+
+ CleanupStack::Pop(&iClientRequests);
}
else
{
@@ -416,14 +445,23 @@
void CBasrvAccMan::ShowNote(TBTGenericInfoNoteType aNote, const TBTDevAddr& aAddr)
{
TRACE_INFO((_L("CBasrvAccMan::ShowNote %d"), aNote))
- TRAPD(err, iNotifierArray.Append(CBasrvActiveNotifier::NewL(*this, CActive::EPriorityStandard, KShowNoteRequest, aAddr, aNote)));
- if (err)
+ TRAPD(err, DoShowNoteL(aNote, aAddr));
+ if (err != KErrNone)
{
TRACE_ERROR((_L("could not construct active notifer object")))
return;
}
}
+void CBasrvAccMan::DoShowNoteL(TBTGenericInfoNoteType aNote, const TBTDevAddr& aAddr)
+ {
+ CBasrvActiveNotifier* activeNotifier = CBasrvActiveNotifier::NewL(*this, CActive::EPriorityStandard, KShowNoteRequest, aAddr, aNote);
+
+ CleanupStack::PushL(activeNotifier);
+ iNotifierArray.AppendL(activeNotifier);
+ CleanupStack::Pop(activeNotifier);
+ }
+
void CBasrvAccMan::FilterProfileSupport(TAccInfo& aInfo)
{
TInt pluginbit = iPluginMan->AvailablePlugins();
@@ -729,8 +767,6 @@
case KAsyncHandlingRequest:
{
DoAudioRequestL();
- delete iAsyncHandlingActive;
- iAsyncHandlingActive = NULL;
break;
}
default:
@@ -760,7 +796,7 @@
void CBasrvAccMan::DoAudioRequestL()
{
TRACE_FUNC
- if (iAudioRequests.Count() && !iAudioRequests[0].iOngoing && (!iAsyncHandlingActive || !iAsyncHandlingActive->IsActive()))
+ if (iAudioRequests.Count() && !iAudioRequests[0].iOngoing && !iAsyncHandlingActive->IsActive())
{
iAudioRequests[0].iOngoing = ETrue;
TInt err = KErrNotFound;
@@ -827,7 +863,7 @@
req.iReqType = ERejectAudioOpenedByAcc;
req.iOngoing = EFalse;
TInt idx = 0;
- if (iAudioRequests.Count() && iAudioRequests[0].iOngoing)
+ if (iAudioRequests.Count() && iAudioRequests[0].iOngoing && !iAsyncHandlingActive->IsActive())
{
idx = 1;
}
@@ -839,18 +875,12 @@
Trace(_L("[Audio Request buf] 2(Reject) %d at '%S', to index %d"), iCloseType, &buf, idx);
});
- if (!err && !iAsyncHandlingActive && !iAudioRequests[0].iOngoing)
+ if ((err == KErrNone) && !iAudioRequests[0].iOngoing)
{
- // Start rejection asynchronously
- iAsyncHandlingActive =
- CBasrvActive::New(*this, CActive::EPriorityStandard, KAsyncHandlingRequest);
- if (iAsyncHandlingActive)
- {
- iAsyncHandlingActive->iStatus = KRequestPending;
- TRequestStatus* sta = &(iAsyncHandlingActive->iStatus);
- User::RequestComplete(sta, KErrNone);
- iAsyncHandlingActive->GoActive();
- }
+ iAsyncHandlingActive->iStatus = KRequestPending;
+ TRequestStatus* sta = &(iAsyncHandlingActive->iStatus);
+ User::RequestComplete(sta, KErrNone);
+ iAsyncHandlingActive->GoActive();
}
}