System.Beacon.Components.TBeacon.OnParseManufacturerData

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnParseManufacturerData;

C++

__property OnParseManufacturerData;

Properties

Type Visibility Source Unit Parent
event published
System.Beacon.Components.pas
System.Beacon.Components.hpp
System.Beacon.Components TBeacon

Description

Occurs when the Bluetooth Low Energy manager discovers a device, and lets you parse the manufacturer-specific data in the advertising data of the discovered device.

System.Beacon.Components.TBeacon.OnParseManufacturerData inherits from System.Beacon.Components.TCustomBeacon.OnParseManufacturerData. All content below this line refers to System.Beacon.Components.TCustomBeacon.OnParseManufacturerData.

Occurs when the Bluetooth Low Energy manager discovers a device, and lets you parse the manufacturer-specific data in the advertising data of the discovered device.

Bluetooth Low Energy devices can advertise themselves so that other Bluetooth Low Energy devices, such as yours, can discover them. Beacons are Bluetooth Low Energy devices that include manufacturer-specific data in their advertising data that allows you to determine the distance between the beacon and your Bluetooth Low Energy device.

The format of that manufacturer-specific data usually follows one of two widely-used standards, either iBeacon or AltBeacon. The beacon component supports those standards, and it can successfully parse any manufacturer-specific data that follows either one of them, as long as you previously configure the right standard to use.

However, there may be beacons that do not follow any of those standards, and provide their data in a format of their own. If that is the case of your beacons, you can implement an event handler for OnParseManufacturerData that parses the incoming manufacturer-specific data and fills a beacon information record.

The event handler of OnParseManufacturerData receives the following parameters:

  • Sender is your beacon component.
  • AData is the manufacturer-specific data from the advertising data of a discovered Bluetooth Low Energy device. AData_High is the number of bytes in AData.
  • BeaconInfo is an instance of TBeaconInfo that you must fill from the data in AData.
  • Handled determines whether your event handler successfully parsed the input data and filled BeaconInfo with the required information (True) or your event handler expects the default parser of the beacon component to parse the input data instead (False). Handled is False by default, make sure that you change its value to True after you successfully parse the input data.

As a starting point for your event handler, check the implementation of the existing parser functions for the supported standards. See TStandardBeaconParser.Parse and TAlternativeBeaconParser.Parse on the platform-specific System.Beacon.Common.pas unit that implements the beacon API for platforms other than iOS. You can find this unit on the C:\Program Files (x86)\Embarcadero\Studio\23.0\source\rtl\net folder.

See Also