RTL.SimpleBeacon Sample
Contents
Location
You can find the Simple Beacon sample project at:
- Start | Programs | Embarcadero RAD Studio 10 Seattle | Samples and navigate to:
Object Pascal\Multi-Device Samples\Device Sensors and Services\Bluetooth\Beacons\Simple Beacon Demo
CPP\Multi-Device Samples\Device Sensors and Services\Bluetooth\Beacons\Simple Beacon Demo
- Subversion Repository:
- http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Seattle/Object%20Pascal/Multi-Device%20Samples/Device%20Sensors%20and%20Services/Bluetooth/Beacons/Simple%20Beacon%20Demo
- http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Seattle/CPP/Multi-Device%20Samples/Device%20Sensors%20and%20Services/Bluetooth/Beacons/Simple%20Beacon%20Demo
Description
This is a sample that shows the use of the Beacon API to search for nearby beacons.
The application uses the following controls:
Button1
: Fires theButton1Click
event handler.Beacon1
: The control that implements the TBeacon component.Memo1
: Displays the messages about discovered beacons.
How to Use the Sample
- Navigate to one of the locations given above and open:
- Delphi: BeaconComponent.dproj.
- C++: BeaconComponentCPP.cbproj.
- Press F9 or choose Run > Run.
- Click the Start button to start searching for beacons.
The application displays the following information in the Memo1
control:
- When a beacon comes into range:
- When a beacon goes out of range:
Implementation
This application uses a TBeacon component to:
- Periodically search for nearby beacons and check whether the discovered beacons are still in range.
- Display information when a beacon comes into range.
- Display information when a beacon goes out of range.
Main Form
The application defines the following event handlers:
Button1Click
: Enables theBeacon1
control.Beacon1BeaconEnter
: The event handler for the OnBeaconEnter event. Displays the information about the beacon that comes into range.Beacon1BeaconExit
: The event handler for the OnBeaconExit event. Displays the information about the beacon that goes out of range.