Web Bluetooth API Example

The Web Bluetooth API provides the ability to connect and interact with Bluetooth Low Energy peripherals from JavaScript running within a web page in a web browser. It is supported by Google Chrome and Microsoft Edge browsers running on Windows and other operating systems that support Bluetooth Low Energy. In some browser/OS combinations Web Bluetooth may need to be enabled as an experimental feature.

A demonstration BleTap.htm file is available (contact vtap-support@dotorigin.com to request this). It can be launched in a Chrome or Edge browser on a computer with BLE. The main purpose of this is to demonstrate how to develop an application that uses the VTAP PRO reader’s custom GATT service.

Just open the file in Chrome/Edge and choose the Connect button. The browser will present a window with the scan results, listing any BLE devices that support the custom service. (It will not show any other BLE devices). After selecting a VTAP PRO reader from that list, select the Pair button. The computer operating system will typically popup a Window (outside of the web browser) asking you if you want to pair. If a PIN has been set using the BTServerPin setting in config.txt, then you will need to enter that PIN. Once paired, you will be able to connect from the browser without any interaction from the operating system.

The Output section of the web page shows a trace and any taps. The Response JSON is set with a default action, but can be edited to send your own action response to the VTAP reader.

Each time you tap a pass or tag on the VTAP reader it will display the tap data JSON in the Output window and send the currently set action response JSON.