7
The script is sent over the TCP/IP server by the EM405-8 in a raw format preceded by 4 bytes
specifying the size of the file as shown in Figure 2. Figure 2 also shows the simple procedure to
download the file.
Figure 2 Retrieve Script Download Format
If the
–d
option is found, the script will be deleted at the completion of the download. A deleted
script is not recoverable therefore care must be taken before sending the
-d
option
2.1.8
Run
The
run
command starts the specified script, launches interactive mode or executes the specified
Lua command. One of the three arguments is required for the
run
command. Only one
argument can be passed in a single run command.
run <argument>
arguments:
<script>
run the specified script
-i
enter interactive mode
(scripting socket only)
-e <command>
executes the specified command
Running a specific script will launch the script in its own process so that it may run
independently and so that the user may launch more that one script. In reality,
the
run
command
is optional.
Scripts can be run by simply sending the name of the script to the EM405-8 as a
command itself. Further, if the file extension of the script is
.lua
than the extension may be
omitted. For example, if the script file is
myscript.lua
then the following three commands
perform the same action of launching the script
run myscript.lua
myscript.lua
myscript
Interactive mode is a special mode of the scripting socket in which the user can type Lua source
code directly to the interpreter to be run immediately. Details on interactive mode can be found
in section 2.3.3. The
–i
option is only valid from the scripting socket interface and does not
return until the socket is closed.
FILE SIZE (4 BYTES)
FILE DATA
0
4
4 + FILE SIZE
Download Procedure
1. Send the download command
2. Read the 4-byte Acknowledge
3. If “nck\n” then exit else if “ack\n” continue
4. Connect to the download port via raw socket
5. Read 4-bytes to determine
size.
Byte 0 is
the least significant byte.
6. Read
size
bytes to buffer
7. Write buffer to file on host computer