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