Beacon
Last updated
Last updated
Beacons are pieces of hardware that broadcast a unique wireless identifier. Each element of our beacon framework can be used on its own or in tandem, and enables the platform to identify nearby objects - e.g., how close someone or something is and who or what this thing is.
A general overview of how the beacon framework works can be seen below. Beacons can either be our hardware, our app, or third-party Bluetooth Low Energy beacons. When our hardware is in "Beacon Mode" it will scan for nearby beacons that are discoverable. This can either happen constantly, logically through an equation output, or programmatically by an API message. The scanned "Beacon ID" data can then be streamed into our APIs like any other data. "Magic" beacons will be automatically detected, while third-party beacons need to be filtered within the API.
The following properties can be adjusted on a beacon sweep.
State: Either constant for continuous scan or dynamic for logic and message driven scans
ID: Auto will scan for all “magic” beacons, while Manual will scan for all beacons or if a specific unique identifier is passed, with that identifier in its advertisement
Strength: The threshold of RSSI strength (e.g, how strong a signal is) with smaller numbers corresponding to a shorter range and larger numbers to a wider vicinity
Time: how long a sweep should last when it is dynamic as opposed to constant
To get started using the framework you will need one beacon to look for. For this example we will use our app.
The first step is to start broadcasting a unique "Beacon ID" from the app. To do so, press on the infinity symbol in the bottom right hand corner of the home screen and tap the lock under Auto. You can read more on how to use the app as a beacon here: Beacon.
Once the app is broadcasting you can use our hardware and APIs to look for and stream nearby beacons. Hardware must be in "Beacon Mode" which can be enabled though our API. When in "Beacon Mode," a Device will not be able to be found through our app until it is set back to "Stream Mode." The Device will stay in "Beacon Mode" when power cycled.
To scan for beacons, you first have to add the "Beacons" script to any Game Object. This can be found under the Magic>Algorithms folder. Like modules, the "Beacons" script will automatically detect the hardware that is connected. If more than one piece of hardware is connected it will need to be manually set.
To set a Device into "Beacon Mode," make sure a Device is plugged into the computer and then find the corresponding "Device" script (this will default to the Prism Game Object under Nexus>Dimension). Tap on the Mode dropdown menu, choose Beacon, and then click the Set Mode checkbox. This will set The Device into "Beacon Mode." We suggest restarting the Scene after doing so since the data will not be in the correct format as the Device sets itself up on the switch.
The Beacon Script inspector has three sections:
Properties contain the current beacon sweep settings on the connected hardware.
State: if true (checked) it means it is continuously scanning and if false (unchecked) it will scan through an equation or an API message.
Mode: if true (checked) it will scan for all “magic” beacons and if false (unchecked) it will scan for all beacons. If an ID is entered into the box, it will scan for any beacon with that data in its advertisement.
Strength: the current RSSI strength threshold
The Parameters and Function sections work together to allow you to update beacon sweep properties through the inspector. Modify any of the parameters and then click the corresponding checkbox to update the properties. Set State will cause The Device to set it self up again.
The sweep function will ping the hardware to do a sweep, while the empty function will clear the array of the most recently scanned hardware.
To access beacon data in a script you can add the following code to your script: