Are GATT Event notifications possible without pairing? - bluetooth

I've been pouring over the BT 4.x (LE) spec trying to figure out if this is possible or not (events without pairing/boding).
Does anyone have an insight (and link to the spec preferably) if it's possible?

As Mike Petrichenko commented, GATT communication is definitely possible without pairing. In fact most GATT servers/clients out there function without the need for pairing/bonding. The only exception is when some characteristics require authentication/authorisation in order to read some data (e.g. a medical device with a Heart rate characteristic).
If you want a specific reference to where this is mentioned in the Bluetooth spec, then I recommend looking at the Core Specification version 5.2, Vol 3, Part C, section 10.2 (LE Security Modes):-
The security requirements of a device, a service or a service request
are expressed in terms of a security mode and security level. Each
service or service request may have its own security requirement. The
device may also have a security requirement. A physical connection
between two devices shall operate in only one security mode.
It is then mentioned that LE security mode 1 has the level No security, and many GATT servers/clients work in this level.
You can test this yourself if you have two phones available. You can use the nRF Connect app to run a GATT server on one and a GATT client on the other. You will see that you can browse the GATT table and read data without having to pair.
Below are a few links that contain more information:-
Is pairing/encryption mandatory to allow a peer to write in GATT
Bluetooth Low Energy GATT security levels
How GAP and GATT work

Related

Is it a good idea to advertise a Bluetooth GATT Service solely via the 'service data' data type?

