|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * THIS FILE IS AUTOGENERATED. Do not modify the contents of this file directly |
|
16 * as changes will be lost |
|
17 * Mon Nov 24 15:19:47 2003 |
|
18 * System Includes |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #include <assert.h> |
|
26 |
|
27 |
|
28 /**************************************************************************************** |
|
29 * |
|
30 * Local Includes |
|
31 * |
|
32 ***************************************************************************************/ |
|
33 #include "CSvcUuinterface.h" |
|
34 #include "CSUuinterface.h" |
|
35 #include "CComponentManager.h" |
|
36 |
|
37 |
|
38 /**************************************************************************************** |
|
39 * |
|
40 * Static Variables |
|
41 * |
|
42 ***************************************************************************************/ |
|
43 static CComponentManager<CSUuinterface> *iComponentManager; |
|
44 |
|
45 |
|
46 /**************************************************************************************** |
|
47 * |
|
48 * PUBLIC FUNCTION: ss_startuprpcservice |
|
49 * |
|
50 ***************************************************************************************/ |
|
51 int *ss_startuprpcservice_2( TStartupInfo *aArgs, CLIENT *aDutout ) |
|
52 { |
|
53 static int rv; |
|
54 |
|
55 // if the service is already started then return an error |
|
56 if( iComponentManager != NULL ) { |
|
57 rv = ERR_SERVICE_ALREADY_STARTED; |
|
58 return &rv; |
|
59 } |
|
60 |
|
61 // create the component manager |
|
62 iComponentManager = new CComponentManager<CSUuinterface>( INFO_MAXIMUM_OBJECTS ); |
|
63 if( iComponentManager == NULL ) { |
|
64 rv = ERR_FAILED_TO_CREATE_COMPONENT_MANAGER; |
|
65 return &rv; |
|
66 } |
|
67 |
|
68 // call the custom service manager |
|
69 rv = CSvcUuinterface::StartRPCService( iComponentManager, aArgs ); |
|
70 if( rv != ERR_NONE ) { |
|
71 delete iComponentManager; |
|
72 iComponentManager = NULL; |
|
73 return &rv; |
|
74 } |
|
75 |
|
76 // success |
|
77 rv = ERR_NONE; |
|
78 return &rv; |
|
79 } |
|
80 |
|
81 |
|
82 /**************************************************************************************** |
|
83 * |
|
84 * PUBLIC FUNCTION: sc_shutdownrpcservice |
|
85 * |
|
86 ***************************************************************************************/ |
|
87 int *sc_shutdownrpcservice_2( int *aArgs, CLIENT *aDutout ) |
|
88 { |
|
89 static int rv; |
|
90 int instance_count; |
|
91 int err; |
|
92 |
|
93 // check that the service is started |
|
94 if( iComponentManager == NULL ) { |
|
95 rv = ERR_SERVICE_NOT_RUNNING; |
|
96 return &rv; |
|
97 } |
|
98 |
|
99 // if there are active sessions and the force flag isn't set then return an error |
|
100 instance_count = iComponentManager->GetInstanceCount(); |
|
101 if( (instance_count > 0) && (*aArgs == 0) ) { |
|
102 rv = ERR_ACTIVE_USER_SESSIONS; |
|
103 return &rv; |
|
104 }; |
|
105 |
|
106 // if the force flag IS set then reset all active connections |
|
107 instance_count = iComponentManager->GetInstanceCount(); |
|
108 if( instance_count > 0 ) { |
|
109 err = iComponentManager->DeleteAllInstances(); |
|
110 if( err != 0 ) { |
|
111 rv = ERR_FAILED_TO_REMOVE_ACTIVE_SESSIONS; |
|
112 return &rv; |
|
113 } |
|
114 } |
|
115 |
|
116 // call the custom service manager |
|
117 rv = CSvcUuinterface::StopRPCService(); |
|
118 if( rv != ERR_NONE ) { |
|
119 return &rv; |
|
120 } |
|
121 |
|
122 // delete the component manager |
|
123 delete iComponentManager; |
|
124 iComponentManager = NULL; |
|
125 |
|
126 // success |
|
127 rv = ERR_NONE; |
|
128 return &rv; |
|
129 } |
|
130 |
|
131 |
|
132 /**************************************************************************************** |
|
133 * |
|
134 * PUBLIC FUNCTION: list_devices |
|
135 * |
|
136 ***************************************************************************************/ |
|
137 TComponentList *list_devices_2( void *aArgs, CLIENT *aDutout ) |
|
138 { |
|
139 static TComponentList rv; |
|
140 int i, valid_count, component_instance_count; |
|
141 |
|
142 //free any allocated memory |
|
143 if( rv.TComponentList_val != NULL ) { |
|
144 free( rv.TComponentList_val ); |
|
145 rv.TComponentList_val = NULL; |
|
146 rv.TComponentList_len = 0; |
|
147 } |
|
148 |
|
149 // check that the service is started |
|
150 if( iComponentManager == NULL ) { |
|
151 CSvcUuinterface::SetError( LIST_DEVICES, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
152 return &rv; |
|
153 } |
|
154 |
|
155 // set the return value to generic error |
|
156 CSvcUuinterface::SetError( LIST_DEVICES, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
157 |
|
158 // get the number of active component instances |
|
159 component_instance_count = iComponentManager->GetInstanceCount(); |
|
160 |
|
161 // if there are one or more instances then allocate the memory |
|
162 if( component_instance_count > 0 ) { |
|
163 rv.TComponentList_val = (int*)malloc( sizeof(int) * component_instance_count ); |
|
164 assert( rv.TComponentList_val != NULL ); |
|
165 rv.TComponentList_len = component_instance_count; |
|
166 } |
|
167 |
|
168 // store all the currently active IDs in the list |
|
169 for( i = 0, valid_count = 0; i < INFO_MAXIMUM_OBJECTS; i++ ) { |
|
170 if( iComponentManager->IsValidKey(i) != 0 ) { |
|
171 assert( valid_count < component_instance_count ); |
|
172 (rv.TComponentList_val)[valid_count++] = i; |
|
173 } |
|
174 } |
|
175 |
|
176 // ok return everything |
|
177 return &rv; |
|
178 } |
|
179 |
|
180 |
|
181 /**************************************************************************************** |
|
182 * |
|
183 * PUBLIC FUNCTION: st_setdelay |
|
184 * |
|
185 ***************************************************************************************/ |
|
186 TResult *st_setdelay_2( TConfigValue *aArgs, CLIENT *aDutout ) |
|
187 { |
|
188 static TResult rv; |
|
189 |
|
190 // check that the service is started |
|
191 if( iComponentManager == NULL ) { |
|
192 CSvcUuinterface::SetError( ST_SETDELAY, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
193 return &rv; |
|
194 } |
|
195 |
|
196 // call the corresponding method on the instance |
|
197 rv = CSvcUuinterface::st_setdelay( *aArgs ); |
|
198 return &rv; |
|
199 } |
|
200 |
|
201 |
|
202 /**************************************************************************************** |
|
203 * |
|
204 * PUBLIC FUNCTION: st_setdroppercentage |
|
205 * |
|
206 ***************************************************************************************/ |
|
207 TResult *st_setdroppercentage_2( TConfigValue *aArgs, CLIENT *aDutout ) |
|
208 { |
|
209 static TResult rv; |
|
210 |
|
211 // check that the service is started |
|
212 if( iComponentManager == NULL ) { |
|
213 CSvcUuinterface::SetError( ST_SETDROPPERCENTAGE, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
214 return &rv; |
|
215 } |
|
216 |
|
217 // call the corresponding method on the instance |
|
218 rv = CSvcUuinterface::st_setdroppercentage( *aArgs ); |
|
219 return &rv; |
|
220 } |
|
221 |
|
222 |
|
223 /**************************************************************************************** |
|
224 * |
|
225 * PUBLIC FUNCTION: st_setduplicatepercentage |
|
226 * |
|
227 ***************************************************************************************/ |
|
228 TResult *st_setduplicatepercentage_2( TConfigValue *aArgs, CLIENT *aDutout ) |
|
229 { |
|
230 static TResult rv; |
|
231 |
|
232 // check that the service is started |
|
233 if( iComponentManager == NULL ) { |
|
234 CSvcUuinterface::SetError( ST_SETDUPLICATEPERCENTAGE, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
235 return &rv; |
|
236 } |
|
237 |
|
238 // call the corresponding method on the instance |
|
239 rv = CSvcUuinterface::st_setduplicatepercentage( *aArgs ); |
|
240 return &rv; |
|
241 } |
|
242 |
|
243 |
|
244 /**************************************************************************************** |
|
245 * |
|
246 * PUBLIC FUNCTION: st_setbandwidth |
|
247 * |
|
248 ***************************************************************************************/ |
|
249 TResult *st_setbandwidth_2( TConfigValue *aArgs, CLIENT *aDutout ) |
|
250 { |
|
251 static TResult rv; |
|
252 |
|
253 // check that the service is started |
|
254 if( iComponentManager == NULL ) { |
|
255 CSvcUuinterface::SetError( ST_SETBANDWIDTH, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
256 return &rv; |
|
257 } |
|
258 |
|
259 // call the corresponding method on the instance |
|
260 rv = CSvcUuinterface::st_setbandwidth( *aArgs ); |
|
261 return &rv; |
|
262 } |
|
263 |
|
264 |
|
265 /**************************************************************************************** |
|
266 * |
|
267 * PUBLIC FUNCTION: st_setdrd |
|
268 * |
|
269 ***************************************************************************************/ |
|
270 TResult *st_setdrd_2( TConfigValue *aArgs, CLIENT *aDutout ) |
|
271 { |
|
272 static TResult rv; |
|
273 |
|
274 // check that the service is started |
|
275 if( iComponentManager == NULL ) { |
|
276 CSvcUuinterface::SetError( ST_SETDRD, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
277 return &rv; |
|
278 } |
|
279 |
|
280 // call the corresponding method on the instance |
|
281 rv = CSvcUuinterface::st_setdrd( *aArgs ); |
|
282 return &rv; |
|
283 } |
|
284 |
|
285 |
|
286 /**************************************************************************************** |
|
287 * |
|
288 * PUBLIC FUNCTION: st_clearsettings |
|
289 * |
|
290 ***************************************************************************************/ |
|
291 TResult *st_clearsettings_2( TConfigValue *aArgs, CLIENT *aDutout ) |
|
292 { |
|
293 static TResult rv; |
|
294 |
|
295 // check that the service is started |
|
296 if( iComponentManager == NULL ) { |
|
297 CSvcUuinterface::SetError( ST_CLEARSETTINGS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
298 return &rv; |
|
299 } |
|
300 |
|
301 // call the corresponding method on the instance |
|
302 rv = CSvcUuinterface::st_clearsettings( *aArgs ); |
|
303 return &rv; |
|
304 } |
|
305 |
|
306 |
|
307 /**************************************************************************************** |
|
308 * |
|
309 * PUBLIC FUNCTION: st_stopservice |
|
310 * |
|
311 ***************************************************************************************/ |
|
312 TResult *st_stopservice_2( void *aArgs, CLIENT *aDutout ) |
|
313 { |
|
314 static TResult rv; |
|
315 |
|
316 // check that the service is started |
|
317 if( iComponentManager == NULL ) { |
|
318 CSvcUuinterface::SetError( ST_STOPSERVICE, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
319 return &rv; |
|
320 } |
|
321 |
|
322 // call the corresponding method on the instance |
|
323 rv = CSvcUuinterface::st_stopservice(); |
|
324 return &rv; |
|
325 } |
|
326 |
|
327 |
|
328 /**************************************************************************************** |
|
329 * |
|
330 * PUBLIC FUNCTION: st_reset |
|
331 * |
|
332 ***************************************************************************************/ |
|
333 TResult *st_reset_2( void *aArgs, CLIENT *aDutout ) |
|
334 { |
|
335 static TResult rv; |
|
336 |
|
337 // check that the service is started |
|
338 if( iComponentManager == NULL ) { |
|
339 CSvcUuinterface::SetError( ST_RESET, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
340 return &rv; |
|
341 } |
|
342 |
|
343 // call the corresponding method on the instance |
|
344 rv = CSvcUuinterface::st_reset(); |
|
345 return &rv; |
|
346 } |