Back to WiFiStation Documentation

WiFiStation: sendload

sendload is a command-line program for using WiFiStation’s AT$UPLOAD command over a serial connection.

To upload a program over the WiFiStation’s HTTP interface, use a utility like curl that supports HTTP 307 redirections:

$ curl -L -F file=@msterm.bin http://192.168.1.123/upload

Installation

Fetch the Git tree, then compile and install:

$ git clone https://github.com/jcs/WiFiStation
[...]
$ cd WiFiStation/host
$ make
[...]
$ sudo make install
[...]

On BSD systems you’ll need to use gmake.

Usage

$ sendload
usage: sendload [-d] [-s serial speed] <serial device> <file>

To upload a file msterm.bin to the MailStation over the WiFiStation’s USB serial device /dev/cuaU0 at its default speed of 115200:

$ sendload /dev/cuaU0 msterm.bin

Details

WSLoader needs to know the size of the program it’s receiving, to know when to stop expecting more input and execute it.

WiFiStation’s AT$UPLOAD command requires this size as an argument to the AT$UPLOAD command, which it sends to WSLoader.

[...]
AT$UPLOAD 12345
OK send your 12345 bytes

sendload is passed the name of a file so it can check the size of the file and send it with the AT$UPLOAD command.

Every byte received by AT$UPLOAD is XORed into a running checksum. Every 32 bytes, it prints this checksum to the serial connection, which sendload reads and compares to its own running checksum. This is done partially to ensure no bytes are lost along the serial connection but also to act as a rate limiting measure to avoid overflowing the WiFiStation’s serial input buffer.