|
1 /* |
|
2 * Copyright (c) 2002-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: Script interface in CF. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_CFSCRIPTINTERFACE_H |
|
20 #define M_CFSCRIPTINTERFACE_H |
|
21 |
|
22 class CCFActionSubscription; |
|
23 class MCFActionSubscriptionListener; |
|
24 class MCFScriptOwner; |
|
25 class RThread; |
|
26 |
|
27 /** |
|
28 * Interface for registering scripts. |
|
29 */ |
|
30 class MCFScriptInterface |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * Registers a script. |
|
36 * Possible error codes: |
|
37 * - KErrNotFound, specified context or action in script not defined |
|
38 * - KErrAccessDenied, not enough capabilities for context or action |
|
39 * |
|
40 * @since S60 5.0 |
|
41 * @param aName Script's name, filename or secure id from client thread. |
|
42 * @param aScript Script. |
|
43 * @param aScriptId Reference to script ID return parameter. |
|
44 * @param aClientThread Client thread. |
|
45 * @param aOwner Script owner session. |
|
46 * @return KErrNone if no errors. |
|
47 */ |
|
48 virtual TInt RegisterScript( |
|
49 const TDesC& aName, |
|
50 const TDesC8& aScript, |
|
51 TInt& aScriptId, |
|
52 const RThread& aClientThread, |
|
53 MCFScriptOwner& aOwner ) = 0; |
|
54 |
|
55 /** |
|
56 * Deregister a script. |
|
57 * |
|
58 * @since S60 5.0 |
|
59 * @param aScriptId ID of the script to be removed. |
|
60 * @param aClientThread Client thread which registered the script. |
|
61 * @return KErrNone if no errors. |
|
62 */ |
|
63 virtual TInt DeregisterScript( TInt aScriptId, |
|
64 const RThread& aClientThread ) = 0; |
|
65 |
|
66 /** |
|
67 * Deregister a script. |
|
68 * |
|
69 * @since S60 5.0 |
|
70 * @param aScriptName Name of the script to be removed. |
|
71 * @param aClientThread Client thread which registered the script. |
|
72 * @return KErrNone if no errors. |
|
73 */ |
|
74 virtual TInt DeregisterScript( const TDesC& aScriptName, |
|
75 const RThread& aClientThread ) = 0; |
|
76 |
|
77 /** |
|
78 * Deregister a scripts from a particular Sid. |
|
79 * |
|
80 * @since S60 5.0 |
|
81 * @param aClientThread Client thread which registered the script. |
|
82 * @return KErrNone if no errors. |
|
83 */ |
|
84 virtual TInt DeregisterScripts( const RThread& aClientThread ) = 0; |
|
85 |
|
86 /** |
|
87 * Deregister scripts by script session. This is used when the client |
|
88 * session is closed. |
|
89 * @param aOwner Script owner session being closed. |
|
90 */ |
|
91 virtual void DeregisterScriptOwner( MCFScriptOwner& aOwner ) = 0; |
|
92 |
|
93 /** |
|
94 * Save script into disk. |
|
95 * |
|
96 * @since S60 5.0 |
|
97 * @param aScript Script content to save |
|
98 * @param aScriptId Id of the script which data is stored. |
|
99 * @param aClient Client thread. |
|
100 * @return KErrNone if no errors. |
|
101 */ |
|
102 virtual TInt SaveScript( const TDesC8& aScript, |
|
103 TInt aScriptId, |
|
104 const RThread& aClient ) = 0; |
|
105 |
|
106 /** |
|
107 * Delete script from disk. |
|
108 * |
|
109 * @since S60 5.0 |
|
110 * @param aScriptName Script name to delete. |
|
111 * @param aClientThread Client thread which registered the script. |
|
112 * @return KErrNone if no errors. |
|
113 */ |
|
114 virtual TInt DeleteScript( const TDesC& aScriptName, |
|
115 RThread& aClientThread ) = 0; |
|
116 |
|
117 /** |
|
118 * Delete scripts from disk from a particular Sid. |
|
119 * |
|
120 * @since S60 5.0 |
|
121 * @param aScriptName Script name to delete. |
|
122 * @param aClientThread Client thread which registered the script. |
|
123 * @return KErrNone if no errors. |
|
124 */ |
|
125 virtual TInt DeleteScripts( RThread& aClientThread ) = 0; |
|
126 |
|
127 /** |
|
128 * Check if the script name is already reserved. |
|
129 * |
|
130 * @since S60 5.0 |
|
131 * @param aScriptName Name of the script. |
|
132 * @param aClient Client process thread. |
|
133 * @param aScriptId Id of the script found. |
|
134 * @return ETrue if the name is reserved. |
|
135 */ |
|
136 virtual TBool AlreadyExists( const TDesC& aScriptName, |
|
137 const RThread& aClient, |
|
138 TInt& aScriptId ) const = 0; |
|
139 |
|
140 /** |
|
141 * Cleanup persistent data from a script identified by name. |
|
142 * |
|
143 * @since S60 5.0 |
|
144 * @param aScriptName Name of the script. |
|
145 * @param aClient Owner of the scripts. |
|
146 * @return KErrNone if no errors. |
|
147 */ |
|
148 virtual void CleanupPersistentDataByName( const TDesC& aScriptName, |
|
149 const RThread& aClientThread ) = 0; |
|
150 |
|
151 /** |
|
152 * Cleanup persistent data from all scripts identified by owner uid. |
|
153 * |
|
154 * @since S60 5.0 |
|
155 * @param aClient Owner of the scripts. |
|
156 * @return KErrNone if no errors. |
|
157 */ |
|
158 virtual void CleanupPersistentDataByUid( const RThread& aClient ) = 0; |
|
159 |
|
160 /** |
|
161 * Method for updating (by replacing) a script. |
|
162 * |
|
163 * @since Series 60 5.0 |
|
164 * @param aScriptId Id of the script to be updated. |
|
165 * @param aUpdatedScript descriptor containing the new script. |
|
166 * @param aOwner Script owner session. |
|
167 * @return KErrnone if successful, system wide error code otherwise. |
|
168 */ |
|
169 virtual TInt UpdateScript( TInt aScriptID, |
|
170 const RThread& aOwnerThread, |
|
171 const TDesC8& aUpdatedScript, |
|
172 MCFScriptOwner& aOwner ) = 0; |
|
173 |
|
174 /** |
|
175 * Restore upgraded rom based script with the orginal script found |
|
176 * in rom. |
|
177 * |
|
178 * @since S60 5.0 |
|
179 * @param aScriptId Script id of the existing script. |
|
180 * @return KErrNone if no errors. |
|
181 */ |
|
182 virtual TInt RestoreRomScript( TInt aScriptId, |
|
183 const RThread& aClient ) = 0; |
|
184 |
|
185 /** |
|
186 * Parses the script and checks that client is allowed to upgrade |
|
187 * rom based script. The upgrade must have at least the same |
|
188 * upgrade capability level and the client must have the same |
|
189 * capabilities. |
|
190 * @param aScript The upgrade script. |
|
191 * @param aClient Client process thread. |
|
192 * @return KErrNone if upgrade is allowed. |
|
193 */ |
|
194 virtual TInt IsUpgradeAllowed( const TDesC& aName, |
|
195 const TDesC8& aScript, |
|
196 const RThread& aOwnerThread ) = 0; |
|
197 |
|
198 protected: |
|
199 |
|
200 // Deny destruction through this class |
|
201 virtual ~MCFScriptInterface(){}; |
|
202 }; |
|
203 |
|
204 #endif //M_CFSCRIPTINTERFACE_H |