|
1 /* |
|
2 * Copyright (c) 2008 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: TestMessages |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TESTMESSAGES_H |
|
19 #define TESTMESSAGES_H |
|
20 |
|
21 #include <assert.h> |
|
22 #include <string> |
|
23 |
|
24 #include "logger.h" |
|
25 #include "javauid.h" |
|
26 #include "comms.h" |
|
27 #include "commsmessage.h" |
|
28 |
|
29 using java::util::Uid; |
|
30 |
|
31 using namespace java::comms; |
|
32 |
|
33 namespace java |
|
34 { |
|
35 namespace captain |
|
36 { |
|
37 |
|
38 const int IPC_MESSAGE_TEST_ACK = 100; |
|
39 inline void setAckParameters(CommsMessage& aMessage, int& success) |
|
40 { |
|
41 aMessage.setMessageId(IPC_MESSAGE_TEST_ACK); |
|
42 aMessage << success; |
|
43 } |
|
44 inline void getAckParameters(CommsMessage& aMessage, int& success) |
|
45 { |
|
46 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_ACK); |
|
47 aMessage >> success; |
|
48 } |
|
49 |
|
50 const int IPC_MESSAGE_TEST_EXTENSIONPLUGIN_LOAD_REQ = 200; |
|
51 inline void setLoadExtensionPluginReqParameters(CommsMessage& aMessage, const std::string& pluginName) |
|
52 { |
|
53 aMessage.setMessageId(IPC_MESSAGE_TEST_EXTENSIONPLUGIN_LOAD_REQ); |
|
54 aMessage << pluginName; |
|
55 } |
|
56 inline void getLoadExtensionPluginReqParameters(CommsMessage& aMessage, std::string& pluginName) |
|
57 { |
|
58 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_EXTENSIONPLUGIN_LOAD_REQ); |
|
59 aMessage >> pluginName; |
|
60 } |
|
61 |
|
62 const int IPC_MESSAGE_TEST_EXTENSIONPLUGIN_UNLOAD_REQ = 300; |
|
63 inline void setUnloadExtensionPluginReqParameters(CommsMessage& aMessage, const std::string& pluginName) |
|
64 { |
|
65 aMessage.setMessageId(IPC_MESSAGE_TEST_EXTENSIONPLUGIN_UNLOAD_REQ); |
|
66 aMessage << pluginName; |
|
67 } |
|
68 inline void getUnloadExtensionPluginReqParameters(CommsMessage& aMessage, std::string& pluginName) |
|
69 { |
|
70 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_EXTENSIONPLUGIN_UNLOAD_REQ); |
|
71 aMessage >> pluginName; |
|
72 } |
|
73 |
|
74 const int IPC_MESSAGE_TEST_LAUNCH_APP_REQ = 550; |
|
75 inline void setLaunchAppParameters(CommsMessage& aMessage, const Uid& aUid, |
|
76 const int& aType, const std::string& aRtc) |
|
77 { |
|
78 aMessage.setMessageId(IPC_MESSAGE_TEST_LAUNCH_APP_REQ); |
|
79 aMessage.setModuleId(PLUGIN_ID_JAVACAPTAIN_TESTER_C); |
|
80 aMessage << aUid << aType << aRtc; |
|
81 } |
|
82 inline void getLaunchAppParameters(CommsMessage& aMessage, Uid& aUid, |
|
83 int& aType, std::string& aRtc) |
|
84 { |
|
85 aMessage >> aUid >> aType >> aRtc; |
|
86 } |
|
87 |
|
88 const int IPC_MESSAGE_TEST_TERMINATE_APP_REQ = 551; |
|
89 inline void setTerminateAppParameters(CommsMessage& aMessage, const Uid& aUid) |
|
90 { |
|
91 aMessage.setMessageId(IPC_MESSAGE_TEST_TERMINATE_APP_REQ); |
|
92 aMessage.setModuleId(PLUGIN_ID_JAVACAPTAIN_TESTER_C); |
|
93 aMessage << aUid; |
|
94 } |
|
95 inline void getTerminateAppParameters(CommsMessage& aMessage, Uid& aUid) |
|
96 { |
|
97 aMessage >> aUid; |
|
98 } |
|
99 |
|
100 const int IPC_MESSAGE_TEST_ENABLE_APP_REQ = 600; |
|
101 inline void setEnableAppParameters(CommsMessage& aMessage, const Uid& aUid) |
|
102 { |
|
103 aMessage.setMessageId(IPC_MESSAGE_TEST_ENABLE_APP_REQ); |
|
104 aMessage.setModuleId(PLUGIN_ID_JAVACAPTAIN_TESTER_C); |
|
105 aMessage << aUid; |
|
106 } |
|
107 inline void getEnableAppParameters(CommsMessage& aMessage, Uid& aUid) |
|
108 { |
|
109 aMessage >> aUid; |
|
110 } |
|
111 const int IPC_MESSAGE_TEST_DISABLE_APP_REQ = 700; |
|
112 inline void setDisableAppParameters(CommsMessage& aMessage, const Uid& aUid) |
|
113 { |
|
114 aMessage.setMessageId(IPC_MESSAGE_TEST_DISABLE_APP_REQ); |
|
115 aMessage.setModuleId(PLUGIN_ID_JAVACAPTAIN_TESTER_C); |
|
116 aMessage << aUid; |
|
117 } |
|
118 inline void getDisableAppParameters(CommsMessage& aMessage, Uid& aUid) |
|
119 { |
|
120 aMessage >> aUid; |
|
121 } |
|
122 |
|
123 const int IPC_MESSAGE_TEST_PROCESS_START = 701; |
|
124 inline void setProcessStartParameters(CommsMessage& aMessage, const std::string& exe, const std::string& params) |
|
125 { |
|
126 aMessage.setMessageId(IPC_MESSAGE_TEST_PROCESS_START); |
|
127 aMessage << exe << params; |
|
128 } |
|
129 inline void getProcessStartParameters(CommsMessage& aMessage, std::string& exe, std::string& params) |
|
130 { |
|
131 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_PROCESS_START); |
|
132 aMessage >> exe >> params; |
|
133 } |
|
134 |
|
135 const int IPC_MESSAGE_TEST_PROCESS_KILL = 702; |
|
136 inline void setProcessKillParameters(CommsMessage& aMessage, const int& aPid) |
|
137 { |
|
138 aMessage.setMessageId(IPC_MESSAGE_TEST_PROCESS_KILL); |
|
139 aMessage.setModuleId(PLUGIN_ID_JAVACAPTAIN_TESTER_C); |
|
140 aMessage << aPid; |
|
141 } |
|
142 inline void getProcessKillParameters(CommsMessage& aMessage, int& aPid) |
|
143 { |
|
144 aMessage >> aPid; |
|
145 } |
|
146 const int IPC_MESSAGE_TEST_PROCESS_TERMINATE = 703; |
|
147 inline void setProcessTerminateParameters(CommsMessage& aMessage, const int& aPid) |
|
148 { |
|
149 aMessage.setMessageId(IPC_MESSAGE_TEST_PROCESS_TERMINATE); |
|
150 aMessage.setModuleId(PLUGIN_ID_JAVACAPTAIN_TESTER_C); |
|
151 aMessage << aPid; |
|
152 } |
|
153 inline void getProcessTerminateParameters(CommsMessage& aMessage, int& aPid) |
|
154 { |
|
155 aMessage >> aPid; |
|
156 } |
|
157 |
|
158 const int IPC_MESSAGE_TEST_START_SECONDS_TIMER = 710; |
|
159 const int IPC_MESSAGE_TEST_START_JAVATIME_TIMER = 711; |
|
160 const int IPC_MESSAGE_TEST_STOP_TIMER = 715; |
|
161 const int IPC_MESSAGE_TEST_TIMER_ACK = 716; |
|
162 const int IPC_MESSAGE_TEST_TIMEOUT = 720; |
|
163 |
|
164 inline void setTimerStartSecondsParameters(CommsMessage& aMessage, const int& aTimeout) |
|
165 { |
|
166 aMessage.setMessageId(IPC_MESSAGE_TEST_START_SECONDS_TIMER); |
|
167 aMessage << aTimeout; |
|
168 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
169 "IPC_MESSAGE_TEST_START_SECONDS_TIMER (timeout=%d) encoded", aTimeout); |
|
170 } |
|
171 inline void getTimerStartSecondsParameters(CommsMessage& aMessage, int& aTimeout) |
|
172 { |
|
173 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_START_SECONDS_TIMER); |
|
174 aMessage >> aTimeout; |
|
175 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
176 "IPC_MESSAGE_TEST_START_SECONDS_TIMER (timeout=%d) decoded", aTimeout); |
|
177 } |
|
178 |
|
179 inline void setTimerStartJavaTimeParameters(CommsMessage& aMessage, const long long& aTimeout) |
|
180 { |
|
181 aMessage.setMessageId(IPC_MESSAGE_TEST_START_JAVATIME_TIMER); |
|
182 aMessage << aTimeout; |
|
183 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
184 "IPC_MESSAGE_TEST_START_JAVATIME_TIMER (timeout=%u) encoded", aTimeout); |
|
185 } |
|
186 inline void getTimerStartJavaTimeParameters(CommsMessage& aMessage, long long& aTimeout) |
|
187 { |
|
188 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_START_JAVATIME_TIMER); |
|
189 aMessage >> aTimeout; |
|
190 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
191 "IPC_MESSAGE_TEST_START_JAVATIMER_TIMER (timeout=%u) decoded", aTimeout); |
|
192 } |
|
193 |
|
194 inline void setTimerStopParameters(CommsMessage& aMessage, const int& aTimerId) |
|
195 { |
|
196 aMessage.setMessageId(IPC_MESSAGE_TEST_STOP_TIMER); |
|
197 aMessage << aTimerId; |
|
198 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
199 "IPC_MESSAGE_TEST_STOP_TIMER (timerId=0x%x) encoded", aTimerId); |
|
200 } |
|
201 inline void getTimerStopParameters(CommsMessage& aMessage, int& aTimerId) |
|
202 { |
|
203 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_STOP_TIMER); |
|
204 aMessage >> aTimerId; |
|
205 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
206 "IPC_MESSAGE_TEST_STOP_TIMER (timerId=0x%x) decoded", aTimerId); |
|
207 } |
|
208 |
|
209 inline void setTimerAckParameters(CommsMessage& aMessage, const int& aTimerId) |
|
210 { |
|
211 aMessage.setMessageId(IPC_MESSAGE_TEST_TIMER_ACK); |
|
212 aMessage << aTimerId; |
|
213 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
214 "IPC_MESSAGE_TEST_TIMER_ACK (timerId=0x%x) encoded", aTimerId); |
|
215 } |
|
216 inline void getTimerAckParameters(CommsMessage& aMessage, int& aTimerId) |
|
217 { |
|
218 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_TIMER_ACK); |
|
219 aMessage >> aTimerId; |
|
220 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
221 "IPC_MESSAGE_TEST_TIMER_ACK (timerId=0x%x) decoded", aTimerId); |
|
222 } |
|
223 |
|
224 inline void setTimeoutParameters(CommsMessage& aMessage, const int& aTimerId) |
|
225 { |
|
226 aMessage.setMessageId(IPC_MESSAGE_TEST_TIMEOUT); |
|
227 aMessage << aTimerId; |
|
228 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
229 "IPC_MESSAGE_TEST_TIMEOUT (timerId=0x%x) encoded", aTimerId); |
|
230 } |
|
231 inline void getTimeoutParameters(CommsMessage& aMessage, int& aTimerId) |
|
232 { |
|
233 assert(aMessage.getMessageId() == IPC_MESSAGE_TEST_TIMEOUT); |
|
234 aMessage >> aTimerId; |
|
235 LOG1(EJavaCaptain, EInfoHeavyLoad, |
|
236 "IPC_MESSAGE_TEST_TIMEOUT (timerId=0x%x) decoded", aTimerId); |
|
237 } |
|
238 |
|
239 |
|
240 } // namespace captain |
|
241 } // namespace java |
|
242 |
|
243 |
|
244 #endif // TESTMESSAGES_H |
|
245 |