アンドロイドのサンプルを分析しています。アンドロイドの低エネルギー使用量について説明しています。私は通知を設定している次のコードを見つけましたが、ここで何が起こっているのかは、整数と条件ifsの内部では知ることができません。誰かがそれを少し説明できますか?ブルートゥースの低エネルギー特性(読み取り、通知)を読む - どのように機能するのですか?
とにかく、もっと良い情報源があり、アンドロイドのble概念を説明することができます。ここではどのように働いていますか?公式アンドロイドチュートリアルでは、Bluetooth仕様(https://www.bluetooth.com/specifications/adopted-specifications、Coreバージョン5.0)を読んでみてください可能性があり
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
if (mGattCharacteristics != null) {
final BluetoothGattCharacteristic characteristic =
mGattCharacteristics.get(groupPosition).get(childPosition);
final int charaProp = characteristic.getProperties();
if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
// If there is an active notification on a characteristic, clear
// it first so it doesn't update the data field on the user interface.
if (mNotifyCharacteristic != null) {
mBluetoothLeService.setCharacteristicNotification(
mNotifyCharacteristic, false);
mNotifyCharacteristic = null;
}
mBluetoothLeService.readCharacteristic(characteristic);
}
if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
mNotifyCharacteristic = characteristic;
mBluetoothLeService.setCharacteristicNotification(
characteristic, true);
}
return true;
}
return false;
}
そのサンプルは実際にはすべての可能な方法で壊れています。インターネットを検索するだけであれば、他にもたくさんの例があります。 – Emil
@エミール、他にもたくさんの例がありますが、私はいくつかを見つけようとしましたが、別の方法で複雑になっています。それらの多くは別の方法で書かれています。私が見つけたサンプル/チュートリアルのなかには、BLEの基本や、ビットからの読み方などを説明するものや、16ビットの作成から基本的なUUIDを説明するだけのものはありません。 – Krystian