|
|
|
|
- Presentación
- Principio
- Implementación
Una "baliza" es un transmisor de hardware que puede "dialogar" en un perímetro pequeño con teléfonos inteligentes o tabletas a través de una conexión Bluetooth.. La tecnología utilizada es la de BTLE (Bluetooth Low Energy). La baliza puede, por ejemplo, indicar la proximidad de una obra maestra de arte en un museo; la aplicación puede mostrar el texto explicativo, o puede iniciar un archivo de vídeo o audio. En el aspecto comercial, un Beacon puede activar un mensaje con respecto a una oferta en un producto cercano. Un Beacon también puede informar a un usuario que no está lejos de una tienda que vende un producto que está buscando. Una aplicación pide al teléfono que le advierta cuando se encuentran uno o más Beacons cerca. Esta aplicación puede cerrarse inmediatamente, por lo que no consume batería. Cuando el teléfono detecta un Beacon, reinicia la aplicación y transmite la información del Beacon. Además, el Phone advierte a la aplicación cuando sale de la zona de emisión de Beacon. Se pueden utilizar varias funciones de WLanguage y 2 tipos específicos para manejar las balizas. Dependiendo del modo de uso de su aplicación, puede utilizar uno de los siguientes métodos: - Método 1: automatic detección de faros
Este método consiste en detectar grupos de balizas en la Background con BeaconDetectBackground. Se realiza una acción específica cuando se detecta un grupo de balizas. Ejemplo:
// 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 RETURN END IF nType = bdbEnter THEN SWITCH Group.Major CASE 1 // Read the track for room 1 CASE 2 // Read the track for room 2 ... END END
- Método 2: Detección precisa de las balizas
Este método consiste en utilizar la detección precisa (BeaconDetectPrecise) para get la baliza más cercana y realizar una operación específica. Ejemplo:
// 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 END END // Display information about the masterpiece associated with the tag DisplayMasterpieceInfo(NearestBeacon.Major, NearestBeacon.Minor) END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|