20 #include <bt_subscribe_partner.h> |
20 #include <bt_subscribe_partner.h> |
21 #include <btnotif.h> |
21 #include <btnotif.h> |
22 #include <btengdomainpskeys.h> |
22 #include <btengdomainpskeys.h> |
23 #include <centralrepository.h> |
23 #include <centralrepository.h> |
24 #include <featmgr.h> |
24 #include <featmgr.h> |
25 #include <AknSmallIndicator.h> |
|
26 //#include <avkon.hrh> |
|
27 #include "btengserver.h" |
25 #include "btengserver.h" |
28 #include "btengsrvpluginmgr.h" |
26 #include "btengsrvpluginmgr.h" |
29 #include "btengsrvbbconnectionmgr.h" |
27 #include "btengsrvbbconnectionmgr.h" |
30 #include "btengsrvstate.h" |
28 #include "btengsrvstate.h" |
31 #include "debug.h" |
29 #include "debug.h" |
|
30 #include <btindicatorconstants.h> |
|
31 #include <hbindicatorsymbian.h> |
|
32 #include <hbsymbianvariant.h> |
32 |
33 |
33 /** ID of active object helper */ |
34 /** ID of active object helper */ |
34 const TInt KBTEngSettingsActive = 30; |
35 const TInt KBTEngSettingsActive = 30; |
35 /** Constant for converting minutes to microseconds */ |
36 /** Constant for converting minutes to microseconds */ |
36 //const TInt64 KMinutesInMicroSecs = 60000000; |
37 //const TInt64 KMinutesInMicroSecs = 60000000; |
724 TRACE_FUNC_ENTRY |
727 TRACE_FUNC_ENTRY |
725 TBTPowerStateValue powerState = EBTPowerOff; |
728 TBTPowerStateValue powerState = EBTPowerOff; |
726 TBTVisibilityMode visibilityMode = EBTVisibilityModeHidden; |
729 TBTVisibilityMode visibilityMode = EBTVisibilityModeHidden; |
727 CRepository* cenrep = NULL; |
730 CRepository* cenrep = NULL; |
728 TInt phys = 0; |
731 TInt phys = 0; |
729 TInt connecting = 0; |
732 // TInt connecting = 0; |
730 |
733 |
731 cenrep = CRepository::NewLC( KCRUidBluetoothPowerState ); |
734 cenrep = CRepository::NewLC( KCRUidBluetoothPowerState ); |
732 User::LeaveIfError( cenrep->Get( KBTPowerState, (TInt&) powerState ) ); |
735 User::LeaveIfError( cenrep->Get( KBTPowerState, (TInt&) powerState ) ); |
733 CleanupStack::PopAndDestroy( cenrep ); |
736 CleanupStack::PopAndDestroy( cenrep ); |
734 |
737 |
735 if( powerState == EBTPowerOff ) |
738 if( powerState == EBTPowerOff ) |
736 { |
739 { |
737 // To be migrated |
740 SetIndicatorStateL(EBTIndicatorOff); |
738 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); |
|
739 //SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOff ); |
|
740 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); |
|
741 //SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOff ); |
|
742 } |
741 } |
743 else |
742 else |
744 { |
743 { |
745 // Power is on. |
744 // Power is on. |
746 RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothPHYCount, phys ); |
745 RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothPHYCount, phys ); |
747 RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothConnecting, connecting ); |
746 // RProperty::Get( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothConnecting, connecting ); |
748 |
747 |
749 cenrep = CRepository::NewLC( KCRUidBTEngPrivateSettings ); |
748 cenrep = CRepository::NewLC( KCRUidBTEngPrivateSettings ); |
750 User::LeaveIfError( cenrep->Get( KBTDiscoverable, (TInt&) visibilityMode ) ); |
749 User::LeaveIfError( cenrep->Get( KBTDiscoverable, (TInt&) visibilityMode ) ); |
751 CleanupStack::PopAndDestroy( cenrep ); |
750 CleanupStack::PopAndDestroy( cenrep ); |
752 |
751 |
753 if( visibilityMode == EBTVisibilityModeHidden ) |
752 if( visibilityMode == EBTVisibilityModeHidden ) |
754 { |
753 { |
755 if ( connecting ) // BT connecting and hidden |
754 if ( phys > 0 ) // BT connection active and hidden |
756 { |
755 { |
757 // To be migrated to QT |
756 SetIndicatorStateL(EBTIndicatorHiddenConnected); |
758 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); |
|
759 //SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateAnimate ); |
|
760 } |
|
761 else if ( phys > 0 ) // BT connection active and hidden |
|
762 { |
|
763 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); |
|
764 //SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOn ); |
|
765 } |
757 } |
766 else // BT connection not active and hidden |
758 else // BT connection not active and hidden |
767 { |
759 { |
768 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOn ); |
760 SetIndicatorStateL(EBTIndicatorOnHidden); |
769 //SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOff ); |
761 } |
770 } |
|
771 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); |
|
772 //SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOff ); |
|
773 } |
762 } |
774 else if( visibilityMode == EBTVisibilityModeGeneral || visibilityMode == EBTVisibilityModeTemporary ) |
763 else if( visibilityMode == EBTVisibilityModeGeneral || visibilityMode == EBTVisibilityModeTemporary ) |
775 { |
764 { |
776 if ( connecting ) // BT connecting and visible |
765 if ( phys > 0 ) // BT connection active and visible |
777 { |
766 { |
778 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); |
767 SetIndicatorStateL(EBTIndicatorVisibleConnected); |
779 //SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateAnimate ); |
|
780 } |
|
781 else if ( phys > 0 ) // BT connection active and visible |
|
782 { |
|
783 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOff ); |
|
784 //SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOn ); |
|
785 } |
768 } |
786 else // BT connection not active and visible |
769 else // BT connection not active and visible |
787 { |
770 { |
788 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOnVisible, EAknIndicatorStateOn ); |
771 SetIndicatorStateL(EBTIndicatorOnVisible); |
789 //SetIndicatorStateL( EAknIndicatorBluetoothVisible, EAknIndicatorStateOff ); |
772 } |
790 } |
773 } |
791 //SetIndicatorStateL( EAknIndicatorBluetoothModuleOn, EAknIndicatorStateOff ); |
774 } |
792 //SetIndicatorStateL( EAknIndicatorBluetooth, EAknIndicatorStateOff ); |
775 TRACE_FUNC_EXIT |
793 } |
776 } |
794 } |
777 |
795 TRACE_FUNC_EXIT |
778 void CBTEngSrvSettingsMgr::SetIndicatorStateL( const TInt aState ) |
796 } |
779 { |
797 |
780 TBool success = EFalse; |
798 // --------------------------------------------------------------------------- |
781 if(iIndicatorState != aState) |
799 // ?implementation_description |
782 { |
800 // --------------------------------------------------------------------------- |
783 CHbSymbianVariant* parameters = CHbSymbianVariant::NewL(&aState,CHbSymbianVariant::EInt ); |
801 // |
784 success = iBTIndicator->Activate(KIndicatorType(),parameters); |
802 void CBTEngSrvSettingsMgr::SetIndicatorStateL( const TInt aIndicator, const TInt aState ) |
785 delete parameters; |
803 { |
786 if(!success) |
804 // To be migrated to QT |
787 { |
805 (void) aIndicator; |
788 User::Leave(iBTIndicator->Error()); |
806 (void) aState; |
789 } |
807 //CAknSmallIndicator* indicator = CAknSmallIndicator::NewLC( TUid::Uid( aIndicator ) ); |
790 iIndicatorState = aState; |
808 //indicator->SetIndicatorStateL( aState ); |
791 } |
809 //CleanupStack::PopAndDestroy( indicator ); //indicator |
|
810 } |
792 } |
811 |
793 |
812 |
794 |
813 // --------------------------------------------------------------------------- |
795 // --------------------------------------------------------------------------- |
814 // Gets the current HW power state. |
796 // Gets the current HW power state. |