Knowledge Base

Below is a full explanation of the network commands. Click here for a tutorial with examples of using several of the commands.

Idle ’00 / ’80

Force the SX10509 to the idle state. It’s a good idea to send this command at the end of each session to idle the command processor and ensure it’s ready for the next series of commands. The Xwire transmit buffer takes the following form:

Command

Once this command is executed, the Xwire receive data block takes the following form:

CommandEcho (Equal to the Command byte sent to the SX10509)

Write ’01 / ’81

This command is used to load the data that will be sent to the server. If using a GET request, you must ensure the data

is URL escaped according to RFC3986 Section 2 “Characters”, see http://tools.ietf.org/html/rfc3986#section-2 .

A POST request has no such restriction allowing data to be sent as is. The Xwire transmit buffer takes the following form:

Command, bLength, Data...

Where:

  • bLength is the length of data in this iteration of the command. Each iteration will append data onto that already stored. Setting bLength to zero will erase all existing data, so this should be done before new data is loaded.
  • Data... is bLength bytes of data to append to that already stored. This is what will be sent to the server.

Once this command is executed, the Xwire receive data block takes the following form:

CommandEcho (Equal to the Command byte sent to the SX10509)

Read ’02 / ’82

This command may be used to read data returned by the server in response to a DoGet or DoPost. The DoGet and DoPost responses will indicate how much data is available. The Xwire transmit buffer takes the following form:

Command, bOffsetInc

Where:

  • bOffsetInc is the cumulative starting position for the next read. Set this to zero to (re-)start reading from the beginning of the SX10509 network receive buffer. Each time this is set non-zero, the new read position increments by the same amount. Hence, if this is first set to 0, then 10, then 5 on 3 successive reads, the returned data will start from buffer positions 0, 10 and 15, that is, the 16th received byte.

Once this command is executed, the Xwire receive data block takes the following form:

CommandEcho, bLength, Data...

Where:

  • CommandEcho is identical to the command byte sent to the SX10509
  • bLength is the amount of data returned. Zero means there is no data remaining.
  • Data... is bLength bytes of data from the server.
Server ’03 / ’83

Set the server name where the request will be sent (example: www.splatco.com). Don’t use a leading protocol, ie “http://” as this will automatically be appended by the SX10509. The server name must not exceed 63 characters in length. The Xwire transmit buffer takes the following form:

Command, bLength, Data...

Where:

  • bLength indicates how much data is in this iteration of the command. Setting this to zero will erase any existing server string, and should be done as the first step in setting a new server name.
  • Data... is bLength bytes of the server URL.

Consecutive iterations of the Server command will append data to that already sent. This allows a long server string to be constructed.

Once this command is executed, the Xwire receive data block takes the following form:

CommandEcho (Equal to the Command byte sent to the SX10509)

This command is needed only if the server needs to be changed from the power-up default set in the Server tab of the SX10509 configuration screen.

Port ’04 / ’84

Set the server port where the request should be sent. The Xwire transmit buffer takes the following form:

Command, fPort

Where:

  • fPort is a SPLat floating point value. It must be a whole number and must not exceed 65535. fPort is typically 80 when sending a request to a HTTP server.

Once this command is executed, the Xwire receive data block takes the following form:

CommandEcho (Equal to the Command byte sent to the SX10509)

This command is needed only if the port needs to be changed from the power-up default set in the Server tab of the SX10509 configuration screen.

Path ’05 / ’85

Set the path to the script on the server. Don’t use a leading “/”. The path must not exceed 63 characters in length. The Xwire transmit buffer takes the following form:

Command, bLength, Data...

Where:

  • bLength indicates how much data is in this iteration of the command. Setting this to zero will erase any existing path string, and should be done as the first step in setting a new path.
  • Data is bLength bytes of the path.

Consecutive iterations of the Path command will append data to that already sent to the SX10509. This allows a long path string to be constructed.

Once this command is executed, the Xwire receive data block takes the following form:

CommandEcho (Equal to the Command byte sent to the SX10509)

This command is needed only if the path needs to be changed from the power-up default set in the Server tab of the configuration screen.

