1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-13 04:04:25 +02:00

Add Support for Vigorun scale (#517)

This commit is contained in:
Christoph Walcher
2019-11-28 17:53:58 +01:00
committed by OliE
parent fb2f898709
commit 53cf28a25e
4 changed files with 19 additions and 4 deletions

View File

@@ -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

View File

@@ -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);
}
/**

View File

@@ -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);
}

BIN
docs/scales/vigorun.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 KiB