Inject RileyLinkServiceData in SetPreamble command and remove some unused code
This commit is contained in:
parent
1787afda98
commit
e74e80a4ce
|
@ -38,9 +38,6 @@ public class RileyLinkUtil {
|
|||
private RileyLinkEncodingType encoding;
|
||||
private Encoding4b6b encoding4b6b;
|
||||
|
||||
// TODO maybe not needed
|
||||
private RileyLinkTargetFrequency rileyLinkTargetFrequency;
|
||||
|
||||
@Inject
|
||||
public RileyLinkUtil() {
|
||||
}
|
||||
|
@ -158,8 +155,4 @@ public class RileyLinkUtil {
|
|||
public Encoding4b6b getEncoding4b6b() {
|
||||
return encoding4b6b;
|
||||
}
|
||||
|
||||
public void setRileyLinkTargetFrequency(RileyLinkTargetFrequency rileyLinkTargetFrequency_) {
|
||||
this.rileyLinkTargetFrequency = rileyLinkTargetFrequency_;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -387,7 +387,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;
|
||||
}
|
||||
|
|
|
@ -18,10 +18,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");
|
||||
|
|
|
@ -150,7 +150,7 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
|
|||
return true;
|
||||
} else if (action.equals(RileyLinkConst.Intents.RileyLinkReady)) {
|
||||
|
||||
aapsLogger.warn(LTag.PUMPCOMM, "MedtronicConst.Intents.RileyLinkReady");
|
||||
aapsLogger.warn(LTag.PUMPCOMM, "RileyLinkConst.Intents.RileyLinkReady");
|
||||
// sendIPCNotification(RT2Const.IPC.MSG_note_WakingPump);
|
||||
|
||||
rileyLinkService.rileyLinkBLE.enableNotifications();
|
||||
|
|
|
@ -67,12 +67,10 @@ public class RileyLinkServiceData {
|
|||
return workWithServiceState(null, null, false);
|
||||
}
|
||||
|
||||
|
||||
public void setServiceState(RileyLinkServiceState newState, RileyLinkError errorCode) {
|
||||
workWithServiceState(newState, errorCode, true);
|
||||
}
|
||||
|
||||
|
||||
private synchronized RileyLinkServiceState workWithServiceState(RileyLinkServiceState newState, RileyLinkError errorCode, boolean set) {
|
||||
|
||||
if (set) {
|
||||
|
|
Loading…
Reference in a new issue