1 |
<?xml version="1.0" encoding="UTF-8"?> |
---|
2 |
|
---|
3 |
<!-- |
---|
4 |
Date Author Comments |
---|
5 |
Dec 23, 2004 trout.r@comcast.net Created. |
---|
6 |
Dec 27, 2004 trout.r@comcast.net Added glider disconnect |
---|
7 |
transitions ("... Carrier Detect lost."). |
---|
8 |
Dec 30, 2004 trout.r@comcast.net Commented script. |
---|
9 |
2006-05-19 rtrout@dinkumsoftware.com Add states to send a Ctrl-F after sending |
---|
10 |
a .ma file to the glider. |
---|
11 |
2010-01-24 fnj@webbresearch.com Added support for Science Data Logging (Release 7.0). |
---|
12 |
--> |
---|
13 |
|
---|
14 |
<!-- |
---|
15 |
Used during a mission to transfer sbd and tbd files to the dockserver, transfer an .ma |
---|
16 |
file to the glider, and then re-read the ma file and resume the mission. |
---|
17 |
|
---|
18 |
To change the .ma file sent to the glider, search for two occurances of 'goto_l10.ma' and |
---|
19 |
replace with desired filename. Note this script expects this .ma file to be in the glider's |
---|
20 |
'to-glider' folder on the dockserver machine. |
---|
21 |
|
---|
22 |
For use with dockserver version 1.5 and up. |
---|
23 |
|
---|
24 |
Note: This script has transitions based on loss of Carrier Detect. It may not behave correctly with |
---|
25 |
communications that do NOT support Carrier Detect. |
---|
26 |
--> |
---|
27 |
|
---|
28 |
<gliderScript> |
---|
29 |
<!-- The start state of the script. It waits for a surface dialog and then sends the "s" command. |
---|
30 |
--> |
---|
31 |
<initialState name="sendzModem"> |
---|
32 |
<transitions> |
---|
33 |
<!-- When a surface dialog is seen, send the "s" command and then verify its receipt |
---|
34 |
by the glider. |
---|
35 |
--> |
---|
36 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzModem"> |
---|
37 |
<action type="glider" command="s *.sbd *.tbd"> |
---|
38 |
</action> |
---|
39 |
</transition> |
---|
40 |
</transitions> |
---|
41 |
</initialState> |
---|
42 |
|
---|
43 |
|
---|
44 |
|
---|
45 |
<!-- This state verifies that the "s" command was received by the glider. |
---|
46 |
--> |
---|
47 |
<state name="verifyzModem"> |
---|
48 |
<transitions> |
---|
49 |
<!-- If a surface dialog is seen after the "s" command is sent, comsume it by matching |
---|
50 |
it and remaining in this state. Due to timing over Iridium, more than one surface dialog may |
---|
51 |
be seen between sending the glider a command and seeing that command's echo. |
---|
52 |
While perhaps not absolutely necessary to this script, this transition helps |
---|
53 |
keep the script in sync with what's happening on the glider as indicated by its console output. |
---|
54 |
--> |
---|
55 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzModem"> |
---|
56 |
</transition> |
---|
57 |
<!-- If the "s" command fails to verify - i.e., an echo of the sent command is not seen by the |
---|
58 |
dockserver within a specified time (~ 20 sec), then attempt to resend the command. |
---|
59 |
--> |
---|
60 |
<transition matchExpression="xxx command verify fail xxx" toState="sendzModem"> |
---|
61 |
</transition> |
---|
62 |
<!-- If the sent "s" command is seen, go wait for the zModem transfer to complete. |
---|
63 |
--> |
---|
64 |
<transition matchExpression="s \*.sbd \*.tbd" toState="waitForTransfer"> |
---|
65 |
</transition> |
---|
66 |
<!-- If the glider connection is dropped, attempt to resend the command when the next surface |
---|
67 |
dialog is seen. |
---|
68 |
--> |
---|
69 |
<transition matchExpression="Connection Event: Carrier Detect lost." toState="sendzModem"> |
---|
70 |
</transition> |
---|
71 |
</transitions> |
---|
72 |
</state> |
---|
73 |
|
---|
74 |
|
---|
75 |
<!-- This state looks for indications of zModem transfer success or failure. Note that adding a timeout |
---|
76 |
transition out of this state is dangerous since the time required for a zModem transfer is unknown and |
---|
77 |
highly variable. |
---|
78 |
--> |
---|
79 |
<state name="waitForTransfer"> |
---|
80 |
<transitions> |
---|
81 |
<!-- If a surface dialog is seen, assume the "s" command was missed by the glider or that |
---|
82 |
the glider connection dropped (possibly cancelling the transfer) and it called back - either on |
---|
83 |
the next surfacing or the same surfacing. Resend the command and attempt to verify it was received. |
---|
84 |
--> |
---|
85 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzModem"> |
---|
86 |
<action type="glider" command="s *.sbd *.tbd"> |
---|
87 |
</action> |
---|
88 |
</transition> |
---|
89 |
<!-- If science IS going to transfer, handle new type science side transfer first |
---|
90 |
--> |
---|
91 |
<transition matchExpression="SCIENCE DATA LOGGING: science IS running" toState="waitForNewTypeScienceSideTransfer"> |
---|
92 |
</transition> |
---|
93 |
<!-- If science is NOT going to transfer, skip right to handling new type glider side transfer |
---|
94 |
--> |
---|
95 |
<transition matchExpression="SCIENCE DATA LOGGING: science is NOT running" toState="waitForNewTypeGliderSideTransfer"> |
---|
96 |
</transition> |
---|
97 |
<!-- If science data logging is not present at all, handle old type glider-only transfer |
---|
98 |
--> |
---|
99 |
<transition matchExpression="Enumerating and selecting" toState="waitForOldTypeGliderOnlyTransfer"> |
---|
100 |
</transition> |
---|
101 |
</transitions> |
---|
102 |
</state> |
---|
103 |
|
---|
104 |
|
---|
105 |
|
---|
106 |
<!-- This state looks for indications of zModem transfer success or failure for new type science side transfer. |
---|
107 |
Note that adding a timeout transition out of this state is dangerous since the time required for a zModem |
---|
108 |
transfer is unknown and highly variable. |
---|
109 |
--> |
---|
110 |
<state name="waitForNewTypeScienceSideTransfer"> |
---|
111 |
<transitions> |
---|
112 |
<!-- If a surface dialog is seen, assume the "s" command was missed by the glider or that |
---|
113 |
the glider connection dropped (possibly cancelling the transfer) and it called back - either on |
---|
114 |
the next surfacing or the same surfacing. Resend the command and attempt to verify it was received. |
---|
115 |
--> |
---|
116 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzModem"> |
---|
117 |
<action type="glider" command="s *.sbd *.tbd"> |
---|
118 |
</action> |
---|
119 |
</transition> |
---|
120 |
<!-- If the zModem transfer was successful, go send the next command. |
---|
121 |
--> |
---|
122 |
<transition matchExpression="SCI: SUCCESS" toState="waitForNewTypeGliderSideTransfer"> |
---|
123 |
</transition> |
---|
124 |
<!-- If there were no files to transfer, go send the next command. |
---|
125 |
--> |
---|
126 |
<transition matchExpression="SCI: NO TRANSMISSION" toState="waitForNewTypeGliderSideTransfer"> |
---|
127 |
</transition> |
---|
128 |
<!-- If the transfer explicitly failed, do not attempt to resend the command (it may fail |
---|
129 |
indefinately many times) and go send the next command. |
---|
130 |
--> |
---|
131 |
<transition matchExpression="SCI: Error sending files" toState="waitForNewTypeGliderSideTransfer"> |
---|
132 |
</transition> |
---|
133 |
</transitions> |
---|
134 |
</state> |
---|
135 |
|
---|
136 |
|
---|
137 |
|
---|
138 |
<!-- This state looks for indications of zModem transfer success or failure for new type glider side transfer. |
---|
139 |
Note that adding a timeout transition out of this state is dangerous since the time required for a zModem |
---|
140 |
transfer is unknown and highly variable. |
---|
141 |
--> |
---|
142 |
<state name="waitForNewTypeGliderSideTransfer"> |
---|
143 |
<transitions> |
---|
144 |
<!-- If a surface dialog is seen, assume the "s" command was missed by the glider or that |
---|
145 |
the glider connection dropped (possibly cancelling the transfer) and it called back - either on |
---|
146 |
the next surfacing or the same surfacing. Resend the command and attempt to verify it was received. |
---|
147 |
--> |
---|
148 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzModem"> |
---|
149 |
<action type="glider" command="s *.sbd *.tbd"> |
---|
150 |
</action> |
---|
151 |
</transition> |
---|
152 |
<!-- If the zModem transfer was successful, go send the next command. |
---|
153 |
--> |
---|
154 |
<transition matchExpression="GLD: SUCCESS" toState="sendzrma"> |
---|
155 |
</transition> |
---|
156 |
<!-- If there were no files to transfer, go send the next command. |
---|
157 |
--> |
---|
158 |
<transition matchExpression="GLD: NO TRANSMISSION" toState="sendzrma"> |
---|
159 |
</transition> |
---|
160 |
<!-- If the transfer explicitly failed, do not attempt to resend the command (it may fail |
---|
161 |
indefinately many times) and go send the next command. |
---|
162 |
--> |
---|
163 |
<transition matchExpression="GLD: Error sending files" toState="sendzrma"> |
---|
164 |
</transition> |
---|
165 |
</transitions> |
---|
166 |
</state> |
---|
167 |
|
---|
168 |
|
---|
169 |
|
---|
170 |
<!-- This state looks for indications of zModem transfer success or failure for old type glider-only transfer. |
---|
171 |
Note that adding a timeout transition out of this state is dangerous since the time required for a zModem |
---|
172 |
transfer is unknown and highly variable. |
---|
173 |
--> |
---|
174 |
<state name="waitForOldTypeGliderOnlyTransfer"> |
---|
175 |
<transitions> |
---|
176 |
<!-- If a surface dialog is seen, assume the "s" command was missed by the glider or that |
---|
177 |
the glider connection dropped (possibly cancelling the transfer) and it called back - either on |
---|
178 |
the next surfacing or the same surfacing. Resend the command and attempt to verify it was received. |
---|
179 |
--> |
---|
180 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzModem"> |
---|
181 |
<action type="glider" command="s *.sbd *.tbd"> |
---|
182 |
</action> |
---|
183 |
</transition> |
---|
184 |
<!-- If the zModem transfer was successful, go send the next command. |
---|
185 |
--> |
---|
186 |
<transition matchExpression="SUCCESS" toState="sendzrma"> |
---|
187 |
</transition> |
---|
188 |
<!-- If there were no files to transfer, go send the next command. |
---|
189 |
--> |
---|
190 |
<transition matchExpression="NO TRANSMISSION" toState="sendzrma"> |
---|
191 |
</transition> |
---|
192 |
<!-- If the transfer explicitly failed, do not attempt to resend the command (it may fail |
---|
193 |
indefinately many times) and go send the next command. |
---|
194 |
--> |
---|
195 |
<transition matchExpression="Error sending files" toState="sendzrma"> |
---|
196 |
</transition> |
---|
197 |
</transitions> |
---|
198 |
</state> |
---|
199 |
|
---|
200 |
|
---|
201 |
|
---|
202 |
<!-- This state attempts to send a file to the glider using the "!zr" command. |
---|
203 |
--> |
---|
204 |
<state name="sendzrma"> |
---|
205 |
<transitions> |
---|
206 |
<!-- If a surface dialog is seen, assume the glider is ready to receive a command and |
---|
207 |
send the "!zr" command. Go verify it was received. |
---|
208 |
--> |
---|
209 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzrma"> |
---|
210 |
<action type="glider" command="!dockzr goto_l10.ma"> |
---|
211 |
</action> |
---|
212 |
</transition> |
---|
213 |
<!-- If no surface dialog is seen for 10 minutes, assume the glider has dove and will |
---|
214 |
not reconnect to the dockserver until the next surfacing. To be ready for that next surfacing, |
---|
215 |
go to the initial state of this script. |
---|
216 |
--> |
---|
217 |
<transition timeout="10" toState="sendzModem"> |
---|
218 |
</transition> |
---|
219 |
</transitions> |
---|
220 |
</state> |
---|
221 |
|
---|
222 |
|
---|
223 |
|
---|
224 |
<!-- This state verifies that the "!zr" command was received by the glider. |
---|
225 |
--> |
---|
226 |
<state name="verifyzrma"> |
---|
227 |
<transitions> |
---|
228 |
<!-- If a surface dialog is seen after the "!zr" command is sent, comsume it by matching |
---|
229 |
it and remaining in this state. Due to timing over Iridium, more than one surface dialog may |
---|
230 |
be seen between sending the glider a command and seeing that command's echo. |
---|
231 |
While perhaps not absolutely necessary to this script, this transition helps |
---|
232 |
keep the script in sync with what's happening on the glider as indicated by its console output. |
---|
233 |
--> |
---|
234 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzrma"> |
---|
235 |
</transition> |
---|
236 |
<!-- If the "!zr" command fails to verify - i.e., an echo of the sent command is not seen by the |
---|
237 |
dockserver within a specified time (~ 20 sec), then attempt to resend the command. |
---|
238 |
--> |
---|
239 |
<transition matchExpression="xxx command verify fail xxx" toState="sendzrma"> |
---|
240 |
</transition> |
---|
241 |
<!-- If the command echo is seen, go wait for the zModem transfer to complete. |
---|
242 |
--> |
---|
243 |
<transition matchExpression="!zr" toState="waitForzrma"> |
---|
244 |
</transition> |
---|
245 |
<!-- If the file was not found, resume the mission. |
---|
246 |
--> |
---|
247 |
<transition matchExpression="not found" toState="waitForma"> |
---|
248 |
</transition> |
---|
249 |
<!-- If the glider connection is dropped, attempt to resend the command when the next surface |
---|
250 |
dialog is seen. |
---|
251 |
--> |
---|
252 |
<transition matchExpression="Connection Event: Carrier Detect lost." toState="sendzrma"> |
---|
253 |
</transition> |
---|
254 |
</transitions> |
---|
255 |
</state> |
---|
256 |
|
---|
257 |
|
---|
258 |
<!-- This state waits one minute for a new goto-list file to be updated on the dock server by adding |
---|
259 |
a time out transition. |
---|
260 |
--> |
---|
261 |
<state name="waitForma"> |
---|
262 |
<transitions> |
---|
263 |
<transition timeout="1" toState="sendzrma"> |
---|
264 |
</transition> |
---|
265 |
</transitions> |
---|
266 |
</state> |
---|
267 |
|
---|
268 |
|
---|
269 |
<!-- This state looks for indications of zModem transfer success or failure. Note that adding a timeout |
---|
270 |
transition out of this state is dangerous since the time required for a zModem transfer is unknown and |
---|
271 |
highly variable. |
---|
272 |
--> |
---|
273 |
<state name="waitForzrma"> |
---|
274 |
<transitions> |
---|
275 |
<!-- If a surface dialog is seen, assume the "!zr" command was missed by the glider or that |
---|
276 |
the glider connection dropped (possibly cancelling the transfer) and it called back - either on |
---|
277 |
the next surfacing or the same surfacing. Resend the command and attempt to verify it was received. |
---|
278 |
--> |
---|
279 |
<transition matchExpression="Hit Control-R to RESUME" toState="verifyzrma"> |
---|
280 |
<action type="glider" command="!dockzr goto_l10.ma"> |
---|
281 |
</action> |
---|
282 |
</transition> |
---|
283 |
<!-- If the transfer was successful, go send the reload ma command. |
---|
284 |
--> |
---|
285 |
<transition matchExpression="Done!" toState="sendReloadma"> |
---|
286 |
</transition> |
---|
287 |
<!-- If the transfer explicitly failed, assume it would repeatedly fail. So do not resend and |
---|
288 |
go send the next command. |
---|
289 |
--> |
---|
290 |
<transition matchExpression="FAILED: zr" toState="sendResume"> |
---|
291 |
</transition> |
---|
292 |
</transitions> |
---|
293 |
</state> |
---|
294 |
|
---|
295 |
|
---|
296 |
|
---|
297 |
<!-- This state send a Ctrl-F to cause the glider to reread mafiles. |
---|
298 |
--> |
---|
299 |
<state name="sendReloadma"> |
---|
300 |
<transitions> |
---|
301 |
<!-- If a surface dialog is seen, assume the glider is ready to receive a command and send |
---|
302 |
the Ctrl-F. |
---|
303 |
--> |
---|
304 |
<transition matchExpression="Hit Control-R to RESUME" toState="waitForReloadma"> |
---|
305 |
<action type="glider" command="Ctrl-F"> |
---|
306 |
</action> |
---|
307 |
</transition> |
---|
308 |
<!-- If no surface dialog is seen for 10 minutes, assume the glider dove and go to the |
---|
309 |
start of the script in preparation for the next surfacing. |
---|
310 |
--> |
---|
311 |
<transition timeout="10" toState="sendzModem"> |
---|
312 |
</transition> |
---|
313 |
</transitions> |
---|
314 |
</state> |
---|
315 |
|
---|
316 |
|
---|
317 |
|
---|
318 |
<!-- This state looks for indications of Ctrl-F success or failure. |
---|
319 |
--> |
---|
320 |
<state name="waitForReloadma"> |
---|
321 |
<transitions> |
---|
322 |
<!-- If the Ctrl-F command failed to verify - i.e., the dockserver did not see an echo of |
---|
323 |
the command within ~20 sec of sending it, then attempt to resend it. |
---|
324 |
--> |
---|
325 |
<transition matchExpression="xxx command verify fail xxx" toState="sendReloadma"> |
---|
326 |
</transition> |
---|
327 |
<!-- Once the Ctrl-F is confirmed, go send a Ctrl-R to resume the mission. |
---|
328 |
--> |
---|
329 |
<transition matchExpression="MAFILES will be re-read" toState="sendResume"> |
---|
330 |
</transition> |
---|
331 |
<!-- If no indication of success or failure is seen within 10 minutes, assume the glider dove. Go |
---|
332 |
to the script's first state in preparation for the next surfacing. |
---|
333 |
--> |
---|
334 |
<transition timeout="10" toState="sendzModem"> |
---|
335 |
</transition> |
---|
336 |
<!-- If a surface dialog is seen after sending the Ctrl-F but before an indication of its success, assume |
---|
337 |
the command was missed by the glider. Resend it and wait for success or failure. |
---|
338 |
--> |
---|
339 |
<transition matchExpression="Hit Control-F to RESUME" toState="waitForReloadma"> |
---|
340 |
<action type="glider" command="Ctrl-F"> |
---|
341 |
</action> |
---|
342 |
</transition> |
---|
343 |
</transitions> |
---|
344 |
</state> |
---|
345 |
|
---|
346 |
|
---|
347 |
|
---|
348 |
<!-- This state send a Ctrl-R to cause the glider to resume its mission. |
---|
349 |
--> |
---|
350 |
<state name="sendResume"> |
---|
351 |
<transitions> |
---|
352 |
<!-- If a surface dialog is seen, assume the glider is ready to receive a command and send |
---|
353 |
the Ctrl-R. |
---|
354 |
--> |
---|
355 |
<transition matchExpression="Hit Control-R to RESUME" toState="waitForResume"> |
---|
356 |
<action type="glider" command="Ctrl-R"> |
---|
357 |
</action> |
---|
358 |
</transition> |
---|
359 |
<!-- If no surface dialog is seen for 10 minutes, assume the glider dove and go to the |
---|
360 |
start of the script in preparation for the next surfacing. |
---|
361 |
--> |
---|
362 |
<transition timeout="10" toState="sendzModem"> |
---|
363 |
</transition> |
---|
364 |
</transitions> |
---|
365 |
</state> |
---|
366 |
|
---|
367 |
|
---|
368 |
|
---|
369 |
<!-- This state looks for indications of Ctrl-R success or failure. |
---|
370 |
--> |
---|
371 |
<state name="waitForResume"> |
---|
372 |
<transitions> |
---|
373 |
<!-- If the Ctrl-R command failed to verify - i.e., the dockserver did not see an echo of |
---|
374 |
the command within ~20 sec of sending it, then attempt to resend it. |
---|
375 |
--> |
---|
376 |
<transition matchExpression="xxx command verify fail xxx" toState="sendResume"> |
---|
377 |
</transition> |
---|
378 |
<!-- Once the Ctrl-R is confirmed, go wait for the glider to disconnect - i.e., Iridium hangup |
---|
379 |
--> |
---|
380 |
<transition matchExpression="RESUMING MISSION" toState="waitForDisconnect"> |
---|
381 |
</transition> |
---|
382 |
<!-- If no indication of success or failure is seen within 10 minutes, assume the glider dove. Go |
---|
383 |
to the script's first state in preparation for the next surfacing. |
---|
384 |
--> |
---|
385 |
<transition timeout="10" toState="sendzModem"> |
---|
386 |
</transition> |
---|
387 |
<!-- If a surface dialog is seen after sending the Ctrl-R but before an indication of its success, assume |
---|
388 |
the command was missed by the glider. Resend it and wait for success or failure. |
---|
389 |
--> |
---|
390 |
<transition matchExpression="Hit Control-R to RESUME" toState="waitForResume"> |
---|
391 |
<action type="glider" command="Ctrl-R"> |
---|
392 |
</action> |
---|
393 |
</transition> |
---|
394 |
</transitions> |
---|
395 |
</state> |
---|
396 |
|
---|
397 |
|
---|
398 |
|
---|
399 |
<!-- This state waits for the glider to disconnect and then goes to the script's first state in preparation for the |
---|
400 |
glider's next surfacing. The text "Connection Event: Carrier Detect lost." is always the last text seen when a |
---|
401 |
glider disconnects. Since this state matches that text before going to the script's first state, the glider's console |
---|
402 |
output as seen by the script is cleared before looping back to the first state. This helps prevent some spurious |
---|
403 |
glider output to cause a premature zModem transfer - premature in the sense that the glider has not yet dove |
---|
404 |
and later resurfaced. |
---|
405 |
--> |
---|
406 |
<state name="waitForDisconnect"> |
---|
407 |
<transitions> |
---|
408 |
<!-- To help keep the script in sync with the glider's dialog, wait until the glider hangs up before |
---|
409 |
looping back to the start of this script. Helps insure that any spurious glider dialog that is received |
---|
410 |
before the glider hangs up does not cause a premature transition out of this script's start state. |
---|
411 |
--> |
---|
412 |
<transition matchExpression="Connection Event: Carrier Detect lost." toState="sendzModem"> |
---|
413 |
</transition> |
---|
414 |
</transitions> |
---|
415 |
</state> |
---|
416 |
|
---|
417 |
|
---|
418 |
|
---|
419 |
<finalState name="final" |
---|
420 |
completionCode="0" |
---|
421 |
completionMessage="All OK"> |
---|
422 |
</finalState> |
---|
423 |
</gliderScript> |
---|
424 |
|
---|