Android 4.4.2 OS用に書かれた同じコードで奇妙なシナリオが発生するSamsungとSamsung(A8)Android 5.1.1。上記のコードでAndroid Bleの書き込み
if(mBluetoothGattCharacteristic==null){
return;
}
byte [] mCommandData=new byte[64];
mCommandData[0]=Constants.REMOTE_CMD;
mCommandData[1]=(byte) mRemoteCommand;
mBluetoothGattCharacteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE);
boolean isUpdated= mBluetoothGattCharacteristic.setValue(mCommandData);
boolean isWriteDone=mBluetoothGatt.writeCharacteristic(mBluetoothGattCharacteristic);
LogUtils.i("LOG", "Ble Write set is---"+ isUpdated + " Characteristics Write done"+ isWriteDone);
/**
* Create New Command Release Key
*/
byte [] mCommandRelease=new byte[64];
mCommandRelease[0]=Constants.REMOTE_CMD;
mCommandData[1]=(byte)Constants.IR_KEY_RELEASE;
isUpdated= mBluetoothGattCharacteristic.setValue(mCommandData);
isWriteDone=mBluetoothGatt.writeCharacteristic(mBluetoothGattCharacteristic);
LogUtils.i("LOG", "Ble Write set is---"+ isUpdated + " Characteristics Write done"+ isWriteDone);
アンドロイド4.4.2用writeCharacteristic
コマンド書き込みの両方に当てはまり与えます。
しかし、アンドロイドの場合はそれが初めての書き込みに真与え5.1.1およびそれがwriteCharacteristic
で偽与える次の書き込みを続けるだとき、今私は思っています解決策は、私は待つ必要がアンドロイド5.1.1でありますonCharacteristicWrite
の場合は、次のコマンドを書き込みます。
このような問題がある場合は、私に案内してください。これはサムスンのデバイスでのみ起こりますか?今私はonCharacteristicWrite
に私の次のコマンドを置くことによって、問題を整理するために
これは正しい解決策です。 AndroidのBLE APIでは、一度に1つのGATT操作しか実行できません。 – Emil