|
1 // Copyright (c) 2006-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef HCIUTIL_H |
|
23 #define HCIUTIL_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <bluetooth/hci/hcierrors.h> |
|
27 |
|
28 // Note that KMaxHciUtilComponentName + ini-file path + ".ini" must not |
|
29 // exceed the length of a TName. |
|
30 const static TUint KMaxHciUtilComponentName = 60; |
|
31 _LIT(KDefaultIniFilePath, "\\private\\101F7989\\Bluetooth\\"); |
|
32 |
|
33 _LIT(KHciUtilPanic, "HCI Util Panic"); |
|
34 |
|
35 enum THciUtilPanic |
|
36 { |
|
37 EAlreadyAnIniFileOpen = 0, |
|
38 ESectionNameTooBig, |
|
39 EKeyNameTooBig, |
|
40 }; |
|
41 |
|
42 /** |
|
43 Common features used throughout the HCI |
|
44 */ |
|
45 class CIniFileData; |
|
46 class CHciUtil : public CBase |
|
47 { |
|
48 public: |
|
49 IMPORT_C static CHciUtil* NewL(const TDesC& aComponentName); |
|
50 IMPORT_C ~CHciUtil(); |
|
51 |
|
52 IMPORT_C void OpenIniFileL(); |
|
53 IMPORT_C void OpenIniFileL(const TDesC& aPath, const TDesC& aFile); |
|
54 IMPORT_C void CloseIniFile(); |
|
55 |
|
56 IMPORT_C TUid GetUidFromFileL(const TDesC& aSection, const TDesC& aTag); |
|
57 IMPORT_C TUint GetValueFromFileL(const TDesC& aSection, const TDesC& aTag); |
|
58 |
|
59 IMPORT_C static TAny* LoadImplementationL(TUid aIfUid, TInt aKeyOffset); |
|
60 IMPORT_C static TAny* LoadImplementationL(TUid aIfUid, TUid aImplUid, TInt aKeyOffset); |
|
61 |
|
62 IMPORT_C static void DestroyedImplementation(TUid aKey); |
|
63 |
|
64 IMPORT_C static TInt SymbianErrorCode(THCIErrorCode aErrorCode); |
|
65 |
|
66 private: |
|
67 void ConstructL(const TDesC& aComponentName); |
|
68 CHciUtil(); |
|
69 |
|
70 void GetFromFileL(const TDesC& aSection, const TDesC& aTag, TPtrC& aRetText); |
|
71 TUid FormatUidL(TPtrC& aDes); |
|
72 TUint FormatValueL(TPtrC& aDes); |
|
73 |
|
74 private: |
|
75 TBuf <KMaxHciUtilComponentName> iCompName; |
|
76 CIniFileData* iIniFile; |
|
77 }; |
|
78 |
|
79 #endif // HCIUTIL_H |