1 // Copyright (c) 1998-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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__MSVREG_H__)
18 #if !defined(__E32BASE_H__)
21 #if !defined(__F32FILE_H__)
31 enum TMtsrDllIndex // Used in CMtmGroupData
33 EMtsrServerComponentIndex,
34 EMtsrClientComponentIndex,
35 EMtsrUiComponentIndex,
36 EMtsrUiDataComponentIndex
39 const TInt KHumanReadableNameLength=50;
40 typedef TBuf<KHumanReadableNameLength> THumanReadableName; // could be used client side
42 #define KMsvDefaultTimeoutMicroSeconds32 30000000
44 // forward declarations
50 class CMtmDllInfo : public CBase
51 /** Encapsulates the registration data for a single concrete MTM component.
53 It is used in the creation of registration data for an MTM group. Typically,
54 an application gathers a number of CMtmDllInfo objects into an CMtmDllInfoArray.
61 IMPORT_C static CMtmDllInfo* NewL(const TDesC& aHumanReadableName,const TUidType& aUidType,const TDesC& aFilename,TInt aEntryPointOrdinalNumber,const TVersion aVersion);
62 IMPORT_C static CMtmDllInfo* NewL(const CMtmDllInfo& aMtmDllInfo);
63 IMPORT_C static CMtmDllInfo* NewL(RReadStream& aStream);
64 IMPORT_C ~CMtmDllInfo();
65 IMPORT_C void SetHumanReadableNameL(const TDesC& aHumanReadableName);
66 inline TPtrC HumanReadableName() const;
67 IMPORT_C void InternalizeL(RReadStream& aStream);
68 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; // not used but as it is exported it has been kept
69 IMPORT_C TBool operator==(const CMtmDllInfo& aMtmDllInfo) const;
70 void SetMessagingCapability(TBool aCapability);
71 void SetSendBodyCapability(TBool aCapability);
72 void SetCapabilitiesAvailable(TBool aBool);
73 IMPORT_C TBool MessagingCapability() const;
74 IMPORT_C TBool SendBodyCapability() const;
75 IMPORT_C TBool CapabilitiesAvailable() const;
76 TPtrC FileName() const;
79 CMtmDllInfo(const TUidType& aUidType,TInt aEntryPointOrdinalNumber,const TVersion aVersion);
80 CMtmDllInfo(const CMtmDllInfo& aMtmDllInfo);
81 void ConstructL(const TDesC& aHumanReadableName, const TDesC& aFilename);
83 HBufC* iHumanReadableName; // Should be less than KHumanReadableNameLength
85 /** Group of UIDs for the MTM. See NewL() for details. */
86 TUidType iUidType; // Three uids
87 /** Ordinal of factory function for the MTM component */
88 TInt iEntryPointOrdinalNumber;
89 /** Version information for the MTM component */
92 /** Flag that indicates if the MTM can send messages */
93 TBool iMessagingCapability;
94 /** Flag that indicates if the MTM can handle body text */
95 TBool iSendBodyCapability;
96 /** Flag that indicates if settings have been made for the
97 MessagingCapability() and SendBodyCapability() flags */
98 TBool iCapabilitiesAvailable;
104 class CMtmDllInfoArray : public CArrayPtrFlat<CMtmDllInfo>
105 /** Collects the registration data for concrete MTM components, as encapsulated
106 in CMtmDllInfo objects, into an array.
108 Basic array functionality is provided by the base class CArrayPtrFlat<CMtmDllInfo>.
110 It is used in the creation of registration data for an MTM group: see CMtmGroupData.
117 IMPORT_C CMtmDllInfoArray();
118 IMPORT_C ~CMtmDllInfoArray();
119 IMPORT_C void AddMtmDllInfoL(CMtmDllInfo* aMtmDllInfo);
122 class TCapabilitySet;
124 class CMtmGroupData : public CBase
125 /** Encapsulates the registration data for an MTM group.
127 It is used to access and write the registration data file for an MTM group.
134 IMPORT_C static CMtmGroupData* NewL(TUid aMtmTypeUid, TUid aTechnologyTypeUid,CMtmDllInfoArray* aMtmDllInfoArray, const TCapabilitySet& aMtmRequiredCaps);
135 IMPORT_C static CMtmGroupData* NewL(const CMtmGroupData& aMtmGroupData);
136 IMPORT_C static CMtmGroupData* NewL(RReadStream& aStream);
137 IMPORT_C ~CMtmGroupData();
138 IMPORT_C void InternalizeL(RReadStream& aStream);
139 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; // not used but as it is exported it has been kept
140 inline TUid MtmTypeUid() const;
141 inline TUid TechnologyTypeUid() const;
142 IMPORT_C const CMtmDllInfoArray& MtmDllInfoArray() const;
143 IMPORT_C const TCapabilitySet& GetMtmRequiredCapabilities() const;
144 IMPORT_C TBool operator==(const CMtmGroupData& aMtmGroupData) const;
146 CMtmGroupData(TUid aMtmTypeUid, TUid aTechnologyTypeUid, CMtmDllInfoArray* aMtmDllInfoArray, const TCapabilitySet& aMtmRequiredCaps);
147 void ConstructL(const CMtmGroupData& aMtmGroupData);
149 void AppendMtmDllInfoArrayL(const CMtmDllInfoArray& aMtmDllInfoArray);
150 CMtmDllInfoArray& MtmDllInfoArrayPrivate();
151 CMtmGroupData(TUid aMtmTypeUid=KNullUid,TUid aTechnologyTypeUid=KNullUid);
152 void AppendMtmDllInfoL(CMtmDllInfo* aMtmDllInfo); // Leaves if second uid wrong
155 TUid iTechnologyTypeUid;
156 CMtmDllInfoArray* iMtmDllInfoArray;
157 TCapabilitySet iMtmRequiredCaps;
161 class MRegisteredMtmDllObserver
168 virtual TInt UseMtmGroup(TUid aMtmTypeUid)=0;
169 virtual TInt ReleaseMtmGroup(TUid aMtmTypeUid)=0;
173 // Real non-derivable class
175 class CRegisteredMtmDll : public CTimer
176 /** Allows an MTM object to access registry information about itself.
183 IMPORT_C static CRegisteredMtmDll* NewL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
184 IMPORT_C ~CRegisteredMtmDll();
186 inline TUid MtmTypeUid() const;
187 inline TUid TechnologyTypeUid() const;
188 inline const CMtmDllInfo& MtmDllInfo() const;
190 inline TInt MtmDllRefCount() const;
192 IMPORT_C TInt GetLibrary(RFs& aFs,RLibrary& aMtmDllLibrary); // Increments reference count if successful or returns error
193 IMPORT_C void ReleaseLibrary(); // Decrements access count
194 // Should be called from destructor of any objects created from the library
196 CRegisteredMtmDll(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
197 void ConstructL(const CMtmDllInfo& aMtmDllInfo);
198 void LoadLibraryL(RFs& aFs);
204 TUid iTechnologyTypeUid;
205 CMtmDllInfo* iMtmDllInfo;
206 RLibrary iMtmDllLibrary;
207 TInt iMtmDllRefCount;
208 TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
209 MRegisteredMtmDllObserver& iRegisteredMtmDllObserver;
214 class CRegisteredMtmDllArray : public CArrayPtrFlat<CRegisteredMtmDll>
221 IMPORT_C CRegisteredMtmDllArray();
222 IMPORT_C ~CRegisteredMtmDllArray();
223 IMPORT_C void AddRegisteredMtmDllL(CRegisteredMtmDll* aRegisteredMtmDll);
228 class CMtmDllRegistry : public CBase
229 /** Accesses the various MTM component registries.
231 The derived classes used by
232 clients are CClientMtmRegistry, CMtmUiDataRegistry, and CMtmUiRegistry. It
233 provides functions to discover the MTMs registered in such a registry. The
234 registered MTMs can be regarded as existing in a list: you can use NumRegisteredMtmDlls()
235 to get the number in the list, and MtmTypeUid() to index into it.
242 IMPORT_C ~CMtmDllRegistry();
244 inline TInt NumRegisteredMtmDlls() const;
245 IMPORT_C TUid MtmTypeUid(TInt anIndex) const;
247 inline TBool IsPresent(TUid aMtmTypeUid) const;
248 IMPORT_C TUid TechnologyTypeUid(TUid aMtmTypeUid) const;
249 IMPORT_C const CMtmDllInfo& RegisteredMtmDllInfo(TUid aMtmTypeUid) const;
250 IMPORT_C TBool IsInUse(TUid aMtmTypeUid) const; // returns true if specified DLL in use
251 IMPORT_C TBool IsInUse() const; // returns true if any DLL in use
254 IMPORT_C CMtmDllRegistry(RFs& aFs,TUid aMtmDllTypeUid,TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32=KMsvDefaultTimeoutMicroSeconds32);
256 IMPORT_C TInt MtmTypeUidToIndex(TUid anMtmTypeUid) const;
258 IMPORT_C TInt AddRegisteredMtmDll(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver); // returns error
259 IMPORT_C void RemoveRegisteredMtmDll(TUid aMtmTypeUid);
260 IMPORT_C void RemoveAllRegisteredMtmDlls();
263 void DoAddRegisteredMtmDllL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver); // returns error
267 TUid iMtmDllTypeUid; // Second Uid in all Dlls
268 CRegisteredMtmDllArray iRegisteredMtmDllArray; // Inline CArray, OK because no NewL();
269 TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
273 #include <msvreg.inl>