|
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 was autogenerated by rpcgen, but should be modified by the developer. |
|
16 * Make sure you don't use the -component_mod flag in future or this file will be overwritten. |
|
17 * Thu Oct 16 14:41:55 2003 |
|
18 * System Includes |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #include <stdio.h> |
|
26 |
|
27 |
|
28 /**************************************************************************************** |
|
29 * |
|
30 * Local Includes |
|
31 * |
|
32 ***************************************************************************************/ |
|
33 #include "CSvcHostexecuteasync.h" |
|
34 #include "hostexecuteasync.h" |
|
35 |
|
36 |
|
37 /**************************************************************************************** |
|
38 * |
|
39 * Macro Functions |
|
40 * |
|
41 ***************************************************************************************/ |
|
42 #define SET_ERROR_CODE(type_name,member_name,ptr_to_result) { \ |
|
43 ptr_to_result = (type_name*)aArgs; \ |
|
44 memset( ptr_to_result, 0, sizeof(type_name) ); \ |
|
45 ptr_to_result->member_name = aError; \ |
|
46 } |
|
47 |
|
48 #define SET_LIST_ERROR_CODE(type_name,ptr_to_result) { \ |
|
49 assert( aError != ERR_NONE ); \ |
|
50 ptr_to_result = (type_name*)aArgs; \ |
|
51 if( ptr_to_result->type_name##_len != 0 ) { \ |
|
52 free( ptr_to_result->type_name##_val ); \ |
|
53 ptr_to_result->type_name##_val = NULL; \ |
|
54 ptr_to_result->type_name##_len = 0; \ |
|
55 } \ |
|
56 } |
|
57 |
|
58 |
|
59 |
|
60 /**************************************************************************************** |
|
61 * |
|
62 * File-scope variables |
|
63 * |
|
64 ***************************************************************************************/ |
|
65 static CComponentManager<CSHostexecuteasync> *iComponentManager; |
|
66 |
|
67 |
|
68 /**************************************************************************************** |
|
69 * |
|
70 * Implementation |
|
71 * |
|
72 ***************************************************************************************/ |
|
73 |
|
74 |
|
75 /**************************************************************************************** |
|
76 * |
|
77 * PUBLIC: GetInstanceKeyFromArgs |
|
78 * |
|
79 ***************************************************************************************/ |
|
80 int CSvcHostexecuteasync::GetInstanceKeyFromArgs( int aMethod, void *aArgs ) |
|
81 { |
|
82 int rv; |
|
83 int *ik_integer; |
|
84 |
|
85 switch( aMethod ) { |
|
86 |
|
87 // Integer params |
|
88 case DSTR_REMOVEPROCESS: |
|
89 case KILLPROCESS: |
|
90 case STOPPROCESS: |
|
91 case GETPROCESSINFO: |
|
92 case GETSTANDARDOUTPUT: |
|
93 case GETSTANDARDERROR: |
|
94 ik_integer = (int*)aArgs; |
|
95 rv = *ik_integer; |
|
96 break; |
|
97 |
|
98 // Error |
|
99 default: |
|
100 rv = ERR_INVALID_METHOD; |
|
101 break; |
|
102 } |
|
103 return rv; |
|
104 } |
|
105 |
|
106 |
|
107 /**************************************************************************************** |
|
108 * |
|
109 * PUBLIC: SetError |
|
110 * |
|
111 ***************************************************************************************/ |
|
112 int CSvcHostexecuteasync::SetError( int aMethod, void *aArgs, int aError ) |
|
113 { |
|
114 int rv; |
|
115 TResult *rv_result; |
|
116 THostExecuteAsyncProcessInfo *rv_proc_info; |
|
117 TVarData *rv_vardata; |
|
118 TComponentList *rv_cl; |
|
119 |
|
120 switch( aMethod ) { |
|
121 |
|
122 // TComponentList |
|
123 case LIST_DEVICES: |
|
124 SET_LIST_ERROR_CODE( TComponentList, rv_cl ); |
|
125 break; |
|
126 |
|
127 // TResult |
|
128 case CSTR_STARTPROCESS: |
|
129 case DSTR_REMOVEPROCESS: |
|
130 case KILLPROCESS: |
|
131 case STOPPROCESS: |
|
132 SET_ERROR_CODE( TResult, iStandardResult, rv_result ); |
|
133 break; |
|
134 |
|
135 // THostExecuteAsyncProcessInfo |
|
136 case GETPROCESSINFO: |
|
137 SET_ERROR_CODE( THostExecuteAsyncProcessInfo, iErrorCode, rv_proc_info ); |
|
138 break; |
|
139 |
|
140 // VarData |
|
141 case GETSTANDARDOUTPUT: |
|
142 case GETSTANDARDERROR: |
|
143 SET_LIST_ERROR_CODE( TVarData, rv_vardata ); |
|
144 break; |
|
145 |
|
146 // Invalid |
|
147 default: |
|
148 rv = ERR_INVALID_METHOD; |
|
149 break; |
|
150 } |
|
151 return rv; |
|
152 } |
|
153 |
|
154 |
|
155 /**************************************************************************************** |
|
156 * |
|
157 * PUBLIC: GetError |
|
158 * |
|
159 ***************************************************************************************/ |
|
160 int CSvcHostexecuteasync::GetError( int aMethod, void *aArgs ) |
|
161 { |
|
162 TResult *result; |
|
163 |
|
164 // check assumption |
|
165 assert( (aMethod == CSTR_STARTPROCESS) || (aMethod == DSTR_REMOVEPROCESS) ); |
|
166 |
|
167 // return error code |
|
168 result = (TResult*)aArgs; |
|
169 return result->iStandardResult; |
|
170 } |
|
171 |
|
172 |
|
173 /**************************************************************************************** |
|
174 * |
|
175 * PUBLIC: StartRPCService |
|
176 * |
|
177 ***************************************************************************************/ |
|
178 int CSvcHostexecuteasync::StartRPCService( CComponentManager<CSHostexecuteasync> *aComponentManager, TStartupInfo *aArg ) |
|
179 { |
|
180 assert( iComponentManager == NULL ); |
|
181 iComponentManager = aComponentManager; |
|
182 return ERR_NONE; |
|
183 } |
|
184 |
|
185 |
|
186 /**************************************************************************************** |
|
187 * |
|
188 * PUBLIC: StopRPCService |
|
189 * |
|
190 ***************************************************************************************/ |
|
191 int CSvcHostexecuteasync::StopRPCService() |
|
192 { |
|
193 iComponentManager = NULL; |
|
194 return ERR_NONE; |
|
195 } |