9
Figure 3 Script Upload Format
If the
–x
option is found, the script will be automatically executed at the completion of the
download. A minor limitation of the
–x
option is that is does not allow you to pass arguments to
the script upon running it. If this functionality is needed, simply use the
upload
command
without the
–x
option followed by the
run
command.
2.1.11
Ver
The
ver
command will return version information of both the Lua interpreter and the EM405-8
extensions. The result will be output via the same interface from which the command was
received. There are no arguments to the
ver
command.
ver
2.2
STORING SCRIPTS AND SUPPORTING FILES
All scripts and supporting files are stored in a single script pool. Since there are no
subdirectories in the script pool each file must have a unique name. Using the
upload
command
detailed in section 2.1.10, the user can upload and store any file into the script pool. All file
related commands such as
list
,
read
,
remove
,
retrieve
and
run
operate on the script pool.
Files in the script pool are labeled either
sys
or
user
. The system files are scripts that are
furnished by C&H and are stored on the EM405-8 as part of the EM405-8 firmware. These files
include EM405-8 utility scripts. User files are those uploaded by the user. Using the
–l
argument of the
list
command, the
sys
versus
user
type of each file can be determined.
If the EM405-8 being used includes the internal mass storage option, the script pool is
automatically stored on the mass storage device in a non-volatile fashion. If the EM405-8 does
not contain the internal mass storage option, the script pool, with the exception of the system
scripts, is stored in volatile memory and must be uploaded after every power-up. In both cases,
the absolute path of the user script pool is:
/usr/scripts/user
.
There are several symbolic links in the EM405-8 web server host directory and link to the script
pool. These symbolic links allow scripts to be used to create custom web pages and allow these
custom webpage to link to images and other files uploaded by the user. Details on the symbolic
links and the use of scripts to develop custom web pages can be found in section 4.0.
FILE SIZE (4 BYTES)
FILE DATA
0
4
4 + FILE SIZE
Upload Procedure
1. Send the upload command
2. Read the 4-byte Acknowledge
3. If “nck\n” then exit else if “ack\n” continue
4. Connect to the upload port via raw socket
5. Determine the file size
6. Pass the 4-byte
size.
Byte 0 is the least
significant byte.
7. Read the file and pass size bytes to the
EM405-8