Bluetooth LE デバイスのサービスから特性を読み取ろうとしています。何らかの理由で、一部の特性について、 を呼び出した後-[CBPeripheralManager discoverCharacteristics:forService]
、peripheral:didDiscoverServices:
コールバックが 0 の特性を取得しています。このサービスの特性を読み取れるようにするための回避策はありますか?
Xcode 用のハードウェア IO ツールをインストールし、PacketLogger を実行すると、discoverServices 呼び出しが、開始ハンドル = 0x1a、終了ハンドルで 0x08 タイプ要求 (Bluetooth® コア仕様ボリューム 3、パート F、セクション 3.4.4.1) による読み取りを引き起こしていることが明らかです。 =0x1a、属性タイプ=0x2803。
Also, by defining the following class extensions to read the protected fields, it is apparent that the service that I’m interested in, 0x180a=Device Information, also has ATT handles too close to comfort: _startHandle=0x1a and _endHandle=0x1a.
@implementation CBService(ProtectedProps)
- (NSNumber*) startHandle {
return self->_startHandle;
}
- (NSNumber*) endHandle {
return self->_endHandle;
}
@end
@implementation CBCharacteristic(ProtectedProps)
- (NSNumber*) descriptorHandle {
return self->_handle;
}
- (NSNumber*) valueHandle {
return self->_valueHandle;
}
@end
By the way, when I read the device from LightBlue on an iPhone 4S, the service works fine, and I can read the 3 characteristics of this service.
I’m testing this on OSX 10.9 Mavericks with Apple Bluetooth Software Version: 4.2.0f6 12982. The device that I’m testing is a Livescribe 3.
Here is a table of the actual GATT handles, CBService handles, and UUIDs. It looks like having a 16-bit UUID after a 128-bit UUID messed up the table. Bluetooth 4.0 section 3.1 states that 16-bit UUID services “should” be grouped together for performance, but I don’t think they must.
- 0001–0004 0001–0004 uuid:1801
- 0005–0009 0005–0009 uuid:1800
- 0010–0019 0010–0019 uuid:128 bit UUID
- 001A–0020 001A–001A uuid:180a
- 0021–0023 missing uuid:180f
- 0024–002A 0021–0027 uuid:128 bit UUID
- 002E–0031 002B–002E uuid:128 bit UUID