29 #include "btengsrvpluginmgr.h" |
29 #include "btengsrvpluginmgr.h" |
30 #include "btengsrvbbconnectionmgr.h" |
30 #include "btengsrvbbconnectionmgr.h" |
31 #include "btengsrvstate.h" |
31 #include "btengsrvstate.h" |
32 #include "debug.h" |
32 #include "debug.h" |
33 |
33 |
34 #ifndef SETLOCALNAME |
|
35 #include <btengsettings.h> |
|
36 #endif |
|
37 |
|
38 /** ID of active object helper */ |
34 /** ID of active object helper */ |
39 const TInt KBTEngSettingsActive = 30; |
35 const TInt KBTEngSettingsActive = 30; |
40 /** Constant for converting minutes to microseconds */ |
36 /** Constant for converting minutes to microseconds */ |
41 //const TInt64 KMinutesInMicroSecs = 60000000; |
37 //const TInt64 KMinutesInMicroSecs = 60000000; |
42 const TInt64 KMinutesInMicroSecs = MAKE_TINT64( 0, 60000000 ); |
38 const TInt64 KMinutesInMicroSecs = MAKE_TINT64( 0, 60000000 ); |
43 /** Timeout for disabling Simple Pairing debug mode. The value is 30 minutes. */ |
39 /** Timeout for disabling Simple Pairing debug mode. The value is 30 minutes. */ |
44 //const TInt KBTEngSspDebugModeTimeout = 1800000000; |
40 //const TInt KBTEngSspDebugModeTimeout = 1800000000; |
45 const TInt64 KBTEngSspDebugModeTimeout = MAKE_TINT64( 0, 1800000000 ); |
41 const TInt64 KBTEngSspDebugModeTimeout = MAKE_TINT64( 0, 1800000000 ); |
46 /** Timeout for turning BT off automatically. The value is 10.5 seconds. */ |
42 /** Timeout for turning BT off automatically. The value is 10.5 seconds. */ |
47 const TInt KBTEngBtAutoOffTimeout = 10500000; |
43 const TInt KBTEngBtAutoOffTimeout = 10500000; |
48 /** Default values for Major Service Class */ |
44 |
49 const TUint16 KCoDDefaultServiceClass = EMajorServiceTelephony | EMajorServiceObjectTransfer | EMajorServiceNetworking; |
|
50 /** Default values for Major Device Class */ |
|
51 const TUint8 KCoDDefaultMajorDeviceClass = EMajorDevicePhone; |
|
52 /** Default values for Minor Device Class */ |
|
53 const TUint8 KCoDDefaultMinorDeviceClass = EMinorDevicePhoneSmartPhone; |
|
54 |
|
55 |
|
56 // ======== MEMBER FUNCTIONS ======== |
45 // ======== MEMBER FUNCTIONS ======== |
57 |
46 |
58 // --------------------------------------------------------------------------- |
47 // --------------------------------------------------------------------------- |
59 // C++ default constructor |
48 // C++ default constructor |
60 // --------------------------------------------------------------------------- |
49 // --------------------------------------------------------------------------- |
666 if ( aStatus != KErrNone && aStatus != KErrAlreadyExists && aStatus != KErrCancel ) |
662 if ( aStatus != KErrNone && aStatus != KErrAlreadyExists && aStatus != KErrCancel ) |
667 { |
663 { |
668 // Something went wrong, so we turn BT off again. |
664 // Something went wrong, so we turn BT off again. |
669 SetPowerStateL( EBTOff, EFalse ); |
665 SetPowerStateL( EBTOff, EFalse ); |
670 } |
666 } |
671 else |
667 |
672 { |
|
673 // Write CoD only when the hardware has fully powered up. |
|
674 TBTPowerState currState ( EBTOff ); |
|
675 (void) GetHwPowerState( currState ); |
|
676 if ( currState == EBTOn ) |
|
677 { |
|
678 SetClassOfDeviceL(); |
|
679 #ifndef SETLOCALNAME |
|
680 // the macro SETLOCALNAME is used as a workaround to tackle the BT name |
|
681 // could not be saved to BT chip before chip initialization completed for the first time, |
|
682 // which is one of the regression after improving the BT boot up time. |
|
683 // To be removed once the final solution is in place. |
|
684 CBTEngSettings* settings = CBTEngSettings::NewL(); |
|
685 TBTDeviceName localName; |
|
686 localName.Zero(); |
|
687 TInt err = settings->GetLocalName(localName); |
|
688 if (err == KErrNone) |
|
689 { |
|
690 settings->SetLocalName(localName); |
|
691 } |
|
692 delete settings; |
|
693 #endif |
|
694 } |
|
695 } |
|
696 if ( !iMessage.IsNull()) |
668 if ( !iMessage.IsNull()) |
697 { |
669 { |
698 iMessage.Complete( aStatus ); |
670 iMessage.Complete( aStatus ); |
699 } |
671 } |
700 TRACE_FUNC_EXIT |
672 TRACE_FUNC_EXIT |
912 { |
884 { |
913 iAutoOffClients = 0; |
885 iAutoOffClients = 0; |
914 } |
886 } |
915 TRACE_FUNC_EXIT |
887 TRACE_FUNC_EXIT |
916 } |
888 } |
917 |
|
918 |
|
919 // --------------------------------------------------------------------------- |
|
920 // Set the Class of Device. |
|
921 // --------------------------------------------------------------------------- |
|
922 // |
|
923 void CBTEngSrvSettingsMgr::SetClassOfDeviceL() |
|
924 { |
|
925 TRACE_FUNC_ENTRY |
|
926 TUint16 serviceClass = KCoDDefaultServiceClass; |
|
927 // Check from feature manager if stereo audio is enabled. |
|
928 FeatureManager::InitializeLibL(); |
|
929 TBool supported = FeatureManager::FeatureSupported( KFeatureIdBtStereoAudio ); |
|
930 FeatureManager::UnInitializeLib(); |
|
931 if( supported ) |
|
932 { |
|
933 // A2DP spec says we should set this bit as we are a SRC |
|
934 serviceClass |= EMajorServiceCapturing; |
|
935 } |
|
936 // These values may nayway be overridden by HCI |
|
937 TBTDeviceClass cod( serviceClass, KCoDDefaultMajorDeviceClass, |
|
938 KCoDDefaultMinorDeviceClass ); |
|
939 // Ignore error, it is non-critical |
|
940 (void) RProperty::Set( KPropertyUidBluetoothControlCategory, |
|
941 KPropertyKeyBluetoothSetDeviceClass, cod.DeviceClass() ); |
|
942 TRACE_FUNC_EXIT |
|
943 } |
|