mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-13 12:14:19 +02:00
Add Support for Vigorun scale (#517)
This commit is contained in:
@@ -35,6 +35,7 @@ openScale has built-in support for a number of Bluetooth (BLE or "smart") scales
|
|||||||
- Runtastic Libra
|
- Runtastic Libra
|
||||||
- Sanitas SBF70
|
- Sanitas SBF70
|
||||||
- Silvercrest SBF75
|
- Silvercrest SBF75
|
||||||
|
- Vigorun
|
||||||
- Xiaomi Mi scale v1 and v2
|
- Xiaomi Mi scale v1 and v2
|
||||||
- Yunmai Mini and SE
|
- Yunmai Mini and SE
|
||||||
- iHealth HS3
|
- iHealth HS3
|
||||||
|
@@ -39,6 +39,7 @@ import java.util.UUID;
|
|||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static android.bluetooth.BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT;
|
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 android.content.Context.LOCATION_SERVICE;
|
||||||
import static com.welie.blessed.BluetoothPeripheral.GATT_SUCCESS;
|
import static com.welie.blessed.BluetoothPeripheral.GATT_SUCCESS;
|
||||||
|
|
||||||
@@ -179,12 +180,25 @@ public abstract class BluetoothCommunication {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a byte array to a Bluetooth device.
|
* 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) {
|
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));
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -68,7 +68,7 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
buf[6] = (byte)0xCC;
|
buf[6] = (byte)0xCC;
|
||||||
buf[7] = (byte)((buf[2] + buf[3] + buf[4] + buf[5] + buf[6]) & 0xFF);
|
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
BIN
docs/scales/vigorun.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 503 KiB |
Reference in New Issue
Block a user