--- a/bluetoothengine/btmac/src/btmonobearer/bmbcmdlistener.cpp Mon Jan 18 20:28:57 2010 +0200
+++ b/bluetoothengine/btmac/src/btmonobearer/bmbcmdlistener.cpp Tue Jan 26 12:06:42 2010 +0200
@@ -1,5 +1,5 @@
/*
-* 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"
@@ -33,7 +33,8 @@
CBmbCmdListener::~CBmbCmdListener()
{
Cancel();
- iProperty.Close();
+ iATCmdProperty.Close();
+ iATRespProperty.Close();
}
// ---------------------------------------------------------------------------
@@ -44,11 +45,7 @@
void CBmbCmdListener::HandlingDataCompleted( const TDesC8& aResp )
{
// No better error handling than ignoring it.
- (void) iProperty.Set( aResp );
- // Handling previous received command has completed, this object
- // is ready for picking up the next one, regardless of
- // response sent successfully or not.
- Subscribe();
+ (void) iATRespProperty.Set( aResp );
TRACE_FUNC
}
@@ -61,7 +58,8 @@
void CBmbCmdListener::ConstructL()
{
TRACE_FUNC
- LEAVE_IF_ERROR(iProperty.Attach(KPSUidBluetoothEnginePrivateCategory, KBTATCodec));
+ LEAVE_IF_ERROR(iATCmdProperty.Attach(KPSUidBluetoothEnginePrivateCategory, KBTHfpATCommand));
+ LEAVE_IF_ERROR(iATRespProperty.Attach(KPSUidBluetoothEnginePrivateCategory, KBTHfpATResponse));
Subscribe();
}
@@ -69,48 +67,34 @@
{
TRACE_FUNC
TInt err = iStatus.Int();
+ Subscribe();
// Error could be received from Subscribe when the PS
// key is deleted due to powering BT off. In
// this case, we just re-subscribe.
if(err == KErrNone)
{
iAtCmdBuf.Zero();
- err = iProperty.Get(iAtCmdBuf);
+ err = iATCmdProperty.Get(iAtCmdBuf);
if ( !err && iAtCmdBuf.Length() > 0 )
{
// An AT command to be processed by iParent.
// At command handling completion, iParent will call this object
- // to send out response via HandlingDataCompleted()
- // which will subscribe to PS key update after the response has been
- // sent.
+ // to send out response via HandlingDataCompleted().
iParent.DataFromRemote(iAtCmdBuf);
}
- else
- {
- // No valid command in the PS key, re-subscribe.
- err = KErrArgument;
- }
}
TRACE_ERROR((_L8("listener Status %d"), err))
- // If err is 0, this object shall not immediately listen to new commands via
- // Subscribe() function while a command is under processing by iParent.
- // Btmonocmdhandler ensures not to deliver
- // the next command to this bearer while a command is being processed.
- if(err != KErrNone)
- {
- Subscribe();
- }
}
void CBmbCmdListener::DoCancel()
{
- iProperty.Cancel();
+ iATCmdProperty.Cancel();
}
void CBmbCmdListener::Subscribe()
{
__ASSERT_ALWAYS( !IsActive(), Panic(EBmbPanicCmdListenerBadState) );
- iProperty.Subscribe(iStatus);
+ iATCmdProperty.Subscribe(iStatus);
SetActive();
TRACE_FUNC
}