User manual
WiSnap User Manual 4.41 10202014-ML
Page 44
Value
Wake Reason
0
Undefined
1
Power on or hardware reset (battery install or power up)
2
Sleep (wake when the sleep timer is expired)
3
Sensor
4
Undefined
5
Button (WiSnap-AAA serial adapter only)
6
Software reboot
7
Watchdog
Example:
- set option format 1 - automatically send an HTML data header
- set option format 7 - append sensor data in ASCII hex format
- set option format 11 - append all key value pairs to the sensor data
13.2 Automatically periodically connect to web server
The WiSnap module can be setup to automatically post data to a web server using the set sys auto <value> command, where
<value> is a decimal number representing seconds. For example, the WiSnap module can be configured to connect to the web
server every 10 seconds by using the set sys auto 10.
The example below illustrates the commands to configure WiSnap for connecting to the web server every 30 seconds.
1) set com remote GET$/ob.php?obvar=WEATHER - setup the string
2)
set sys auto 30 - auto connect every 30 seconds
3) set option format 1 - auto send header once connection is opened
4)
set ip proto 18 - turn on HTTP mode=0x10 + TCP mode = 0x2
Note (1): when HTTP mode is set, the WiSnap automatically appends the \n\n to the end of the packet.
Note (2): if the html header contains spaces, the $ is required when entering the string. Space is the command
delimiter. When WiSnap command parser sees $ it will convert this to a SPACE character.
13.3 Automatically connect to web server on UART data
WiSnap supports a mode in which it can connect to the web server when it receives UART data. In this mode, connection to the
web server will be triggered on UART data.
Example:
- set ip proto 18 - turn on HTTP mode=0x10 + TCP mode = 0x2
-
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 GET$/userprog.php?DATA= - sample server application
-
set uart mode 2 - automatically connect using data TRIGGER mode
Then when the serial UART data comes in, WiSnap auto connects to the web server, and will automatically send
GET
/userprog.php?DATA=<users
serial data> \n\n