User:Davidv BeaconFence

From RAD Studio
Jump to: navigation, search

Go Up to User:Davidv


BeaconFence allows you to exploit the main Geofencing features in your application. BeaconFence is an improved TBeaconManager that now embeds a new Map Editor that helps you design a map of a physical space of interest, such as a geographic area, a building, or in general any real or virtual environment you may desire to create.

BeaconFence provides your application on a BLE device with the following features:

  • Monitor beacons and fire proximity events.
  • Define zones and fire proximity events for: entering zone, exiting zone and approaching zone.
  • Compute automatically the position of your BLE mobile device in a map.
  • Calculate a desired path between points of interest in a map.

Using BeaconFence

In order to start using TBeaconMapFencing you must include the System.Beacon.Fencing unit and enable the component so that the fencing location process starts.

BeaconMapFencing1.Enabled := True;

Setting a Map

In order to set a map in your application you can choose between two alternatives:

Note:*Use OnBeforeMapChange to manage custom actions before a map changes.
  • Use ProjectInformation to access information regarding with detected Beacons and calculated paths in the XML map project.

Setting Option Properties

Now you can use BeaconManagerOptions to change the following visual options for the current map:

  • ColorBeacon
  • HighlightZones
  • ShowPosition
  • ShowPositionInPath
  • ShowBeacons
  • ShowBeaconSignal
  • ShowZones
  • ShowPaths

Yet to include content about (distribute accordinly to their specific subsecs):

  • property Enabled;
  • property XMLMap;
  • property PaintControl;
  • property ParticleFilterOptions;

Proximity Events

  • OnBeaconEnter: Fired when a new detected beacon within a reachable distance.
  • OnBeaconExit: Fired when a beacon is no longer detected within a reachable distance.
  • OnBeaconProximity: Fired every time the proximity to a beacon changes.



Zone Events

  • OnZoneEnter: Fired when the calculated position is inside a defined zone.
  • OnZoneExit: Fired when the calculated position leaves a defined zone.

Computing Position

The API for BeaconFence provides the System.Beacon.Fencing.PositionCalculator unit, where you can find the necessary classes used to estimate the current position of your BLE device in a specific map.

Custome implementation

System.Beacon.Fencing.PositionCalculator includes abstract classes that you can override in order to implement your custom design for the position calculator. To that end, you have to override the methods in an object of type TPositionCalculatorClass.

Note: Use the OnEstimgatingPosition] event to retreive the estimate of the current position at runtime.
  • OnCalcPosition: Fired before a position is calculated.
  • OnPositionEstimated: Fired when the calculated position changes.

Calculating Path

TCustomBeaconMapFencing.ShowPathToNodeIndex


System.Beacon.Fencing.PathFinder.pas (Graph implementation to be used to find paths)-->Just one record used to calculate routes between points. Currently is an implementation of Dijkstra algorithm.

Also has two class functions to calculate distances bewtween points and a point and a segment (that probably will be moved to another unit.)

System.Beacon.Fencing.PathFinder.pas

See Also