ohos: integrate services discovering agent


Add one entry point to QOhosBluetoothRemoteDeviceProxy,
requestRemoteDeviceServices(), which reads the remote device name,
class and transport in a single JS thread crossing and then asks for
the profile UUIDs without waiting: the promise settles onto the Qt
thread through remoteDeviceServicesRead(). start() therefore returns
at once, as the agent's asynchronous contract requires, instead of
holding the Qt thread for an over the air query the peer paces. The
proxy is process wide and its result reaches every agent, so each one
takes only the answer for the device it asked about.

OHOS offers no SDP browse: connection.getRemoteProfileUuids() answers
with the profiles the system itself has resolved and never with the
UUID of a third-party SPP service, so an application looking for its
own service would always come back empty-handed. Serve it a record for
each UUID it asked for instead: build one QBluetoothServiceInfo per
entry of the agent's UUID filter, carrying that UUID as the service
UUID together with the standard SerialPort service class and an RFCOMM
protocol descriptor. Leave the server channel unknown, because a
connection is made by UUID through
QBluetoothSocket::connectToService(address, uuid) and OHOS never
discloses a channel number. Keep a failing getRemoteProfileUuids()
advisory, as the records do not depend on its result.

Build these records only for the peer the application named with
setRemoteAddress(). A discovery over every device cannot tell which peer
hosts the requested service, so a record per device would announce
services that are not there. Describe the UUIDs the system did resolve
with the same record, so that connecting through a QBluetoothServiceInfo
finds the RFCOMM protocol on a socket constructed without one.

Skip a remote device whose transport is LE only, since SPP is a domain
of classic Bluetooth and such a device can serve no RFCOMM service. Do
not require the device to be paired: the OHOS SPP documentation asks
only for an address obtained from the discovery process, and
sppConnect() pairs on demand.

Discover services only for a powered on adapter and report
PoweredOffError otherwise. Report MissingPermissionsError when the
access bluetooth permission is gone and InputOutputError when the
remote device cannot be queried at all, both only while discovering a
single device, because the agent keeps no error for the individual
devices of a full discovery.

Task-number: QTBUG-147192
Pick-to: 6.12
Change-Id: I27ba1496d654fee212092fcef7be97d71d18ceae
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Zbigniew Chyla <zbigniew.chyla@qt.io>
commitf98928d020d728119fe5de32526492a56179b6d1
parent4f3582952d0cc24f01ec230fda4b5bf5e217bc11
authorAdam Krzykala <adam.krzykala@qt.io>
committerDawid Śliwa <dawid.sliwa@qt.io>
commit timeMon, 14 Sep 2026 12:02:20 +0000