I am trying to find any workarounds for a Bluetooth LE bug on OSX. In particular, I want to know where OSX goes wrong in reading the Bluetooth LE GATT table. Thus, I am viewing the L2CAP packets in PacketLogger from Hardware IO Tools for XCode.
When I use Bluetooth Explorer to connect to the Bluetooth LE device, I am expecting to see 3.4.4.9 Read By Group Type Request(uuid=0x2800 «Primary Service», startingHandle=0x0001, endingHandle=0xffff) to discover primary services (or Find By Type Value Request(uuid=0x2800, value:uuid of service)), followed by 3.4.4.1 Read By Type Request(uuid=0x2803 «Characteristic») to discover characteristics. This is what I see when I sniff the packets from an iPhone (using a CC2540).
But on OSX, the only L2CAP requests that I see in PacketLogger (and the CC2540) after connecting are:
- Read By Type Request(attributeType=0x2803, startingHandle=0x001a, endingHandle=0x001a)
- Read By Type Request(attributeType=0x2802 «Include», startingHandle=0x0001, endingHandle=0x0004)
- Read By Type Request(attributeType=0x2802, startingHandle=0x0005, endingHandle=0x0009)
- Read By Type Request(attributeType=0x2802, startingHandle=0x0010, endingHandle=0x0019)
- Read By Type Request(attributeType=0x2802, startingHandle=0x001a, endingHandle=0x001a)
- Read By Type Request(attributeType=0x2803, startingHandle=0x001a, endingHandle=0x001a)
- Read By Type Request(attributeType=0x2802, startingHandle=0x0021, endingHandle=0x0027)
- Read By Type Request(attributeType=0x2802, startingHandle=0x002b, endingHandle=0x002e)
These are not enough requests to discover the services, yet Bluetooth Explorer lists all the service UUIDs at this point. This indicates that OSX already knows where the services are on this Bluetooth LE device. Does blued cache device services and read them on startup? If so, how can I clear the cache?
I have tried turning off Bluetooth, killing blued, and restarting OSX, but every time OSX never rediscovers the services.