mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-12 01:51:58 +01:00
added firmware check on connect
This commit is contained in:
parent
b20963348d
commit
ebab69a063
@ -365,6 +365,9 @@ public class QHybridSupport extends QHybridBaseSupport {
|
|||||||
case "00002a26-0000-1000-8000-00805f9b34fb": {
|
case "00002a26-0000-1000-8000-00805f9b34fb": {
|
||||||
String firmwareVersion = characteristic.getStringValue(0);
|
String firmwareVersion = characteristic.getStringValue(0);
|
||||||
gbDevice.setFirmwareVersion(firmwareVersion);
|
gbDevice.setFirmwareVersion(firmwareVersion);
|
||||||
|
|
||||||
|
checkFirmwareVersion(firmwareVersion);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "00002a19-0000-1000-8000-00805f9b34fb": {
|
case "00002a19-0000-1000-8000-00805f9b34fb": {
|
||||||
@ -384,6 +387,19 @@ public class QHybridSupport extends QHybridBaseSupport {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkFirmwareVersion(String firmwareVersion){
|
||||||
|
if(!isFirmwareCompatible(firmwareVersion)){
|
||||||
|
GB.toast("Firmware " + firmwareVersion + " not compatible", Toast.LENGTH_LONG, GB.ERROR);
|
||||||
|
getDevice().setName("incopatible firmware");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isFirmwareCompatible(String firmwareVersion){
|
||||||
|
int major = Integer.parseInt(firmwareVersion.substring(6, 7));
|
||||||
|
|
||||||
|
return major == 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
public boolean onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||||
switch (characteristic.getUuid().toString()) {
|
switch (characteristic.getUuid().toString()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user