¿Alguien sabe cómo mandar texto a la MiBand 2 desde android?
Hasta ahora soy capaz de enviar números pero no strings y no sé como hacer.
@Override
public void onServicesDiscovered(final BluetoothGatt gatt, int status)
{
super.onServicesDiscovered(gatt, status);
Log.d(TAG, "onServicesDiscovered status="+status);
if (status == BluetoothGatt.GATT_SUCCESS) {
charact_2A06 = gatt.getService(Constants.UUID_SERVICE_1802).getCharacteristic(Constants.UUID_CHARACTERISTIC_2A46);
isConnected = true;
}
}
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic)
{
super.onCharacteristicChanged(gatt, characteristic);
Log.d(TAG, "onCharacteristicChanged "+characteristic.getUuid()+" "+ Arrays.toString(characteristic.getValue()));
}
@Override
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
super.onCharacteristicWrite(gatt, characteristic, status);
Log.d(TAG, "onCharacteristicWrite "+characteristic.getUuid()+" "+ Arrays.toString(characteristic.getValue()));
if(mWait!=null && mWait.getCount()>0)
mWait.countDown();
}
};
public void enviarDatos(String dato){
if(!isConnected){
connect();
}
try {
mWait = new CountDownLatch(1);
mWait = new CountDownLatch(1);
byte b =Byte.valueOf(dato);
charact_2A06.setValue(new byte[]{-3,2,b,(byte)0});
mGatt.writeCharacteristic(charact_2A06);
}
catch (Exception e)
{
e.printStackTrace();
}
}