ContentType ’06 / ’86

Set the content type (also known as media type) when using a POST request. This is not used when performing a GET request. The content type must not exceed 39 characters in length. The Xwire transmit buffer takes the following form:

Command, bLength, Data...

Where:

  • bLength indicates how much data is in this iteration of the command. Setting this to zero will erase any existing type string, and should be done as the first step in setting a new type.
  • Data is bLength bytes of the content type

Consecutive iterations of the ContentType command will append data to that already sent to the SX10509. This allows a long type string to be constructed.

Once this command is executed, the Xwire receive data block takes the following form:

CommandEcho (Equal to the Command byte sent to the SX10509)

This command is needed only if the content type needs to be changed from the power-up default set in the Server tab of the configuration screen.

DoGet ’07 / ’87

Send a GET request based on the Server, Port, Path and Data that has previously been loaded into the SX10509.

The Xwire transmit buffer take ths following form:

Command

It may take several seconds for the request to be sent and the reply received. Loading any other command while the GET

request is in progress will cancel the GET request. The Xwire receive data block for the reply takes the following form:

CommandEcho,bLength,fResult

Where:

  • CommandEcho is identical to the command byte sent to the SX10509
  • bLength is the total length of data received from the server, truncated to 255 bytes.
  • fResult is the result as sent from the server. This will be 200 if the request completed successfully, 404 if the script couldn’t be found, etc. Refer to RFC2616 section 10 “Status Code Definitions”, see http://tools.ietf.org/html/rfc2616#section-10
DoPost ’08 / ’88

This is just like the DoGet command, except a POST request will be sent instead. For this command, the ContentType string will also be used.

Otherwise, this command is identical to the DoGet command, so please refer to that section for more details.

GetID ’09 / ’89

This command fetches the unique ID of the SX10509. This ID is fixed and cannot be modified.

The Xwire transmit buffer takes the following form:

Command

On completion of the command the Xwire receive data block will take the form:

CommandEcho,bLength,IDString...

Where:

  • CommandEcho is identical to the command byte sent to the SX10509
  • bLength is the number of characters in the ID string (maximum of 8)
  • IDString is the ID number in ASCII.

To help the server identify the source of each request, this ID is automatically sent to the server in the http header

within a field named “X-SPLat-ID”, for example, here’s a full POST request sent by the SX10509:

   -------------------------------------
   POST /sch/weather.php HTTP/1.0
   Host: www.splatco.com:80
   Content-Type: application/x-www-form-urlencoded
   Content-Length: 14
   X-SPLat-ID: 3691053277
   Connection: close

   city=melbourne
   -------------------------------------     

The “city=melbourne” line was sent by the SPLat application using the Write command.

If your server script is written in PHP, a simple method for the server-side script to obtain this ID is as follows:

$id = $_SERVER['HTTP_X_SPLAT_ID'];

GetGMT ‘0A / ‘8A

This command fetches the current epoch time in seconds since 1/1/1970, GMT. This time may be used in a request sent to a server as a timestamp. The Xwire transmit buffer takes the following form:

Command

On completion of the command the Xwire receive data block will take the form:

CommandEcho,bLength,GMTString...

Where:

  • CommandEcho is identical to the command byte sent to the SX10509
  • bLength is the number of characters in the ID string (maximum of 8)
  • GMTString is the GMT number in ASCII.
GetIP ‘0B / ‘8B

This command returns the current LAN IP address of the SX10509. The first three bytes are the IP address as 8-bit unsigned values.

For example, an address of 192.168.1.23 is returned as 192,168,123. The Xwire transmit buffer takes the following form:

Command

On completion of the command the Xwire receive data block will take the form:

CommandEcho,IP_1,IP_2,IP_3

Where:

  • CommandEcho is identical to the command byte sent to the SX10509
  • IP_1 is the first 8-bit number (octet) of the IPv4 IP address, in binary.
  • IP_2 is the second 8-bit number (octet) of the IPv4 IP address, in binary.
  • IP_3 is the third 8-bit number (octet) of the IPv4 IP address, in binary.