0
|
1 |
// Copyright (c) 2008-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 the License "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 |
// Hardware Configuration Respoitory Platform Independent Layer (PIL)
|
|
15 |
//
|
|
16 |
|
|
17 |
/**
|
|
18 |
@file hcr_pil.h
|
|
19 |
Kernel side definitions for the HCR Platform Indepent Layer.
|
|
20 |
|
|
21 |
@internalTechnology
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef HCR_PIL_H
|
|
25 |
#define HCR_PIL_H
|
|
26 |
|
|
27 |
|
|
28 |
// -- INCLUDES ----------------------------------------------------------------
|
|
29 |
|
|
30 |
|
|
31 |
#include <e32def.h>
|
|
32 |
#include <e32err.h>
|
|
33 |
|
|
34 |
#include "hcr_hai.h"
|
|
35 |
|
|
36 |
|
|
37 |
// -- CLASSES -----------------------------------------------------------------
|
|
38 |
|
|
39 |
namespace HCR
|
|
40 |
{
|
|
41 |
class TRepository;
|
|
42 |
|
|
43 |
|
|
44 |
//!< Mask for testing for word size settings
|
|
45 |
static const TInt KMaskWordTypes = 0x0000FFFF;
|
|
46 |
|
|
47 |
//!< Mask for testing for large settings
|
|
48 |
static const TInt KMaskLargeTypes = 0xFFFF0000;
|
|
49 |
|
|
50 |
|
|
51 |
/**
|
|
52 |
*/
|
|
53 |
class TSettingRef
|
|
54 |
{
|
|
55 |
public:
|
|
56 |
TSettingRef(TRepository* aRepos, SSettingBase* aSetting)
|
|
57 |
{ iRep = aRepos; iSet = aSetting; }
|
|
58 |
~TSettingRef()
|
|
59 |
{ }
|
|
60 |
|
|
61 |
public:
|
|
62 |
TRepository* iRep;
|
|
63 |
SSettingBase* iSet;
|
|
64 |
};
|
|
65 |
|
|
66 |
|
|
67 |
/**
|
|
68 |
*/
|
|
69 |
class HCRInternal
|
|
70 |
{
|
|
71 |
public:
|
|
72 |
HCRInternal();
|
|
73 |
HCRInternal(HCR::MVariant* aVar);
|
|
74 |
~HCRInternal();
|
|
75 |
|
|
76 |
TInt Initialise();
|
|
77 |
|
|
78 |
TInt FindSetting(const TSettingId& aId, TSettingType aType, TSettingRef& aSetting);
|
|
79 |
TInt FindWordSettings(TInt aNum, const TSettingId* aIds, TInt32* aValues,
|
|
80 |
TSettingType* aTypes, TInt* aErrors);
|
|
81 |
TInt CheckIntegrity();
|
|
82 |
|
|
83 |
enum States
|
|
84 |
{
|
|
85 |
EStatUndef = 0x00000000,
|
|
86 |
EStatNotReady = 0x00010000,
|
|
87 |
EStatConstructed = EStatNotReady + 0x0001,
|
|
88 |
EStatVariantInitialised = EStatNotReady + 0x0002,
|
|
89 |
EStatInitialised = EStatNotReady + 0x0004,
|
|
90 |
|
|
91 |
EStatReady = 0x00020000,
|
|
92 |
|
|
93 |
EStatFailed = 0x00800000,
|
|
94 |
|
|
95 |
EStatMajornMask = 0xFFFF0000,
|
|
96 |
EStatMinorMask = 0x0000FFFF
|
|
97 |
};
|
|
98 |
|
|
99 |
TUint32 GetStatus();
|
|
100 |
|
|
101 |
public: // For Test
|
|
102 |
enum TReposId
|
|
103 |
{
|
|
104 |
ECoreRepos = 1,
|
|
105 |
EOverrideRepos
|
|
106 |
};
|
|
107 |
|
|
108 |
/**
|
|
109 |
Based on the input parameter aId it switches the selected repository to the given
|
|
110 |
name. It is searching the new repository file in \sys\bin and \sys\Data respectively.
|
|
111 |
It keeps the original value of the repository if the file not found.
|
|
112 |
|
|
113 |
@param aFileName The zero terminated, c-style ASCII string of the new repository file without path.
|
|
114 |
If the name is an empty string (NULL) the it deletes the repository object
|
|
115 |
@param aId The internal repository identifier (see TReposId)
|
|
116 |
|
|
117 |
|
|
118 |
@return KErrNone if successful, the selected internal repository variables point to the new HCR
|
|
119 |
or the referenced repository object deleted.
|
|
120 |
KErrNotFound if the new repository file not found.
|
|
121 |
KErrNotSupported if repository identifier not supported
|
|
122 |
|
|
123 |
*/
|
|
124 |
TInt SwitchRepository(const TText * aFileName, const TReposId aId=ECoreRepos);
|
|
125 |
|
|
126 |
|
|
127 |
private:
|
|
128 |
/** Member holding the status of the HCR service */
|
|
129 |
TUint32 iStatus;
|
|
130 |
|
|
131 |
/** Handle on the variant code in the PSL component part */
|
|
132 |
HCR::MVariant* iVariant;
|
|
133 |
|
|
134 |
/** Compiled settings in the PSL code */
|
|
135 |
TRepository* iVariantStore;
|
|
136 |
|
|
137 |
/** File settings in the core ROM image */
|
|
138 |
TRepository* iCoreImgStore;
|
|
139 |
|
|
140 |
/** File settings shadowed in RAM from NAND */
|
|
141 |
TRepository* iOverrideStore;
|
|
142 |
|
|
143 |
friend class HCRInternalTestObserver;
|
|
144 |
|
|
145 |
};
|
|
146 |
|
|
147 |
|
|
148 |
/**
|
|
149 |
*/
|
|
150 |
class TRepository
|
|
151 |
{
|
|
152 |
public:
|
|
153 |
// Repository methods
|
|
154 |
virtual TInt Initialise ()=0;
|
|
155 |
virtual TInt CheckIntegrity ()=0;
|
|
156 |
virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting)=0;
|
|
157 |
|
|
158 |
// Setting accessor methods
|
|
159 |
virtual TBool IsWordValue(const TSettingRef& aRef);
|
|
160 |
virtual TBool IsLargeValue(const TSettingRef& aRef);
|
|
161 |
virtual void GetId(const TSettingRef& aRef, TCategoryUid& aCat, TElementId& aKey);
|
|
162 |
virtual void GetId(const TSettingRef& aRef, SSettingId& aId);
|
|
163 |
virtual TInt32 GetType(const TSettingRef& aRef);
|
|
164 |
virtual TUint16 GetLength(const TSettingRef& aRef);
|
|
165 |
|
|
166 |
virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue)=0;
|
|
167 |
virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue)=0;
|
|
168 |
};
|
|
169 |
|
|
170 |
|
|
171 |
/**
|
|
172 |
*/
|
|
173 |
class TRepositoryCompiled : public TRepository
|
|
174 |
{
|
|
175 |
public:
|
|
176 |
static TRepository* New(const SRepositoryCompiled* aRepos);
|
|
177 |
virtual ~TRepositoryCompiled();
|
|
178 |
|
|
179 |
virtual TInt Initialise();
|
|
180 |
virtual TInt CheckIntegrity();
|
|
181 |
virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
|
|
182 |
|
|
183 |
virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
|
|
184 |
virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
|
|
185 |
|
|
186 |
private:
|
|
187 |
TRepositoryCompiled(const SRepositoryCompiled* aRepos);
|
|
188 |
|
|
189 |
private:
|
|
190 |
const SRepositoryCompiled* iRepos;
|
|
191 |
};
|
|
192 |
|
|
193 |
/**
|
|
194 |
*/
|
|
195 |
class TRepositoryFile : public TRepository
|
|
196 |
{
|
|
197 |
public:
|
|
198 |
static TRepository* New(const SRepositoryFile* aRepos);
|
|
199 |
virtual ~TRepositoryFile();
|
|
200 |
|
|
201 |
virtual TInt Initialise();
|
|
202 |
virtual TInt CheckIntegrity();
|
|
203 |
virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
|
|
204 |
|
|
205 |
virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
|
|
206 |
virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
|
|
207 |
|
|
208 |
private:
|
|
209 |
TRepositoryFile(const SRepositoryFile* aRepos);
|
|
210 |
|
|
211 |
private:
|
|
212 |
const SRepositoryFile* iRepos;
|
|
213 |
};
|
|
214 |
|
|
215 |
|
|
216 |
} // namespace HCR
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
// -- GLOBALS -----------------------------------------------------------------
|
|
221 |
|
|
222 |
|
|
223 |
GLREF_C HCR::HCRInternal gHCR;
|
|
224 |
|
|
225 |
#define HCRSingleton (&gHCR)
|
|
226 |
|
|
227 |
#define HCRReady ((gHCR.GetStatus() & HCRInternal::EStatReady) == HCRInternal::EStatReady)
|
|
228 |
#define HCRNotReady ((gHCR.GetStatus() & HCRInternal::EStatReady) == 0)
|
|
229 |
|
|
230 |
|
|
231 |
|
|
232 |
#endif // HCR_PIL_H
|
|
233 |
|