|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <btfeaturescfg.h> |
|
20 #include <featmgr/FeatureControl.h> |
|
21 #include <featmgr/FeatMgr.h> |
|
22 |
|
23 /** |
|
24 Device supports bluetooth data profiles disabled. |
|
25 */ |
|
26 const TInt KFeatureIdTempFfBluetoothDataProfilesDisabled = 0x1000001; |
|
27 |
|
28 /** |
|
29 Device supports bluetooth disabled. |
|
30 */ |
|
31 const TInt KFeatureIdTempFfBluetoothDisabled = 0x1000002; |
|
32 |
|
33 |
|
34 EXPORT_C void BluetoothFeatures::SetEnterpriseEnablementL(BluetoothFeatures::TEnterpriseEnablementMode aMode) |
|
35 { |
|
36 // This method is only provided for use by the Bluetooth DCMO plugin. |
|
37 // Hence we should be running in the DCMO server process. |
|
38 _LIT_SECURE_ID(KDcmoServerSecureUid, 0x2001FE47); |
|
39 RProcess proc; |
|
40 if ( proc.SecureId() != KDcmoServerSecureUid ) |
|
41 { |
|
42 User::Leave(KErrPermissionDenied); |
|
43 } |
|
44 |
|
45 const TUid KBtDisabledUid = {KFeatureIdTempFfBluetoothDisabled}; |
|
46 const TUid KBtDataProfilesDisabledUid = {KFeatureIdTempFfBluetoothDataProfilesDisabled}; |
|
47 |
|
48 RFeatureControl featureControl; |
|
49 User::LeaveIfError(featureControl.Connect()); |
|
50 CleanupClosePushL(featureControl); |
|
51 switch ( aMode ) |
|
52 { |
|
53 case EDisabled: |
|
54 User::LeaveIfError(featureControl.EnableFeature(KBtDisabledUid)); |
|
55 User::LeaveIfError(featureControl.DisableFeature(KBtDataProfilesDisabledUid)); |
|
56 break; |
|
57 case EDataProfilesDisabled: |
|
58 User::LeaveIfError(featureControl.DisableFeature(KBtDisabledUid)); |
|
59 User::LeaveIfError(featureControl.EnableFeature(KBtDataProfilesDisabledUid)); |
|
60 break; |
|
61 case EEnabled: |
|
62 User::LeaveIfError(featureControl.DisableFeature(KBtDisabledUid)); |
|
63 User::LeaveIfError(featureControl.DisableFeature(KBtDataProfilesDisabledUid)); |
|
64 break; |
|
65 default: |
|
66 User::Leave(KErrArgument); |
|
67 break; |
|
68 } |
|
69 CleanupStack::PopAndDestroy(&featureControl); |
|
70 } |
|
71 |
|
72 EXPORT_C BluetoothFeatures::TEnterpriseEnablementMode BluetoothFeatures::EnterpriseEnablementL() |
|
73 { |
|
74 TEnterpriseEnablementMode mode = EDisabled; |
|
75 |
|
76 FeatureManager::InitializeLibL(); |
|
77 const TBool bluetoothDisabled = FeatureManager::FeatureSupported(KFeatureIdTempFfBluetoothDisabled); |
|
78 if ( !bluetoothDisabled ) |
|
79 { |
|
80 const TBool dataProfilesDisabled = FeatureManager::FeatureSupported(KFeatureIdTempFfBluetoothDataProfilesDisabled); |
|
81 if ( dataProfilesDisabled ) |
|
82 { |
|
83 mode = EDataProfilesDisabled; |
|
84 } |
|
85 else |
|
86 { |
|
87 mode = EEnabled; |
|
88 } |
|
89 } |
|
90 FeatureManager::UnInitializeLib(); |
|
91 |
|
92 return mode; |
|
93 } |