• Overview
  • Principle
  • Implementation
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
A "beacon" is a hardware transmitter that can "dialog" on a small perimeter with smartphones or tablets via a Bluetooth connection. The technology used is the one of BTLE (Bluetooth Low Energy).
The Beacon can for example indicate the proximity of an art masterpiece in a museum; the application can display the explanation text, or it can start a video or an audio file.
On the commercial side, a Beacon can trigger a message regarding a bargain on a nearby product. A Beacon can also inform a user that he is not far away from a store that sells a product he is looking for.
An application asks the phone to be warned when one or more Beacons are found nearby. This application can be closed immediately, therefore it consumes no battery.
When the phone detects a Beacon, it restarts the application and transmits the Beacon information.
Furthermore, the phone warns the application when it exits from the emission area of Beacon.
Several WLanguage functions and 2 specific types can be used to manage Beacons.
AndroidAndroid Widget Caution: In Android, the management of Beacons uses the Android Beacon Library module, subject to license. You must comply with this license, available from the WINDEV Mobile license.
Depending on the use mode of your application, you have the ability to use one of the following methods:
  • Method 1: Automatic detection of Beacons
    This method consists in detecting groups of Beacons in the background with BeaconDetectBackground. A specific action is performed when a group of Beacons is detected. Example:
    // In a museum, we want to trigger the reading (resp. the stop) of an audio guide
    // when the visitor enters into (resp. exits from) a room.
    // Each Beacon is associated with the same UUID corresponding to the museum and
    // a Major number corresponding to the room in which the beacon will be positioned.
    // A Beacon is placed at each entrance to each room of the museum..
    // The application must call the BeaconDetectBackground function
    // with an array of BeaconGroup variables corresponding to each museum room.
    // The callback procedure passed as parameter to the function will be called
    // whenever entering into or exiting from a room and it will give information
    // about the detected groupe of beacons in order to
    // emulate the audio-guide to play the corresponding track.
    // Museum UUID
    sUUID is string = "f4231ab6-5ef2-6c99-4229-af6c72e0446e"
    // Create a beaconGroup variable for each room
    groupRoom1 is beaconGroup
    groupRoom1.UUID = sUUID
    groupRoom1.Major = 1
    groupRoom2 is beaconGroup
    groupRoom2.UUID = sUUID
    groupRoom2.Major = 2
    groupRoom3 is beaconGroup
    groupRoom3.UUID = sUUID
    groupRoom3.Major = 3
    groupRoom4 is beaconGroup
    groupRoom4.UUID = sUUID
    groupRoom4.Major = 4
    // Start the detection
    arrBeaconGroup is array of beaconGroup = [groupRoom1, ...
       groupRoom2, groupRoom3, groupRoom4)
    // The ProcDetection procedure will be run whenever the mobile enters into
    // or exits from the area defined by each group of beacons.
    BeaconDetectBackground(arrBeaconGroup, ProcDetection)
    PROCEDURE ProcDetection(Group is beaconGroup, nType is int)
    IF nType = bdbLeave THEN
    // Stop the current track
    IF nType = bdbEnter THEN
    SWITCH Group.Major
    CASE 1
    // Read the track for room 1
    CASE 2
    // Read the track for room 2
  • Method 2: Precise detection of Beacons
    This method consists in using the precise detection (BeaconDetectPrecise) to get the nearest Beacon and perform a specific operation. Example:
    // In a museum, we want to display on the visitor device the information
    // regarding the masterpiece he is looking at. Associate to each Beacon
    // the same UUID corresponding to the museum as well as Major and Minor numbers
    // allowing each Beacon to be uniquely identified.
    // A Beacon is placed next to each work of art in the museum.
    // The application must call the BeaconDetectPrecise function with a
    // BeaconGroup variable corresponding to the museum tags.
    // The callback procedure passed as parameter to the function will be called whenever
    // a new list of Beacons is detected. Then, all you have to do is find
    // the nearest Beacon to identify the work the visitor is looking at and to display
    // the corresponding information in the application.
    // Museum UUID
    sUUID is string = "f4231ab6-5ef2-6c99-4229-af6c72e0446e"
    // Create a beaconGroup variable corresponding to the museum tags
    groupMuseum is beaconGroup
    groupMuseum.UUID = sUUID
    // Start the detection
    BeaconDetectPrecise(groupMuseum, ProcDetection)
    INTERNAL PROCEDURE ProcDetection(arrInfo is array of beaconDetectionInfo)
    nMinDistance is int
    NearestBeacon is beaconDetectionInfo
    FOR EACH Information OF arrInfo
    IF nMinDistance = 0 _OR_ Information.Distance < nMinDistance
    NearestBeacon = Information
    // Display information about the masterpiece associated with the tag
    DisplayMasterpieceInfo(NearestBeacon.Major, NearestBeacon.Minor)
Minimum version required
  • Version 23
Click [Add] to post a comment