|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Public interface for querying support for features on a device, and |
|
15 // subscribing for notification if any features are added or removed. |
|
16 // |
|
17 // |
|
18 |
|
19 #ifndef FEATREG_H |
|
20 #define FEATREG_H |
|
21 |
|
22 /** |
|
23 * Interface for inquiring whether features are supported on the device. |
|
24 * |
|
25 * The code segment below shows an example of how the QuerySupport() API |
|
26 * should be used in client code that checks feature status. |
|
27 * |
|
28 * @code |
|
29 * |
|
30 * // Single query |
|
31 * // |
|
32 * TBool haveUsb = RFeatureRegistry::QuerySupportS(NFeature::KUsb) > 0; |
|
33 * if (haveUsb) |
|
34 * { // ... connect to USB service ... |
|
35 * } |
|
36 * |
|
37 * // or Multiple queries |
|
38 * // |
|
39 * RFeatureRegistry featReg; |
|
40 * const TBool opened = (featReg.Open() == KErrNone); |
|
41 * iHaveUsb = opened && (featReg.QuerySupport(NFeature::KUsb) > 0); |
|
42 * iHaveBluetooth = opened && (featReg.QuerySupport(NFeature::KBluetooth) > 0); |
|
43 * featReg.Close(); // can always call Close(), even if Open() failed: |
|
44 * // ... proceed to update application menus based on these featue flags |
|
45 * |
|
46 * @endcode |
|
47 * |
|
48 * Note the QuerySupport() API can return a negative error code. Clients |
|
49 * calling this API need to decide if this should result in specific error |
|
50 * handling or whether ignoring the error and assuming the feature is not |
|
51 * supported is the best policy. |
|
52 * |
|
53 * @see RFeatureRegistry::QuerySupportS |
|
54 * @publishedPartner |
|
55 * @deprecated |
|
56 */ |
|
57 NONSHARABLE_CLASS(RFeatureRegistry) |
|
58 { |
|
59 public: |
|
60 /** |
|
61 * Bit assignments in status word for listed features |
|
62 * |
|
63 * @internalComponent |
|
64 */ |
|
65 enum |
|
66 { |
|
67 EStatusSupportBit = 1, |
|
68 EStatusUpgradableBit = 2 |
|
69 }; |
|
70 inline RFeatureRegistry(); |
|
71 IMPORT_C TInt Open(); |
|
72 IMPORT_C TInt QuerySupport(TUid aFeatureUid); |
|
73 IMPORT_C TInt QuerySupport(TUid aFeatureUid, TUint32& aInfo); |
|
74 IMPORT_C void Close(); |
|
75 |
|
76 IMPORT_C static TInt QuerySupportS(TUid aFeatureUid); |
|
77 IMPORT_C static TInt QuerySupportS(TUid aFeatureUid, TUint32& aInfo); |
|
78 |
|
79 private: |
|
80 class TImpl; |
|
81 TImpl* iImpl; |
|
82 }; |
|
83 |
|
84 #ifndef SYMBIAN_FEATURE_MANAGER |
|
85 /** |
|
86 * Interface for obtaining notification of changes in the Feature Registry. |
|
87 * |
|
88 * @internalComponent |
|
89 */ |
|
90 |
|
91 NONSHARABLE_CLASS(RFeatureRegistryNotify) |
|
92 { |
|
93 public: |
|
94 inline RFeatureRegistryNotify(); |
|
95 IMPORT_C TInt Open(); |
|
96 IMPORT_C void Subscribe(TRequestStatus &aNotifyStatus); |
|
97 IMPORT_C void Cancel(); |
|
98 IMPORT_C void Close(); |
|
99 |
|
100 private: |
|
101 class TImpl; |
|
102 TImpl* iImpl; |
|
103 }; |
|
104 |
|
105 #endif |
|
106 |
|
107 #include <featreg.inl> |
|
108 |
|
109 #endif |