1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 10:56:50 +01:00

Mi2: some internal cleanups/renamings

This commit is contained in:
cpfeiffer 2017-03-05 21:27:47 +01:00
parent 0b45fe63f0
commit f6bee00582
3 changed files with 5 additions and 7 deletions

View File

@ -115,7 +115,7 @@ public class MiBand2Service {
public static final byte COMMAND_FIRMWARE_START_DATA = 0x03; // to UUID_CHARACTERISTIC_FIRMWARE
public static final byte COMMAND_FIRMWARE_UPDATE_SYNC = 0x00; // to UUID_CHARACTERISTIC_FIRMWARE
public static final byte COMMAND_FIRMWARE_CHECKSUM = 0x04; // to UUID_CHARACTERISTIC_FIRMWARE
public static final byte COMMAND_FIRMWARE_APPLY_REBOOT = 0x05; // or is it REBOOT? to UUID_CHARACTERISTIC_FIRMWARE
public static final byte COMMAND_FIRMWARE_REBOOT = 0x05; // to UUID_CHARACTERISTIC_FIRMWARE
public static final byte[] RESPONSE_FINISH_SUCCESS = new byte[] {RESPONSE, 2, SUCCESS };
public static final byte[] RESPONSE_FIRMWARE_DATA_SUCCESS = new byte[] {RESPONSE, COMMAND_FIRMWARE_START_DATA, SUCCESS };

View File

@ -335,8 +335,6 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
return new Mi2NotificationStrategy(this);
}
static final byte[] reboot = new byte[]{MiBandService.COMMAND_REBOOT};
static final byte[] startHeartMeasurementManual = new byte[]{0x15, MiBandService.COMMAND_SET_HR_MANUAL, 1};
static final byte[] stopHeartMeasurementManual = new byte[]{0x15, MiBandService.COMMAND_SET_HR_MANUAL, 0};
static final byte[] startHeartMeasurementContinuous = new byte[]{0x15, MiBandService.COMMAND_SET__HR_CONTINUOUS, 1};
@ -684,7 +682,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
public void onReboot() {
try {
TransactionBuilder builder = performInitialized("Reboot");
builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), reboot);
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_FIRMWARE), new byte[] { MiBand2Service.COMMAND_FIRMWARE_REBOOT});
builder.queue(getQueue());
} catch (IOException ex) {
LOG.error("Unable to reboot MI", ex);

View File

@ -116,7 +116,7 @@ public class UpdateFirmwareOperation extends AbstractMiBand2Operation {
sendApplyReboot(getFirmwareInfo());
break;
}
case MiBand2Service.COMMAND_FIRMWARE_APPLY_REBOOT: {
case MiBand2Service.COMMAND_FIRMWARE_REBOOT: {
GB.updateInstallNotification(getContext().getString(R.string.updatefirmwareoperation_update_complete), false, 100, getContext());
// getSupport().onReboot();
done();
@ -238,8 +238,8 @@ public class UpdateFirmwareOperation extends AbstractMiBand2Operation {
}
private void sendApplyReboot(Mi2FirmwareInfo firmwareInfo) throws IOException {
TransactionBuilder builder = performInitialized("send firmware apply/reboot");
builder.write(fwCControlChar, new byte[] { MiBand2Service.COMMAND_FIRMWARE_APPLY_REBOOT });
TransactionBuilder builder = performInitialized("send firmware reboot");
builder.write(fwCControlChar, new byte[] { MiBand2Service.COMMAND_FIRMWARE_REBOOT});
builder.queue(getQueue());
}