epoc32/include/apgcli.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/apgcli.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/apgcli.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,309 @@
     1.4 -apgcli.h
     1.5 +// Copyright (c) 1997-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(__APGCLI_H__)
    1.21 +#define __APGCLI_H__
    1.22 +
    1.23 +#if !defined(__E32BASE_H__)
    1.24 +#include <e32base.h>
    1.25 +#endif
    1.26 +#if !defined(__APMSTD_H__)
    1.27 +#include <apmstd.h>
    1.28 +#endif
    1.29 +#if !defined(__APMREC_H__)
    1.30 +#include <apmrec.h>
    1.31 +#endif
    1.32 +#if !defined(__APAID_H__)
    1.33 +#include <apaid.h>
    1.34 +#endif
    1.35 +#if !defined(__BADESCA_H__)
    1.36 +#include <badesca.h>
    1.37 +#endif
    1.38 +#if !defined(__F32FILE_H__)
    1.39 +#include <f32file.h>
    1.40 +#endif
    1.41 +
    1.42 +// classes referenced
    1.43 +class CApaCommandLine;
    1.44 +class CApaMaskedBitmap;
    1.45 +class MArrayFiller;
    1.46 +class RFile;
    1.47 +
    1.48 +class CApaLsSessionExtension;
    1.49 +
    1.50 +class CDataRecognitionResultArrayEntry;
    1.51 +class CApaRegistrationResourceFileWriter;
    1.52 +class CApaLocalisableResourceFileWriter;
    1.53 +
    1.54 +/* @internalComponent
    1.55 +*/
    1.56 +IMPORT_C TUint MinApplicationStackSize();
    1.57 +
    1.58 +class CDataRecognitionResultArray : public CBase
    1.59 +/**
    1.60 +This class holds the recognition results of a recognized directory.
    1.61 +@publishedAll
    1.62 +@released
    1.63 +*/
    1.64 +	{
    1.65 +public: // exported functions
    1.66 +	IMPORT_C CDataRecognitionResultArray();
    1.67 +	IMPORT_C virtual ~CDataRecognitionResultArray();
    1.68 +	IMPORT_C const TFileName& Path() const;
    1.69 +	IMPORT_C TUint Count() const;
    1.70 +	IMPORT_C void GetDataRecognitionResultL(TDataRecognitionResult& aResult, const TUint aIndex) const;
    1.71 +	IMPORT_C void GetFileNameL(TFileName& aFileName, const TUint aIndex) const;
    1.72 +public: // dll internally
    1.73 +	TUint InternalizeL(const CBufFlat& aBuffer);
    1.74 +	void SetPath(const TFileName& aPath);
    1.75 +private:
    1.76 +	TFileName iPath;
    1.77 +	RPointerArray<CDataRecognitionResultArrayEntry> iEntries;
    1.78 +	};
    1.79 +
    1.80 +
    1.81 +
    1.82 +////////////////////////////////////
    1.83 +// RApaLsSession
    1.84 +////////////////////////////////////
    1.85 +
    1.86 +class RApaLsSession : public RSessionBase
    1.87 +/** A session with the application architecture server.
    1.88 +
    1.89 +The server provides access to a cached list of the applications on the device. 
    1.90 +
    1.91 +To use this class, clients first need to connect to the server. 
    1.92 +
    1.93 +Then, one of GetAllApps(), GetEmbeddableApps() or GetFilteredApps() needs to be called. 
    1.94 +These functions do some initialisation of server data in preparation for returning the 
    1.95 +application list (which is owned by the server).
    1.96 +
    1.97 +Then, GetNextApp() is called in a loop. The first time around, it populates the session's 
    1.98 +application list and retrieves the first application in the list. Further calls to GetNextApp() 
    1.99 +retrieve the remaining applications in the list, until RApaLsSession::ENoMoreAppsInList is 
   1.100 +returned.
   1.101 +
   1.102 +The session should be closed when it is no longer needed, before it goes out of scope.
   1.103 +
   1.104 +Various functions in RApaLsSession need to access the application list, and may return 
   1.105 +RApaLsSession::EAppListInvalid to indicate that the function was called before the initial 
   1.106 +population of the list is complete. If this occurs, you could try again after a short delay.
   1.107 +
   1.108 +This class provides many other functions, for instance launching applications, querying 
   1.109 +application-specific information, recognising data.
   1.110 +
   1.111 +@publishedAll
   1.112 +@released */
   1.113 +	{
   1.114 +	friend class CApaLsSessionExtension;
   1.115 +public:
   1.116 +	enum {
   1.117 +		/** A possible return value from GetNextApp(), to indicate that there are no more 
   1.118 +		applications in the list. */
   1.119 +		ENoMoreAppsInList=1,
   1.120 +		/** Indicates that an RApaLsSession member function was called before the session's 
   1.121 +		application list is fully populated. */
   1.122 +		EAppListInvalid
   1.123 +		};
   1.124 +	/** Defines the way an application is launched. */
   1.125 +	enum TLaunchType {
   1.126 +		/** Launches a new instance of the application. */
   1.127 +		ELaunchNewApp=1,
   1.128 +		/** Launches a new instance of the application if no existing instance of the application 
   1.129 +		is running. If an instance of the application is already running, then it 
   1.130 +		is brought to the foreground. */
   1.131 +		ESwitchFiles
   1.132 +		};
   1.133 +	
   1.134 +public:
   1.135 +	IMPORT_C RApaLsSession();
   1.136 +	//
   1.137 +	IMPORT_C TInt Connect();
   1.138 +	IMPORT_C TVersion Version() const;
   1.139 +	//
   1.140 +	IMPORT_C TInt AppCount(TInt& aCount) const; // returns error
   1.141 +	IMPORT_C TInt EmbeddableAppCount(TInt& aCount) const; // returns error
   1.142 +	//
   1.143 +	IMPORT_C TInt GetAllApps() const; // Call to initialize
   1.144 +	IMPORT_C TInt GetAllApps(TInt aScreenMode) const; // Call to initialize
   1.145 +	IMPORT_C TInt GetEmbeddableApps() const; // Call to initialize
   1.146 +	IMPORT_C TInt GetEmbeddableApps(TInt aScreenMode) const; // Call to initialize
   1.147 +	// 7.0s
   1.148 +	IMPORT_C TInt GetFilteredApps(const TApaEmbeddabilityFilter& aFilter) const; // Call to initialize
   1.149 +	IMPORT_C TInt GetFilteredApps(const TApaEmbeddabilityFilter& aFilter, TInt aScreenMode) const; // Call to initialize
   1.150 +	// 8.1
   1.151 +	IMPORT_C TInt GetFilteredApps(TUint aCapabilityAttributeMask, TUint aCapabilityAttributeValue) const; // Call to initialize
   1.152 +	IMPORT_C TInt GetFilteredApps(TUint aCapabilityAttributeMask, TUint aCapabilityAttributeValue, TInt aScreenMode) const; // Call to initialize
   1.153 +	// 9.0
   1.154 +	IMPORT_C TInt GetServerApps(TUid aServiceUid) const; // Call to initialize
   1.155 +	IMPORT_C TInt GetServerApps(TUid aServiceUid, TInt aScreenMode) const; // Call to initialize
   1.156 +	//
   1.157 +	IMPORT_C TInt GetNextApp(TApaAppInfo& aInfo) const; // call repeatedly, returns err (inc ENoMoreAppsInList,EAppListInvalid)
   1.158 +	IMPORT_C TInt GetNextApp(TApaAppInfo& aInfo,TInt aScreenMode) const; // call repeatedly, returns err (inc ENoMoreAppsInList,EAppListInvalid)
   1.159 +	//
   1.160 +	IMPORT_C TInt GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const;
   1.161 +	IMPORT_C TInt SetAppShortCaption(const TDesC& aShortCaption, TLanguage aLanguage, TUid aAppUid);
   1.162 +	IMPORT_C TInt GetDefaultScreenNumber(TInt& aDefaultScreenNumber, TUid aAppUid) const;
   1.163 +	
   1.164 +public:
   1.165 +	IMPORT_C TInt GetAppCapability(TDes8& aCapabilityBuf,TUid aAppUid) const;
   1.166 +	IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine); // This is only recommended for non document based apps
   1.167 +	IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine,TThreadId& aThreadId);
   1.168 +	IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine,TThreadId& aThreadId,TRequestStatus* aRequestStatusForRendezvous);
   1.169 +	//
   1.170 +	IMPORT_C TInt RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const;
   1.171 +	IMPORT_C TInt RecognizeData(const RFile& aFile, TDataRecognitionResult& aDataType) const;
   1.172 +	IMPORT_C TInt RecognizeSpecificData(const TDesC& aName, const TDesC8& aBuffer, const TDataType& aDataType, TBool& aResult) const;
   1.173 +	IMPORT_C TInt RecognizeSpecificData(const RFile& aFile, const TDataType& aDataType, TBool& aResult) const;
   1.174 +	//
   1.175 +	IMPORT_C TInt AppForDataType(const TDataType& aDataType, TUid& aAppUid) const;
   1.176 +	IMPORT_C TInt StartDocument(const TDesC& aFileName, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp);
   1.177 +	IMPORT_C TInt StartDocument(RFile& aFile, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous=NULL);
   1.178 +	IMPORT_C TInt StartDocument(const TDesC& aFileName, const TDataType& aDataType, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp);
   1.179 +	IMPORT_C TInt StartDocument(RFile& aFile, const TDataType& aDataType, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous=NULL);
   1.180 +	IMPORT_C TInt StartDocument(const TDesC& aFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp);
   1.181 +	IMPORT_C TInt StartDocument(RFile& aFile, TUid aAppUid, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous=NULL);
   1.182 +	IMPORT_C TInt CreateDocument(const TDesC& aFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp);
   1.183 +	//
   1.184 +	IMPORT_C TInt GetAppIcon(TUid aAppUid, TInt aSize, CApaMaskedBitmap& aAppBitmap) const;
   1.185 +	//
   1.186 +	IMPORT_C TInt AppForDocument(const TDesC& aFileName, TUid& aAppUid, TDataType& aDataType) const;
   1.187 +	IMPORT_C TInt AppForDocument(const RFile& aFile, TUid& aAppUid, TDataType& aDataType) const;
   1.188 +	IMPORT_C TInt IsProgram(const TDesC& aFileName, TBool& aProgram) const;
   1.189 +	IMPORT_C TInt GetAcceptedConfidence(TInt& aConfidence) const;
   1.190 +	IMPORT_C TInt SetAcceptedConfidence(TInt aConfidence);
   1.191 +	IMPORT_C TInt GetMaxDataBufSize(TInt& aBufSize) const;
   1.192 +	IMPORT_C TInt SetMaxDataBufSize(TInt aBufSize);
   1.193 +	IMPORT_C TInt GetPreferredBufSize(TInt& aPreferredBufSize) const;
   1.194 +	IMPORT_C TInt GetSupportedDataTypesL(CDataTypeArray& aDataTypes) const;
   1.195 +	//
   1.196 +	IMPORT_C TInt GetAppIconSizes(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const;
   1.197 +	IMPORT_C TInt GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const;
   1.198 +	IMPORT_C TInt GetAppIcon(TUid aAppUid, RFile& aFile) const;
   1.199 +	//
   1.200 +	IMPORT_C TInt GetAppViews(CApaAppViewArray& aAppViews, TUid aAppUid) const;
   1.201 +	IMPORT_C TInt GetAppViewIcon(TUid aAppUid, TUid aViewUid, const TSize& aSize, CApaMaskedBitmap& aViewBitmap) const;
   1.202 +	IMPORT_C TInt GetAppOwnedFiles(CDesCArray& aAppOwnedFiles, TUid aAppUid) const;
   1.203 +	//
   1.204 +	IMPORT_C TInt NumberOfOwnDefinedIcons(TUid aAppUid, TInt& aCount) const;
   1.205 +	//
   1.206 +	IMPORT_C TInt GetAppIcon(TUid aAppUid, HBufC*& aFullFileName) const;
   1.207 +	IMPORT_C TInt GetAppViewIcon(TUid aAppUid, TUid aViewUid, HBufC*& aFullFileName) const;
   1.208 +	IMPORT_C TInt InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid);
   1.209 +	IMPORT_C TInt InsertDataMappingIfHigher(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid, TBool& aInserted);
   1.210 +	IMPORT_C TInt DeleteDataMapping(const TDataType& aDataType);
   1.211 +	/**
   1.212 +	@internalComponent
   1.213 +	@released
   1.214 +	*/
   1.215 +	IMPORT_C TInt InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, 
   1.216 +		TUid aUid, TUid aServiceUid);
   1.217 +	/**
   1.218 +	@internalComponent
   1.219 +	@released
   1.220 +	*/
   1.221 +	IMPORT_C TInt DeleteDataMapping(const TDataType& aDataType, TUid aServiceUid);
   1.222 +	/**
   1.223 +	@internalComponent
   1.224 +	@released
   1.225 +	*/
   1.226 +	IMPORT_C TInt GetAppByDataType(const TDataType& aDataType, TUid aServiceUid, TUid& aAppUid) const;
   1.227 +
   1.228 +public:
   1.229 +	//
   1.230 +	IMPORT_C CApaAppServiceInfoArray* GetAppServicesLC(TUid aAppUid) const;
   1.231 +	IMPORT_C CApaAppServiceInfoArray* GetServiceImplementationsLC(TUid aServiceUid) const;
   1.232 +	IMPORT_C CApaAppServiceInfoArray* GetServiceImplementationsLC(TUid aServiceUid, const TDataType& aDataType) const;
   1.233 +	IMPORT_C void GetAppServicesL(TUid aAppUid, CArrayFixFlat<TUid>& aServiceUids) const;
   1.234 +	IMPORT_C CApaAppServiceInfoArray* GetAppServiceOpaqueDataLC(TUid aAppUid, TUid aServiceUid) const;
   1.235 +	IMPORT_C TInt AppForDataTypeAndService(const TDataType& aDataType, TUid aServiceUid, TUid& aAppUid) const;
   1.236 +	IMPORT_C TInt AppForDocumentAndService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const;
   1.237 +	IMPORT_C TInt AppForDocumentAndService(const RFile& aFile, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const;
   1.238 +	IMPORT_C TInt ApplicationLanguage(TUid aAppUid, TLanguage& aLanguage) const;
   1.239 +	IMPORT_C void Close(); //lint !e1511 Member hides non-virtual member
   1.240 +
   1.241 +	IMPORT_C void RegisterListPopulationCompleteObserver(TRequestStatus& aStatus) const;
   1.242 +	IMPORT_C TInt CancelListPopulationCompleteObserver() const;
   1.243 +	IMPORT_C TInt MatchesSecurityPolicy(TBool& aMatches, TUid aAppUid, const TSecurityPolicy& aSecurityPolicy) const;
   1.244 +	IMPORT_C TInt RecognizeFilesL(const TDesC& aPath, CDataRecognitionResultArray& aResult) const;
   1.245 +	IMPORT_C void RecognizeFilesL(const TDesC& aPath, CDataRecognitionResultArray& aResult, TRequestStatus& aStatus);
   1.246 +	IMPORT_C TInt RecognizeFilesL(const TDesC& aPath, const TDesC8& aDataType, CDataRecognitionResultArray& aResult) const;
   1.247 +	IMPORT_C void RecognizeFilesL(const TDesC& aPath, const TDesC8& aDataType, CDataRecognitionResultArray& aResult, TRequestStatus& aStatus);
   1.248 +	IMPORT_C void CancelRecognizeFiles();
   1.249 +
   1.250 +	IMPORT_C void RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable);
   1.251 +	IMPORT_C void DeregisterNonNativeApplicationTypeL(TUid aApplicationType);
   1.252 +	IMPORT_C void PrepareNonNativeApplicationsUpdatesL();
   1.253 +	IMPORT_C void RegisterNonNativeApplicationL(TUid aApplicationType, const TDriveUnit& aDrive, CApaRegistrationResourceFileWriter& aRegistrationResourceFile, CApaLocalisableResourceFileWriter* aLocalisableResourceFile, const RFile* aIconFile);
   1.254 +	IMPORT_C void DeregisterNonNativeApplicationL(TUid aApplication);
   1.255 +	IMPORT_C void CommitNonNativeApplicationsUpdatesL();
   1.256 +	IMPORT_C TInt RollbackNonNativeApplicationsUpdates();
   1.257 +	IMPORT_C void NotifyOnDataMappingChange(TRequestStatus& aRequestStatus);
   1.258 +	IMPORT_C void CancelNotifyOnDataMappingChange();
   1.259 +	IMPORT_C TInt GetAppType(TUid& aTypeUid, TUid aAppUid) const;
   1.260 +	
   1.261 +	IMPORT_C TInt ForceRegistration(const RPointerArray<TDesC>& aRegFiles);
   1.262 +	
   1.263 +public:
   1.264 +	// not for public use
   1.265 +	IMPORT_C static void SetFsSessionL(RFs& aFsSession);
   1.266 +	IMPORT_C static void ClearFsSession();
   1.267 +	IMPORT_C static RFs* FsSession();
   1.268 +	IMPORT_C void SetNotify(TBool aCompleteImmediatelyIfNoScanImpendingOrInProgress, TRequestStatus& aStatus);
   1.269 +	IMPORT_C void CancelNotify();
   1.270 +
   1.271 +private: // Reserved for future use
   1.272 +	IMPORT_C virtual void RApaLsSession_Reserved1();
   1.273 +	IMPORT_C virtual void RApaLsSession_Reserved2();
   1.274 +
   1.275 +public:
   1.276 +	/**
   1.277 +	@publishedPartner
   1.278 +	@released
   1.279 +	*/
   1.280 +	IMPORT_C void ForceCommitNonNativeApplicationsUpdatesL(); 
   1.281 +	
   1.282 +private:
   1.283 +	void DoGetAppOwnedFilesL(CDesCArray& aArrayToFill, TUid aAppUid) const;
   1.284 +	void DoGetAppViewsL(CApaAppViewArray& aArrayToFill, TUid aAppUid) const;
   1.285 +	void DoGetAppIconSizesL(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const;
   1.286 +	TInt DoAppCount(TInt& aCount,TInt aCommand) const;
   1.287 +	void FetchArrayL(MArrayFiller& aArrayFiller,TUid aAppUid, TInt aOpcode, TInt aInitialBufSize) const;
   1.288 +	CBufBase* GetServiceBufferLC(TInt aOpcode, TUid aUid1, TUid aUid2=KNullUid) const;
   1.289 +	TInt StartAndCreate(TInt aRqst,const TDesC& aFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aLaunchType);
   1.290 +	CBufBase* GetServiceBufferLC(TInt aOpcode, TUid aUid1, const TDataType& aDataType) const;
   1.291 +	TInt SendReceiveWithReconnect(TInt aFunction,const TIpcArgs& aIpcArgs) const;
   1.292 +	TInt TransferAndInternalizeDataL(const TDesC& aPath, const TInt aRequiredBufferSize, CDataRecognitionResultArray& aResult) const;
   1.293 +	TInt GetExecutableName(TDes& aNativeExecutableName, TDes& aLogicalExecutableName, HBufC8*& aOpaqueData, TIpcArgs& aIpcArgs, TInt aOpcode) const;
   1.294 +	TInt GetOpaqueData(HBufC8*& aOpaqueData, TInt aLengthOfOpaqueData) const;
   1.295 +	TInt StartApplicationPassingFileHandle(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const RFile& aFile, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous);
   1.296 +	TInt StartApplicationPassingDocumentName(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const TDesC& aDocumentName, TThreadId& aThreadId,TApaCommand aCommand, TRequestStatus* aRequestStatusForRendezvous);
   1.297 +	void StartApplicationL(const TDesC& aNativeExecutableName, const CApaCommandLine& aCommandLine, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous);
   1.298 +	TInt DoAppForDocumentOptionallySpecifyingService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const;
   1.299 +	TInt DoAppForDocumentOptionallySpecifyingService(const RFile& aFile, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const;
   1.300 +	TInt GetBufferFromFile(HBufC8*& aBuffer, const TDesC& aFileName) const;
   1.301 +	TInt DoStartApp(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous);
   1.302 +	void DoStartAppL(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous);
   1.303 +	static void GetThreadIdL(TThreadId& aThreadId, const RProcess& aProcess);
   1.304 +	static void DeletePointerToPointerToTAny(TAny* aPointerToPointerToTAny);
   1.305 +	static CBufFlat* CreateRegFilesBufferL(const RPointerArray<TDesC>& aRegFiles);
   1.306 +	static void CleanupOperation(TAny* aAny);
   1.307 +
   1.308 +private: // data
   1.309 +	CApaLsSessionExtension* iExtension; // friend!
   1.310 +	};
   1.311 +
   1.312 +
   1.313 +#endif