diff --git a/README.md b/README.md index d26c4315..5cda4b3d 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ openScale has built-in support for a number of Bluetooth (BLE or "smart") scales - Runtastic Libra - Sanitas SBF70 - Silvercrest SBF75 +- Vigorun - Xiaomi Mi scale v1 and v2 - Yunmai Mini and SE - iHealth HS3 diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java index c177189e..67f041b3 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java @@ -39,6 +39,7 @@ import java.util.UUID; import timber.log.Timber; import static android.bluetooth.BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT; +import static android.bluetooth.BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE; import static android.content.Context.LOCATION_SERVICE; import static com.welie.blessed.BluetoothPeripheral.GATT_SUCCESS; @@ -179,12 +180,25 @@ public abstract class BluetoothCommunication { /** * Write a byte array to a Bluetooth device. - * @param characteristic the Bluetooth UUID characteristic - * @param bytes the bytes that should be write + * + * @param characteristic the Bluetooth UUID characteristic + * @param bytes the bytes that should be write */ protected void writeBytes(UUID service, UUID characteristic, byte[] bytes) { + writeBytes(service, characteristic, bytes, false); + } + + /** + * Write a byte array to a Bluetooth device. + * + * @param characteristic the Bluetooth UUID characteristic + * @param bytes the bytes that should be write + * @param noResponse true if no response is required + */ + protected void writeBytes(UUID service, UUID characteristic, byte[] bytes, boolean noResponse) { Timber.d("Invoke write bytes [" + byteInHex(bytes) + "] on " + BluetoothGattUuid.prettyPrint(characteristic)); - btPeripheral.writeCharacteristic(btPeripheral.getCharacteristic(service, characteristic), bytes, WRITE_TYPE_DEFAULT); + btPeripheral.writeCharacteristic(btPeripheral.getCharacteristic(service, characteristic), bytes, + noResponse ? WRITE_TYPE_NO_RESPONSE : WRITE_TYPE_DEFAULT); } /** diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java index e3570fab..d7fe201b 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java @@ -68,7 +68,7 @@ public class BluetoothMGB extends BluetoothCommunication { buf[6] = (byte)0xCC; buf[7] = (byte)((buf[2] + buf[3] + buf[4] + buf[5] + buf[6]) & 0xFF); - writeBytes(uuid_service, uuid_char_cfg, buf); + writeBytes(uuid_service, uuid_char_cfg, buf, true); } diff --git a/docs/scales/vigorun.jpg b/docs/scales/vigorun.jpg new file mode 100644 index 00000000..428c219f Binary files /dev/null and b/docs/scales/vigorun.jpg differ