bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
--- a/bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp	Tue Aug 31 15:25:10 2010 +0300
+++ b/bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp	Wed Sep 01 12:20:04 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006 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"
@@ -23,9 +23,6 @@
 #include "btpluginnotifier.h"
 #include "debug.h"
 #include <btfeaturescfg.h>
-#include <btnotifclient.h>
-#include "btindicatorconstants.h"
-#include <hbsymbianvariant.h>
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -62,7 +59,6 @@
 	delete repository;
 	
 	CBTEngSettings* settings = CBTEngSettings::NewL();
-	iBTIndicator = CHbIndicatorSymbian::NewL(); 
 	
 	BluetoothFeatures::TEnterpriseEnablementMode mode = BluetoothFeatures::EnterpriseEnablementL();
 	TRACE_INFO( ( _L( "mode = %d" ), mode) )
@@ -72,23 +68,15 @@
         TRACE_INFO( ( _L( "Turning BT on" ) ) )
         TInt err = settings->SetPowerState( EBTPowerOn );
         TRACE_INFO( ( _L( "SetPowerState returned %d" ), err ) )
-        if ( !err )
+        if( !err )
             {
-            HandleBtPowerChanged( EBTPowerOn );
+            iHandler.NotifyBearerStatus( ELocodBearerBT, power );
             }
         }
     else
         {
         TRACE_INFO( ( _L( "Turning BT off" ) ) )
         (void) settings->SetPowerState( EBTPowerOff );	// Result is not important here
-        TInt state =  EBTIndicatorOff;
-        CHbSymbianVariant* parameters = CHbSymbianVariant::NewL(&state,CHbSymbianVariant::EInt );
-        TBool success = iBTIndicator->Activate(KIndicatorType(),parameters); 
-        delete parameters;
-        if(!success)
-            {
-            User::Leave(iBTIndicator->Error());
-            }
         }
     delete settings;
 	if ( mode != BluetoothFeatures::EDisabled ) // only subscribe if there's any point (NB changing Enterprise Disabling mode requires a reboot)
@@ -123,7 +111,6 @@
     TRACE_FUNC_ENTRY
     Cancel();
     delete iSession;
-    delete iBTIndicator;
     }
 
 
@@ -142,30 +129,6 @@
     SetActive();
     }
 
-// ---------------------------------------------------------------------------
-// Handles power state change. Inform Locod. In addition, if BT is on, start
-// btnotifier server.
-// ---------------------------------------------------------------------------
-//
-void CBTPluginNotifier::HandleBtPowerChanged( TBTPowerStateValue aPower )
-    {
-    TRACE_FUNC_ARG( ( _L( " to %d" ), aPower ) )
-    TInt err (KErrNone );
-    if ( aPower == EBTPowerOn )
-        {
-        // Start BT notifier server by creating a session with it:
-        RBTNotifier btnotif;
-        err = btnotif.Connect();
-        TRACE_INFO( ( _L( "start bt notifier server %d" ), err ) )
-        // btnotif server manages its lifecycle. no need
-        // to keep this session:
-        btnotif.Close();
-        }
-    if ( !err )
-        {
-        iHandler.NotifyBearerStatus( ELocodBearerBT, aPower );
-        }
-    }
 
 // ---------------------------------------------------------------------------
 // From class CActive.
@@ -199,12 +162,9 @@
         case EKeyInt:
             {
             TRACE_INFO( ( _L( "[CBTPluginNotifier::RunL2 %d]" ), status ) )
-            TInt newValue = EBTPowerOff;
-            TInt err = iSession->Get( iId, newValue );
-            if ( !err )
-                {
-                HandleBtPowerChanged( static_cast<TBTPowerStateValue>( newValue ) );
-                }
+            TInt newValue = 1;
+            iSession->Get( iId, newValue );
+            iHandler.NotifyBearerStatus( ELocodBearerBT, newValue );
             }
             break;
         default: