|
|
@@ -23,7 +23,7 @@ public class MinimedPumpManager: RileyLinkPumpManager {
|
|
|
return MinimedPumpManager.managerIdentifier
|
|
|
}
|
|
|
|
|
|
- public init(state: MinimedPumpManagerState, rileyLinkDeviceProvider: RileyLinkDeviceProvider, rileyLinkConnectionManager: RileyLinkConnectionManager? = nil, pumpOps: PumpOps? = nil) {
|
|
|
+ public init(state: MinimedPumpManagerState, rileyLinkDeviceProvider: RileyLinkDeviceProvider, pumpOps: PumpOps? = nil) {
|
|
|
self.lockedState = Locked(state)
|
|
|
|
|
|
self.hkDevice = HKDevice(
|
|
|
@@ -37,27 +37,28 @@ public class MinimedPumpManager: RileyLinkPumpManager {
|
|
|
udiDeviceIdentifier: nil
|
|
|
)
|
|
|
|
|
|
- super.init(rileyLinkDeviceProvider: rileyLinkDeviceProvider, rileyLinkConnectionManager: rileyLinkConnectionManager)
|
|
|
+ super.init(rileyLinkDeviceProvider: rileyLinkDeviceProvider)
|
|
|
|
|
|
// Pump communication
|
|
|
let idleListeningEnabled = state.pumpModel.hasMySentry && state.useMySentry
|
|
|
- self.pumpOps = pumpOps ?? PumpOps(pumpSettings: state.pumpSettings, pumpState: state.pumpState, delegate: self)
|
|
|
+
|
|
|
+ self.pumpOps = pumpOps ?? MinimedPumpOps(pumpSettings: state.pumpSettings, pumpState: state.pumpState, delegate: self)
|
|
|
|
|
|
self.rileyLinkDeviceProvider.idleListeningState = idleListeningEnabled ? MinimedPumpManagerState.idleListeningEnabledDefaults : .disabled
|
|
|
}
|
|
|
|
|
|
public required convenience init?(rawState: PumpManager.RawStateValue) {
|
|
|
guard let state = MinimedPumpManagerState(rawValue: rawState),
|
|
|
- let connectionManagerState = state.rileyLinkConnectionManagerState else
|
|
|
+ let connectionManagerState = state.rileyLinkConnectionState else
|
|
|
{
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+ let deviceProvider = RileyLinkBluetoothDeviceProvider(autoConnectIDs: connectionManagerState.autoConnectIDs)
|
|
|
+
|
|
|
+ self.init(state: state, rileyLinkDeviceProvider: deviceProvider)
|
|
|
|
|
|
- let rileyLinkConnectionManager = RileyLinkConnectionManager(state: connectionManagerState)
|
|
|
-
|
|
|
- self.init(state: state, rileyLinkDeviceProvider: rileyLinkConnectionManager.deviceProvider, rileyLinkConnectionManager: rileyLinkConnectionManager)
|
|
|
-
|
|
|
- rileyLinkConnectionManager.delegate = self
|
|
|
+ deviceProvider.delegate = self
|
|
|
}
|
|
|
|
|
|
public private(set) var pumpOps: PumpOps!
|
|
|
@@ -175,6 +176,11 @@ public class MinimedPumpManager: RileyLinkPumpManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private func logDeviceCommunication(_ message: String, type: DeviceLogEntryType = .send) {
|
|
|
+ // Not dispatching here; if delegate queue is blocked, timestamps will be delayed
|
|
|
+ self.pumpDelegate.delegate?.deviceManager(self, logEventForDeviceIdentifier: state.pumpID, type: type, message: message, completion: nil)
|
|
|
+ }
|
|
|
+
|
|
|
private let cgmDelegate = WeakSynchronizedDelegate<CGMManagerDelegate>()
|
|
|
private let pumpDelegate = WeakSynchronizedDelegate<PumpManagerDelegate>()
|
|
|
|
|
|
@@ -186,13 +192,13 @@ public class MinimedPumpManager: RileyLinkPumpManager {
|
|
|
|
|
|
// MARK: - RileyLink Updates
|
|
|
|
|
|
- override public var rileyLinkConnectionManagerState: RileyLinkConnectionManagerState? {
|
|
|
+ override public var rileyLinkConnectionManagerState: RileyLinkConnectionState? {
|
|
|
get {
|
|
|
- return state.rileyLinkConnectionManagerState
|
|
|
+ return state.rileyLinkConnectionState
|
|
|
}
|
|
|
set {
|
|
|
setState { (state) in
|
|
|
- state.rileyLinkConnectionManagerState = newValue
|
|
|
+ state.rileyLinkConnectionState = newValue
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -208,15 +214,18 @@ public class MinimedPumpManager: RileyLinkPumpManager {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- log.debug("MinimedPacket received: %{public}@", String(describing: message))
|
|
|
+ logDeviceCommunication("MySentry \(String(describing: message))", type: .receive)
|
|
|
|
|
|
switch message.messageBody {
|
|
|
case let body as MySentryPumpStatusMessageBody:
|
|
|
self.updatePumpStatus(body, from: device)
|
|
|
- case is MySentryAlertMessageBody, is MySentryAlertClearedMessageBody:
|
|
|
+ case let body as MySentryAlertMessageBody:
|
|
|
+ self.log.default("MySentry Alert: %{public}@", String(describing: body))
|
|
|
+ case let body as MySentryAlertClearedMessageBody:
|
|
|
+ self.log.default("MySentry Alert Cleared: %{public}@", String(describing: body))
|
|
|
break
|
|
|
- case let body:
|
|
|
- self.log.error("Unknown MySentry Message: %d: %{public}@", message.messageType.rawValue, body.txData.hexadecimalString)
|
|
|
+ default:
|
|
|
+ self.log.error("Unknown MySentry Message: %d: %{public}@", message.messageType.rawValue, message.txData.hexadecimalString)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -452,14 +461,14 @@ extension MinimedPumpManager {
|
|
|
|
|
|
if case .suspended = state.suspendState {
|
|
|
return PumpStatusHighlight(
|
|
|
- localizedMessage: NSLocalizedString("Insulin Suspended", comment: "Status highlight that insulin delivery was suspended."),
|
|
|
+ localizedMessage: LocalizedString("Insulin Suspended", comment: "Status highlight that insulin delivery was suspended."),
|
|
|
imageName: "pause.circle.fill",
|
|
|
state: .warning)
|
|
|
}
|
|
|
|
|
|
if date.timeIntervalSince(lastSync(for: state, recents: recents) ?? .distantPast) > .minutes(12) {
|
|
|
return PumpStatusHighlight(
|
|
|
- localizedMessage: NSLocalizedString("Signal Loss", comment: "Status highlight when communications with the pod haven't happened recently."),
|
|
|
+ localizedMessage: LocalizedString("Signal Loss", comment: "Status highlight when communications with the pod haven't happened recently."),
|
|
|
imageName: "exclamationmark.circle.fill",
|
|
|
state: .critical)
|
|
|
}
|
|
|
@@ -480,9 +489,9 @@ extension MinimedPumpManager {
|
|
|
}
|
|
|
|
|
|
private var pumpBatteryLowAlert: Alert {
|
|
|
- let title = NSLocalizedString("Pump Battery Low", comment: "The notification title for a low pump battery")
|
|
|
- let body = NSLocalizedString("Change the pump battery immediately", comment: "The notification alert describing a low pump battery")
|
|
|
- let content = Alert.Content(title: title, body: body, acknowledgeActionButtonLabel: NSLocalizedString("Dismiss", comment: "Default alert dismissal"))
|
|
|
+ let title = LocalizedString("Pump Battery Low", comment: "The notification title for a low pump battery")
|
|
|
+ let body = LocalizedString("Change the pump battery immediately", comment: "The notification alert describing a low pump battery")
|
|
|
+ let content = Alert.Content(title: title, body: body, acknowledgeActionButtonLabel: LocalizedString("Dismiss", comment: "Default alert dismissal"))
|
|
|
return Alert(identifier: Self.pumpBatteryLowAlertIdentifier, foregroundContent: content, backgroundContent: content, trigger: .immediate)
|
|
|
}
|
|
|
|
|
|
@@ -534,9 +543,9 @@ extension MinimedPumpManager {
|
|
|
}
|
|
|
|
|
|
private var pumpReservoirEmptyAlert: Alert {
|
|
|
- let title = NSLocalizedString("Pump Reservoir Empty", comment: "The notification title for an empty pump reservoir")
|
|
|
- let body = NSLocalizedString("Change the pump reservoir now", comment: "The notification alert describing an empty pump reservoir")
|
|
|
- let content = Alert.Content(title: title, body: body, acknowledgeActionButtonLabel: NSLocalizedString("Ok", comment: "Default alert dismissal"))
|
|
|
+ let title = LocalizedString("Pump Reservoir Empty", comment: "The notification title for an empty pump reservoir")
|
|
|
+ let body = LocalizedString("Change the pump reservoir now", comment: "The notification alert describing an empty pump reservoir")
|
|
|
+ let content = Alert.Content(title: title, body: body, acknowledgeActionButtonLabel: LocalizedString("Ok", comment: "Default alert dismissal"))
|
|
|
return Alert(identifier: Self.pumpReservoirEmptyAlertIdentifier, foregroundContent: content, backgroundContent: content, trigger: .immediate)
|
|
|
}
|
|
|
|
|
|
@@ -545,7 +554,7 @@ extension MinimedPumpManager {
|
|
|
}
|
|
|
|
|
|
private func pumpReservoirLowAlertForAmount(_ units: Double, andTimeRemaining remaining: TimeInterval?) -> Alert {
|
|
|
- let title = NSLocalizedString("Pump Reservoir Low", comment: "The notification title for a low pump reservoir")
|
|
|
+ let title = LocalizedString("Pump Reservoir Low", comment: "The notification title for a low pump reservoir")
|
|
|
|
|
|
let unitsString = NumberFormatter.localizedString(from: NSNumber(value: units), number: .decimal)
|
|
|
|
|
|
@@ -559,12 +568,12 @@ extension MinimedPumpManager {
|
|
|
let body: String
|
|
|
|
|
|
if let remaining = remaining, let timeString = intervalFormatter.string(from: remaining) {
|
|
|
- body = String(format: NSLocalizedString("%1$@ U left: %2$@", comment: "Low reservoir alert with time remaining format string. (1: Number of units remaining)(2: approximate time remaining)"), unitsString, timeString)
|
|
|
+ body = String(format: LocalizedString("%1$@ U left: %2$@", comment: "Low reservoir alert with time remaining format string. (1: Number of units remaining)(2: approximate time remaining)"), unitsString, timeString)
|
|
|
} else {
|
|
|
- body = String(format: NSLocalizedString("%1$@ U left", comment: "Low reservoir alert format string. (1: Number of units remaining)"), unitsString)
|
|
|
+ body = String(format: LocalizedString("%1$@ U left", comment: "Low reservoir alert format string. (1: Number of units remaining)"), unitsString)
|
|
|
}
|
|
|
|
|
|
- let content = Alert.Content(title: title, body: body, acknowledgeActionButtonLabel: NSLocalizedString("Ok", comment: "Default alert dismissal"))
|
|
|
+ let content = Alert.Content(title: title, body: body, acknowledgeActionButtonLabel: LocalizedString("Ok", comment: "Default alert dismissal"))
|
|
|
return Alert(identifier: Self.pumpReservoirLowAlertIdentifier, foregroundContent: content, backgroundContent: content, trigger: .immediate)
|
|
|
}
|
|
|
|
|
|
@@ -690,19 +699,19 @@ extension MinimedPumpManager {
|
|
|
}
|
|
|
|
|
|
if var runningTempBasal = state.unfinalizedTempBasal {
|
|
|
- // Look for following temp basal cancel event
|
|
|
+ // Look for following temp basal cancel event in pump history
|
|
|
if let tempBasalCancellation = result.remainingEvents.first(where: { (event) -> Bool in
|
|
|
if let dose = event.dose,
|
|
|
- dose.type == .tempBasal,
|
|
|
- dose.startDate > runningTempBasal.startTime,
|
|
|
- dose.startDate < runningTempBasal.finishTime,
|
|
|
- dose.unitsPerHour == 0
|
|
|
+ dose.type == .tempBasal,
|
|
|
+ dose.startDate > runningTempBasal.startTime,
|
|
|
+ dose.startDate < runningTempBasal.finishTime,
|
|
|
+ dose.startDate.timeIntervalSince(dose.endDate) == 0
|
|
|
{
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
}) {
|
|
|
- runningTempBasal.finishTime = tempBasalCancellation.date
|
|
|
+ runningTempBasal.cancel(at: tempBasalCancellation.date, pumpModel: state.pumpModel)
|
|
|
state.unfinalizedTempBasal = runningTempBasal
|
|
|
state.suspendState = .resumed(tempBasalCancellation.date)
|
|
|
}
|
|
|
@@ -718,7 +727,7 @@ extension MinimedPumpManager {
|
|
|
/// - error: An error describing why the fetch and/or store failed
|
|
|
private func fetchPumpHistory(_ completion: @escaping (_ error: Error?) -> Void) {
|
|
|
guard let insulinType = insulinType else {
|
|
|
- completion(PumpManagerError.configuration(nil))
|
|
|
+ completion(PumpManagerError.configuration(MinimedPumpManagerError.insulinTypeNotConfigured))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -737,6 +746,7 @@ extension MinimedPumpManager {
|
|
|
}
|
|
|
|
|
|
// Include events up to a minute before startDate, since pump event time and pending event time might be off
|
|
|
+ self.log.default("Fetching history since %{public}@", String(describing: startDate.addingTimeInterval(.minutes(-1))))
|
|
|
let (historyEvents, model) = try session.getHistoryEvents(since: startDate.addingTimeInterval(.minutes(-1)))
|
|
|
|
|
|
// Reconcile history with pending doses
|
|
|
@@ -757,9 +767,11 @@ extension MinimedPumpManager {
|
|
|
preconditionFailure("pumpManagerDelegate cannot be nil")
|
|
|
}
|
|
|
|
|
|
- let pendingEvents = (self.state.pendingDoses + [self.state.unfinalizedBolus, self.state.unfinalizedTempBasal]).compactMap({ $0?.newPumpEvent })
|
|
|
+ let pendingEvents = (self.state.pendingDoses + [self.state.unfinalizedBolus, self.state.unfinalizedTempBasal]).compactMap({ $0?.newPumpEvent() })
|
|
|
|
|
|
- delegate.pumpManager(self, hasNewPumpEvents: remainingHistoryEvents + pendingEvents, lastSync: self.lastSync, completion: { (error) in
|
|
|
+ self.log.default("Reporting new pump events: %{public}@", String(describing: remainingHistoryEvents + pendingEvents))
|
|
|
+
|
|
|
+ delegate.pumpManager(self, hasNewPumpEvents: remainingHistoryEvents + pendingEvents, lastReconciliation: self.state.lastReconciliation, completion: { (error) in
|
|
|
// Called on an unknown queue by the delegate
|
|
|
if error == nil {
|
|
|
self.recents.lastAddedPumpEvents = Date()
|
|
|
@@ -791,9 +803,9 @@ extension MinimedPumpManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private func storePendingPumpEvents(_ completion: @escaping (_ error: MinimedPumpManagerError?) -> Void) {
|
|
|
+ private func storePendingPumpEvents(forceFinalization: Bool = false, _ completion: @escaping (_ error: MinimedPumpManagerError?) -> Void) {
|
|
|
// Must be called from the sessionQueue
|
|
|
- let events = (self.state.pendingDoses + [self.state.unfinalizedBolus, self.state.unfinalizedTempBasal]).compactMap({ $0?.newPumpEvent })
|
|
|
+ let events = (self.state.pendingDoses + [self.state.unfinalizedBolus, self.state.unfinalizedTempBasal]).compactMap({ $0?.newPumpEvent(forceFinalization: forceFinalization) })
|
|
|
|
|
|
log.debug("Storing pending pump events: %{public}@", String(describing: events))
|
|
|
|
|
|
@@ -802,7 +814,7 @@ extension MinimedPumpManager {
|
|
|
preconditionFailure("pumpManagerDelegate cannot be nil")
|
|
|
}
|
|
|
|
|
|
- delegate.pumpManager(self, hasNewPumpEvents: events, lastSync: self.lastSync, completion: { (error) in
|
|
|
+ delegate.pumpManager(self, hasNewPumpEvents: events, lastReconciliation: self.state.lastReconciliation, completion: { (error) in
|
|
|
// Called on an unknown queue by the delegate
|
|
|
if let error = error {
|
|
|
self.log.error("Pump event storage failed: %{public}@", String(describing: error))
|
|
|
@@ -1068,7 +1080,7 @@ extension MinimedPumpManager: PumpManager {
|
|
|
|
|
|
public func suspendDelivery(completion: @escaping (Error?) -> Void) {
|
|
|
guard let insulinType = insulinType else {
|
|
|
- completion(PumpManagerError.configuration(nil))
|
|
|
+ completion(PumpManagerError.configuration(MinimedPumpManagerError.insulinTypeNotConfigured))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -1077,7 +1089,7 @@ extension MinimedPumpManager: PumpManager {
|
|
|
|
|
|
public func resumeDelivery(completion: @escaping (Error?) -> Void) {
|
|
|
guard let insulinType = insulinType else {
|
|
|
- completion(PumpManagerError.configuration(nil))
|
|
|
+ completion(PumpManagerError.configuration(MinimedPumpManagerError.insulinTypeNotConfigured))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -1174,12 +1186,12 @@ extension MinimedPumpManager: PumpManager {
|
|
|
}
|
|
|
|
|
|
guard let insulinType = insulinType else {
|
|
|
- completion(.configuration(nil))
|
|
|
+ completion(.configuration(MinimedPumpManagerError.insulinTypeNotConfigured))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
|
|
|
- pumpOps.runSession(withName: "Bolus", using: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
+ pumpOps.runSession(withName: "Bolus", usingSelector: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
|
|
|
guard let session = session else {
|
|
|
completion(.connection(MinimedPumpManagerError.noRileyLink))
|
|
|
@@ -1273,7 +1285,7 @@ extension MinimedPumpManager: PumpManager {
|
|
|
public func cancelBolus(completion: @escaping (PumpManagerResult<DoseEntry?>) -> Void) {
|
|
|
|
|
|
guard let insulinType = insulinType else {
|
|
|
- completion(.failure(.configuration(nil)))
|
|
|
+ completion(.failure(.configuration(MinimedPumpManagerError.insulinTypeNotConfigured)))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -1290,11 +1302,11 @@ extension MinimedPumpManager: PumpManager {
|
|
|
|
|
|
public func enactTempBasal(unitsPerHour: Double, for duration: TimeInterval, completion: @escaping (PumpManagerError?) -> Void) {
|
|
|
guard let insulinType = insulinType else {
|
|
|
- completion(.configuration(nil))
|
|
|
+ completion(.configuration(MinimedPumpManagerError.insulinTypeNotConfigured))
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- pumpOps.runSession(withName: "Set Temp Basal", using: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
+ pumpOps.runSession(withName: "Set Temp Basal", usingSelector: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
guard let session = session else {
|
|
|
completion(.connection(MinimedPumpManagerError.noRileyLink))
|
|
|
return
|
|
|
@@ -1305,12 +1317,10 @@ extension MinimedPumpManager: PumpManager {
|
|
|
let result = session.setTempBasal(unitsPerHour, duration: duration)
|
|
|
|
|
|
switch result {
|
|
|
- case .success(let response):
|
|
|
+ case .success:
|
|
|
let now = Date()
|
|
|
- let endDate = now.addingTimeInterval(response.timeRemaining)
|
|
|
- let startDate = endDate.addingTimeInterval(-duration)
|
|
|
|
|
|
- let dose = UnfinalizedDose(tempBasalRate: unitsPerHour, startTime: startDate, duration: duration, insulinType: insulinType)
|
|
|
+ let dose = UnfinalizedDose(tempBasalRate: unitsPerHour, startTime: now, duration: duration, insulinType: insulinType, automatic: true)
|
|
|
|
|
|
self.recents.tempBasalEngageState = .stable
|
|
|
|
|
|
@@ -1319,14 +1329,14 @@ extension MinimedPumpManager: PumpManager {
|
|
|
// If we were successful, then we know we aren't suspended
|
|
|
self.setState({ (state) in
|
|
|
if case .suspended = state.suspendState {
|
|
|
- state.suspendState = .resumed(startDate)
|
|
|
+ state.suspendState = .resumed(now)
|
|
|
} else if isResumingScheduledBasal {
|
|
|
- state.suspendState = .resumed(startDate)
|
|
|
+ state.suspendState = .resumed(now)
|
|
|
}
|
|
|
|
|
|
let pumpModel = state.pumpModel
|
|
|
|
|
|
- state.unfinalizedTempBasal?.cancel(at: startDate, pumpModel: pumpModel)
|
|
|
+ state.unfinalizedTempBasal?.cancel(at: now, pumpModel: pumpModel)
|
|
|
if let previousTempBasal = state.unfinalizedTempBasal {
|
|
|
state.pendingDoses.append(previousTempBasal)
|
|
|
}
|
|
|
@@ -1346,6 +1356,8 @@ extension MinimedPumpManager: PumpManager {
|
|
|
case .failure(let error):
|
|
|
completion(.communication(error))
|
|
|
|
|
|
+ self.logDeviceCommunication("Set temp basal failed: \(error.localizedDescription)", type: .error)
|
|
|
+
|
|
|
// If we got a command-refused error, we might be suspended or bolusing, so update the state accordingly
|
|
|
if case .arguments(.pumpError(.commandRefused)) = error {
|
|
|
do {
|
|
|
@@ -1400,7 +1412,7 @@ extension MinimedPumpManager: PumpManager {
|
|
|
public func setMaximumTempBasalRate(_ rate: Double) { }
|
|
|
|
|
|
public func syncBasalRateSchedule(items scheduleItems: [RepeatingScheduleValue<Double>], completion: @escaping (Result<BasalRateSchedule, Error>) -> Void) {
|
|
|
- pumpOps.runSession(withName: "Save Basal Profile", using: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
+ pumpOps.runSession(withName: "Save Basal Profile", usingSelector: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
guard let session = session else {
|
|
|
completion(.failure(PumpManagerError.connection(MinimedPumpManagerError.noRileyLink)))
|
|
|
return
|
|
|
@@ -1419,7 +1431,7 @@ extension MinimedPumpManager: PumpManager {
|
|
|
}
|
|
|
|
|
|
public func syncDeliveryLimits(limits deliveryLimits: DeliveryLimits, completion: @escaping (Result<DeliveryLimits, Error>) -> Void) {
|
|
|
- pumpOps.runSession(withName: "Save Settings", using: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
+ pumpOps.runSession(withName: "Save Settings", usingSelector: rileyLinkDeviceProvider.firstConnectedDevice) { (session) in
|
|
|
guard let session = session else {
|
|
|
completion(.failure(PumpManagerError.connection(MinimedPumpManagerError.noRileyLink)))
|
|
|
return
|
|
|
@@ -1444,9 +1456,29 @@ extension MinimedPumpManager: PumpManager {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public func deletePump(completion: @escaping () -> Void) {
|
|
|
+ storePendingPumpEvents(forceFinalization: true) { error in
|
|
|
+ self.notifyDelegateOfDeletion {
|
|
|
+ completion()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
extension MinimedPumpManager: PumpOpsDelegate {
|
|
|
+ public func willSend(_ message: String) {
|
|
|
+ logDeviceCommunication(message, type: .send)
|
|
|
+ }
|
|
|
+
|
|
|
+ public func didReceive(_ message: String) {
|
|
|
+ logDeviceCommunication(message, type: .receive)
|
|
|
+ }
|
|
|
+
|
|
|
+ public func didError(_ message: String) {
|
|
|
+ logDeviceCommunication(message, type: .error)
|
|
|
+ }
|
|
|
+
|
|
|
public func pumpOps(_ pumpOps: PumpOps, didChange state: PumpState) {
|
|
|
setState { (pumpManagerState) in
|
|
|
pumpManagerState.pumpState = state
|