We're designing a Bluetooth LE peripheral that implements some primary GATT service and needs to advertise the existence of the service as well as a few bytes of data related to the service. The device is intended to connect to arbitrary consumer smartphones (therefore mostly Android and iOS). We use a 16-bit service UUID and plan to advertise the related data via the advertising data type 0x16 (Service Data - 16 bit UUID). Due to the limited size of the advertising PDU, we'd like to avoid any additional advertising data, most notably we'd like to avoid advertising the same UUID also via data type 0x03 (Complete List of 16-bit UUIDs).
As the device should be used with consumer smartphones, compatibility is a major concern and therefore the compliance with relevant standards is as well. A critical aspect seems to be that the smartphone OSes should be able to do efficient filtering for devices advertising our service, so the app may run and listen in the background.
A safe approach would be to advertise both, 'service data' as well as 'complete list of UUIDs', because all OSes are certainly able to filter for UUIDs advertised in the latter, but this would exceed the size of the advertising PDU. We could also configure the mobile's BLE scanner to return all BLE devices nearby, without any filtering and do the filtering in our own code, but this wouldn't be efficient and wouldn't allow to run in the background.
We did some testing with different smartphones (Android and iPhones, older and newer ones) and at the first glance filtering for service UUIDs when only the service data type is advertised, seems to work just fine. However, we couldn't find any documentation (neither for Android nor for iOS) that definitely states that this is a supported scenario, so we can't be sure that it works on all phones and also in the future.
The Apple Accessory Design Guidelines section 36.4 refers to the Bluetooth Core Specification Supplement, Part A and states the following:
The advertising data sent by the accessory should contain at least the following information as described in the Bluetooth Core Specification Supplement, Part A:
Flags
TX Power Level
Local Name
Services
[...]
The primary services should always be advertised in the advertising PDU.
However, this doesn't make clear which kind of advertising data type should be used and the same is true for the Android documentation.
With this context my questions are:
Is it a good idea to advertise the primary GATT service solely via the 'service data' data type?
Would this even comply to the Bluetooth Core Specification?
Is there any documentation for Android and iOS that makes clear, whether this is a supported scenario from the OS standpoint (I actually don't mean the OS source code)?
Are there any Android (>= 5.0) or iOS (>= 11) devices that would not be able to filter for service UUIDs advertised via the 'service data' data type?
What is the best practice in such a case, given the limited size of the advertising PDU?
Thank you for your thoughts!

Zephyr BLE: Can a GATT Client connect to multiple GATT Servers

My question is very brief - In the Zephyr documentation, I couldn't find an answer to my question (which surprised me). Is it possible for a GATT Client to connect to more than one GATT Server?
Right now I am using two boards to compute something (one as a server and one as a client). Ideally, the result of the computation should be written to a characteristic on a third device, another GATT server.
You're right I couldn't find this information easily but it is certainly possible to have multiple connections as I've tried this myself before. Many application and products built on Zephyr also rely on this feature. Generally speaking, there is no limit to the number of BLE connections that is imposed by the Bluetooth specification, but the limitation is usually dictated by the hardware. This is somehow mentioned in the Zephyr link below:-
https://docs.zephyrproject.org/latest/guides/bluetooth/overview.html
I hope this helps.

Progressive web app beacon search

Is it possible to search for beacon data (uuid, url, ...) with a progressive web application using just web technologies that is without using native mobile technologies (Android, ios, ...)?
Thanks in advance.
Unfortunately, this is not possible as of July 2020. While Google has been working on the WebBluetooth project to bring support for many bluetooth operations to the browser, at least in Google Chrome implementations on Android 6+, Mac or ChromeOS.
Scanning for beacons is not yet possible as of this writing. The API requires that the OS scan for devices matching a requested criteria, and then let the user choose a device to connect to using a user interface. This essentially rules out beacon detection.
Bluetooth scanning APIs are still in draft form here.
EDIT: The APIs mentioned by #zurfyx in the answer below allow you to scan for and connect to an advertised GATT service, but do not allow you to read the data in the advertisement. This is a critical distinction, as reading the data in the advertisement is the key capability required for actual bluetooth beacon detection. That capability is missing from that API. Without that capability, it is impossible to detect a beacon, it is only possible to connect to a BLE device that might be an Eddystone or other service advertisement-based beacon.
UPDATE July 2020: Safari will not be getting any WebBluetooth APIs at all due to privacy concerns, according to a June 2020 announcement by Apple This makes Bluetooth scanning impossible on iOS we apps for the foreseeable future.
As of July 2020, Chrome does not support scanning arbitrary advertisements. See status here: https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md
Disclaimer: I wrote eddystone-web-bluetooth (a library which makes it easy to read and write to an Eddystone device). github#eddystone-web-bluetooth npm#eddystone-web-bluetooth
It is possible to scan for Bluetooth devices by using the Web Bluetooth API (currently supported only by Chrome).
By using Bluetooth GATT service, you can connect to Eddystone devices and send/receive data by communicating following their public specifications (which are basically a list of request codes, and the format in which to send and expect their responses).
These services include information such as:
URL
Advertising interval
Lock state
and more
By using the Bluetooth standard information you can get to know the most generic device information, such as its id and name:
navigator.bluetooth.requestDevice
#beaufortfrancois wrote the probably first Eddystone Web Bluetooth configuration code (source code / demo), so it is probably worth a read if you want to dig more into this. I learned a lot from it.

GATT profile and UART service

I am new to developing a mobile app with bluetooth connection to peripheral device. I searched that GATT is the relevant profile used for bluetoothLE communication but our client recommended that we use UART service. Now I am confused as to
1. how these two things are related and
2. Do we have to opt for one of these, if so, what are the pros and cons of each. Thanks
Legacy Bluetooth provides the serial port profile (SPP) - This is essentially a serial input/output stream over Bluetooth.
Bluetooth Low Energy provides a number of profiles, but the most commonly used is GATT. GATT exposes characteristics/attributes which are a little like variables that you can read from/write to. A read/write is limited to 20 bytes.
Many embedded BLE chipsets provide a "UART emulation" over BLE GATT. Here a pair of attributes are used; one for read and one for write.
The Central device writes bytes to the 'write' attribute and the embedded chip sends them out of a serial port on the chip.
Similarly, data that is written to the chip's serial port and sent to the central via a notification of new data in the 'read' attribute.
You don't say what platform your are developing on, but one important consideration is that use of SPP on iOS requires your hardware to be MFi certified by Apple, while BLE/GATT does not.

Ble Beacon Gpio read/write

I'm not a ble guru, I worked on some modules to expose some simple service with pairing and bla bla :9
One of our customer ask me if it possible to control mcu gpio, with a beacon service running. For what I know beacon standard is only a lighthouse to check the proximity (streaming simple packet uuid, signal strength etc etc), and the only way to do something like this is to expose a new service running concurrently with beacon ( in practice send multi type of packets). I don't want pairing (beacon<->device app) and don't worry about race condition, if multi devices set/reset a gpio, it's not my business.
I found something similar https://community.estimote.com/hc/en-us/articles/217429867-What-is-GPIO-How-to-set-it-up-, what you think about?
There are libraries or eddystone's extensions to do that? Some project on github?
We prefer to work with Nordic ble module, but if you know solution based on other mcu, you are welcome.
Thanks for your help
Standard beacons (iBeacon, Eddystone, AltBeacon) are transmit only devices. They simply send out advertisements at a fixed rate with a unique identifier. Some manufacturers expose proprietary configuration interfaces as read-write Bluetooth LE GATT Services. But there is no standard GATT Service that does this, and the manufacturer-specific schemes are designed specifically to set beacon identifiers and other operating parameters.
I don't think there are beacon-specific libraries or extensions that will help with this, beyond standard Bluetooth LE SDKs for iOS and Android. In order to accomplish this goal with a Nordic BLE module you would need to build your own custom system:
Write custom Nordic firmware (that sits alongside beacon transmission firmware) that exposes a new Bluetooth LE GATT Service. The service would expose a writable GATT Attribute that would control the GPIO pin.
Write custom mobile app code that connects to this GATT Service (CoreBluetooth on iOS and android.bluetooth on Android), and writes to the GATT attribute to control the pin.
One thing you must be careful of is that connecting to to a GATT Service will typically stop a Bluetooth Peripheral from advertising (meaning it won't transmit as a beacon). So you may wish to drop the connection quickly to prevent mobile devices or other Bluetooth Centrals from stoping the beacon transmissions.

Resources