|
1 /* |
|
2 * Copyright (c) 2008-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: Haptics uid header file. |
|
15 * This class is designed to parse the associated text file |
|
16 * and determine allowed UIDs for requesting license key. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef C_HWRMHAPTICSUID_H |
|
22 #define C_HWRMHAPTICSUID_H |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 class RFs; |
|
27 |
|
28 |
|
29 /** |
|
30 * This class is contains information is license auto set allowed |
|
31 * for one specific UID (VID or SID) |
|
32 * |
|
33 * @since S60 5.1 |
|
34 */ |
|
35 class TUidItem |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * C++ constructor. |
|
40 */ |
|
41 TUidItem( const TDesC8& aUidType, TUid aUid, TBool aAllowed ); |
|
42 |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Uid type, "VID" / "SID" |
|
47 */ |
|
48 TBuf8<3> iUidType; |
|
49 |
|
50 /** |
|
51 * Secure id / Vendor id. |
|
52 */ |
|
53 TUid iUid; |
|
54 |
|
55 /** |
|
56 * Is license auto set allowed. |
|
57 */ |
|
58 TBool iAllowed; |
|
59 }; |
|
60 |
|
61 |
|
62 /** |
|
63 * This class is intended to parse the associated UID text file and |
|
64 * provide an API to check is license auto set allowed VID/SID |
|
65 * combination specified. |
|
66 * |
|
67 * @since S60 5.1 |
|
68 */ |
|
69 class CHWRMHapticsUid : public CBase |
|
70 { |
|
71 public: |
|
72 |
|
73 /** |
|
74 * Two-phased constructor. |
|
75 * |
|
76 * @param aFilename Filename of UID file, which should not |
|
77 * include the path as the file is stored in |
|
78 * the private directory. |
|
79 */ |
|
80 static CHWRMHapticsUid* NewL( const TDesC& aFilename ); |
|
81 |
|
82 /** |
|
83 * Two-phased constructor. |
|
84 * Leaves instance on the cleanup stack. |
|
85 * |
|
86 * @param aFilename Filename of UID file, which should not |
|
87 * include the path as the file is stored in |
|
88 * the private directory. |
|
89 */ |
|
90 static CHWRMHapticsUid* NewLC( const TDesC& aFilename ); |
|
91 |
|
92 /** |
|
93 * Destructor. |
|
94 */ |
|
95 virtual ~CHWRMHapticsUid(); |
|
96 |
|
97 public: |
|
98 |
|
99 /** |
|
100 * Checks if automated license setting is allowed for VID/SID combination |
|
101 * found from aMessage. |
|
102 * |
|
103 * @param aMessage Message which VID and SID are checked against |
|
104 * the values retrieved from file. |
|
105 * @return ETrue or EFalse depending is automated license setting allowed. |
|
106 */ |
|
107 TBool LicenseAutoSetAllowed( const RMessage2& aMessage ); |
|
108 |
|
109 private: |
|
110 |
|
111 /** |
|
112 * C++ constructor. |
|
113 */ |
|
114 CHWRMHapticsUid(); |
|
115 |
|
116 /** |
|
117 * By default Symbian 2nd phase constructor is private. |
|
118 * |
|
119 * @param aFilename Filename of UID file, which should not |
|
120 * include the path as the file is stored in |
|
121 * the private directory. |
|
122 */ |
|
123 void ConstructL( const TDesC& aFilename ); |
|
124 |
|
125 /** |
|
126 * Method constructs the array of UIDs from the |
|
127 * given stream (usually an RFileReadStream) |
|
128 * |
|
129 * @param aFs File server session |
|
130 * @param aFilename Filename to read |
|
131 */ |
|
132 void ParseUidFileL( RFs& aFs, const TDesC& aFilename ); |
|
133 |
|
134 /** |
|
135 * Helper method to convert and validate UID from a descriptor. |
|
136 * |
|
137 * @param aUidDes The Uid to be converted |
|
138 * @param aUid Reference that will contain the UID |
|
139 * @return KErrNone if successful, KErrCorrupt if invalid |
|
140 */ |
|
141 TInt ConvertId( const TDesC8& aUidDes, TUid& aUid ) const; |
|
142 |
|
143 private: |
|
144 |
|
145 /** |
|
146 * Array of UIDs from the UID file. |
|
147 */ |
|
148 RArray<TUidItem> iUidArray; |
|
149 |
|
150 /** |
|
151 * Index pointer to iUidArray. |
|
152 */ |
|
153 TInt iNextUidIndex; |
|
154 }; |
|
155 |
|
156 #endif // C_HWRMHAPTICSUID_H |
|
157 |
|
158 // End of File |