我是
Android的新手,现在正在做一个简单的应用程序,需要将一些数据写入外围设备.
三星GT-S7272C设备其实没有什么问题.但是当我切换到Sony LT29i时,当我试图写入某个特性时,总是会有一个状态133.我会给出一些简短的代码.
BluetoothGattService syncService = gatt.getService(SYNC_DATA_SERVICE);
BluetoothGattCharacteristic tChar = syncService.getCharacteristic(SYNC_TIME_INPUT_CHAR);
if (tChar == null) throw new AssertionError("characteristic null when sync time!");
int diff = /*a int*/;
tChar.setValue(diff,BluetoothGattCharacteristic.FORMAT_SINT32,0);
gatt.writeCharacteristic(tChar);
和onCharacteristicWrite函数:
@Override
public void onCharacteristicWrite(BluetoothGatt gatt,BluetoothGattCharacteristic characteristic,int status) {
Log.d(TAG,String.format("Sync: onCharWrite,status = %d",status));
try {
if (status != BluetoothGatt.GATT_SUCCESS) throw new AssertionEr