|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Client class for the alfredserver.exe |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef R_ALFCLIENTBASE_H |
|
21 #define R_ALFCLIENTBASE_H |
|
22 |
|
23 #include <AknServerApp.h> |
|
24 #include <f32file.h> |
|
25 |
|
26 class CAlfEnv; |
|
27 class RApaLsSession; |
|
28 class CApaCommandLine; |
|
29 /** |
|
30 * Alfred client base. |
|
31 * |
|
32 * @lib alfclient.lib |
|
33 * @since S60 v3.2 |
|
34 */ |
|
35 class RAlfClientBase : public RAknAppServiceBase |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Constructor |
|
42 */ |
|
43 IMPORT_C RAlfClientBase(TInt aServiceUid); |
|
44 |
|
45 /** |
|
46 * Opens connection to the server. |
|
47 * Must be called before any other activity! |
|
48 */ |
|
49 IMPORT_C void OpenL(); |
|
50 |
|
51 /** |
|
52 * Grants server access to given private file |
|
53 * This access is valid as long as the session remains alive |
|
54 * |
|
55 * @param aFileName Full filename of file to be shared |
|
56 * @param aObjectIdentfier To which object the generated token will be passed |
|
57 * @param aCommandId Command indetifier that allows server implementation to distinguish this particular file |
|
58 * |
|
59 * @return Any system wide error code, KErrNone on success |
|
60 */ |
|
61 IMPORT_C TInt GrantAccessToPrivateFile( const TDesC& aFileName, |
|
62 TInt aObjectIdentfier, |
|
63 TInt aCommandId ); |
|
64 /** |
|
65 * Grants server access to given private file |
|
66 * This access is valid as long as the session remains alive |
|
67 * |
|
68 * @param aOpenFile Open filehandle, can reside other process gage as well |
|
69 * @param aObjectIdentfier To which object the generated token will be passed |
|
70 * @param aCommandId Command indetifier that allows server implementation to distinguish this particular file |
|
71 * |
|
72 * @return Any system wide error code, KErrNone on success |
|
73 */ |
|
74 IMPORT_C TInt GrantAccessToPrivateFile( const RFile& aFile, |
|
75 TInt aObjectIdentfier, |
|
76 TInt aCommandId ); |
|
77 |
|
78 /** |
|
79 *! internal |
|
80 */ |
|
81 void SetAlfEnv(CAlfEnv& aAlf); |
|
82 |
|
83 |
|
84 // from base class RAknAppServiceBase |
|
85 |
|
86 /** |
|
87 * From RAknAppServiceBase. |
|
88 * Returns the service UID which the server implements. |
|
89 * |
|
90 * @return Service UID supported. |
|
91 */ |
|
92 IMPORT_C TUid ServiceUid() const; |
|
93 |
|
94 void StartAsyncL(TRequestStatus* aStatus); |
|
95 void CompleteAsynchConstructionL(); |
|
96 |
|
97 protected: |
|
98 |
|
99 /** |
|
100 * Construct the server name. |
|
101 */ |
|
102 IMPORT_C static void ConstructServerName( |
|
103 TName& aServerName, |
|
104 TUid aAppServerUid, |
|
105 TUint aServerDifferentiator ); |
|
106 |
|
107 /** |
|
108 * Starts the server. |
|
109 */ |
|
110 IMPORT_C TUint StartServerL( TUid aAppUid ); |
|
111 |
|
112 /** |
|
113 * Launches the application. |
|
114 */ |
|
115 IMPORT_C void LaunchAppL( |
|
116 TUid aAppUid, |
|
117 TUint aServerDifferentiator, |
|
118 TThreadId& aThreadId ); |
|
119 |
|
120 private: |
|
121 TInt iServiceUid; |
|
122 CAlfEnv* iEnv; |
|
123 CApaCommandLine* iCmdLine; |
|
124 RApaLsSession* iApa; |
|
125 }; |
|
126 |
|
127 NONSHARABLE_CLASS(CAlfAsynchStartup): public CActive |
|
128 { |
|
129 public: |
|
130 |
|
131 /** |
|
132 * Starts the server. Does not return client for caller, so to be utilized only by FW to trigger server creation |
|
133 */ |
|
134 IMPORT_C static void StartL(); |
|
135 |
|
136 private: |
|
137 CAlfAsynchStartup(); |
|
138 void RunL(); |
|
139 void DoCancel(); |
|
140 RAlfClientBase iClient; |
|
141 }; |
|
142 |
|
143 |
|
144 #endif // R_ALFCLIENT_H |