WiSnap User Manual 4.41 05282015-ML
Page 43
-
set dns name
myserver
-
sets the DNS host name of the TCP/IP connection to “myserver”. Once the address
is resolved an automatic connection will be made.
To manually lookup the IP address of a host, use this command:
-
lookup
<string>
-
string is the hostname.
12.6 Utilizing the Backup IP address/connect function
The module contains a feature for auto-retry and redundancy. If the host’s first IP address connection fails, the module uses
the backup IP (if set). If this fails (or is not set), the module uses the first DNS name. If this fails (or is not set), the module uses
the backup DNS name (if set).
To set the backup IP address, use:
set ip backup
<address>
To set the backup DNS name, use:
set dns backup
<string>
13 Using HTML Client Feature
The WiSnap module has a built in HTML client. When enabled, the WiSnap module is capable of getting or posting data to a
web server. Using the HTML client, it is now possible to post serial and/or sensor data to the host web server. This feature
make is possible to provide Wi-Fi capabilities to applications such as GPS units, remote sensors, weather station, etc.
Example:
User wants to retrieve data from web server with this format:
-
http:
//www.webserver.com/ob.php?obvar=WEATHER
Settings:
-
set ip proto 18 -
enable html client
-
set dns name www.webserver.com -
name of your web server
-
set ip address 0 -
so WiSnap will use DNS
-
set ip remote 80 -
standard web server port
-
set com remote 0 -
turn off the REMOTE string so it does not interfere with the post
To make the connection the command would be
open
or inline you can send
open www.webserver.com 80.
The user’s microprocessor should write to the UART:
GET /ob.php?obvar=WEATHER \n\n
where the \n is the LINEFEED character decimal 10 or hex 0xa.Two linefeeds are
required so the web server knows the page is complete.
NOTE:
Some web servers require a carriage return and linefeed to indicate that the page is complete. In this case, use
\r\n
at the end of the string instead of
\n\n
.
13.1 Built-in HTML Client Modes
WiSnap can be setup to automatically post data to and get data from a web server without any external HOST CPU. The
advanced web features are enabled using the
set option format
<flag>
command. This is a bit mapped register. The functions
of the bits are described in the table below:
set option format
<flag>
Bitmapped value.