From 70026a58ed4499f8cb5faec75deb7f34c6e57eab Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Sat, 18 Jun 2016 22:25:51 -0700 Subject: [PATCH 01/16] Storing the raw bytes in PumpEvents --- .../AlarmClockReminderPumpEvent.swift | 5 ++++- .../PumpEvents/AlarmSensorPumpEvent.swift | 3 +++ .../PumpEvents/BGReceivedPumpEvent.swift | 3 +++ .../BasalProfileStartPumpEvent.swift | 3 +++ MinimedKit/PumpEvents/BatteryPumpEvent.swift | 3 +++ .../PumpEvents/BolusNormalPumpEvent.swift | 3 +++ .../BolusWizardEstimatePumpEvent.swift | 20 ++++++------------- .../PumpEvents/CalBGForPHPumpEvent.swift | 3 +++ .../ChangeAlarmClockEnablePumpEvent.swift | 3 +++ .../ChangeAlarmClockTimePumpEvent.swift | 3 +++ .../ChangeAlarmNotifyModePumpEvent.swift | 3 +++ .../ChangeAudioBolusPumpEvent.swift | 3 +++ .../ChangeBGReminderEnablePumpEvent.swift | 3 +++ .../ChangeBGReminderOffsetPumpEvent.swift | 3 +++ .../ChangeBasalProfilePatternPumpEvent.swift | 3 +++ .../ChangeBasalProfilePumpEvent.swift | 3 +++ .../ChangeBolusReminderEnablePumpEvent.swift | 3 +++ .../ChangeBolusReminderTimePumpEvent.swift | 3 +++ .../ChangeBolusScrollStepSizePumpEvent.swift | 3 +++ .../ChangeBolusWizardSetupPumpEvent.swift | 3 +++ .../ChangeCaptureEventEnablePumpEvent.swift | 3 +++ .../PumpEvents/ChangeCarbUnitsPumpEvent.swift | 3 +++ .../ChangeChildBlockEnablePumpEvent.swift | 3 +++ .../PumpEvents/ChangeMaxBasalPumpEvent.swift | 3 +++ .../PumpEvents/ChangeMaxBolusPumpEvent.swift | 3 +++ .../ChangeOtherDeviceIDPumpEvent.swift | 3 +++ .../ChangeParadigmLinkIDPumpEvent.swift | 3 +++ .../ChangeReservoirWarningTimePumpEvent.swift | 3 +++ ...ensorRateOfChangeAlertSetupPumpEvent.swift | 3 +++ .../ChangeSensorSetup2PumpEvent.swift | 3 +++ .../ChangeTempBasalTypePumpEvent.swift | 3 +++ .../ChangeTimeFormatPumpEvent.swift | 3 +++ .../PumpEvents/ChangeTimePumpEvent.swift | 3 +++ .../ChangeVariableBolusPumpEvent.swift | 3 +++ .../ChangeWatchdogEnablePumpEvent.swift | 3 +++ ...angeWatchdogMarriageProfilePumpEvent.swift | 3 +++ .../PumpEvents/ClearAlarmPumpEvent.swift | 3 +++ .../DeleteAlarmClockTimePumpEvent.swift | 3 +++ .../DeleteBolusReminderTimePumpEvent.swift | 3 +++ .../DeleteOtherDeviceIDPumpEvent.swift | 3 +++ .../EnableDisableRemotePumpEvent.swift | 3 +++ .../JournalEntryExerciseMarkerPumpEvent.swift | 3 +++ .../JournalEntryPumpLowBatteryPumpEvent.swift | 3 +++ ...ournalEntryPumpLowReservoirPumpEvent.swift | 3 +++ .../Model522ResultTotalsPumpEvent.swift | 3 +++ MinimedKit/PumpEvents/PrimePumpEvent.swift | 3 +++ .../PumpEvents/PumpAlarmPumpEvent.swift | 3 +++ MinimedKit/PumpEvents/PumpEvent.swift | 6 +++++- .../ResultDailyTotalPumpEvent.swift | 3 +++ MinimedKit/PumpEvents/ResumePumpEvent.swift | 3 +++ MinimedKit/PumpEvents/RewindPumpEvent.swift | 3 +++ MinimedKit/PumpEvents/Sara6EPumpEvent.swift | 7 ++++--- .../SelectBasalProfilePumpEvent.swift | 3 +++ MinimedKit/PumpEvents/SuspendPumpEvent.swift | 3 +++ .../TempBasalDurationPumpEvent.swift | 3 +++ .../PumpEvents/TempBasalPumpEvent.swift | 3 +++ .../UnabsorbedInsulinPumpEvent.swift | 3 +++ 57 files changed, 178 insertions(+), 19 deletions(-) diff --git a/MinimedKit/PumpEvents/AlarmClockReminderPumpEvent.swift b/MinimedKit/PumpEvents/AlarmClockReminderPumpEvent.swift index 7021bcdec..a00f4e7d5 100644 --- a/MinimedKit/PumpEvents/AlarmClockReminderPumpEvent.swift +++ b/MinimedKit/PumpEvents/AlarmClockReminderPumpEvent.swift @@ -10,6 +10,7 @@ import Foundation public struct AlarmClockReminderPumpEvent: TimestampedPumpEvent { public let length: Int + public let rawData: NSData public let timestamp: NSDateComponents public init?(availableData: NSData, pumpModel: PumpModel) { @@ -18,7 +19,9 @@ public struct AlarmClockReminderPumpEvent: TimestampedPumpEvent { guard length <= availableData.length else { return nil } - + + rawData = availableData[0.. Int { return Int(availableData[idx] as UInt8) diff --git a/MinimedKit/PumpEvents/BasalProfileStartPumpEvent.swift b/MinimedKit/PumpEvents/BasalProfileStartPumpEvent.swift index f04ec0606..5a5273004 100644 --- a/MinimedKit/PumpEvents/BasalProfileStartPumpEvent.swift +++ b/MinimedKit/PumpEvents/BasalProfileStartPumpEvent.swift @@ -10,6 +10,7 @@ import Foundation public struct BasalProfileStartPumpEvent: TimestampedPumpEvent { public let length: Int + public let rawData: NSData public let timestamp: NSDateComponents let rate: Double let profileIndex: Int @@ -22,6 +23,8 @@ public struct BasalProfileStartPumpEvent: TimestampedPumpEvent { guard length <= availableData.length else { return nil } + + rawData = availableData[0.. Int { return Int(availableData[idx] as UInt8) diff --git a/MinimedKit/PumpEvents/BatteryPumpEvent.swift b/MinimedKit/PumpEvents/BatteryPumpEvent.swift index b43e7286d..7941b44ba 100644 --- a/MinimedKit/PumpEvents/BatteryPumpEvent.swift +++ b/MinimedKit/PumpEvents/BatteryPumpEvent.swift @@ -10,6 +10,7 @@ import Foundation public struct BatteryPumpEvent: TimestampedPumpEvent { public let length: Int + public let rawData: NSData public let timestamp: NSDateComponents public init?(availableData: NSData, pumpModel: PumpModel) { @@ -18,6 +19,8 @@ public struct BatteryPumpEvent: TimestampedPumpEvent { guard length <= availableData.length else { return nil } + + rawData = availableData[0..= availableData.length { - carbohydrates = 0 - bloodGlucose = 0 - foodEstimate = 0 - correctionEstimate = 0 - bolusEstimate = 0 - unabsorbedInsulinTotal = 0 - bgTargetLow = 0 - bgTargetHigh = 0 - insulinSensitivity = 0 - carbRatio = 0 - timestamp = NSDateComponents() + + guard length <= availableData.length else { return nil } - + + rawData = availableData[0.. Int { return Int(availableData[idx] as UInt8) diff --git a/MinimedKit/PumpEvents/ChangeAlarmClockEnablePumpEvent.swift b/MinimedKit/PumpEvents/ChangeAlarmClockEnablePumpEvent.swift index 683fde6b7..cdc673869 100644 --- a/MinimedKit/PumpEvents/ChangeAlarmClockEnablePumpEvent.swift +++ b/MinimedKit/PumpEvents/ChangeAlarmClockEnablePumpEvent.swift @@ -10,6 +10,7 @@ import Foundation public struct ChangeAlarmClockEnablePumpEvent: TimestampedPumpEvent { public let length: Int + public let rawData: NSData public let timestamp: NSDateComponents public init?(availableData: NSData, pumpModel: PumpModel) { @@ -18,6 +19,8 @@ public struct ChangeAlarmClockEnablePumpEvent: TimestampedPumpEvent { guard length <= availableData.length else { return nil } + + rawData = availableData[0.. Int { return Int(availableData[idx] as UInt8) diff --git a/MinimedKit/PumpEvents/PumpAlarmPumpEvent.swift b/MinimedKit/PumpEvents/PumpAlarmPumpEvent.swift index e0c11eca5..b4d47f5e7 100644 --- a/MinimedKit/PumpEvents/PumpAlarmPumpEvent.swift +++ b/MinimedKit/PumpEvents/PumpAlarmPumpEvent.swift @@ -10,6 +10,7 @@ import Foundation public struct PumpAlarmPumpEvent: TimestampedPumpEvent { public let length: Int + public let rawData: NSData public let timestamp: NSDateComponents let rawType: Int @@ -19,6 +20,8 @@ public struct PumpAlarmPumpEvent: TimestampedPumpEvent { guard length <= availableData.length else { return nil } + + rawData = availableData[0.. availableData.length { - timestamp = NSDateComponents() - validDateStr = "Invalid" + guard 16 <= availableData.length else { return nil } + rawData = availableData[0..> 3) == 0 ? .Absolute : .Percent if rateType == .Absolute { diff --git a/MinimedKit/PumpEvents/UnabsorbedInsulinPumpEvent.swift b/MinimedKit/PumpEvents/UnabsorbedInsulinPumpEvent.swift index bdb321201..a58e6a870 100644 --- a/MinimedKit/PumpEvents/UnabsorbedInsulinPumpEvent.swift +++ b/MinimedKit/PumpEvents/UnabsorbedInsulinPumpEvent.swift @@ -28,6 +28,7 @@ public struct UnabsorbedInsulinPumpEvent: PumpEvent { } public let length: Int + public let rawData: NSData public let records: [Record] @@ -38,6 +39,8 @@ public struct UnabsorbedInsulinPumpEvent: PumpEvent { guard length <= availableData.length else { return nil } + + rawData = availableData[0.. Int { return Int(availableData[idx] as UInt8) From 488ed85cefddc9f84a39f06ae4b929c9d9eeedc8 Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Mon, 20 Jun 2016 22:33:57 -0700 Subject: [PATCH 02/16] Adding Questionable3b; handling pumps with empty history --- MinimedKit/PumpEventType.swift | 3 ++ MinimedKit/PumpEvents/UnknownPumpEvent.swift | 35 ++++++++++++++++++++ MinimedKitTests/HistoryPageTests.swift | 9 +++++ RileyLink.xcodeproj/project.pbxproj | 14 +++++--- RileyLinkKit/PumpOpsSynchronous.swift | 12 ++++++- 5 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 MinimedKit/PumpEvents/UnknownPumpEvent.swift diff --git a/MinimedKit/PumpEventType.swift b/MinimedKit/PumpEventType.swift index fe4fc114f..4f7266eba 100644 --- a/MinimedKit/PumpEventType.swift +++ b/MinimedKit/PumpEventType.swift @@ -34,6 +34,7 @@ public enum PumpEventType: UInt8 { case TempBasal = 0x33 case JournalEntryPumpLowReservoir = 0x34 case AlarmClockReminder = 0x35 + case Questionable3b = 0x3b case ChangeParadigmLinkID = 0x3c case BGReceived = 0x3f case JournalEntryExerciseMarker = 0x41 @@ -179,6 +180,8 @@ public enum PumpEventType: UInt8 { return ChangeCaptureEventEnablePumpEvent.self case .SelectBasalProfile: return SelectBasalProfilePumpEvent.self + case .Questionable3b: + return UnknownPumpEvent.self } } } diff --git a/MinimedKit/PumpEvents/UnknownPumpEvent.swift b/MinimedKit/PumpEvents/UnknownPumpEvent.swift new file mode 100644 index 000000000..bdf09b063 --- /dev/null +++ b/MinimedKit/PumpEvents/UnknownPumpEvent.swift @@ -0,0 +1,35 @@ +// +// UnknownPumpEvent.swift +// RileyLink +// +// Created by Nate Racklyeft on 6/20/16. +// Copyright © 2016 Pete Schwamb. All rights reserved. +// + +import Foundation + + +public struct UnknownPumpEvent: TimestampedPumpEvent { + public let length: Int + public let rawData: NSData + public let timestamp: NSDateComponents + + public init?(availableData: NSData, pumpModel: PumpModel) { + length = 7 + + guard length <= availableData.length else { + return nil + } + + rawData = availableData[0.. 0 { + break + } else { + throw error + } + } NSLog("Fetched page %d: %@", pageNum, pageData) let page = try HistoryPage(pageData: pageData, pumpModel: pumpModel) From ffb9366d52dd40cd6967828bb0e0010e4def4df8 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Tue, 21 Jun 2016 23:18:04 -0700 Subject: [PATCH 03/16] Fix timezone handling on mysentry packets for Nightscout pump status --- NightscoutUploadKit/NightscoutUploader.swift | 15 ++++++++++----- NightscoutUploadKit/TimeFormat.swift | 14 -------------- RileyLink/DeviceDataManager.swift | 1 + 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/NightscoutUploadKit/NightscoutUploader.swift b/NightscoutUploadKit/NightscoutUploader.swift index a42eb3635..1fbaeb9f5 100644 --- a/NightscoutUploadKit/NightscoutUploader.swift +++ b/NightscoutUploadKit/NightscoutUploader.swift @@ -142,12 +142,17 @@ public class NightscoutUploader: NSObject { nsStatus["uploader"] = ["battery":uploaderDevice.batteryLevel * 100] } - let pumpDate = TimeFormat.timestampStr(status.pumpDateComponents) + guard let pumpDate = status.pumpDateComponents.date else { + NSLog("Pump date not set (or timezone missing) in pump status message!") + return + } + + let pumpDateStr = TimeFormat.timestampStrFromDate(pumpDate) nsStatus["pump"] = [ - "clock": pumpDate, + "clock": pumpDateStr, "iob": [ - "timestamp": pumpDate, + "timestamp": pumpDateStr, "bolusiob": status.iob, ], "reservoir": status.reservoirRemainingUnits, @@ -176,9 +181,9 @@ public class NightscoutUploader: NSObject { "type": "sgv" ] if let sensorDateComponents = status.glucoseDateComponents, - let sensorDate = TimeFormat.timestampAsLocalDate(sensorDateComponents) { + let sensorDate = sensorDateComponents.date { entry["date"] = sensorDate.timeIntervalSince1970 * 1000 - entry["dateString"] = TimeFormat.timestampStr(sensorDateComponents) + entry["dateString"] = TimeFormat.timestampStrFromDate(sensorDate) } switch status.previousGlucose { case .Active(glucose: let previousGlucose): diff --git a/NightscoutUploadKit/TimeFormat.swift b/NightscoutUploadKit/TimeFormat.swift index 86f6e180e..136660675 100644 --- a/NightscoutUploadKit/TimeFormat.swift +++ b/NightscoutUploadKit/TimeFormat.swift @@ -10,20 +10,6 @@ import Foundation class TimeFormat: NSObject { private static var formatterISO8601 = NSDateFormatter.ISO8601DateFormatter() - - static func timestampAsLocalDate(comps: NSDateComponents) -> NSDate? { - let cal = comps.calendar ?? NSCalendar.currentCalendar() - cal.timeZone = comps.timeZone ?? NSTimeZone.localTimeZone() - return cal.dateFromComponents(comps) - } - - static func timestampStr(comps: NSDateComponents) -> String { - if let date = timestampAsLocalDate(comps) { - return formatterISO8601.stringFromDate(date) - } else { - return "Invalid" - } - } static func timestampStrFromDate(date: NSDate) -> String { return formatterISO8601.stringFromDate(date) diff --git a/RileyLink/DeviceDataManager.swift b/RileyLink/DeviceDataManager.swift index dd2730586..446d665b4 100644 --- a/RileyLink/DeviceDataManager.swift +++ b/RileyLink/DeviceDataManager.swift @@ -174,6 +174,7 @@ class DeviceDataManager { private func updatePumpStatus(status: MySentryPumpStatusMessageBody, fromDevice device: RileyLinkDevice) { status.pumpDateComponents.timeZone = pumpTimeZone + status.glucoseDateComponents?.timeZone = pumpTimeZone if status != latestPumpStatus { latestPumpStatus = status From c52b21142be9be1f6d6c35c4ce42972e2b697256 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Tue, 21 Jun 2016 23:32:24 -0700 Subject: [PATCH 04/16] Make source field of ns records consistent --- RileyLink/DeviceDataManager.swift | 10 ++++------ RileyLinkBLEKit/RileyLinkBLEDevice.m | 2 +- RileyLinkKit/RileyLinkDevice.swift | 4 ++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/RileyLink/DeviceDataManager.swift b/RileyLink/DeviceDataManager.swift index 446d665b4..86cdaaccc 100644 --- a/RileyLink/DeviceDataManager.swift +++ b/RileyLink/DeviceDataManager.swift @@ -182,9 +182,8 @@ class DeviceDataManager { if status.batteryRemainingPercent == 0 { //NotificationManager.sendPumpBatteryLowNotification() } - let source = "rileylink://medtronic/\(device.name)" if Config.sharedInstance().uploadEnabled { - nightscoutUploader.handlePumpStatus(status, device: source) + nightscoutUploader.handlePumpStatus(status, device: device.deviceURI) } // Sentry packets are sent in groups of 3, 5s apart. Wait 11s to avoid conflicting comms. @@ -201,7 +200,7 @@ class DeviceDataManager { switch response { case .Success(let (events, pumpModel)): NSLog("fetchHistory succeeded.") - self.handleNewHistoryEvents(events, pumpModel: pumpModel) + self.handleNewHistoryEvents(events, pumpModel: pumpModel, device: device) NSNotificationCenter.defaultCenter().postNotificationName(self.dynamicType.PumpEventsUpdatedNotification, object: self) case .Failure(let error): @@ -210,12 +209,11 @@ class DeviceDataManager { } } - private func handleNewHistoryEvents(events: [TimestampedHistoryEvent], pumpModel: PumpModel) { + private func handleNewHistoryEvents(events: [TimestampedHistoryEvent], pumpModel: PumpModel, device: RileyLinkDevice) { // TODO: get insulin doses from history // TODO: upload events to Nightscout - let source = "rileylink://medtronic/\(pumpModel)" if Config.sharedInstance().uploadEnabled { - nightscoutUploader.processPumpEvents(events, source: source, pumpModel: pumpModel) + nightscoutUploader.processPumpEvents(events, source: device.deviceURI, pumpModel: pumpModel) } } diff --git a/RileyLinkBLEKit/RileyLinkBLEDevice.m b/RileyLinkBLEKit/RileyLinkBLEDevice.m index 65ab8f269..00ab4ec1e 100644 --- a/RileyLinkBLEKit/RileyLinkBLEDevice.m +++ b/RileyLinkBLEKit/RileyLinkBLEDevice.m @@ -451,7 +451,7 @@ - (void)cleanup { } - (NSString*) deviceURI { - return [@"rl://" stringByAppendingString:self.name]; + return [@"rileylink://" stringByAppendingString:self.name]; } - (void) setCustomName:(nonnull NSString*)customName { diff --git a/RileyLinkKit/RileyLinkDevice.swift b/RileyLinkKit/RileyLinkDevice.swift index 7befc2c7a..6f63f170c 100644 --- a/RileyLinkKit/RileyLinkDevice.swift +++ b/RileyLinkKit/RileyLinkDevice.swift @@ -38,6 +38,10 @@ public class RileyLinkDevice { return device.firmwareVersion } + public var deviceURI: String { + return device.deviceURI + } + public var name: String? { return device.name } From 6700b9adbf8649c1555d234d2711f07756fecf72 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Wed, 22 Jun 2016 22:25:56 -0700 Subject: [PATCH 05/16] Add async error handling for nightscout upload errors --- NightscoutUploadKit/NightscoutUploader.swift | 48 ++++++++++++++------ RileyLink/DeviceDataManager.swift | 3 ++ 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/NightscoutUploadKit/NightscoutUploader.swift b/NightscoutUploadKit/NightscoutUploader.swift index 1fbaeb9f5..03db8b5b9 100644 --- a/NightscoutUploadKit/NightscoutUploader.swift +++ b/NightscoutUploadKit/NightscoutUploader.swift @@ -10,6 +10,14 @@ import UIKit import MinimedKit import Crypto +public enum UploadError: ErrorType { + case MissingAPISecret + case MissingNightscoutURL + case InvalidNightscoutURL(String) + case HTTPError(status: Int, body: String) + case MissingTimezone +} + public class NightscoutUploader: NSObject { enum DexcomSensorError: UInt8 { @@ -32,6 +40,8 @@ public class NightscoutUploader: NSObject { let defaultNightscoutEntriesPath = "/api/v1/entries.json" let defaultNightscoutTreatmentPath = "/api/v1/treatments.json" let defaultNightscoutDeviceStatusPath = "/api/v1/devicestatus.json" + + public var errorHandler: ((error: ErrorType, context: String) -> Void)? public override init() { entries = [AnyObject]() @@ -73,7 +83,6 @@ public class NightscoutUploader: NSObject { } else if newestEventTime != nil { observingPumpEventsSince = newestEventTime! } - NSLog("Updated fetch start time to %@", observingPumpEventsSince) for treatment in NightscoutPumpEvents.translate(events, eventSource: source) { addTreatment(treatment, pumpModel:pumpModel) @@ -143,7 +152,7 @@ public class NightscoutUploader: NSObject { } guard let pumpDate = status.pumpDateComponents.date else { - NSLog("Pump date not set (or timezone missing) in pump status message!") + self.errorHandler?(error: UploadError.MissingTimezone, context: "Unable to get status.pumpDateComponents.date") return } @@ -207,6 +216,7 @@ public class NightscoutUploader: NSObject { }() entries.append(entry) } + flushAll() } public func handleMeterMessage(msg: MeterMessage) { @@ -244,17 +254,27 @@ public class NightscoutUploader: NSObject { flushTreatments() } - func uploadToNS(json: [AnyObject], endpoint:String, completion: (String?) -> Void) { + func uploadToNS(json: [AnyObject], endpoint:String, completion: (ErrorType?) -> Void) { if json.count == 0 { completion(nil) return } - if let siteURL = siteURL, - let APISecret = APISecret, - let uploadURL = NSURL(string: endpoint, relativeToURL: NSURL(string: siteURL)) { + guard let siteURL = siteURL else { + completion(UploadError.MissingNightscoutURL) + return + } + + guard let APISecret = APISecret else { + completion(UploadError.MissingAPISecret) + return + } + + + if let uploadURL = NSURL(string: endpoint, relativeToURL: NSURL(string: siteURL)) { let request = NSMutableURLRequest(URL: uploadURL) do { + let sendData = try NSJSONSerialization.dataWithJSONObject(json, options: NSJSONWritingOptions.PrettyPrinted) request.HTTPMethod = "POST" @@ -266,19 +286,19 @@ public class NightscoutUploader: NSObject { let task = NSURLSession.sharedSession().dataTaskWithRequest(request, completionHandler: { (data, response, error) in let httpResponse = response as! NSHTTPURLResponse if let error = error { - completion(error.description) + completion(error) } else if httpResponse.statusCode != 200 { - completion(String(data: data!, encoding: NSUTF8StringEncoding)!) + completion(UploadError.HTTPError(status: httpResponse.statusCode, body:String(data: data!, encoding: NSUTF8StringEncoding)!)) } else { completion(nil) } }) task.resume() - } catch { - completion("Couldn't encode data to json.") + } catch let error as NSError { + completion(error) } } else { - completion("Invalid URL: \(siteURL), \(endpoint)") + completion(UploadError.InvalidNightscoutURL("\(siteURL), \(endpoint)")) } } @@ -287,7 +307,7 @@ public class NightscoutUploader: NSObject { deviceStatuses = [AnyObject]() uploadToNS(inFlight, endpoint: defaultNightscoutDeviceStatusPath) { (error) in if error != nil { - NSLog("Uploading device status to nightscout failed: %@", error!) + self.errorHandler?(error: error!, context: "Uploading device status") // Requeue self.deviceStatuses.appendContentsOf(inFlight) } @@ -299,7 +319,7 @@ public class NightscoutUploader: NSObject { entries = [AnyObject]() uploadToNS(inFlight, endpoint: defaultNightscoutEntriesPath) { (error) in if error != nil { - NSLog("Uploading nightscout entries failed: %@", error!) + self.errorHandler?(error: error!, context: "Uploading nightscout entries") // Requeue self.entries.appendContentsOf(inFlight) } @@ -311,7 +331,7 @@ public class NightscoutUploader: NSObject { treatmentsQueue = [AnyObject]() uploadToNS(inFlight, endpoint: defaultNightscoutTreatmentPath) { (error) in if error != nil { - NSLog("Uploading nightscout treatment records failed: %@", error!) + self.errorHandler?(error: error!, context: "Uploading nightscout treatment records") // Requeue self.treatmentsQueue.appendContentsOf(inFlight) } diff --git a/RileyLink/DeviceDataManager.swift b/RileyLink/DeviceDataManager.swift index 86cdaaccc..1342323d4 100644 --- a/RileyLink/DeviceDataManager.swift +++ b/RileyLink/DeviceDataManager.swift @@ -243,6 +243,9 @@ class DeviceDataManager { nightscoutUploader = NightscoutUploader() nightscoutUploader.siteURL = nightscoutURL nightscoutUploader.APISecret = nightscoutAPISecret + nightscoutUploader.errorHandler = { (error: ErrorType, context: String) -> Void in + NSLog("Error %s, while %s", String(error), context) + } let calendar = NSCalendar.currentCalendar() From 71934b8bfd1efd67c5c63c982b2f70c5550845f0 Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Wed, 22 Jun 2016 22:35:15 -0700 Subject: [PATCH 06/16] Adding the "Empty History Page" message type, cleaning up Ops errors --- MinimedKit/MessageType.swift | 1 + MinimedKit/PumpEventType.swift | 2 +- RileyLinkKit/PumpOpsSynchronous.swift | 43 ++++++++++++++------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/MinimedKit/MessageType.swift b/MinimedKit/MessageType.swift index 7462afcf0..a4df84169 100644 --- a/MinimedKit/MessageType.swift +++ b/MinimedKit/MessageType.swift @@ -15,6 +15,7 @@ public enum MessageType: UInt8 { case PumpBackfill = 0x08 case FindDevice = 0x09 case DeviceLink = 0x0A + case EmptyHistoryPage = 0x15 case ChangeTime = 0x40 case Bolus = 0x42 case ChangeTempBasal = 0x4c diff --git a/MinimedKit/PumpEventType.swift b/MinimedKit/PumpEventType.swift index 4f7266eba..e10507be8 100644 --- a/MinimedKit/PumpEventType.swift +++ b/MinimedKit/PumpEventType.swift @@ -180,7 +180,7 @@ public enum PumpEventType: UInt8 { return ChangeCaptureEventEnablePumpEvent.self case .SelectBasalProfile: return SelectBasalProfilePumpEvent.self - case .Questionable3b: + default: return UnknownPumpEvent.self } } diff --git a/RileyLinkKit/PumpOpsSynchronous.swift b/RileyLinkKit/PumpOpsSynchronous.swift index 7f6148e19..4bc8b8097 100644 --- a/RileyLinkKit/PumpOpsSynchronous.swift +++ b/RileyLinkKit/PumpOpsSynchronous.swift @@ -15,7 +15,8 @@ public enum PumpCommsError: ErrorType { case RFCommsFailure(String) case UnknownPumpModel case RileyLinkTimeout - case UnknownResponse(String) + case UnknownResponse(rx: NSData?, during: String?) + case UnexpectedResponse(PumpMessage, from: PumpMessage) } public enum RXFilterMode: UInt8 { @@ -56,7 +57,7 @@ class PumpOpsSynchronous { } guard let data = cmd.receivedPacket.data, message = PumpMessage(rxData: data) where message.address == msg.address else { - throw PumpCommsError.UnknownResponse("Sent \(msg.txData) and received \(cmd.receivedPacket.data ?? NSData())") + throw PumpCommsError.UnknownResponse(rx: cmd.receivedPacket.data, during: "Sent \(msg.txData)") } return message @@ -83,7 +84,7 @@ class PumpOpsSynchronous { // Pump successfully received and responded to short wakeup message! return } else { - lastError = PumpCommsError.UnknownResponse("Wakeup shortResponse: \(shortResponse.txData)") + lastError = PumpCommsError.UnexpectedResponse(shortResponse, from: shortPowerMessage) } } catch let error { lastError = error @@ -107,7 +108,7 @@ class PumpOpsSynchronous { let longResponse = try sendAndListen(longPowerMessage) guard longResponse.messageType == .PumpAck else { - throw PumpCommsError.UnknownResponse("Wakeup longResponse: \(longResponse.txData)") + throw PumpCommsError.UnexpectedResponse(longResponse, from: longPowerMessage) } NSLog("Power on for %.0f minutes", duration.minutes) @@ -121,13 +122,13 @@ class PumpOpsSynchronous { let shortResponse = try sendAndListen(shortMsg) guard shortResponse.messageType == .PumpAck else { - throw PumpCommsError.UnknownResponse(String(shortResponse.txData)) + throw PumpCommsError.UnexpectedResponse(shortResponse, from: shortMsg) } let response = try sendAndListen(msg) guard response.messageType == responseMessageType else { - throw PumpCommsError.UnknownResponse(String(response.txData)) + throw PumpCommsError.UnexpectedResponse(response, from: msg) } return response @@ -159,7 +160,7 @@ class PumpOpsSynchronous { let response = try sendAndListen(msg) guard response.messageType == messageType, let body = response.messageBody as? T else { - throw PumpCommsError.UnknownResponse(String(response.txData)) + throw PumpCommsError.UnexpectedResponse(response, from: msg) } return body } @@ -198,17 +199,19 @@ class PumpOpsSynchronous { internal func changeTime(messageGenerator: () -> PumpMessage) throws { try wakeup() - - let shortResponse = try sendAndListen(makePumpMessage(.ChangeTime)) + + let shortMessage = makePumpMessage(.ChangeTime) + let shortResponse = try sendAndListen(shortMessage) guard shortResponse.messageType == .PumpAck else { - throw PumpCommsError.UnknownResponse("changeTime shortResponse: \(shortResponse.txData)") + throw PumpCommsError.UnexpectedResponse(shortResponse, from: shortMessage) } - - let response = try sendAndListen(messageGenerator()) + + let message = messageGenerator() + let response = try sendAndListen(message) guard response.messageType == .PumpAck else { - throw PumpCommsError.UnknownResponse("changeTime response: \(response.txData)") + throw PumpCommsError.UnexpectedResponse(response, from: message) } } @@ -227,7 +230,7 @@ class PumpOpsSynchronous { guard let data = listenForFindMessageCmd.receivedPacket.data, findMessage = PumpMessage(rxData: data) where findMessage.address.hexadecimalString == pump.pumpID && findMessage.packetType == .MySentry, let findMessageBody = findMessage.messageBody as? FindDeviceMessageBody, findMessageResponseBody = MySentryAckMessageBody(sequence: findMessageBody.sequence, watchdogID: watchdogID, responseMessageTypes: [findMessage.messageType]) else { - throw PumpCommsError.UnknownResponse("Received \(listenForFindMessageCmd.receivedPacket.data ?? NSData())") + throw PumpCommsError.UnknownResponse(rx: listenForFindMessageCmd.receivedPacket.data, during: "Watchdog listening") } // Identify as a MySentry device @@ -239,7 +242,7 @@ class PumpOpsSynchronous { linkMessageBody = linkMessage.messageBody as? DeviceLinkMessageBody, linkMessageResponseBody = MySentryAckMessageBody(sequence: linkMessageBody.sequence, watchdogID: watchdogID, responseMessageTypes: [linkMessage.messageType]) else { - throw PumpCommsError.UnknownResponse("Received \(linkMessage.messageBody.txData)") + throw PumpCommsError.UnexpectedResponse(linkMessage, from: findMessageResponse) } // Acknowledge the pump linked with us @@ -340,8 +343,8 @@ class PumpOpsSynchronous { do { pageData = try getHistoryPage(pageNum) } catch let error as PumpCommsError { - if pageNum > 0 { - break + if case .UnexpectedResponse(let response, from: _) = error where response.messageType == .EmptyHistoryPage { + break pages } else { throw error } @@ -378,10 +381,8 @@ class PumpOpsSynchronous { let msg = makePumpMessage(.GetHistoryPage, body: GetHistoryPageCarelinkMessageBody(pageNum: pageNum)) - guard let firstResponse = try? runCommandWithArguments(msg, responseMessageType: .GetHistoryPage) else { - throw PumpCommsError.RFCommsFailure("Pump not responding to GetHistory command") - } - + let firstResponse = try runCommandWithArguments(msg, responseMessageType: .GetHistoryPage) + var expectedFrameNum = 1 var curResp = firstResponse.messageBody as! GetHistoryPageCarelinkMessageBody From bd371d75a7a03d8e0c76ef4d3cf269481424b517 Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Wed, 22 Jun 2016 22:36:05 -0700 Subject: [PATCH 07/16] Reverting development team change --- RileyLink.xcodeproj/project.pbxproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RileyLink.xcodeproj/project.pbxproj b/RileyLink.xcodeproj/project.pbxproj index 2a62e1c23..0eb22e71d 100644 --- a/RileyLink.xcodeproj/project.pbxproj +++ b/RileyLink.xcodeproj/project.pbxproj @@ -1369,34 +1369,34 @@ TargetAttributes = { 430D64CA1CB855AB00FCA750 = { CreatedOnToolsVersion = 7.3; - DevelopmentTeam = 57NRR26737; + DevelopmentTeam = UY678SP37Q; }; 430D64D31CB855AB00FCA750 = { CreatedOnToolsVersion = 7.3; }; 43722FAD1CB9F7630038B7F2 = { CreatedOnToolsVersion = 7.3; - DevelopmentTeam = 57NRR26737; + DevelopmentTeam = UY678SP37Q; }; 43722FB61CB9F7640038B7F2 = { CreatedOnToolsVersion = 7.3; }; C10D9BC01C8269D500378342 = { CreatedOnToolsVersion = 7.2.1; - DevelopmentTeam = 57NRR26737; + DevelopmentTeam = UY678SP37Q; }; C10D9BC91C8269D500378342 = { CreatedOnToolsVersion = 7.2.1; }; C12EA236198B436800309FA4 = { - DevelopmentTeam = 57NRR26737; + DevelopmentTeam = UY678SP37Q; }; C12EA251198B436800309FA4 = { TestTargetID = C12EA236198B436800309FA4; }; C1B3830A1CD0665D00CE7782 = { CreatedOnToolsVersion = 7.3; - DevelopmentTeam = 57NRR26737; + DevelopmentTeam = UY678SP37Q; }; C1B383131CD0665D00CE7782 = { CreatedOnToolsVersion = 7.3; From ff558ac8356598813ac9505668af70733fda7c7b Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Wed, 22 Jun 2016 22:39:16 -0700 Subject: [PATCH 08/16] Changing the `during` arg to be non-optional --- RileyLinkKit/PumpOpsSynchronous.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RileyLinkKit/PumpOpsSynchronous.swift b/RileyLinkKit/PumpOpsSynchronous.swift index 4bc8b8097..ead51960d 100644 --- a/RileyLinkKit/PumpOpsSynchronous.swift +++ b/RileyLinkKit/PumpOpsSynchronous.swift @@ -15,7 +15,7 @@ public enum PumpCommsError: ErrorType { case RFCommsFailure(String) case UnknownPumpModel case RileyLinkTimeout - case UnknownResponse(rx: NSData?, during: String?) + case UnknownResponse(rx: NSData?, during: String) case UnexpectedResponse(PumpMessage, from: PumpMessage) } From 86031a243a3ef0c167e334e85b3967e429f7e0ce Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Wed, 22 Jun 2016 22:51:34 -0700 Subject: [PATCH 09/16] fix error message --- RileyLink/DeviceDataManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RileyLink/DeviceDataManager.swift b/RileyLink/DeviceDataManager.swift index 1342323d4..5e294d883 100644 --- a/RileyLink/DeviceDataManager.swift +++ b/RileyLink/DeviceDataManager.swift @@ -244,7 +244,7 @@ class DeviceDataManager { nightscoutUploader.siteURL = nightscoutURL nightscoutUploader.APISecret = nightscoutAPISecret nightscoutUploader.errorHandler = { (error: ErrorType, context: String) -> Void in - NSLog("Error %s, while %s", String(error), context) + NSLog("Error %@, while %@", String(error), context) } From 83de82d2e66584b8b2f2f001d90d3f8876b9c6a1 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Wed, 22 Jun 2016 23:18:24 -0700 Subject: [PATCH 10/16] Swifty string interp, swifty optional handling, and fix crash on invalid hostname --- NightscoutUploadKit/NightscoutUploader.swift | 20 ++++++++++++-------- RileyLink/DeviceDataManager.swift | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/NightscoutUploadKit/NightscoutUploader.swift b/NightscoutUploadKit/NightscoutUploader.swift index 03db8b5b9..626aa6677 100644 --- a/NightscoutUploadKit/NightscoutUploader.swift +++ b/NightscoutUploadKit/NightscoutUploader.swift @@ -284,10 +284,14 @@ public class NightscoutUploader: NSObject { request.HTTPBody = sendData let task = NSURLSession.sharedSession().dataTaskWithRequest(request, completionHandler: { (data, response, error) in - let httpResponse = response as! NSHTTPURLResponse + if let error = error { completion(error) - } else if httpResponse.statusCode != 200 { + return + } + + if let httpResponse = response as? NSHTTPURLResponse where + httpResponse.statusCode != 200 { completion(UploadError.HTTPError(status: httpResponse.statusCode, body:String(data: data!, encoding: NSUTF8StringEncoding)!)) } else { completion(nil) @@ -306,8 +310,8 @@ public class NightscoutUploader: NSObject { let inFlight = deviceStatuses deviceStatuses = [AnyObject]() uploadToNS(inFlight, endpoint: defaultNightscoutDeviceStatusPath) { (error) in - if error != nil { - self.errorHandler?(error: error!, context: "Uploading device status") + if let error = error { + self.errorHandler?(error: error, context: "Uploading device status") // Requeue self.deviceStatuses.appendContentsOf(inFlight) } @@ -318,8 +322,8 @@ public class NightscoutUploader: NSObject { let inFlight = entries entries = [AnyObject]() uploadToNS(inFlight, endpoint: defaultNightscoutEntriesPath) { (error) in - if error != nil { - self.errorHandler?(error: error!, context: "Uploading nightscout entries") + if let error = error { + self.errorHandler?(error: error, context: "Uploading nightscout entries") // Requeue self.entries.appendContentsOf(inFlight) } @@ -330,8 +334,8 @@ public class NightscoutUploader: NSObject { let inFlight = treatmentsQueue treatmentsQueue = [AnyObject]() uploadToNS(inFlight, endpoint: defaultNightscoutTreatmentPath) { (error) in - if error != nil { - self.errorHandler?(error: error!, context: "Uploading nightscout treatment records") + if let error = error { + self.errorHandler?(error: error, context: "Uploading nightscout treatment records") // Requeue self.treatmentsQueue.appendContentsOf(inFlight) } diff --git a/RileyLink/DeviceDataManager.swift b/RileyLink/DeviceDataManager.swift index 5e294d883..fd949193f 100644 --- a/RileyLink/DeviceDataManager.swift +++ b/RileyLink/DeviceDataManager.swift @@ -244,7 +244,7 @@ class DeviceDataManager { nightscoutUploader.siteURL = nightscoutURL nightscoutUploader.APISecret = nightscoutAPISecret nightscoutUploader.errorHandler = { (error: ErrorType, context: String) -> Void in - NSLog("Error %@, while %@", String(error), context) + print("Error \(error), while \(context)") } From d1dc1530fb9e667731c7b41e611f5669d3cc78cb Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Thu, 23 Jun 2016 11:09:17 -0700 Subject: [PATCH 11/16] Track timestamp of last successfully uploaded treatment from pump, and use it to specify how far back in time we need to look for events from the pump --- NSUserDefaults.swift | 25 +++++++++++++ NightscoutUploadKit/NightscoutUploader.swift | 38 ++++++++++---------- RileyLink.xcodeproj/project.pbxproj | 4 +++ RileyLink/DeviceDataManager.swift | 8 +---- 4 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 NSUserDefaults.swift diff --git a/NSUserDefaults.swift b/NSUserDefaults.swift new file mode 100644 index 000000000..f72b40d72 --- /dev/null +++ b/NSUserDefaults.swift @@ -0,0 +1,25 @@ +// +// NSUserDefaults.swift +// RileyLink +// +// Created by Pete Schwamb on 6/23/16. +// Copyright © 2016 Pete Schwamb. All rights reserved. +// + +import Foundation + + +extension NSUserDefaults { + private enum Key: String { + case LastStoredTreatmentTimestamp = "com.rileylink.NightscoutUploadKit.LastStoredTreatmentTimestamp" + } + + var lastStoredTreatmentTimestamp: NSDate? { + get { + return objectForKey(Key.LastStoredTreatmentTimestamp.rawValue) as? NSDate + } + set { + setObject(newValue, forKey: Key.LastStoredTreatmentTimestamp.rawValue) + } + } +} \ No newline at end of file diff --git a/NightscoutUploadKit/NightscoutUploader.swift b/NightscoutUploadKit/NightscoutUploader.swift index 626aa6677..8e954df34 100644 --- a/NightscoutUploadKit/NightscoutUploader.swift +++ b/NightscoutUploadKit/NightscoutUploader.swift @@ -31,11 +31,17 @@ public class NightscoutUploader: NSObject { var entries: [AnyObject] var deviceStatuses: [AnyObject] - var treatmentsQueue: [AnyObject] + var treatmentsQueue: [NightscoutTreatment] var lastMeterMessageRxTime: NSDate? - var observingPumpEventsSince: NSDate + public private(set) var observingPumpEventsSince: NSDate + + var lastStoredTreatmentTimestamp: NSDate = NSDate.distantPast() { + didSet { + NSUserDefaults.standardUserDefaults().lastStoredTreatmentTimestamp = lastStoredTreatmentTimestamp + } + } let defaultNightscoutEntriesPath = "/api/v1/entries.json" let defaultNightscoutTreatmentPath = "/api/v1/treatments.json" @@ -45,11 +51,11 @@ public class NightscoutUploader: NSObject { public override init() { entries = [AnyObject]() - treatmentsQueue = [AnyObject]() + treatmentsQueue = [NightscoutTreatment]() deviceStatuses = [AnyObject]() let calendar = NSCalendar.currentCalendar() - observingPumpEventsSince = calendar.dateByAddingUnit(.Day, value: -1, toDate: NSDate(), options: [])! + self.observingPumpEventsSince = NSUserDefaults.standardUserDefaults().lastStoredTreatmentTimestamp ?? calendar.dateByAddingUnit(.Day, value: -1, toDate: NSDate(), options: [])! super.init() } @@ -85,23 +91,11 @@ public class NightscoutUploader: NSObject { } for treatment in NightscoutPumpEvents.translate(events, eventSource: source) { - addTreatment(treatment, pumpModel:pumpModel) + treatmentsQueue.append(treatment) } self.flushAll() } - func addTreatment(treatment:NightscoutTreatment, pumpModel:PumpModel) { - var rep = treatment.dictionaryRepresentation - if rep["created_at"] == nil && rep["timestamp"] != nil { - rep["created_at"] = rep["timestamp"] - } - if rep["created_at"] == nil { - rep["created_at"] = TimeFormat.timestampStrFromDate(NSDate()) - } - treatmentsQueue.append(rep) - } - - // Entries [ { sgv: 375, // date: 1432421525000, // dateString: '2015-05-23T22:52:05.000Z', @@ -331,13 +325,19 @@ public class NightscoutUploader: NSObject { } func flushTreatments() { + + let inFlight = treatmentsQueue - treatmentsQueue = [AnyObject]() - uploadToNS(inFlight, endpoint: defaultNightscoutTreatmentPath) { (error) in + treatmentsQueue = [NightscoutTreatment]() + uploadToNS(inFlight.map({$0.dictionaryRepresentation}), endpoint: defaultNightscoutTreatmentPath) { (error) in if let error = error { self.errorHandler?(error: error, context: "Uploading nightscout treatment records") // Requeue self.treatmentsQueue.appendContentsOf(inFlight) + } else { + if let last = inFlight.last { + self.lastStoredTreatmentTimestamp = last.timestamp + } } } } diff --git a/RileyLink.xcodeproj/project.pbxproj b/RileyLink.xcodeproj/project.pbxproj index d38595856..e0061216a 100644 --- a/RileyLink.xcodeproj/project.pbxproj +++ b/RileyLink.xcodeproj/project.pbxproj @@ -203,6 +203,7 @@ C1B383301CD0680800CE7782 /* MinimedKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C10D9BC11C8269D500378342 /* MinimedKit.framework */; }; C1B383311CD068C300CE7782 /* RileyLinkBLEKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 430D64CB1CB855AB00FCA750 /* RileyLinkBLEKit.framework */; }; C1B383361CD1BA8100CE7782 /* DeviceDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1B383351CD1BA8100CE7782 /* DeviceDataManager.swift */; }; + C1B4A94E1D1C423D003B8985 /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1B4A94D1D1C423D003B8985 /* NSUserDefaults.swift */; }; C1C3578F1C927303009BDD4F /* MeterMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1C3578E1C927303009BDD4F /* MeterMessage.swift */; }; C1C357911C92733A009BDD4F /* MeterMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1C357901C92733A009BDD4F /* MeterMessageTests.swift */; }; C1E535EA1991E36700C2AC49 /* NSData+Conversion.m in Sources */ = {isa = PBXBuildFile; fileRef = C1E535E91991E36700C2AC49 /* NSData+Conversion.m */; }; @@ -532,6 +533,7 @@ C1B3831B1CD0665D00CE7782 /* NightscoutUploadKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutUploadKitTests.swift; sourceTree = ""; }; C1B3831D1CD0665D00CE7782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C1B383351CD1BA8100CE7782 /* DeviceDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceDataManager.swift; sourceTree = ""; }; + C1B4A94D1D1C423D003B8985 /* NSUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSUserDefaults.swift; sourceTree = SOURCE_ROOT; }; C1C3578E1C927303009BDD4F /* MeterMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeterMessage.swift; path = Messages/MeterMessage.swift; sourceTree = ""; }; C1C357901C92733A009BDD4F /* MeterMessageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeterMessageTests.swift; path = Messages/MeterMessageTests.swift; sourceTree = ""; }; C1E535E81991E36700C2AC49 /* NSData+Conversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Conversion.h"; sourceTree = ""; }; @@ -1049,6 +1051,7 @@ C1842C281C908A3C00DB42AC /* NightscoutUploader.swift */, C12FB2751CC5893C00879B80 /* TempBasalNightscoutTreatment.swift */, 43B0ADC81D1268B300AAD278 /* TimeFormat.swift */, + C1B4A94D1D1C423D003B8985 /* NSUserDefaults.swift */, ); path = NightscoutUploadKit; sourceTree = ""; @@ -1744,6 +1747,7 @@ C1B3832B1CD0668600CE7782 /* BGCheckNightscoutTreatment.swift in Sources */, C1B383291CD0668600CE7782 /* NightscoutPumpEvents.swift in Sources */, 43B0ADCC1D126E3000AAD278 /* NSDateFormatter.swift in Sources */, + C1B4A94E1D1C423D003B8985 /* NSUserDefaults.swift in Sources */, C1B3832D1CD0668600CE7782 /* BolusNightscoutTreatment.swift in Sources */, 43D657461D0CF38F00216E20 /* NSTimeInterval.swift in Sources */, C1B3832C1CD0668600CE7782 /* MealBolusNightscoutTreatment.swift in Sources */, diff --git a/RileyLink/DeviceDataManager.swift b/RileyLink/DeviceDataManager.swift index fd949193f..9e28f36a8 100644 --- a/RileyLink/DeviceDataManager.swift +++ b/RileyLink/DeviceDataManager.swift @@ -28,8 +28,6 @@ class DeviceDataManager { var latestPumpStatus: MySentryPumpStatusMessageBody? - private var observingPumpEventsSince: NSDate - var nightscoutUploader: NightscoutUploader var pumpTimeZone: NSTimeZone? = Config.sharedInstance().pumpTimeZone { @@ -196,7 +194,7 @@ class DeviceDataManager { private func getPumpHistory(device: RileyLinkDevice) { lastHistoryAttempt = NSDate() - device.ops!.getHistoryEventsSinceDate(observingPumpEventsSince) { (response) -> Void in + device.ops!.getHistoryEventsSinceDate(nightscoutUploader.observingPumpEventsSince) { (response) -> Void in switch response { case .Success(let (events, pumpModel)): NSLog("fetchHistory succeeded.") @@ -247,10 +245,6 @@ class DeviceDataManager { print("Error \(error), while \(context)") } - - let calendar = NSCalendar.currentCalendar() - observingPumpEventsSince = calendar.dateByAddingUnit(.Day, value: -1, toDate: NSDate(), options: [])! - getHistoryTimer = NSTimer.scheduledTimerWithTimeInterval(5.0 * 60, target:self, selector:#selector(DeviceDataManager.timerTriggered), userInfo:nil, repeats:true) // This triggers one history fetch right away (in 10s) From 5c131a7b4f6e3b1f0c99bcc8d201928aa9b11af6 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Thu, 23 Jun 2016 11:24:20 -0700 Subject: [PATCH 12/16] Last commit removed the setting of created_at, which is actually what nightscout uses to determine placement of treatments on the timeline, instead of timestamp. Setting created_at to equal timestamp for all treatments --- NightscoutUploadKit/NightscoutTreatment.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/NightscoutUploadKit/NightscoutTreatment.swift b/NightscoutUploadKit/NightscoutTreatment.swift index cc8282004..5050e80e5 100644 --- a/NightscoutUploadKit/NightscoutTreatment.swift +++ b/NightscoutUploadKit/NightscoutTreatment.swift @@ -30,6 +30,7 @@ public class NightscoutTreatment : DictionaryRepresentable { public var dictionaryRepresentation: [String: AnyObject] { return [ + "created_at": TimeFormat.timestampStrFromDate(timestamp), "timestamp": TimeFormat.timestampStrFromDate(timestamp), "enteredBy": enteredBy, ] From 22431d36cfd6c1c941b7177d3aee66b0ed13b6f7 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Thu, 23 Jun 2016 17:29:24 -0700 Subject: [PATCH 13/16] Use pump ID to invalidate observingPumpEventsSince attribute --- NightscoutUploadKit/NightscoutUploader.swift | 22 +++++++++++++------- RileyLink/DeviceDataManager.swift | 7 ++++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/NightscoutUploadKit/NightscoutUploader.swift b/NightscoutUploadKit/NightscoutUploader.swift index 8e954df34..ffa850a91 100644 --- a/NightscoutUploadKit/NightscoutUploader.swift +++ b/NightscoutUploadKit/NightscoutUploader.swift @@ -48,19 +48,30 @@ public class NightscoutUploader: NSObject { let defaultNightscoutDeviceStatusPath = "/api/v1/devicestatus.json" public var errorHandler: ((error: ErrorType, context: String) -> Void)? + + public var pumpID: String? { + didSet { + if oldValue != nil { + self.observingPumpEventsSince = NSDate().dateByAddingTimeInterval(60*60*24*(-1)) + } + } + } - public override init() { + public init(siteURL: String?, APISecret: String?, pumpID: String?) { entries = [AnyObject]() treatmentsQueue = [NightscoutTreatment]() deviceStatuses = [AnyObject]() - let calendar = NSCalendar.currentCalendar() - self.observingPumpEventsSince = NSUserDefaults.standardUserDefaults().lastStoredTreatmentTimestamp ?? calendar.dateByAddingUnit(.Day, value: -1, toDate: NSDate(), options: [])! + self.siteURL = siteURL + self.APISecret = APISecret + self.pumpID = pumpID + + self.observingPumpEventsSince = NSUserDefaults.standardUserDefaults().lastStoredTreatmentTimestamp ?? NSDate().dateByAddingTimeInterval(60*60*24*(-1)) super.init() } - // MARK: - Decoding Treatments + // MARK: - Processing data from pump public func processPumpEvents(events: [TimestampedHistoryEvent], source: String, pumpModel: PumpModel) { @@ -242,7 +253,6 @@ public class NightscoutUploader: NSObject { // MARK: - Uploading func flushAll() { - flushDeviceStatuses() flushEntries() flushTreatments() @@ -325,8 +335,6 @@ public class NightscoutUploader: NSObject { } func flushTreatments() { - - let inFlight = treatmentsQueue treatmentsQueue = [NightscoutTreatment]() uploadToNS(inFlight.map({$0.dictionaryRepresentation}), endpoint: defaultNightscoutTreatmentPath) { (error) in diff --git a/RileyLink/DeviceDataManager.swift b/RileyLink/DeviceDataManager.swift index 9e28f36a8..f3a02133d 100644 --- a/RileyLink/DeviceDataManager.swift +++ b/RileyLink/DeviceDataManager.swift @@ -61,6 +61,8 @@ class DeviceDataManager { rileyLinkManager.pumpState = nil } + nightscoutUploader.pumpID = pumpID + Config.sharedInstance().pumpID = pumpID } } @@ -238,12 +240,11 @@ class DeviceDataManager { autoConnectIDs: connectedPeripheralIDs ) - nightscoutUploader = NightscoutUploader() - nightscoutUploader.siteURL = nightscoutURL - nightscoutUploader.APISecret = nightscoutAPISecret + nightscoutUploader = NightscoutUploader(siteURL: nightscoutURL, APISecret: nightscoutAPISecret, pumpID: pumpID) nightscoutUploader.errorHandler = { (error: ErrorType, context: String) -> Void in print("Error \(error), while \(context)") } + nightscoutUploader.pumpID = pumpID getHistoryTimer = NSTimer.scheduledTimerWithTimeInterval(5.0 * 60, target:self, selector:#selector(DeviceDataManager.timerTriggered), userInfo:nil, repeats:true) From 24aa97223bed43e1e2476c368b3e8168dd2785c7 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Thu, 23 Jun 2016 17:59:12 -0700 Subject: [PATCH 14/16] Move NSUserDefaults for NightscoutUploadKit --- .../NSUserDefaults.swift | 0 RileyLink.xcodeproj/project.pbxproj | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename NSUserDefaults.swift => NightscoutUploadKit/NSUserDefaults.swift (100%) diff --git a/NSUserDefaults.swift b/NightscoutUploadKit/NSUserDefaults.swift similarity index 100% rename from NSUserDefaults.swift rename to NightscoutUploadKit/NSUserDefaults.swift diff --git a/RileyLink.xcodeproj/project.pbxproj b/RileyLink.xcodeproj/project.pbxproj index e0061216a..c62575f75 100644 --- a/RileyLink.xcodeproj/project.pbxproj +++ b/RileyLink.xcodeproj/project.pbxproj @@ -533,7 +533,7 @@ C1B3831B1CD0665D00CE7782 /* NightscoutUploadKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutUploadKitTests.swift; sourceTree = ""; }; C1B3831D1CD0665D00CE7782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C1B383351CD1BA8100CE7782 /* DeviceDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceDataManager.swift; sourceTree = ""; }; - C1B4A94D1D1C423D003B8985 /* NSUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSUserDefaults.swift; sourceTree = SOURCE_ROOT; }; + C1B4A94D1D1C423D003B8985 /* NSUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NSUserDefaults.swift; path = NightscoutUploadKit/NSUserDefaults.swift; sourceTree = SOURCE_ROOT; }; C1C3578E1C927303009BDD4F /* MeterMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeterMessage.swift; path = Messages/MeterMessage.swift; sourceTree = ""; }; C1C357901C92733A009BDD4F /* MeterMessageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeterMessageTests.swift; path = Messages/MeterMessageTests.swift; sourceTree = ""; }; C1E535E81991E36700C2AC49 /* NSData+Conversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Conversion.h"; sourceTree = ""; }; From 3e111b3c1e38fbbcaab0f457676354ce854b4dcc Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Fri, 24 Jun 2016 20:29:56 -0700 Subject: [PATCH 15/16] Fixing floating-point precision in derived message values --- MinimedKit/Messages/MySentryPumpStatusMessageBody.swift | 8 ++++---- MinimedKit/Messages/ReadSettingsCarelinkMessageBody.swift | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MinimedKit/Messages/MySentryPumpStatusMessageBody.swift b/MinimedKit/Messages/MySentryPumpStatusMessageBody.swift index eab8be077..a4d7b78fb 100644 --- a/MinimedKit/Messages/MySentryPumpStatusMessageBody.swift +++ b/MinimedKit/Messages/MySentryPumpStatusMessageBody.swift @@ -94,8 +94,8 @@ public enum SensorReading { ``` */ public struct MySentryPumpStatusMessageBody: MessageBody, DictionaryRepresentable { - private static let reservoirSignificantDigit = 0.1 - private static let iobSigificantDigit = 0.025 + private static let reservoirMultiplier: Double = 10 + private static let iobMultiplier: Double = 40 public static let length = 36 public let sequence: UInt8 @@ -137,14 +137,14 @@ public struct MySentryPumpStatusMessageBody: MessageBody, DictionaryRepresentabl self.glucoseTrend = trend - reservoirRemainingUnits = Double(Int(bigEndianBytes: rxData[12...13])) * self.dynamicType.reservoirSignificantDigit + reservoirRemainingUnits = Double(Int(bigEndianBytes: rxData[12...13])) / self.dynamicType.reservoirMultiplier let reservoirRemainingPercent: UInt8 = rxData[15] self.reservoirRemainingPercent = Int(round(Double(reservoirRemainingPercent) / 4.0 * 100)) reservoirRemainingMinutes = Int(bigEndianBytes: [rxData[16], rxData[17]]) - iob = Double(Int(bigEndianBytes: rxData[22...23])) * self.dynamicType.iobSigificantDigit + iob = Double(Int(bigEndianBytes: rxData[22...23])) / self.dynamicType.iobMultiplier let batteryRemainingPercent: UInt8 = rxData[14] self.batteryRemainingPercent = Int(round(Double(batteryRemainingPercent) / 4.0 * 100)) diff --git a/MinimedKit/Messages/ReadSettingsCarelinkMessageBody.swift b/MinimedKit/Messages/ReadSettingsCarelinkMessageBody.swift index f4d7a05eb..c30febb8c 100644 --- a/MinimedKit/Messages/ReadSettingsCarelinkMessageBody.swift +++ b/MinimedKit/Messages/ReadSettingsCarelinkMessageBody.swift @@ -38,8 +38,8 @@ public enum BasalProfile { ``` */ public class ReadSettingsCarelinkMessageBody: CarelinkLongMessageBody { - private static let maxBolusSignificantDigit = 0.1 - private static let maxBasalSignificantDigit = 0.025 + private static let maxBolusMultiplier: Double = 10 + private static let maxBasalMultiplier: Double = 40 public let maxBasal: Double public let maxBolus: Double @@ -54,10 +54,10 @@ public class ReadSettingsCarelinkMessageBody: CarelinkLongMessageBody { } let maxBolusTicks: UInt8 = rxData[7] - maxBolus = Double(maxBolusTicks) * self.dynamicType.maxBolusSignificantDigit + maxBolus = Double(maxBolusTicks) * self.dynamicType.maxBolusMultiplier let maxBasalTicks: Int = Int(bigEndianBytes: rxData[8...9]) - maxBasal = Double(maxBasalTicks) * self.dynamicType.maxBasalSignificantDigit + maxBasal = Double(maxBasalTicks) * self.dynamicType.maxBasalMultiplier let rawSelectedBasalProfile: UInt8 = rxData[12] selectedBasalProfile = BasalProfile(rawValue: rawSelectedBasalProfile) From 32e5fce649a67fd2b1ffe0a924bafec07c99a778 Mon Sep 17 00:00:00 2001 From: Nathan Racklyeft Date: Fri, 24 Jun 2016 22:25:56 -0700 Subject: [PATCH 16/16] agvtool new-marketing-version 0.5.0 && agvtool bump --- MinimedKit/Info.plist | 2 +- MinimedKitTests/Info.plist | 2 +- NightscoutUploadKit/Info.plist | 2 +- NightscoutUploadKitTests/Info.plist | 2 +- RileyLink.xcodeproj/project.pbxproj | 36 ++++++++++++------------ RileyLink/RileyLink-Info.plist | 2 +- RileyLinkBLEKit/Info.plist | 2 +- RileyLinkBLEKitTests/Info.plist | 2 +- RileyLinkKit/Info.plist | 2 +- RileyLinkKitTests/Info.plist | 2 +- RileyLinkTests/RileyLinkTests-Info.plist | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/MinimedKit/Info.plist b/MinimedKit/Info.plist index c94109423..288c341b6 100644 --- a/MinimedKit/Info.plist +++ b/MinimedKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/MinimedKitTests/Info.plist b/MinimedKitTests/Info.plist index 21d7d5017..94b6ed951 100644 --- a/MinimedKitTests/Info.plist +++ b/MinimedKitTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/NightscoutUploadKit/Info.plist b/NightscoutUploadKit/Info.plist index c94109423..288c341b6 100644 --- a/NightscoutUploadKit/Info.plist +++ b/NightscoutUploadKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/NightscoutUploadKitTests/Info.plist b/NightscoutUploadKitTests/Info.plist index e82cdb5f9..96201fb94 100644 --- a/NightscoutUploadKitTests/Info.plist +++ b/NightscoutUploadKitTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/RileyLink.xcodeproj/project.pbxproj b/RileyLink.xcodeproj/project.pbxproj index c62575f75..d20c148df 100644 --- a/RileyLink.xcodeproj/project.pbxproj +++ b/RileyLink.xcodeproj/project.pbxproj @@ -1847,11 +1847,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -1875,11 +1875,11 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -1938,11 +1938,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -1968,11 +1968,11 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -2031,11 +2031,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -2060,11 +2060,11 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -2133,7 +2133,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -2175,7 +2175,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2280,11 +2280,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -2313,11 +2313,11 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 6; + DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = ( diff --git a/RileyLink/RileyLink-Info.plist b/RileyLink/RileyLink-Info.plist index 4b900d173..64710dbec 100644 --- a/RileyLink/RileyLink-Info.plist +++ b/RileyLink/RileyLink-Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/RileyLinkBLEKit/Info.plist b/RileyLinkBLEKit/Info.plist index c94109423..288c341b6 100644 --- a/RileyLinkBLEKit/Info.plist +++ b/RileyLinkBLEKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/RileyLinkBLEKitTests/Info.plist b/RileyLinkBLEKitTests/Info.plist index 21d7d5017..94b6ed951 100644 --- a/RileyLinkBLEKitTests/Info.plist +++ b/RileyLinkBLEKitTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/RileyLinkKit/Info.plist b/RileyLinkKit/Info.plist index c94109423..288c341b6 100644 --- a/RileyLinkKit/Info.plist +++ b/RileyLinkKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/RileyLinkKitTests/Info.plist b/RileyLinkKitTests/Info.plist index 21d7d5017..94b6ed951 100644 --- a/RileyLinkKitTests/Info.plist +++ b/RileyLinkKitTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion diff --git a/RileyLinkTests/RileyLinkTests-Info.plist b/RileyLinkTests/RileyLinkTests-Info.plist index 92db6ccd5..f3119ec14 100644 --- a/RileyLinkTests/RileyLinkTests-Info.plist +++ b/RileyLinkTests/RileyLinkTests-Info.plist @@ -13,7 +13,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.4.0 + 0.5.0 CFBundleSignature ???? CFBundleVersion