epoc32/include/msvreg.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/msvreg.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/msvreg.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,275 @@
     1.4 -msvreg.h
     1.5 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#if !defined(__MSVREG_H__)
    1.21 +#define __MSVREG_H__
    1.22 +#if !defined(__E32BASE_H__)
    1.23 +#include <e32base.h>
    1.24 +#endif
    1.25 +#if !defined(__F32FILE_H__)
    1.26 +#include <f32file.h>
    1.27 +#endif
    1.28 +
    1.29 +
    1.30 +
    1.31 +/**
    1.32 +@internalComponent
    1.33 +@released
    1.34 +*/
    1.35 +enum TMtsrDllIndex    //  Used in CMtmGroupData
    1.36 +	{
    1.37 +	EMtsrServerComponentIndex,
    1.38 +	EMtsrClientComponentIndex,
    1.39 +	EMtsrUiComponentIndex,
    1.40 +	EMtsrUiDataComponentIndex
    1.41 +	};
    1.42 +
    1.43 +const TInt KHumanReadableNameLength=50;
    1.44 +typedef TBuf<KHumanReadableNameLength> THumanReadableName;   //  could be used client side
    1.45 +
    1.46 +#define KMsvDefaultTimeoutMicroSeconds32 30000000
    1.47 +
    1.48 +// forward declarations
    1.49 +class RWriteStream;
    1.50 +class RReadStream;
    1.51 +class RFs;
    1.52 +
    1.53 +
    1.54 +class CMtmDllInfo : public CBase
    1.55 +/** Encapsulates the registration data for a single concrete MTM component. 
    1.56 +
    1.57 +It is used in the creation of registration data for an MTM group. Typically, 
    1.58 +an application gathers a number of CMtmDllInfo objects into an CMtmDllInfoArray. 
    1.59 + 
    1.60 +@publishedAll
    1.61 +@released
    1.62 +*/
    1.63 +	{
    1.64 +public:
    1.65 +	IMPORT_C static CMtmDllInfo* NewL(const TDesC& aHumanReadableName,const TUidType& aUidType,const TDesC& aFilename,TInt aEntryPointOrdinalNumber,const TVersion aVersion);
    1.66 +	IMPORT_C static CMtmDllInfo* NewL(const CMtmDllInfo& aMtmDllInfo);
    1.67 +	IMPORT_C static CMtmDllInfo* NewL(RReadStream& aStream);
    1.68 +	IMPORT_C ~CMtmDllInfo();
    1.69 +	IMPORT_C void SetHumanReadableNameL(const TDesC& aHumanReadableName);
    1.70 +	inline TPtrC HumanReadableName() const;
    1.71 +	IMPORT_C void InternalizeL(RReadStream& aStream);
    1.72 +	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;  // not used but as it is exported it has been kept
    1.73 +	IMPORT_C TBool operator==(const CMtmDllInfo& aMtmDllInfo) const; 
    1.74 +	void SetMessagingCapability(TBool aCapability);
    1.75 +	void SetSendBodyCapability(TBool aCapability);
    1.76 +	void SetCapabilitiesAvailable(TBool aBool);
    1.77 +	IMPORT_C TBool MessagingCapability() const;
    1.78 +	IMPORT_C TBool SendBodyCapability() const;
    1.79 +	IMPORT_C TBool CapabilitiesAvailable() const;
    1.80 +	TPtrC FileName() const;
    1.81 +private:
    1.82 +	CMtmDllInfo();
    1.83 +	CMtmDllInfo(const TUidType& aUidType,TInt aEntryPointOrdinalNumber,const TVersion aVersion);
    1.84 +	CMtmDllInfo(const CMtmDllInfo& aMtmDllInfo);
    1.85 +	void ConstructL(const TDesC& aHumanReadableName, const TDesC& aFilename);
    1.86 +private:
    1.87 +	HBufC* iHumanReadableName;         //  Should be less than KHumanReadableNameLength
    1.88 +public:
    1.89 +	/** Group of UIDs for the MTM. See NewL() for details. */
    1.90 +	TUidType iUidType;                 //  Three uids
    1.91 +	/** Ordinal of factory function for the MTM component */
    1.92 +	TInt iEntryPointOrdinalNumber;
    1.93 +	/** Version information for the MTM component */
    1.94 +	TVersion iVersion;
    1.95 +
    1.96 +	/** Flag that indicates if the MTM can send messages */
    1.97 +	TBool iMessagingCapability;
    1.98 +	/** Flag that indicates if the MTM can handle body text */
    1.99 +	TBool iSendBodyCapability;
   1.100 +	/** Flag that indicates if settings have been made for the 
   1.101 +	MessagingCapability() and SendBodyCapability() flags */	
   1.102 +	TBool iCapabilitiesAvailable;
   1.103 +private:
   1.104 +	HBufC* iFilename;
   1.105 +	};
   1.106 +
   1.107 +
   1.108 +class CMtmDllInfoArray : public CArrayPtrFlat<CMtmDllInfo>
   1.109 +/** Collects the registration data for concrete MTM components, as encapsulated 
   1.110 +in CMtmDllInfo objects, into an array.
   1.111 +
   1.112 +Basic array functionality is provided by the base class CArrayPtrFlat<CMtmDllInfo>.
   1.113 +
   1.114 +It is used in the creation of registration data for an MTM group: see CMtmGroupData. 
   1.115 +
   1.116 +@publishedAll
   1.117 +@released
   1.118 +*/
   1.119 +	{
   1.120 +public:
   1.121 +	IMPORT_C CMtmDllInfoArray();
   1.122 +	IMPORT_C ~CMtmDllInfoArray();
   1.123 +	IMPORT_C void AddMtmDllInfoL(CMtmDllInfo* aMtmDllInfo);
   1.124 +	};
   1.125 +
   1.126 +class TCapabilitySet;
   1.127 +
   1.128 +class CMtmGroupData : public CBase
   1.129 +/** Encapsulates the registration data for an MTM group. 
   1.130 +
   1.131 +It is used to access and write the registration data file for an MTM group.
   1.132 + 
   1.133 +@publishedAll
   1.134 +@released
   1.135 +*/
   1.136 +	{
   1.137 +public:
   1.138 +	IMPORT_C static CMtmGroupData* NewL(TUid aMtmTypeUid, TUid aTechnologyTypeUid,CMtmDllInfoArray* aMtmDllInfoArray, const TCapabilitySet& aMtmRequiredCaps);
   1.139 +	IMPORT_C static CMtmGroupData* NewL(const CMtmGroupData& aMtmGroupData);
   1.140 +	IMPORT_C static CMtmGroupData* NewL(RReadStream& aStream);
   1.141 +	IMPORT_C ~CMtmGroupData();
   1.142 +	IMPORT_C void InternalizeL(RReadStream& aStream);
   1.143 +	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;  // not used but as it is exported it has been kept
   1.144 +	inline TUid MtmTypeUid() const;
   1.145 +	inline TUid TechnologyTypeUid() const;
   1.146 +	IMPORT_C const CMtmDllInfoArray& MtmDllInfoArray() const;
   1.147 +	IMPORT_C const TCapabilitySet& GetMtmRequiredCapabilities() const;
   1.148 +	IMPORT_C TBool operator==(const CMtmGroupData& aMtmGroupData) const;
   1.149 +private:
   1.150 +	CMtmGroupData(TUid aMtmTypeUid, TUid aTechnologyTypeUid, CMtmDllInfoArray* aMtmDllInfoArray, const TCapabilitySet& aMtmRequiredCaps);
   1.151 +	void ConstructL(const CMtmGroupData& aMtmGroupData);
   1.152 +	void ConstructL();
   1.153 +	void AppendMtmDllInfoArrayL(const CMtmDllInfoArray& aMtmDllInfoArray);
   1.154 +	CMtmDllInfoArray& MtmDllInfoArrayPrivate();
   1.155 +	CMtmGroupData(TUid aMtmTypeUid=KNullUid,TUid aTechnologyTypeUid=KNullUid);
   1.156 +	void AppendMtmDllInfoL(CMtmDllInfo* aMtmDllInfo);  // Leaves if second uid wrong
   1.157 +private:
   1.158 +	TUid iMtmTypeUid;
   1.159 +	TUid iTechnologyTypeUid;
   1.160 +	CMtmDllInfoArray* iMtmDllInfoArray;
   1.161 +	TCapabilitySet iMtmRequiredCaps;
   1.162 +	};
   1.163 +
   1.164 +
   1.165 +class MRegisteredMtmDllObserver
   1.166 +/** 
   1.167 +@internalComponent
   1.168 +@released
   1.169 +*/
   1.170 +	{
   1.171 +public:
   1.172 +	virtual TInt UseMtmGroup(TUid aMtmTypeUid)=0;
   1.173 +	virtual TInt ReleaseMtmGroup(TUid aMtmTypeUid)=0;
   1.174 +	};
   1.175 +
   1.176 +
   1.177 +//  Real non-derivable class
   1.178 +
   1.179 +class CRegisteredMtmDll : public CTimer
   1.180 +/** Allows an MTM object to access registry information about itself.
   1.181 + 
   1.182 +@publishedAll
   1.183 +@released
   1.184 +*/
   1.185 +	{
   1.186 +public:
   1.187 +	IMPORT_C static CRegisteredMtmDll* NewL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
   1.188 +	IMPORT_C ~CRegisteredMtmDll();
   1.189 +
   1.190 +	inline TUid MtmTypeUid() const;
   1.191 +	inline TUid TechnologyTypeUid() const;
   1.192 +	inline const CMtmDllInfo& MtmDllInfo() const;
   1.193 +
   1.194 +	inline TInt MtmDllRefCount() const;
   1.195 +
   1.196 +	IMPORT_C TInt GetLibrary(RFs& aFs,RLibrary& aMtmDllLibrary);   // Increments reference count if successful or returns error 
   1.197 +	IMPORT_C void ReleaseLibrary();                       // Decrements access count
   1.198 +	                                                      // Should be called from destructor of any objects created from the library 
   1.199 +private:
   1.200 +	CRegisteredMtmDll(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
   1.201 +	void ConstructL(const CMtmDllInfo& aMtmDllInfo);
   1.202 +	void LoadLibraryL(RFs& aFs);   
   1.203 +
   1.204 +	void RunL();
   1.205 +
   1.206 +private:
   1.207 +	TUid iMtmTypeUid;
   1.208 +	TUid iTechnologyTypeUid;
   1.209 +	CMtmDllInfo* iMtmDllInfo;
   1.210 +	RLibrary iMtmDllLibrary;
   1.211 +	TInt iMtmDllRefCount;
   1.212 +	TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
   1.213 +	MRegisteredMtmDllObserver& iRegisteredMtmDllObserver;
   1.214 +	};
   1.215 +
   1.216 +
   1.217 +
   1.218 +class CRegisteredMtmDllArray : public CArrayPtrFlat<CRegisteredMtmDll>
   1.219 +/**
   1.220 +@internalComponent
   1.221 +@released
   1.222 +*/
   1.223 +	{
   1.224 +public:
   1.225 +	IMPORT_C CRegisteredMtmDllArray();
   1.226 +	IMPORT_C ~CRegisteredMtmDllArray();
   1.227 +	IMPORT_C void AddRegisteredMtmDllL(CRegisteredMtmDll* aRegisteredMtmDll);
   1.228 +	};
   1.229 +
   1.230 +//  Base class
   1.231 +
   1.232 +class CMtmDllRegistry : public CBase
   1.233 +/** Accesses the various MTM component registries. 
   1.234 +
   1.235 +The derived classes used by 
   1.236 +clients are CClientMtmRegistry, CMtmUiDataRegistry, and CMtmUiRegistry. It 
   1.237 +provides functions to discover the MTMs registered in such a registry. The 
   1.238 +registered MTMs can be regarded as existing in a list: you can use NumRegisteredMtmDlls() 
   1.239 +to get the number in the list, and MtmTypeUid() to index into it.
   1.240 + 
   1.241 +@internalComponent
   1.242 +@released
   1.243 +*/
   1.244 +	{
   1.245 +public:
   1.246 +	IMPORT_C ~CMtmDllRegistry();
   1.247 +
   1.248 +	inline TInt NumRegisteredMtmDlls() const;
   1.249 +	IMPORT_C TUid MtmTypeUid(TInt anIndex) const;                                
   1.250 +
   1.251 +	inline TBool IsPresent(TUid aMtmTypeUid) const;
   1.252 +	IMPORT_C TUid TechnologyTypeUid(TUid aMtmTypeUid) const;
   1.253 +	IMPORT_C const CMtmDllInfo& RegisteredMtmDllInfo(TUid aMtmTypeUid) const;                                
   1.254 +	IMPORT_C TBool IsInUse(TUid aMtmTypeUid) const;        // returns true if specified DLL in use 
   1.255 +	IMPORT_C TBool IsInUse() const;                        // returns true if any DLL in use 
   1.256 +
   1.257 +protected:
   1.258 +	IMPORT_C CMtmDllRegistry(RFs& aFs,TUid aMtmDllTypeUid,TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32=KMsvDefaultTimeoutMicroSeconds32); 
   1.259 +
   1.260 +	IMPORT_C TInt MtmTypeUidToIndex(TUid anMtmTypeUid) const;
   1.261 +
   1.262 +	IMPORT_C TInt AddRegisteredMtmDll(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver); // returns error
   1.263 +	IMPORT_C void RemoveRegisteredMtmDll(TUid aMtmTypeUid);         
   1.264 +	IMPORT_C void RemoveAllRegisteredMtmDlls();                     
   1.265 +
   1.266 +private:
   1.267 +	void DoAddRegisteredMtmDllL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver); // returns error
   1.268 +
   1.269 +protected:
   1.270 +	RFs& iFs;
   1.271 +	TUid iMtmDllTypeUid;  //  Second Uid in all Dlls
   1.272 +	CRegisteredMtmDllArray iRegisteredMtmDllArray;  // Inline CArray, OK because no NewL();
   1.273 +	TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
   1.274 +	};
   1.275 +
   1.276 +
   1.277 +#include <msvreg.inl>
   1.278 +
   1.279 +#endif