--- a/bluetoothengine/bteng/btengsettings/src/btengsettingsnotify.cpp Mon May 03 12:40:50 2010 +0300
+++ b/bluetoothengine/bteng/btengsettings/src/btengsettingsnotify.cpp Fri May 14 16:01:46 2010 +0300
@@ -90,22 +90,11 @@
//
CBTEngSettingsNotify::~CBTEngSettingsNotify()
{
- if ( iPowerKeyCenRep )
- {
- iPowerKeyCenRep->NotifyCancel( KBTPowerState );
- }
- delete iPowerKeyWatcher; // Will call Cancel()
+ delete iPowerKeyWatcher;
delete iPowerKeyCenRep;
- if ( iVisiKeyCenRep )
- {
- iVisiKeyCenRep->NotifyCancel( KBTDiscoverable );
- }
- delete iVisiKeyWatcher; // Will call Cancel()
+ delete iVisiKeyWatcher;
delete iVisiKeyCenRep;
- if( iBTeng.Handle() )
- {
- iBTeng.Close();
- }
+ iBTeng.Close();
}
@@ -138,12 +127,12 @@
// Handles notification of a setting change, and informs our observer.
// ---------------------------------------------------------------------------
//
-void CBTEngSettingsNotify::RequestCompletedL( CBTEngActive* aActive, TInt aId,
+void CBTEngSettingsNotify::RequestCompletedL( CBTEngActive* aActive,
TInt aStatus )
{
- TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aId, aStatus ) )
+ TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aActive->RequestId(), aStatus ) )
- if( aId == KPowerKeyReqId && aStatus == KBTPowerState )
+ if( aActive->RequestId() == KPowerKeyReqId && aStatus == KBTPowerState )
{
iPowerKeyCenRep->NotifyRequest( KBTPowerState,
iPowerKeyWatcher->RequestStatus() );
@@ -155,7 +144,7 @@
iObserver->PowerStateChanged( (TBTPowerStateValue) value );
}
}
- else if( aId == KVisibilityKeyReqId && aStatus == KBTDiscoverable )
+ else if( aActive->RequestId() == KVisibilityKeyReqId && aStatus == KBTDiscoverable )
{
iVisiKeyCenRep->NotifyRequest( KBTDiscoverable,
iVisiKeyWatcher->RequestStatus() );
@@ -172,23 +161,42 @@
// Coudl be a repository-wide reset (KInvalidNotificationId),
// or an invalid key ID. Anyway we know the ID of the active
// object, so we can just reset the watcher.
- HandleError( aActive, aId, aStatus );
+ HandleError( aActive, aStatus );
}
TRACE_FUNC_EXIT
}
+// ---------------------------------------------------------------------------
+// From class MBTEngActiveObserver.
+// Handles cancelation of an outstanding request
+// ---------------------------------------------------------------------------
+//
+void CBTEngSettingsNotify::CancelRequest( TInt aRequestId )
+ {
+ TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) )
+
+ if( aRequestId == KPowerKeyReqId )
+ {
+ iPowerKeyCenRep->NotifyCancel( KBTPowerState );
+ }
+ else if( aRequestId == KVisibilityKeyReqId )
+ {
+ iVisiKeyCenRep->NotifyCancel( KBTDiscoverable );
+ }
+ TRACE_FUNC_EXIT
+ }
// ---------------------------------------------------------------------------
// From class MBTEngCenRepNotify.
// Handles error situation by just re-ordering notification from CenRep.
// ---------------------------------------------------------------------------
//
-void CBTEngSettingsNotify::HandleError( CBTEngActive* aActive, TInt aId,
+void CBTEngSettingsNotify::HandleError( CBTEngActive* aActive,
TInt aError )
{
- TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aId, aError ) )
+ TRACE_FUNC_ARG( ( _L( "Id(%d), status(%d)" ), aActive->RequestId(), aError ) )
(void) aError;
- if( aId == KPowerKeyReqId )
+ if( aActive->RequestId() == KPowerKeyReqId )
{
delete iPowerKeyCenRep;
iPowerKeyCenRep = NULL;
@@ -201,7 +209,7 @@
aActive->GoActive();
}
}
- else if( aId == KVisibilityKeyReqId )
+ else if( aActive->RequestId() == KVisibilityKeyReqId )
{
delete iVisiKeyCenRep;
iVisiKeyCenRep = NULL;