Inject dependencies in SetPreamble RL command

This commit is contained in:
Bart Sopers 2020-08-09 19:37:01 +02:00
parent 817ec086a1
commit 1172aa753e
2 changed files with 3 additions and 2 deletions

View file

@ -388,7 +388,7 @@ public class RFSpy {
try { try {
resp = writeToData(new SetPreamble(injector, preamble), EXPECTED_MAX_BLUETOOTH_LATENCY_MS); resp = writeToData(new SetPreamble(injector, preamble), EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
} catch (Exception e) { } catch (Exception e) {
e.toString(); aapsLogger.error("Failed to set preamble", e);
} }
return resp; return resp;
} }

View file

@ -17,10 +17,11 @@ public class SetPreamble extends RileyLinkCommand {
private int preamble; private int preamble;
public SetPreamble(HasAndroidInjector injector, int preamble) throws Exception { public SetPreamble(HasAndroidInjector injector, int preamble) throws Exception {
super(); super();
injector.androidInjector().inject(this);
// this command was not supported before 2.0 // this command was not supported before 2.0
if (!rileyLinkServiceData.firmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) { if (!rileyLinkServiceData.firmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) {
throw new NotImplementedException("Old firmware does not support SetPreamble command"); throw new NotImplementedException("Old firmware does not support SetPreamble command");