[Bluetooth][ACR: TWDAPI-256] Sanitize UUIDs in BLE APIs
The ACR defines ways, in which Bluetooth APIs will handle UUIDs passed
as arguments and returned from functions and adds clarifications about
converisons of UUIDs passed to the Web API, that are made before
advertising.
It also adds tizen.bluetooth.BASE_UUID constant.
APIs modified in this commit:
BluetoothLEDevice::getService():
- now it accepts UUIDs in any of the 3 formats defined in BluetoothUUID
BluetoothLEDevice::getServiceAllUuids():
- a bugfix and slight change of behavior:
In the past, this function has always trimmed UUIDs retrieved
from native API to 16 bit format. In case of UUIDs not built with
Bluetooth's BASE_UUID the conversions were erroneous, for example:
"
198d3a9c-e21a-4f72-a48b-
39a6bad7e583" was converted to "3a9c" which
(almost surely) did not correspond to any service on the device.
The function now returns UUIDs in their shortest formats.
BluetoothLEAdvertiseData::uuids and
BluetoothLEAdvertiseData::solicitationuuids:
- now they accept UUIDs in any of the 3 formats defined in
BluetoothUUID
BluetoothLEAdvertiseData::serviceData:
- it accepts UUIDs in any of the 3 formats defined in BluetoothUUID
Verification: tct-bluetooth-tizen-tests pass rate:
Auto: 100% (BLE suite)
Manual: 10/11 tests passed. The fail is due to a bug in TCT tests
Manual tests in Chrome DevTools:
tizen.bluetooth.BASE_UUID exists and its value is correct
BluetoothLEAdapter::startAdvertise:
BluetoothLEAdvertiseData::uuids:
16 bit: advertised as 16 bit (OK)
32 bit: advertised as 32 bit
Random 128 bit: advertised as 128 bit (OK)
16 bit as 128 bit: advertised as 16 bit (OK)
32 bit as 128 bit: advertised as 32 bit
BluetoothLEAdvertiseData::solicitationuuids:
16 bit: advertised as 16 bit (OK)
32 bit: advertised as 32 bit
Random 128 bit: advertised as 128 bit (OK)
16 bit as 128 bit: advertised as 16 bit (OK)
32 bit as 128 bit: advertised as 32 bit
BluetoothLEAdvertiseData::BluetoothLEServiceData::uuid:
16 bit: advertised as 16 bit (OK)
32 bit: InvalidValuesErrror, Invalid parameter (OK)
Random 128 bit: InvalidValuesErrror: Invalid parameter (OK)
16 bit as 128 bit: advertised as 16 bit (OK)
32 bit as 128 bit: InvalidValuesErrror: Invalid parameter (OK)
BluetoothLEAdapter::startScan() and BluetoothLEScanCallback():
BluetoothLEDevice::uuids:
16 bit: found as 16 bit (OK)
32 bit: not found at all (OK - native API does not support detecting
32 bit UUIDs at all)
Random 128 bit: found as 128 bit (OK)
16 bit as 128 bit: found as 128 bit (OK)
32 bit as 128 bit: found as 128 bit (OK)
BluetoothLEDevice::solicitationuuids:
16 bit: found as 16 bit (OK)
32 bit: not found at all (OK - native API does not support detecting
32 bit UUIDs at all)
Random 128 bit: found as 128 bit (OK)
16 bit as 128 bit: found as 128 bit (OK)
32 bit as 128 bit: found as 128 bit (OK)
BluetoothLEDevice::BluetoothLEServiceData::uuid:
16 bit: found as 16 bit (OK)
32 bit: not found at all (probably OK - native API supports only 128
bit UUIDs)
Random 128 bit: not found at all (native support for 128 bit UUIDs
will be introduced in Tizen 6.0)
16 bit as 128 bit: not found at all (native support for 128 bit UUIDs
will be introduced in Tizen 6.0)
32 bit as 128 bit: not found at all (native support for 128 bit UUIDs
will be introduced in Tizen 6.0)
BluetoothLEDevice::getServiceAllUuids():
16 bit: found as 16 bit (OK)
32 bit:
According to the Bluetooth Core Specification (Version 5.2, Vol 3, Part G,
chapter 3.1 "Service Definition"), GATT servers can only provide 16
and 128 bit services, so a 32 bit service UUID could not be created.
Random 128 bit: found as 128 bit (OK)
16 bit as 128 bit: found as 16 bit (OK)
32 bit as 128 bit: found as 32 bit (OK)
BluetoothLEDevice::getService(): TEST 1 - passing UUID as a parameter:
16 bit to retrieve 16 bit service: OK
16 bit to retrieve 128 bit built with BASE_UUID service: OK
128 bit to retrieve 128 bit built with BASE_UUID service: OK
Random 128 bit: OK
BluetoothLEDevice::getService(): TEST 2 - the value of
BluetoothGATTService::uuid:
The same as passed to the getService() for all cases.
BluetoothLEDevice::getService(): TEST 3 - values of
BluetoothGATTService::uuid in the
service objects from services
included in a service
I was unable to test this functionality. I have tried to create a
GATT service incluing secondary services, but was unable to do that neither
using a BLE adapter and bluetoothctl command on my PC, nor the Android app
I use for tests.
Change-Id: Ic0b75867cb4be3e2fb3fa9ea046b515503363edb
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>