Can't connect to BLE device

2019-07-25 08:57发布

问题:

Trying to connect an Android phone to a somewhat unusual, nonstandard BLE device (a blood pressure monitor). Data points:

  • My program connects and reads other BLE devices fine.
  • My program sees the device in a BLE scan, but won't connect. Instead I get an immediate "Disconnected" status with a generic GATT_ERROR (status code 0x85).
  • Nordic's Android BLE scanner app will connect and read/write the device.
  • The device uses an unknown Service (FFF0) with one characteristic (FFF1) for notifications from the device and another (FFF2) to write commands to it.
  • The TI BLE packet sniffer software seems to indicate that no connection request is ever sent to the device.

Here's what I've observed with the Nordic scanner app: When you turn the device on, it advertises and the app can connect to it. If you then enable Notifications on FFF1, you receive a byte 0xA5; this is per the device spec, which says it sends this byte every 500 ms. The (rather rudimentary) docs say this is "waiting for the connection" but obviously it is already connected. If you then write the specified "start" command string to FFF2, it starts taking a reading and appears to perform correctly.

The Nordic app can connect; why can't mine?

Update: have verified that the Nordic app works on the same Android phone that is running my program.