RTL.BeaconProximityColors Sample

From RAD Studio Code Examples
Jump to: navigation, search

The sample shows how to implement an application for detecting changes on the proximity property of a detected Beacon. The sample indicates if a new beacon has gone into the Inmediate area. If a change is detected, the form changes its background color.

To have this sample working and showing changes, you need a Bluetooth LE beacon compatible to one of the available types: iBeacon or AltBeacon.

Location

You can find the ColorBeaconProximity sample project at:


Description

This sample searches beacons that are advertising its manufacturer data according to one of the available types. This sample is developed using the Beacon framework directly instead of the TBeacon component. In Using Beacons you can find more information about how to implement a beacon application.

BeaconProximityColor.png

How to Use the Sample

  1. Navigate to the location given above and open:
    • Delphi: ColorsBeaconProximity.dproj.
    • C++: ColorsBeaconProximityCPP.cbproj.
  2. Select as a platform, a device with a bluetooth LE sensor.
    Note: See Using Bluetooth for more information about client platform support for Bluetooh LE.
  3. Press F9 or choose Run > Run.
  4. Click Start to start to detect beacons.
  5. Click Stop to stop to detect beacons.

Implementation

When the form is initially shown, the application initializes and configures everything needed for receiving beacons:

Once the OnBeaconProximity event occurs, if the new proximity parameter is Inmediate, the color of the form changes. The color is associated to the beacon which proximity value changes. In this sample, the beacon is identified by its Major ID, you must use the Major ID and/or Minor ID of your beacon instead.

Uses

See Also