1

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.

  1. 0001–0004 0001–0004 uuid:1801
  2. 0005–0009 0005–0009 uuid:1800
  3. 0010–0019 0010–0019 uuid:128 bit UUID
  4. 001A–0020 001A–001A uuid:180a
  5. 0021–0023 missing uuid:180f
  6. 0024–002A 0021–0027 uuid:128 bit UUID
  7. 002E–0031 002B–002E uuid:128 bit UUID
4

1 に答える 1

1

128 ビット UUID とインターリーブされた 16 ビット UUID を読み取る際のバグは、おそらく OSX 10.9.1 で修正されました。ただし、コンピューターがまだ周辺機器に接続されていたため、不正な値がキャッシュされていました。そのため、以前に周辺機器に接続していた場合、何度再接続または再起動しても、キャッシュされた GATT 値が正しくないため、バグは依然として現れます。

結合キャッシュ /Library/Preferences/com.apple.Bluetooth.plist を消去して、blued を強制終了する必要がありました。私の他の質問を参照してくださいblued cache ATT values, and how to clear the cache? 詳細については。

于 2014-03-03T21:48:07.760 に答える