RTL.ExtendedBeaconScanner Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows how to scan for Beacon devices using different scan modes: Standard, Alternative, Eddyston, and Extended.

When selecting the Extended mode, the sample allows you to select the kind of Beacon device to scan: iBeacon, AltBeacon, and Eddystone. The Extended mode allows scanning all different kind of beacon devices simultaneously.

Location

You can find the ExtendedBeaconScanner sample project at:

Description

This sample shows how to use the Extended scan mode to discover all kind of beacons at the same time.

Using the Extended scan mode, the application is able to discover non-registered beacons.

The demo also works with the Standard, Alternative, and Eddyston modes to discover registered beacons.

How to Use the Sample

  1. Navigate to the location given above and open AllBeaconsScanner.dproj.
  2. Press F9 or choose Run > Run.
  3. Select the scan mode: Standard, Alternative, Eddyston, or Extended.
  4. When selecting Extended as the scan mode, select the kind of beacon to scan: iBeacon, AltBeacon, and Eddystone.
  5. Select Device Inf. to show information about the discovered devices in the TListView.
  6. Click SCAN to start scanning for devices.

Implementation

This application uses a TBeacon component:

  • The Mode property is used to define the scan mode. The value that comes by default is extended.
  • The ModeExtended property indicates which kind of beacons to monitor. The values that comes by default are: [iBeacons, AltBeacons, Eddystones].

SCAN Button

The Mode property and the ModeExtended property are defined using two functions:

  • GetScanningModeChecked function checks the Scan mode selected in the Scan mode panel of the application. Modes are mutually exclusive.
  • GetKindOfBeaconsChecked function checks the kind of beacon selected in the Extended mode panel of the application. The Extended mode allows you to scan for several kinds of beacons at the same time.

The SCAN button calls the StartScan method to start monitoring beacons.

STOP SCANNING Button

The STOP SCANNING button calls the StopScan method to stop monitoring beacons.

Device Information

When Device Inf is selected, the TListView is filled with the information of the discovered devices.

The TTimer component is used to print the information in the TListView after the specified time interval, in this case 1 second.

The OnTimer event triggers the Timer1Timer procedure after the defined time interval.

The Timer1Timer procedure checks the BeaconList and gets information about the devices.

Uses

See Also