如何通过蓝牙获取远程设备的序列号?

My *_*God 4 android bluetooth-lowenergy android-bluetooth

在我的应用程序中,我发现了蓝牙设备,因此得到以下---

  • 蓝牙设备的名称.
  • 蓝牙设备的硬件地址.

这是通过BluetoothDevice为每个发现的设备获取对象并调用 object.getName()和来完成的object.getAddress().

我还想获得每个发现的蓝牙设备的序列号.

我知道要把我自己设备的序列号作为---

android.os.Build.SERIAL
Run Code Online (Sandbox Code Playgroud)

ben*_*nka 7

许多蓝牙低能量配置文件提供称为的服务Device Information.
已分配的UUID:https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx? u 0x180A
= org.bluetooth.service.device_information.xml

在该服务下,存在可以保持特定于蓝牙低功耗设备的序列号的Serial Number String 特征.
分配的UUID:https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx? u 0x2A25
=org.bluetooth.characteristic.serial_number_string.xml

这是可选的,并非所有BLE配置文件都具有它,您必须连接到设备才能检索此信息.