1 apgcli.h |
1 // Copyright (c) 1997-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(__APGCLI_H__) |
|
17 #define __APGCLI_H__ |
|
18 |
|
19 #if !defined(__E32BASE_H__) |
|
20 #include <e32base.h> |
|
21 #endif |
|
22 #if !defined(__APMSTD_H__) |
|
23 #include <apmstd.h> |
|
24 #endif |
|
25 #if !defined(__APMREC_H__) |
|
26 #include <apmrec.h> |
|
27 #endif |
|
28 #if !defined(__APAID_H__) |
|
29 #include <apaid.h> |
|
30 #endif |
|
31 #if !defined(__BADESCA_H__) |
|
32 #include <badesca.h> |
|
33 #endif |
|
34 #if !defined(__F32FILE_H__) |
|
35 #include <f32file.h> |
|
36 #endif |
|
37 |
|
38 // classes referenced |
|
39 class CApaCommandLine; |
|
40 class CApaMaskedBitmap; |
|
41 class MArrayFiller; |
|
42 class RFile; |
|
43 |
|
44 class CApaLsSessionExtension; |
|
45 |
|
46 class CDataRecognitionResultArrayEntry; |
|
47 class CApaRegistrationResourceFileWriter; |
|
48 class CApaLocalisableResourceFileWriter; |
|
49 |
|
50 /* @internalComponent |
|
51 */ |
|
52 IMPORT_C TUint MinApplicationStackSize(); |
|
53 |
|
54 class CDataRecognitionResultArray : public CBase |
|
55 /** |
|
56 This class holds the recognition results of a recognized directory. |
|
57 @publishedAll |
|
58 @released |
|
59 */ |
|
60 { |
|
61 public: // exported functions |
|
62 IMPORT_C CDataRecognitionResultArray(); |
|
63 IMPORT_C virtual ~CDataRecognitionResultArray(); |
|
64 IMPORT_C const TFileName& Path() const; |
|
65 IMPORT_C TUint Count() const; |
|
66 IMPORT_C void GetDataRecognitionResultL(TDataRecognitionResult& aResult, const TUint aIndex) const; |
|
67 IMPORT_C void GetFileNameL(TFileName& aFileName, const TUint aIndex) const; |
|
68 public: // dll internally |
|
69 TUint InternalizeL(const CBufFlat& aBuffer); |
|
70 void SetPath(const TFileName& aPath); |
|
71 private: |
|
72 TFileName iPath; |
|
73 RPointerArray<CDataRecognitionResultArrayEntry> iEntries; |
|
74 }; |
|
75 |
|
76 |
|
77 |
|
78 //////////////////////////////////// |
|
79 // RApaLsSession |
|
80 //////////////////////////////////// |
|
81 |
|
82 class RApaLsSession : public RSessionBase |
|
83 /** A session with the application architecture server. |
|
84 |
|
85 The server provides access to a cached list of the applications on the device. |
|
86 |
|
87 To use this class, clients first need to connect to the server. |
|
88 |
|
89 Then, one of GetAllApps(), GetEmbeddableApps() or GetFilteredApps() needs to be called. |
|
90 These functions do some initialisation of server data in preparation for returning the |
|
91 application list (which is owned by the server). |
|
92 |
|
93 Then, GetNextApp() is called in a loop. The first time around, it populates the session's |
|
94 application list and retrieves the first application in the list. Further calls to GetNextApp() |
|
95 retrieve the remaining applications in the list, until RApaLsSession::ENoMoreAppsInList is |
|
96 returned. |
|
97 |
|
98 The session should be closed when it is no longer needed, before it goes out of scope. |
|
99 |
|
100 Various functions in RApaLsSession need to access the application list, and may return |
|
101 RApaLsSession::EAppListInvalid to indicate that the function was called before the initial |
|
102 population of the list is complete. If this occurs, you could try again after a short delay. |
|
103 |
|
104 This class provides many other functions, for instance launching applications, querying |
|
105 application-specific information, recognising data. |
|
106 |
|
107 @publishedAll |
|
108 @released */ |
|
109 { |
|
110 friend class CApaLsSessionExtension; |
|
111 public: |
|
112 enum { |
|
113 /** A possible return value from GetNextApp(), to indicate that there are no more |
|
114 applications in the list. */ |
|
115 ENoMoreAppsInList=1, |
|
116 /** Indicates that an RApaLsSession member function was called before the session's |
|
117 application list is fully populated. */ |
|
118 EAppListInvalid |
|
119 }; |
|
120 /** Defines the way an application is launched. */ |
|
121 enum TLaunchType { |
|
122 /** Launches a new instance of the application. */ |
|
123 ELaunchNewApp=1, |
|
124 /** Launches a new instance of the application if no existing instance of the application |
|
125 is running. If an instance of the application is already running, then it |
|
126 is brought to the foreground. */ |
|
127 ESwitchFiles |
|
128 }; |
|
129 |
|
130 public: |
|
131 IMPORT_C RApaLsSession(); |
|
132 // |
|
133 IMPORT_C TInt Connect(); |
|
134 IMPORT_C TVersion Version() const; |
|
135 // |
|
136 IMPORT_C TInt AppCount(TInt& aCount) const; // returns error |
|
137 IMPORT_C TInt EmbeddableAppCount(TInt& aCount) const; // returns error |
|
138 // |
|
139 IMPORT_C TInt GetAllApps() const; // Call to initialize |
|
140 IMPORT_C TInt GetAllApps(TInt aScreenMode) const; // Call to initialize |
|
141 IMPORT_C TInt GetEmbeddableApps() const; // Call to initialize |
|
142 IMPORT_C TInt GetEmbeddableApps(TInt aScreenMode) const; // Call to initialize |
|
143 // 7.0s |
|
144 IMPORT_C TInt GetFilteredApps(const TApaEmbeddabilityFilter& aFilter) const; // Call to initialize |
|
145 IMPORT_C TInt GetFilteredApps(const TApaEmbeddabilityFilter& aFilter, TInt aScreenMode) const; // Call to initialize |
|
146 // 8.1 |
|
147 IMPORT_C TInt GetFilteredApps(TUint aCapabilityAttributeMask, TUint aCapabilityAttributeValue) const; // Call to initialize |
|
148 IMPORT_C TInt GetFilteredApps(TUint aCapabilityAttributeMask, TUint aCapabilityAttributeValue, TInt aScreenMode) const; // Call to initialize |
|
149 // 9.0 |
|
150 IMPORT_C TInt GetServerApps(TUid aServiceUid) const; // Call to initialize |
|
151 IMPORT_C TInt GetServerApps(TUid aServiceUid, TInt aScreenMode) const; // Call to initialize |
|
152 // |
|
153 IMPORT_C TInt GetNextApp(TApaAppInfo& aInfo) const; // call repeatedly, returns err (inc ENoMoreAppsInList,EAppListInvalid) |
|
154 IMPORT_C TInt GetNextApp(TApaAppInfo& aInfo,TInt aScreenMode) const; // call repeatedly, returns err (inc ENoMoreAppsInList,EAppListInvalid) |
|
155 // |
|
156 IMPORT_C TInt GetAppInfo(TApaAppInfo& aInfo,TUid aAppUid) const; |
|
157 IMPORT_C TInt SetAppShortCaption(const TDesC& aShortCaption, TLanguage aLanguage, TUid aAppUid); |
|
158 IMPORT_C TInt GetDefaultScreenNumber(TInt& aDefaultScreenNumber, TUid aAppUid) const; |
|
159 |
|
160 public: |
|
161 IMPORT_C TInt GetAppCapability(TDes8& aCapabilityBuf,TUid aAppUid) const; |
|
162 IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine); // This is only recommended for non document based apps |
|
163 IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine,TThreadId& aThreadId); |
|
164 IMPORT_C TInt StartApp(const CApaCommandLine& aCommandLine,TThreadId& aThreadId,TRequestStatus* aRequestStatusForRendezvous); |
|
165 // |
|
166 IMPORT_C TInt RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const; |
|
167 IMPORT_C TInt RecognizeData(const RFile& aFile, TDataRecognitionResult& aDataType) const; |
|
168 IMPORT_C TInt RecognizeSpecificData(const TDesC& aName, const TDesC8& aBuffer, const TDataType& aDataType, TBool& aResult) const; |
|
169 IMPORT_C TInt RecognizeSpecificData(const RFile& aFile, const TDataType& aDataType, TBool& aResult) const; |
|
170 // |
|
171 IMPORT_C TInt AppForDataType(const TDataType& aDataType, TUid& aAppUid) const; |
|
172 IMPORT_C TInt StartDocument(const TDesC& aFileName, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp); |
|
173 IMPORT_C TInt StartDocument(RFile& aFile, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous=NULL); |
|
174 IMPORT_C TInt StartDocument(const TDesC& aFileName, const TDataType& aDataType, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp); |
|
175 IMPORT_C TInt StartDocument(RFile& aFile, const TDataType& aDataType, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous=NULL); |
|
176 IMPORT_C TInt StartDocument(const TDesC& aFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp); |
|
177 IMPORT_C TInt StartDocument(RFile& aFile, TUid aAppUid, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous=NULL); |
|
178 IMPORT_C TInt CreateDocument(const TDesC& aFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aLaunchType=ELaunchNewApp); |
|
179 // |
|
180 IMPORT_C TInt GetAppIcon(TUid aAppUid, TInt aSize, CApaMaskedBitmap& aAppBitmap) const; |
|
181 // |
|
182 IMPORT_C TInt AppForDocument(const TDesC& aFileName, TUid& aAppUid, TDataType& aDataType) const; |
|
183 IMPORT_C TInt AppForDocument(const RFile& aFile, TUid& aAppUid, TDataType& aDataType) const; |
|
184 IMPORT_C TInt IsProgram(const TDesC& aFileName, TBool& aProgram) const; |
|
185 IMPORT_C TInt GetAcceptedConfidence(TInt& aConfidence) const; |
|
186 IMPORT_C TInt SetAcceptedConfidence(TInt aConfidence); |
|
187 IMPORT_C TInt GetMaxDataBufSize(TInt& aBufSize) const; |
|
188 IMPORT_C TInt SetMaxDataBufSize(TInt aBufSize); |
|
189 IMPORT_C TInt GetPreferredBufSize(TInt& aPreferredBufSize) const; |
|
190 IMPORT_C TInt GetSupportedDataTypesL(CDataTypeArray& aDataTypes) const; |
|
191 // |
|
192 IMPORT_C TInt GetAppIconSizes(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const; |
|
193 IMPORT_C TInt GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const; |
|
194 IMPORT_C TInt GetAppIcon(TUid aAppUid, RFile& aFile) const; |
|
195 // |
|
196 IMPORT_C TInt GetAppViews(CApaAppViewArray& aAppViews, TUid aAppUid) const; |
|
197 IMPORT_C TInt GetAppViewIcon(TUid aAppUid, TUid aViewUid, const TSize& aSize, CApaMaskedBitmap& aViewBitmap) const; |
|
198 IMPORT_C TInt GetAppOwnedFiles(CDesCArray& aAppOwnedFiles, TUid aAppUid) const; |
|
199 // |
|
200 IMPORT_C TInt NumberOfOwnDefinedIcons(TUid aAppUid, TInt& aCount) const; |
|
201 // |
|
202 IMPORT_C TInt GetAppIcon(TUid aAppUid, HBufC*& aFullFileName) const; |
|
203 IMPORT_C TInt GetAppViewIcon(TUid aAppUid, TUid aViewUid, HBufC*& aFullFileName) const; |
|
204 IMPORT_C TInt InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid); |
|
205 IMPORT_C TInt InsertDataMappingIfHigher(const TDataType& aDataType, TDataTypePriority aPriority, TUid aUid, TBool& aInserted); |
|
206 IMPORT_C TInt DeleteDataMapping(const TDataType& aDataType); |
|
207 /** |
|
208 @internalComponent |
|
209 @released |
|
210 */ |
|
211 IMPORT_C TInt InsertDataMapping(const TDataType& aDataType, TDataTypePriority aPriority, |
|
212 TUid aUid, TUid aServiceUid); |
|
213 /** |
|
214 @internalComponent |
|
215 @released |
|
216 */ |
|
217 IMPORT_C TInt DeleteDataMapping(const TDataType& aDataType, TUid aServiceUid); |
|
218 /** |
|
219 @internalComponent |
|
220 @released |
|
221 */ |
|
222 IMPORT_C TInt GetAppByDataType(const TDataType& aDataType, TUid aServiceUid, TUid& aAppUid) const; |
|
223 |
|
224 public: |
|
225 // |
|
226 IMPORT_C CApaAppServiceInfoArray* GetAppServicesLC(TUid aAppUid) const; |
|
227 IMPORT_C CApaAppServiceInfoArray* GetServiceImplementationsLC(TUid aServiceUid) const; |
|
228 IMPORT_C CApaAppServiceInfoArray* GetServiceImplementationsLC(TUid aServiceUid, const TDataType& aDataType) const; |
|
229 IMPORT_C void GetAppServicesL(TUid aAppUid, CArrayFixFlat<TUid>& aServiceUids) const; |
|
230 IMPORT_C CApaAppServiceInfoArray* GetAppServiceOpaqueDataLC(TUid aAppUid, TUid aServiceUid) const; |
|
231 IMPORT_C TInt AppForDataTypeAndService(const TDataType& aDataType, TUid aServiceUid, TUid& aAppUid) const; |
|
232 IMPORT_C TInt AppForDocumentAndService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const; |
|
233 IMPORT_C TInt AppForDocumentAndService(const RFile& aFile, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType) const; |
|
234 IMPORT_C TInt ApplicationLanguage(TUid aAppUid, TLanguage& aLanguage) const; |
|
235 IMPORT_C void Close(); //lint !e1511 Member hides non-virtual member |
|
236 |
|
237 IMPORT_C void RegisterListPopulationCompleteObserver(TRequestStatus& aStatus) const; |
|
238 IMPORT_C TInt CancelListPopulationCompleteObserver() const; |
|
239 IMPORT_C TInt MatchesSecurityPolicy(TBool& aMatches, TUid aAppUid, const TSecurityPolicy& aSecurityPolicy) const; |
|
240 IMPORT_C TInt RecognizeFilesL(const TDesC& aPath, CDataRecognitionResultArray& aResult) const; |
|
241 IMPORT_C void RecognizeFilesL(const TDesC& aPath, CDataRecognitionResultArray& aResult, TRequestStatus& aStatus); |
|
242 IMPORT_C TInt RecognizeFilesL(const TDesC& aPath, const TDesC8& aDataType, CDataRecognitionResultArray& aResult) const; |
|
243 IMPORT_C void RecognizeFilesL(const TDesC& aPath, const TDesC8& aDataType, CDataRecognitionResultArray& aResult, TRequestStatus& aStatus); |
|
244 IMPORT_C void CancelRecognizeFiles(); |
|
245 |
|
246 IMPORT_C void RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable); |
|
247 IMPORT_C void DeregisterNonNativeApplicationTypeL(TUid aApplicationType); |
|
248 IMPORT_C void PrepareNonNativeApplicationsUpdatesL(); |
|
249 IMPORT_C void RegisterNonNativeApplicationL(TUid aApplicationType, const TDriveUnit& aDrive, CApaRegistrationResourceFileWriter& aRegistrationResourceFile, CApaLocalisableResourceFileWriter* aLocalisableResourceFile, const RFile* aIconFile); |
|
250 IMPORT_C void DeregisterNonNativeApplicationL(TUid aApplication); |
|
251 IMPORT_C void CommitNonNativeApplicationsUpdatesL(); |
|
252 IMPORT_C TInt RollbackNonNativeApplicationsUpdates(); |
|
253 IMPORT_C void NotifyOnDataMappingChange(TRequestStatus& aRequestStatus); |
|
254 IMPORT_C void CancelNotifyOnDataMappingChange(); |
|
255 IMPORT_C TInt GetAppType(TUid& aTypeUid, TUid aAppUid) const; |
|
256 |
|
257 IMPORT_C TInt ForceRegistration(const RPointerArray<TDesC>& aRegFiles); |
|
258 |
|
259 public: |
|
260 // not for public use |
|
261 IMPORT_C static void SetFsSessionL(RFs& aFsSession); |
|
262 IMPORT_C static void ClearFsSession(); |
|
263 IMPORT_C static RFs* FsSession(); |
|
264 IMPORT_C void SetNotify(TBool aCompleteImmediatelyIfNoScanImpendingOrInProgress, TRequestStatus& aStatus); |
|
265 IMPORT_C void CancelNotify(); |
|
266 |
|
267 private: // Reserved for future use |
|
268 IMPORT_C virtual void RApaLsSession_Reserved1(); |
|
269 IMPORT_C virtual void RApaLsSession_Reserved2(); |
|
270 |
|
271 public: |
|
272 /** |
|
273 @publishedPartner |
|
274 @released |
|
275 */ |
|
276 IMPORT_C void ForceCommitNonNativeApplicationsUpdatesL(); |
|
277 |
|
278 private: |
|
279 void DoGetAppOwnedFilesL(CDesCArray& aArrayToFill, TUid aAppUid) const; |
|
280 void DoGetAppViewsL(CApaAppViewArray& aArrayToFill, TUid aAppUid) const; |
|
281 void DoGetAppIconSizesL(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const; |
|
282 TInt DoAppCount(TInt& aCount,TInt aCommand) const; |
|
283 void FetchArrayL(MArrayFiller& aArrayFiller,TUid aAppUid, TInt aOpcode, TInt aInitialBufSize) const; |
|
284 CBufBase* GetServiceBufferLC(TInt aOpcode, TUid aUid1, TUid aUid2=KNullUid) const; |
|
285 TInt StartAndCreate(TInt aRqst,const TDesC& aFileName, TUid aAppUid, TThreadId& aThreadId, TLaunchType aLaunchType); |
|
286 CBufBase* GetServiceBufferLC(TInt aOpcode, TUid aUid1, const TDataType& aDataType) const; |
|
287 TInt SendReceiveWithReconnect(TInt aFunction,const TIpcArgs& aIpcArgs) const; |
|
288 TInt TransferAndInternalizeDataL(const TDesC& aPath, const TInt aRequiredBufferSize, CDataRecognitionResultArray& aResult) const; |
|
289 TInt GetExecutableName(TDes& aNativeExecutableName, TDes& aLogicalExecutableName, HBufC8*& aOpaqueData, TIpcArgs& aIpcArgs, TInt aOpcode) const; |
|
290 TInt GetOpaqueData(HBufC8*& aOpaqueData, TInt aLengthOfOpaqueData) const; |
|
291 TInt StartApplicationPassingFileHandle(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const RFile& aFile, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous); |
|
292 TInt StartApplicationPassingDocumentName(const TDesC& aNativeExecutableName, const TDesC& aLogicalExecutableName, const TDesC8* aOpaqueData, const TDesC& aDocumentName, TThreadId& aThreadId,TApaCommand aCommand, TRequestStatus* aRequestStatusForRendezvous); |
|
293 void StartApplicationL(const TDesC& aNativeExecutableName, const CApaCommandLine& aCommandLine, TThreadId& aThreadId, TRequestStatus* aRequestStatusForRendezvous); |
|
294 TInt DoAppForDocumentOptionallySpecifyingService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const; |
|
295 TInt DoAppForDocumentOptionallySpecifyingService(const RFile& aFile, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const; |
|
296 TInt GetBufferFromFile(HBufC8*& aBuffer, const TDesC& aFileName) const; |
|
297 TInt DoStartApp(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous); |
|
298 void DoStartAppL(const CApaCommandLine& aCommandLine, TThreadId* aThreadId,TRequestStatus* aRequestStatusForRendezvous); |
|
299 static void GetThreadIdL(TThreadId& aThreadId, const RProcess& aProcess); |
|
300 static void DeletePointerToPointerToTAny(TAny* aPointerToPointerToTAny); |
|
301 static CBufFlat* CreateRegFilesBufferL(const RPointerArray<TDesC>& aRegFiles); |
|
302 static void CleanupOperation(TAny* aAny); |
|
303 |
|
304 private: // data |
|
305 CApaLsSessionExtension* iExtension; // friend! |
|
306 }; |
|
307 |
|
308 |
|
309 #endif |