Coded Beacon Frame

From SubPos
Jump to: navigation, search

The coding schema in the Wi-Fi beacon frame (with coding masks) has been designed in such a way that it can be inserted into most existing access points, client devices and various APIs. The following is the SSID coding that is transmitted in a beacon frame.

0 161
24bit 24bit (unsigned int) 32bit (signed int) 32bit (signed int) 24bit (unsigned int) 26bit (unsigned int)
Human Readable Tag ("SPS") Unique Device ID` Latitude (decimal degrees, 7dp) or y coordinate in cm's (offset mapping). Longitude (decimal degrees, 7dp) or x coordinate in cm's (offset mapping). Application ID Altitude (cm, from height of mean sea level)~, or or z coordinate in cm's (offset mapping).
162 247
1bit 1bit 1bit 11bit 3bit 13bit 56bit
Below Sea Level (altitude sign bit; 1 = below, 0 = above) or sign bit for z coordinate (offset mapping; 1 = negative, 0 = positive). Offset Mapping Enable (non GPS coords) 3D Location Enable TX Power (EIRP dBm, 1dp)^ Path Loss Coefficient Selection Application Reserved Coding Masks (0x7F and invalid chars)

` Unique to an area, not necessarily the entire world. Generally unique for an Application ID (unless 0).

~ Should be height of floor relative to height of mean sea level, not where the node/access point is mounted, unless 3D location is enabled.

^ Decimal value is offset by +100.0 to create unsigned value (dBm; -100bDm is the minimum 802.11 receive strength, 23dBm is the maximum; note, this doesn't relate to RSSI maximums and minimums). If using transmitter power as a rough guide for this value from the specifications sheet, be sure to use the value of the lowest supported rate, as transmit power will change depending on the modulation scheme. For full compatibility, you should support 802.11b as the lowest support standard which will generally have a higher transmit power and support CCK modulation at 1Mbps. Using different figures here will change the path loss algorithm required to get an accurate result.

Notes

  • All integers are encoded with the MSB as the leftmost bit and the LSB as the rightmost bit in the string (with the start of the string beginning with the human readable tag) and signed integers are two's compliment representations.
  • Beacon frames should be sent at a minimum rate of 1mbps and 802.11b to normalise RSSI across all devices. Different speeds and coding will affect the RSSI.
  • Values with decimal points are stored as fixed point representations and should be handled appropriately (multiply by 10,000,000 before encoding, divide by 10,000,000 after decoding).
  • The length of the coded SSID is only 31 bytes, as some embedded systems use a null terminator on the 32nd byte of the SSID.
  • If a new version of the coded frame specification is released, the starting tag will dictate the version number. SPS = version 1, SP2 = version 2, etc.
  • When using offset mapping, the application developer should determine the center-point of the area and map out from there in the negative and positive axes.
  • Access points or nodes can be placed into learning mode, which enables them to determine their position from other Nodes over time for easy deployment of new beacon sources. When in learning mode, the tag should be SLS (or SL[version_num]).

Implementation

C (reference design) - https://github.com/subpos/ssid_coder/blob/master/coder/ssid_coder.c
Javascript (encoder only) - http://wiki.subpos.org/index.php?title=Javascript_SSID_Coder
Java (decoder only) - https://github.com/subpos/subpos_android_api/blob/master/SPSData.java