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