You add one BLE Component to your Project to enable Bluetooth, then each beacon is entered as a BLE Item under the BLE component. Each beacon requires its own ID number to be typed in so that the system can identify it. Then you add actions to the BLE Items that will occur when users come within the range of the beacon.
For example: the beacon’s interaction with the Project can map and direct consumers’ movement within a space; when the consumer comes close to the beacon, the project can notify them with a text popup of special offers, exclusive rewards or extra product information.
Setting up a BLE Component
- Click the large plus button to the right of your project name – this opens the Component Selector
- Go to the IoT tab
- Insert a BLE Component
- A BLE Component has no Properties to set
Starting Bluetooth Scanning
You will need to add a Set BLE Frequency action somewhere to start Bluetooth scanning. You might place this action on a Page “After Show” event, or on a Button click. If the user has not enabled Bluetooth on their device, they will usually be prompted to allow the App to use Bluetooth.
Go on to add BLE Items under the BLE component for each beacon.
Except for On Enable and On Disable these events require advanced programming knowledge. Refer to IoT/SDK documentation for the other events.
- On Device Connected
- On Device Disconnected
- On Device Discovered
- On Enable: Occurs when Bluetooth has been successfully enabled on the device, after an Enable Bluetooth or Set BLE Frequency action. This may have required the user’s permission to enable it.
- On Disabled: Occurs when Bluetooth has been disabled on the device.
- On Scan Start: Occurs when a scanning cycle starts.
- On Scan End: Occurs when a scanning cycle ends.
Actions affecting the BLE Component
There are several specific actions related to the BLE Component in the b>IoT Actions tab. Using either Set BLE Frequency or Enable Bluetooth is required to start operation.
If you’re only using Beacons, and no other types of Bluetooth device, only the Set BLE Frequency action is useful.
- Set BLE Frequency: Enables Bluetooth and starts scanning for beacons; parameter is frequency in milliseconds.
- Enable Bluetooth: Starts Bluetooth operations, without starting scanning.
- Set BLE Characteristic: Changes a setting or parameter on a Bluetooth device. Provides 3 panels to type into Service ID, Characteristic ID and Value (see below).
- Clear BLE State: Provides a dropdown of BLE Components entered into the app. Select the component you want to clear the Bluetooth functionality from.
- Connect to Bluetooth Device: Provides a panel to type Device ID into so that connection can take place.
Setting BLE Characteristics
When using the Set BLE Characteristic Action, the following parameters are required:
- Services are used to break data up into logic entities, and contain specific chunks of data called characteristics. A service can have one or more characteristics, and each service distinguishes itself from other services by means of a unique numeric ID called a UUID, which can be either 16-bit (for officially adopted BLE Services) or 128-bit (for custom services).
- Characteristics are containers for data. A Characteristic encapsulates a single data point and distinguishes itself via a pre-defined 16-bit or 128-bit UUID. Can use the standard characteristics as listed on the link below to ensure interoperability across and BLE-enabled Hardware/Software or define your own custom characteristics which only your peripheral and Software understands. Characteristics can have either read only or write privileges.
- Value is the value attribute that contains the actual user data that the client can read from and write to for practical information exchanges. It has a specific UUIDs that can refer to a sensor’s reading or a keypress on a keyboard. It can contain any type of data imaginable, from temperatures in celsius to key scan codes to display strings to speeds in miles per hour—anything that can be usefully transmitted over two BLE devices can fill in the contents of that value.
Setting up a BLE Item
Using the plus button on the BLE Component you can add BLE Items for each Bluetooth device you want to scan for. These will be grouped under the BLE Component. These items can be beacons or other devices.
This help describes how to set up beacons. Please visit the IoT/SDK documentation for more technical help with Edison or other Bluetooth devices.
BLE Item properties
|ID||Required. Pops up text editor panel to enter the Beacon ID, an 8 digit hexadecimal value such|
|Close||Defines the signal strength that will be considered “Close”. Slider to indicate signal strength in|
decibels (-180 to 0) The default setting is -80 and is generally a very appropriate level.
|Very Close||Defines the signal strength that will be considered “Very Close”. Slider (-180 to 0) The default|
setting is -60 and is generally a very appropriate level.
BLE Item Events
BLE Items have the following events that can occur:
- On Recognize: The beacon has been found, at any distance. In addition to this event, one of the
following will fire:
- On Recognize Close: The beacon has been found at a close range.
- On Recognize Very Close: The beacon has been found at a very short distance (typically a
- On Recognize Far: The beacon has been found at a further distance.
- On Recognize Closest: The beacon has been found and is the strongest signal (closest) of all the
beacons that have been found.
- On Recognize Closest Lost: The beacon is no longer the closest one found.
- On Device Lost: The beacon was found before but has now been lost – could not be found in the
last scan. Useful for an item security app.
The actions may be connected to the movement of a phone, your car keys or travel luggage as examples.