williamr@2
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#if !defined(__MSVREG_H__)
|
williamr@2
|
17 |
#define __MSVREG_H__
|
williamr@2
|
18 |
#if !defined(__E32BASE_H__)
|
williamr@2
|
19 |
#include <e32base.h>
|
williamr@2
|
20 |
#endif
|
williamr@2
|
21 |
#if !defined(__F32FILE_H__)
|
williamr@2
|
22 |
#include <f32file.h>
|
williamr@2
|
23 |
#endif
|
williamr@2
|
24 |
|
williamr@2
|
25 |
|
williamr@2
|
26 |
|
williamr@2
|
27 |
/**
|
williamr@2
|
28 |
@internalComponent
|
williamr@2
|
29 |
@released
|
williamr@2
|
30 |
*/
|
williamr@2
|
31 |
enum TMtsrDllIndex // Used in CMtmGroupData
|
williamr@2
|
32 |
{
|
williamr@2
|
33 |
EMtsrServerComponentIndex,
|
williamr@2
|
34 |
EMtsrClientComponentIndex,
|
williamr@2
|
35 |
EMtsrUiComponentIndex,
|
williamr@2
|
36 |
EMtsrUiDataComponentIndex
|
williamr@2
|
37 |
};
|
williamr@2
|
38 |
|
williamr@2
|
39 |
const TInt KHumanReadableNameLength=50;
|
williamr@2
|
40 |
typedef TBuf<KHumanReadableNameLength> THumanReadableName; // could be used client side
|
williamr@2
|
41 |
|
williamr@2
|
42 |
#define KMsvDefaultTimeoutMicroSeconds32 30000000
|
williamr@2
|
43 |
|
williamr@2
|
44 |
// forward declarations
|
williamr@2
|
45 |
class RWriteStream;
|
williamr@2
|
46 |
class RReadStream;
|
williamr@2
|
47 |
class RFs;
|
williamr@2
|
48 |
|
williamr@2
|
49 |
|
williamr@2
|
50 |
class CMtmDllInfo : public CBase
|
williamr@2
|
51 |
/** Encapsulates the registration data for a single concrete MTM component.
|
williamr@2
|
52 |
|
williamr@2
|
53 |
It is used in the creation of registration data for an MTM group. Typically,
|
williamr@2
|
54 |
an application gathers a number of CMtmDllInfo objects into an CMtmDllInfoArray.
|
williamr@2
|
55 |
|
williamr@2
|
56 |
@publishedAll
|
williamr@2
|
57 |
@released
|
williamr@2
|
58 |
*/
|
williamr@2
|
59 |
{
|
williamr@2
|
60 |
public:
|
williamr@2
|
61 |
IMPORT_C static CMtmDllInfo* NewL(const TDesC& aHumanReadableName,const TUidType& aUidType,const TDesC& aFilename,TInt aEntryPointOrdinalNumber,const TVersion aVersion);
|
williamr@2
|
62 |
IMPORT_C static CMtmDllInfo* NewL(const CMtmDllInfo& aMtmDllInfo);
|
williamr@2
|
63 |
IMPORT_C static CMtmDllInfo* NewL(RReadStream& aStream);
|
williamr@2
|
64 |
IMPORT_C ~CMtmDllInfo();
|
williamr@2
|
65 |
IMPORT_C void SetHumanReadableNameL(const TDesC& aHumanReadableName);
|
williamr@2
|
66 |
inline TPtrC HumanReadableName() const;
|
williamr@2
|
67 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
williamr@2
|
68 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const; // not used but as it is exported it has been kept
|
williamr@2
|
69 |
IMPORT_C TBool operator==(const CMtmDllInfo& aMtmDllInfo) const;
|
williamr@2
|
70 |
void SetMessagingCapability(TBool aCapability);
|
williamr@2
|
71 |
void SetSendBodyCapability(TBool aCapability);
|
williamr@2
|
72 |
void SetCapabilitiesAvailable(TBool aBool);
|
williamr@2
|
73 |
IMPORT_C TBool MessagingCapability() const;
|
williamr@2
|
74 |
IMPORT_C TBool SendBodyCapability() const;
|
williamr@2
|
75 |
IMPORT_C TBool CapabilitiesAvailable() const;
|
williamr@2
|
76 |
TPtrC FileName() const;
|
williamr@2
|
77 |
private:
|
williamr@2
|
78 |
CMtmDllInfo();
|
williamr@2
|
79 |
CMtmDllInfo(const TUidType& aUidType,TInt aEntryPointOrdinalNumber,const TVersion aVersion);
|
williamr@2
|
80 |
CMtmDllInfo(const CMtmDllInfo& aMtmDllInfo);
|
williamr@2
|
81 |
void ConstructL(const TDesC& aHumanReadableName, const TDesC& aFilename);
|
williamr@2
|
82 |
private:
|
williamr@2
|
83 |
HBufC* iHumanReadableName; // Should be less than KHumanReadableNameLength
|
williamr@2
|
84 |
public:
|
williamr@2
|
85 |
/** Group of UIDs for the MTM. See NewL() for details. */
|
williamr@2
|
86 |
TUidType iUidType; // Three uids
|
williamr@2
|
87 |
/** Ordinal of factory function for the MTM component */
|
williamr@2
|
88 |
TInt iEntryPointOrdinalNumber;
|
williamr@2
|
89 |
/** Version information for the MTM component */
|
williamr@2
|
90 |
TVersion iVersion;
|
williamr@2
|
91 |
|
williamr@2
|
92 |
/** Flag that indicates if the MTM can send messages */
|
williamr@2
|
93 |
TBool iMessagingCapability;
|
williamr@2
|
94 |
/** Flag that indicates if the MTM can handle body text */
|
williamr@2
|
95 |
TBool iSendBodyCapability;
|
williamr@2
|
96 |
/** Flag that indicates if settings have been made for the
|
williamr@2
|
97 |
MessagingCapability() and SendBodyCapability() flags */
|
williamr@2
|
98 |
TBool iCapabilitiesAvailable;
|
williamr@2
|
99 |
private:
|
williamr@2
|
100 |
HBufC* iFilename;
|
williamr@2
|
101 |
};
|
williamr@2
|
102 |
|
williamr@2
|
103 |
|
williamr@2
|
104 |
class CMtmDllInfoArray : public CArrayPtrFlat<CMtmDllInfo>
|
williamr@2
|
105 |
/** Collects the registration data for concrete MTM components, as encapsulated
|
williamr@2
|
106 |
in CMtmDllInfo objects, into an array.
|
williamr@2
|
107 |
|
williamr@2
|
108 |
Basic array functionality is provided by the base class CArrayPtrFlat<CMtmDllInfo>.
|
williamr@2
|
109 |
|
williamr@2
|
110 |
It is used in the creation of registration data for an MTM group: see CMtmGroupData.
|
williamr@2
|
111 |
|
williamr@2
|
112 |
@publishedAll
|
williamr@2
|
113 |
@released
|
williamr@2
|
114 |
*/
|
williamr@2
|
115 |
{
|
williamr@2
|
116 |
public:
|
williamr@2
|
117 |
IMPORT_C CMtmDllInfoArray();
|
williamr@2
|
118 |
IMPORT_C ~CMtmDllInfoArray();
|
williamr@2
|
119 |
IMPORT_C void AddMtmDllInfoL(CMtmDllInfo* aMtmDllInfo);
|
williamr@2
|
120 |
};
|
williamr@2
|
121 |
|
williamr@2
|
122 |
class TCapabilitySet;
|
williamr@2
|
123 |
|
williamr@2
|
124 |
class CMtmGroupData : public CBase
|
williamr@2
|
125 |
/** Encapsulates the registration data for an MTM group.
|
williamr@2
|
126 |
|
williamr@2
|
127 |
It is used to access and write the registration data file for an MTM group.
|
williamr@2
|
128 |
|
williamr@2
|
129 |
@publishedAll
|
williamr@2
|
130 |
@released
|
williamr@2
|
131 |
*/
|
williamr@2
|
132 |
{
|
williamr@2
|
133 |
public:
|
williamr@2
|
134 |
IMPORT_C static CMtmGroupData* NewL(TUid aMtmTypeUid, TUid aTechnologyTypeUid,CMtmDllInfoArray* aMtmDllInfoArray, const TCapabilitySet& aMtmRequiredCaps);
|
williamr@2
|
135 |
IMPORT_C static CMtmGroupData* NewL(const CMtmGroupData& aMtmGroupData);
|
williamr@2
|
136 |
IMPORT_C static CMtmGroupData* NewL(RReadStream& aStream);
|
williamr@2
|
137 |
IMPORT_C ~CMtmGroupData();
|
williamr@2
|
138 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
williamr@2
|
139 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const; // not used but as it is exported it has been kept
|
williamr@2
|
140 |
inline TUid MtmTypeUid() const;
|
williamr@2
|
141 |
inline TUid TechnologyTypeUid() const;
|
williamr@2
|
142 |
IMPORT_C const CMtmDllInfoArray& MtmDllInfoArray() const;
|
williamr@2
|
143 |
IMPORT_C const TCapabilitySet& GetMtmRequiredCapabilities() const;
|
williamr@2
|
144 |
IMPORT_C TBool operator==(const CMtmGroupData& aMtmGroupData) const;
|
williamr@2
|
145 |
private:
|
williamr@2
|
146 |
CMtmGroupData(TUid aMtmTypeUid, TUid aTechnologyTypeUid, CMtmDllInfoArray* aMtmDllInfoArray, const TCapabilitySet& aMtmRequiredCaps);
|
williamr@2
|
147 |
void ConstructL(const CMtmGroupData& aMtmGroupData);
|
williamr@2
|
148 |
void ConstructL();
|
williamr@2
|
149 |
void AppendMtmDllInfoArrayL(const CMtmDllInfoArray& aMtmDllInfoArray);
|
williamr@2
|
150 |
CMtmDllInfoArray& MtmDllInfoArrayPrivate();
|
williamr@2
|
151 |
CMtmGroupData(TUid aMtmTypeUid=KNullUid,TUid aTechnologyTypeUid=KNullUid);
|
williamr@2
|
152 |
void AppendMtmDllInfoL(CMtmDllInfo* aMtmDllInfo); // Leaves if second uid wrong
|
williamr@2
|
153 |
private:
|
williamr@2
|
154 |
TUid iMtmTypeUid;
|
williamr@2
|
155 |
TUid iTechnologyTypeUid;
|
williamr@2
|
156 |
CMtmDllInfoArray* iMtmDllInfoArray;
|
williamr@2
|
157 |
TCapabilitySet iMtmRequiredCaps;
|
williamr@2
|
158 |
};
|
williamr@2
|
159 |
|
williamr@2
|
160 |
|
williamr@2
|
161 |
class MRegisteredMtmDllObserver
|
williamr@2
|
162 |
/**
|
williamr@2
|
163 |
@internalComponent
|
williamr@2
|
164 |
@released
|
williamr@2
|
165 |
*/
|
williamr@2
|
166 |
{
|
williamr@2
|
167 |
public:
|
williamr@2
|
168 |
virtual TInt UseMtmGroup(TUid aMtmTypeUid)=0;
|
williamr@2
|
169 |
virtual TInt ReleaseMtmGroup(TUid aMtmTypeUid)=0;
|
williamr@2
|
170 |
};
|
williamr@2
|
171 |
|
williamr@2
|
172 |
|
williamr@2
|
173 |
// Real non-derivable class
|
williamr@2
|
174 |
|
williamr@2
|
175 |
class CRegisteredMtmDll : public CTimer
|
williamr@2
|
176 |
/** Allows an MTM object to access registry information about itself.
|
williamr@2
|
177 |
|
williamr@2
|
178 |
@publishedAll
|
williamr@2
|
179 |
@released
|
williamr@2
|
180 |
*/
|
williamr@2
|
181 |
{
|
williamr@2
|
182 |
public:
|
williamr@2
|
183 |
IMPORT_C static CRegisteredMtmDll* NewL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
|
williamr@2
|
184 |
IMPORT_C ~CRegisteredMtmDll();
|
williamr@2
|
185 |
|
williamr@2
|
186 |
inline TUid MtmTypeUid() const;
|
williamr@2
|
187 |
inline TUid TechnologyTypeUid() const;
|
williamr@2
|
188 |
inline const CMtmDllInfo& MtmDllInfo() const;
|
williamr@2
|
189 |
|
williamr@2
|
190 |
inline TInt MtmDllRefCount() const;
|
williamr@2
|
191 |
|
williamr@2
|
192 |
IMPORT_C TInt GetLibrary(RFs& aFs,RLibrary& aMtmDllLibrary); // Increments reference count if successful or returns error
|
williamr@2
|
193 |
IMPORT_C void ReleaseLibrary(); // Decrements access count
|
williamr@2
|
194 |
// Should be called from destructor of any objects created from the library
|
williamr@2
|
195 |
private:
|
williamr@2
|
196 |
CRegisteredMtmDll(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
|
williamr@2
|
197 |
void ConstructL(const CMtmDllInfo& aMtmDllInfo);
|
williamr@2
|
198 |
void LoadLibraryL(RFs& aFs);
|
williamr@2
|
199 |
|
williamr@2
|
200 |
void RunL();
|
williamr@2
|
201 |
|
williamr@2
|
202 |
private:
|
williamr@2
|
203 |
TUid iMtmTypeUid;
|
williamr@2
|
204 |
TUid iTechnologyTypeUid;
|
williamr@2
|
205 |
CMtmDllInfo* iMtmDllInfo;
|
williamr@2
|
206 |
RLibrary iMtmDllLibrary;
|
williamr@2
|
207 |
TInt iMtmDllRefCount;
|
williamr@2
|
208 |
TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
|
williamr@2
|
209 |
MRegisteredMtmDllObserver& iRegisteredMtmDllObserver;
|
williamr@2
|
210 |
};
|
williamr@2
|
211 |
|
williamr@2
|
212 |
|
williamr@2
|
213 |
|
williamr@2
|
214 |
class CRegisteredMtmDllArray : public CArrayPtrFlat<CRegisteredMtmDll>
|
williamr@2
|
215 |
/**
|
williamr@2
|
216 |
@internalComponent
|
williamr@2
|
217 |
@released
|
williamr@2
|
218 |
*/
|
williamr@2
|
219 |
{
|
williamr@2
|
220 |
public:
|
williamr@2
|
221 |
IMPORT_C CRegisteredMtmDllArray();
|
williamr@2
|
222 |
IMPORT_C ~CRegisteredMtmDllArray();
|
williamr@2
|
223 |
IMPORT_C void AddRegisteredMtmDllL(CRegisteredMtmDll* aRegisteredMtmDll);
|
williamr@2
|
224 |
};
|
williamr@2
|
225 |
|
williamr@2
|
226 |
// Base class
|
williamr@2
|
227 |
|
williamr@2
|
228 |
class CMtmDllRegistry : public CBase
|
williamr@2
|
229 |
/** Accesses the various MTM component registries.
|
williamr@2
|
230 |
|
williamr@2
|
231 |
The derived classes used by
|
williamr@2
|
232 |
clients are CClientMtmRegistry, CMtmUiDataRegistry, and CMtmUiRegistry. It
|
williamr@2
|
233 |
provides functions to discover the MTMs registered in such a registry. The
|
williamr@2
|
234 |
registered MTMs can be regarded as existing in a list: you can use NumRegisteredMtmDlls()
|
williamr@2
|
235 |
to get the number in the list, and MtmTypeUid() to index into it.
|
williamr@2
|
236 |
|
williamr@2
|
237 |
@internalComponent
|
williamr@2
|
238 |
@released
|
williamr@2
|
239 |
*/
|
williamr@2
|
240 |
{
|
williamr@2
|
241 |
public:
|
williamr@2
|
242 |
IMPORT_C ~CMtmDllRegistry();
|
williamr@2
|
243 |
|
williamr@2
|
244 |
inline TInt NumRegisteredMtmDlls() const;
|
williamr@2
|
245 |
IMPORT_C TUid MtmTypeUid(TInt anIndex) const;
|
williamr@2
|
246 |
|
williamr@2
|
247 |
inline TBool IsPresent(TUid aMtmTypeUid) const;
|
williamr@2
|
248 |
IMPORT_C TUid TechnologyTypeUid(TUid aMtmTypeUid) const;
|
williamr@2
|
249 |
IMPORT_C const CMtmDllInfo& RegisteredMtmDllInfo(TUid aMtmTypeUid) const;
|
williamr@2
|
250 |
IMPORT_C TBool IsInUse(TUid aMtmTypeUid) const; // returns true if specified DLL in use
|
williamr@2
|
251 |
IMPORT_C TBool IsInUse() const; // returns true if any DLL in use
|
williamr@2
|
252 |
|
williamr@2
|
253 |
protected:
|
williamr@2
|
254 |
IMPORT_C CMtmDllRegistry(RFs& aFs,TUid aMtmDllTypeUid,TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32=KMsvDefaultTimeoutMicroSeconds32);
|
williamr@2
|
255 |
|
williamr@2
|
256 |
IMPORT_C TInt MtmTypeUidToIndex(TUid anMtmTypeUid) const;
|
williamr@2
|
257 |
|
williamr@2
|
258 |
IMPORT_C TInt AddRegisteredMtmDll(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver); // returns error
|
williamr@2
|
259 |
IMPORT_C void RemoveRegisteredMtmDll(TUid aMtmTypeUid);
|
williamr@2
|
260 |
IMPORT_C void RemoveAllRegisteredMtmDlls();
|
williamr@2
|
261 |
|
williamr@2
|
262 |
private:
|
williamr@2
|
263 |
void DoAddRegisteredMtmDllL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver); // returns error
|
williamr@2
|
264 |
|
williamr@2
|
265 |
protected:
|
williamr@2
|
266 |
RFs& iFs;
|
williamr@2
|
267 |
TUid iMtmDllTypeUid; // Second Uid in all Dlls
|
williamr@2
|
268 |
CRegisteredMtmDllArray iRegisteredMtmDllArray; // Inline CArray, OK because no NewL();
|
williamr@2
|
269 |
TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
|
williamr@2
|
270 |
};
|
williamr@2
|
271 |
|
williamr@2
|
272 |
|
williamr@2
|
273 |
#include <msvreg.inl>
|
williamr@2
|
274 |
|
williamr@2
|
275 |
#endif
|