From 1172aa753e3bb1f999771f385c03d3c9c9de5005 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sun, 9 Aug 2020 19:37:01 +0200 Subject: [PATCH] Inject dependencies in SetPreamble RL command --- .../androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java | 2 +- .../pump/common/hw/rileylink/ble/command/SetPreamble.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java index 7971b6a7aa..a74a14e4a6 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpy.java @@ -388,7 +388,7 @@ public class RFSpy { try { resp = writeToData(new SetPreamble(injector, preamble), EXPECTED_MAX_BLUETOOTH_LATENCY_MS); } catch (Exception e) { - e.toString(); + aapsLogger.error("Failed to set preamble", e); } return resp; } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java index b3f32727c3..0d551204af 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/command/SetPreamble.java @@ -17,10 +17,11 @@ public class SetPreamble extends RileyLinkCommand { private int preamble; - public SetPreamble(HasAndroidInjector injector, int preamble) throws Exception { super(); + injector.androidInjector().inject(this); + // this command was not supported before 2.0 if (!rileyLinkServiceData.firmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) { throw new NotImplementedException("Old firmware does not support SetPreamble command");