User Tools

Site Tools


en:hsmodem:filetx

File Transfer Format

the File Types 2-5 (Image and File Transfer) are using this payload data which is transferred after Byte 0 (File Type) and Byte 1 (Frame Information). So the following contents start at Byte 2.

The file has to be splited into parts fitting into the payload (219 bytes) until everything is transferred. If the last frame is not completely used fill the remaining bytes with 0x00.

First Frame:

the first frame does not only contain file data but has also a file header with this contents. The Frame Information byte must be set to 0.

  • 50 Bytes … Filename. The receiver will store the file under this name. Images should have extension .jpg, HTML file .htm or .html and other files can have any filename.
  • 2 Bytes … CRC16 of the file name or any other unique 16bit ID which can be used to identify this file. The receiver will use it to store file fragments in case the file cannot be transferred without errors.
  • 3 Bytes … (24bit) file size in Bytes. Please note that the maximum file size in HSmodem is 200kByte. The file size is stored MSB first.
  • remaining 163 Bytes … first junk of file data

Example for the first frame of a larger image file:
length: 2 Bytes (Frame Type and Frame Information) + 219 Bytes payload = 221 byte

Byte 0 … 0x02 (file type: image)
Byte 1 … 0x00 (first frame of this file)
Byte 2-51 … filename
Byte 52-53 … CRC16 of the 50 byte long filename
Byte 53-55 … file size in bytes (max 200kByte)
Byte 56-220 … first fragment of file data

Next Frame:

second or consecutive frames. The Frame Information byte must be set to 1.

length: 2 Bytes (Frame Type and Frame Information) + 219 Bytes payload = 221 byte

Byte 0 … 0x02 (file type: image)
Byte 1 … 0x01 (next frame of this file)
Byte 2-220 … next fragment of file data

Last Frame:

Last frame for this file transfer. The Frame Information byte must be set to 2.

length: 2 Bytes (Frame Type and Frame Information) + 219 Bytes payload = 221 byte

Byte 0 … 0x02 (file type: image)
Byte 1 … 0x02 (next frame of this file)
Byte 2-220 … last fragment of file data (unused bytes filled with 0x00)

very small files:

for small files using only one frame (length ⇐163): the Frame Information byte must be set to 3.

Example for a very small file:
length: 2 Bytes (Frame Type and Frame Information) + 219 Bytes payload = 221 byte

Byte 0 … 0x02 (file type: image)
Byte 1 … 0x03 (first+last frame of this file)
Byte 2-51 … filename
Byte 52-53 … CRC16 of the 50 byte long filename
Byte 53-55 … file size in bytes (max 200kByte)
Byte 56-220 … file data (unused bytes filled with 0x00)

Compression

Images: images have to be sent as JPG files with a resolution of max. 640 x 480 pixel or less (this is just a limit of the oscardata.exe GUI, HSmodem can transfer any size as long as the total file size is smaller 200kbyte)

Files (Ascii, HTML or binary): files have to be ZIP compressed before transmission.

ZIP-Filename: must be the pure filename (without path) of the file to be transferred.
Filename of the compressed file inside the ZIP file: same as ZIP-Filename.

The ZIP-Filename will be shown to the user during a reception. The filename inside the ZIP will be used to store this file on the receivers disk, so the best rule is to keep both filenames identical.

en/hsmodem/filetx.txt · Last modified: 2021/03/28 19:14 (external edit)