私は現在、LilyPad Simblee BLEボード(RFD77101)を所有しています。これは、arduino 1.6.5 IDEで定義しているカスタムサービスとの接続を確立しようとしています。Simblee.customUUID
コマンド。カスタムサービスとの接続を確立できません
私は以前に確立したUUIDを使用してBluetoothleGatt
サンプルコードのAndroidスタジオでサービスと特性を取得しようとしました。
私がSimbleeに接続すると、アプリケーションがサービスを認識できず、次のエラーが記録されるという問題があります。
カスタムBLEサービスは、コードがちょっと長いので、私は直接のすべてを掲示していないされて
が見つかりません。誰かが私の問題と必要性とコードの一部を解決するというアイデアを持っているなら、私はそれを投稿することが明らかに嬉しいです。
前もって誰にも感謝します。
これは私が特性を取得しようとします。public voidです:あなたが提供するUUIDが正しい形式ではありません
public void readCustomCharacteristic() {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
/*check if the service is available on the device*/
BluetoothGattService mCustomService = mBluetoothGatt.getService(UUID.fromString("fe84-0000-1000-8000-00805f9b34fb"));
if(mCustomService == null) {
Log.w(TAG, "Custom BLE Service not found");
return;
}
/*get the read characteristic from the service*/
BluetoothGattCharacteristic mReadCharacteristic = mCustomService.getCharacteristic(UUID.fromString("2d30c083-f39f-4ce6-923f-3484ea480596"));
if(!mBluetoothGatt.readCharacteristic(mReadCharacteristic)) {
Log.w(TAG, "Failed to read characteristic");
}
}
"0000"のパディングを追加して特性uuidを "2d30c08 ** 2 ** ..."(Simbleeモジュールの読み込み特性)に変更すると、今すぐ正常に動作しました。ありがとう –