epoc32/include/msvreg.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #if !defined(__MSVREG_H__)
    17 #define __MSVREG_H__
    18 #if !defined(__E32BASE_H__)
    19 #include <e32base.h>
    20 #endif
    21 #if !defined(__F32FILE_H__)
    22 #include <f32file.h>
    23 #endif
    24 
    25 
    26 
    27 /**
    28 @internalComponent
    29 @released
    30 */
    31 enum TMtsrDllIndex    //  Used in CMtmGroupData
    32 	{
    33 	EMtsrServerComponentIndex,
    34 	EMtsrClientComponentIndex,
    35 	EMtsrUiComponentIndex,
    36 	EMtsrUiDataComponentIndex
    37 	};
    38 
    39 const TInt KHumanReadableNameLength=50;
    40 typedef TBuf<KHumanReadableNameLength> THumanReadableName;   //  could be used client side
    41 
    42 #define KMsvDefaultTimeoutMicroSeconds32 30000000
    43 
    44 // forward declarations
    45 class RWriteStream;
    46 class RReadStream;
    47 class RFs;
    48 
    49 
    50 class CMtmDllInfo : public CBase
    51 /** Encapsulates the registration data for a single concrete MTM component. 
    52 
    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. 
    55  
    56 @publishedAll
    57 @released
    58 */
    59 	{
    60 public:
    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;
    77 private:
    78 	CMtmDllInfo();
    79 	CMtmDllInfo(const TUidType& aUidType,TInt aEntryPointOrdinalNumber,const TVersion aVersion);
    80 	CMtmDllInfo(const CMtmDllInfo& aMtmDllInfo);
    81 	void ConstructL(const TDesC& aHumanReadableName, const TDesC& aFilename);
    82 private:
    83 	HBufC* iHumanReadableName;         //  Should be less than KHumanReadableNameLength
    84 public:
    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 */
    90 	TVersion iVersion;
    91 
    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;
    99 private:
   100 	HBufC* iFilename;
   101 	};
   102 
   103 
   104 class CMtmDllInfoArray : public CArrayPtrFlat<CMtmDllInfo>
   105 /** Collects the registration data for concrete MTM components, as encapsulated 
   106 in CMtmDllInfo objects, into an array.
   107 
   108 Basic array functionality is provided by the base class CArrayPtrFlat<CMtmDllInfo>.
   109 
   110 It is used in the creation of registration data for an MTM group: see CMtmGroupData. 
   111 
   112 @publishedAll
   113 @released
   114 */
   115 	{
   116 public:
   117 	IMPORT_C CMtmDllInfoArray();
   118 	IMPORT_C ~CMtmDllInfoArray();
   119 	IMPORT_C void AddMtmDllInfoL(CMtmDllInfo* aMtmDllInfo);
   120 	};
   121 
   122 class TCapabilitySet;
   123 
   124 class CMtmGroupData : public CBase
   125 /** Encapsulates the registration data for an MTM group. 
   126 
   127 It is used to access and write the registration data file for an MTM group.
   128  
   129 @publishedAll
   130 @released
   131 */
   132 	{
   133 public:
   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;
   145 private:
   146 	CMtmGroupData(TUid aMtmTypeUid, TUid aTechnologyTypeUid, CMtmDllInfoArray* aMtmDllInfoArray, const TCapabilitySet& aMtmRequiredCaps);
   147 	void ConstructL(const CMtmGroupData& aMtmGroupData);
   148 	void ConstructL();
   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
   153 private:
   154 	TUid iMtmTypeUid;
   155 	TUid iTechnologyTypeUid;
   156 	CMtmDllInfoArray* iMtmDllInfoArray;
   157 	TCapabilitySet iMtmRequiredCaps;
   158 	};
   159 
   160 
   161 class MRegisteredMtmDllObserver
   162 /** 
   163 @internalComponent
   164 @released
   165 */
   166 	{
   167 public:
   168 	virtual TInt UseMtmGroup(TUid aMtmTypeUid)=0;
   169 	virtual TInt ReleaseMtmGroup(TUid aMtmTypeUid)=0;
   170 	};
   171 
   172 
   173 //  Real non-derivable class
   174 
   175 class CRegisteredMtmDll : public CTimer
   176 /** Allows an MTM object to access registry information about itself.
   177  
   178 @publishedAll
   179 @released
   180 */
   181 	{
   182 public:
   183 	IMPORT_C static CRegisteredMtmDll* NewL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
   184 	IMPORT_C ~CRegisteredMtmDll();
   185 
   186 	inline TUid MtmTypeUid() const;
   187 	inline TUid TechnologyTypeUid() const;
   188 	inline const CMtmDllInfo& MtmDllInfo() const;
   189 
   190 	inline TInt MtmDllRefCount() const;
   191 
   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 
   195 private:
   196 	CRegisteredMtmDll(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver);
   197 	void ConstructL(const CMtmDllInfo& aMtmDllInfo);
   198 	void LoadLibraryL(RFs& aFs);   
   199 
   200 	void RunL();
   201 
   202 private:
   203 	TUid iMtmTypeUid;
   204 	TUid iTechnologyTypeUid;
   205 	CMtmDllInfo* iMtmDllInfo;
   206 	RLibrary iMtmDllLibrary;
   207 	TInt iMtmDllRefCount;
   208 	TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
   209 	MRegisteredMtmDllObserver& iRegisteredMtmDllObserver;
   210 	};
   211 
   212 
   213 
   214 class CRegisteredMtmDllArray : public CArrayPtrFlat<CRegisteredMtmDll>
   215 /**
   216 @internalComponent
   217 @released
   218 */
   219 	{
   220 public:
   221 	IMPORT_C CRegisteredMtmDllArray();
   222 	IMPORT_C ~CRegisteredMtmDllArray();
   223 	IMPORT_C void AddRegisteredMtmDllL(CRegisteredMtmDll* aRegisteredMtmDll);
   224 	};
   225 
   226 //  Base class
   227 
   228 class CMtmDllRegistry : public CBase
   229 /** Accesses the various MTM component registries. 
   230 
   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.
   236  
   237 @internalComponent
   238 @released
   239 */
   240 	{
   241 public:
   242 	IMPORT_C ~CMtmDllRegistry();
   243 
   244 	inline TInt NumRegisteredMtmDlls() const;
   245 	IMPORT_C TUid MtmTypeUid(TInt anIndex) const;                                
   246 
   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 
   252 
   253 protected:
   254 	IMPORT_C CMtmDllRegistry(RFs& aFs,TUid aMtmDllTypeUid,TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32=KMsvDefaultTimeoutMicroSeconds32); 
   255 
   256 	IMPORT_C TInt MtmTypeUidToIndex(TUid anMtmTypeUid) const;
   257 
   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();                     
   261 
   262 private:
   263 	void DoAddRegisteredMtmDllL(TUid aMtmTypeUid,TUid aTechnologyTypeUid,const CMtmDllInfo& aMtmDllInfo,MRegisteredMtmDllObserver& aRegisteredMtmDllObserver); // returns error
   264 
   265 protected:
   266 	RFs& iFs;
   267 	TUid iMtmDllTypeUid;  //  Second Uid in all Dlls
   268 	CRegisteredMtmDllArray iRegisteredMtmDllArray;  // Inline CArray, OK because no NewL();
   269 	TTimeIntervalMicroSeconds32 iTimeoutMicroSeconds32;
   270 	};
   271 
   272 
   273 #include <msvreg.inl>
   274 
   275 #endif