WiSnap User Manual 4.41 05282015-ML
Page 39
over the Wi-Fi link via the UDP protocol (in this case) and the data coming over the Wi-Fi link (via UDP protocol in this case) will
be sent to the UART.
11.2 UDP Auto Pairing
UDP auto pairing feature temporarily stores the Host IP address of the first remote device that send a UDP packet into the
module. This host IP address is stored in the RAM, which will not survive a sleep or power cycle.
This feature allows the WiSnap module to echo back to any client that sends a UDP packet. To use this feature, the host IP
addresses and set the ip flags.
set ip host 0.0.0.0
set ip flags 0x80
11.3 UDP Retry
This feature adds a level of reliability to the UDP protocol without adding the complete overhead of TCP protocol. When
enabled, the module waits for a response on every UDP packet sent, (any UDP packet coming back in). If the response packet is
not received by approximately 250 ms, the same UDP packet is sent out.
This continues until either:
o
A UDP response is seen, or
o
A new UDP packet is sent from the module and is acknowledged
To enable this feature, use
set ip flags
<value>
.
11.4 Using the UDP Broadcast function
The WiSnap module can be setup to automatically generate UDP broadcast packets. This is useful for a number of reasons:
1.
Some Access Points will disconnect devices that sit idle and don’t send any packets after a time. Using the UDP
broadcast informs the AP that WiSnap is alive and wants to stay associated.
2.
This feature can be used by application programs to auto-discover and auto configure the WiSnap module. If an
application is listening for the UDP broadcast, a number of useful parameters are present in the package that can be
used for auto-discovery. For example, the IP address and port number of the WiSnap are both apart of the packet, and
thus the WiSnap can be connected to and configured remotely with this information.
3.
The MAC address of the associated AP, channel, and RSSI value are available in this packet, thus enabling a simple
location and tracking based function.
By default the WiSnap module now sends out a UDP broadcast to 255.255.255.255 on port 55555 at a programmable interval.
The broadcast address, port and interval are set using the
set broadcast
commands.
NOTE:
You can send the module’s sensor data out via UDP broadcast. The analog-to-digital convertor is 14 bits on a
400 mV signal, which translates to about 24 microvolts (0x61A80 in hex). When you use the
show q
command in
command mode, the module displays the raw readings. However, for HTTP web posting and UDP broadcast packets,
the module shifts the reading by 4 bits (which is a divide by 16) resulting in a 16-bit number. Therefore, if you want
the actual voltage sampled, you must take the 16-bit number and shift it left by 4 bits to get the number of
microvolts. If you must have the value in millivolts (and do not need high accuracy), right shift by another 6 bits,
which is the same as dividing by about 1000.
The format of the packet is: 110 bytes of data: