The BEACON datasource widget is used to listen for IBeacon and AltBeacon signals.
Restrictions:
BEACON detection can only be used on devices capable of Bluetooth LE.
Attributes
Name
Type
Default
Description
Req
id
string
null
The id of the widget used for databinding.
enabled
bool
true
If the datasource is enabled.
minor
int (0-99)
null
listens only for beacons with the specified minor
major
int (0-99)
null
listens only for beacons with the specified major
distance
int
null
listens only for beacons with the specified distance in meters
onsuccess
string/Event
null
events the broker will execute upon a successful detection
autoexecute
bool
true
if BEACON scanning will commence automatically at startup
Data Point
Name
Type
Description
id
string
The NFC tag serial#
epoch
int
The time (in epoch) the becon was last detected, Beacons that remain undetected for 15 seconds drop off the list and age will be set to 0 once they come back into range.
age
int
The elapsed time (in epoch) this beacon has been detectable
rssi
int
The beacons relative signal strength intensity
macaddress
string
The beacons mac address
power
int
The beacons transmit power level. This is used in ranging
minor
int (0-99)
The beacons minor number. This is a fixed value ranging from 0-99.
major
int (0-99)
The beacons major number. This is a fixed value ranging from 0-99.
distance
double
The beacons distance (in meters) from the reader. This is a rough calulation based on the power transmit and rssi values.
proximity
string
0.0 : "unknown", 0.0 to 0.5 : "immediate", 0.5 to 3.0 "near", > 3.0 "far"
Attributes (Data Specific)
Name
Type
Default
Description
Req
data
List[?]
If the NFC tag text is encoded as a JSON, XML or URL string, it is deserialized, otherwise it is deserialized as a Data Point. Note: URL's do not neeed to be encoded with their fully qualified domain name. To save space, this can be just a query string (with or without the ?). Only the URL's query parameters are deserialized. The resulting item is addressable using standard DOTNOTATION,
queuetype
string
replace
replace, lifo, fifo, append, prepend. Defines the data aggregation strategy for data returned from initial and subsequent calls. replace (default) replaces all data after each subsequent call. lifo (last in first out), fifo (first in first out), append and prepend are all used in conjunction with the maxrecords attribute
maxrecords
int
10000
The maximum size data can grow to. This works in concert with type
root
string
The root tag that defines the repeatable items in data. This can be a nested field. If not specified, the list is segmented by the first repeatable element found in the data set
ttl
int(s,m,h)
0s
Time to Live caches data in the local persistent HIVE database for the period specified. This saves requerying data that changes infrequently
rowcount
int
0
The number of records in data
Methods (Data Specific)
Name
Type
Description
clear()
Clears data. Invoked in any EVENT string using <id>.clear()
add(jsonOrXml, index)
string, int
Deserializes the jsonOrXml string and adds it to the end of data or at position index if specified. Invoked in any EVENT string using <id>.add(jsonOrXml, index)
remove(index)
int
Removes the last item from data or from position index if specified. Invoked in any EVENT string using <id>.remove(index)
reverse()
Reverses data. Invoked in any EVENT string using <id>.reverse()
Events
Name
Type
Description
start()
Starts listening for beacons that are withing range and meet the specified minor, major and distance criteria (if specified). Invoked in any EVENT string using <id>.start()
stop()
Starts listening for beacons. Invoked in any EVENT string using <id>.stop()
Examples
Example #1
<FML>
<BEACONid="b1"/>
<BOXcenter="true">
<TXTvalue="The Closest Beacon is: {b1.data.id}"/>
</BOX>
</FML>