Skip to content

Commit

Permalink
Merge pull request #327 from ps2/dev
Browse files Browse the repository at this point in the history
Release 1.0.1
  • Loading branch information
ps2 committed Apr 22, 2017
2 parents c7230ca + 56dd547 commit b0dcd07
Show file tree
Hide file tree
Showing 29 changed files with 300 additions and 151 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: objective-c
osx_image: xcode8
xcode_sdk: iphonesimulator10
osx_image: xcode8.3
xcode_sdk: iphonesimulator10.3
xcode_project: RileyLink.xcodeproj
xcode_scheme: RileyLink
script:
- xcodebuild -project RileyLink.xcodeproj -scheme RileyLink -sdk iphonesimulator10.0 build -destination 'name=iPhone SE' test
- xcodebuild -project RileyLink.xcodeproj -scheme RileyLink -sdk iphonesimulator10.3 build -destination 'name=iPhone SE' test
2 changes: 1 addition & 1 deletion Crypto/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion MinimedKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion MinimedKitTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
26 changes: 20 additions & 6 deletions NightscoutUploadKit/DeviceStatus/PumpStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,47 @@ public struct PumpStatus {
let suspended: Bool?
let bolusing: Bool?
let reservoir: Double?

public init(clock: Date, pumpID: String, iob: IOBStatus? = nil, battery: BatteryStatus? = nil, suspended: Bool? = nil, bolusing: Bool? = nil, reservoir: Double? = nil) {
let secondsFromGMT: Int?

public init(clock: Date, pumpID: String, iob: IOBStatus? = nil, battery: BatteryStatus? = nil, suspended: Bool? = nil, bolusing: Bool? = nil, reservoir: Double? = nil, secondsFromGMT: Int? = nil) {
self.clock = clock
self.pumpID = pumpID
self.iob = iob
self.battery = battery
self.suspended = suspended
self.bolusing = bolusing
self.reservoir = reservoir
self.secondsFromGMT = secondsFromGMT
}

public var dictionaryRepresentation: [String: Any] {
var rval = [String: Any]()

rval["clock"] = TimeFormat.timestampStrFromDate(clock)
rval["pumpID"] = pumpID


if let iob = iob {
rval["iob"] = iob.dictionaryRepresentation
}

if let battery = battery {
rval["battery"] = battery.dictionaryRepresentation
}

if let suspended = suspended {
rval["suspended"] = suspended
}

if let bolusing = bolusing {
rval["bolusing"] = bolusing
}

if let reservoir = reservoir {
rval["reservoir"] = reservoir
}
if let iob = iob {
rval["iob"] = iob.dictionaryRepresentation

if let secondsFromGMT = secondsFromGMT {
rval["secondsFromGMT"] = secondsFromGMT
}

return rval
Expand Down
2 changes: 1 addition & 1 deletion NightscoutUploadKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions NightscoutUploadKit/NightscoutPumpEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public class NightscoutPumpEvents: NSObject {
lastBasalDuration = tempBasalDuration
lastBasalDurationDate = event.date
case is SuspendPumpEvent:
let entry = SuspendPumpTreatment(timestamp: event.date, enteredBy: eventSource, suspended: true)
let entry = PumpSuspendTreatment(timestamp: event.date, enteredBy: eventSource)
results.append(entry)
case is ResumePumpEvent:
let entry = SuspendPumpTreatment(timestamp: event.date, enteredBy: eventSource, suspended: false)
let entry = PumpResumeTreatment(timestamp: event.date, enteredBy: eventSource)
results.append(entry)
default:
break
Expand Down
4 changes: 2 additions & 2 deletions NightscoutUploadKit/NightscoutUploader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class NightscoutUploader {
private(set) var entries = [NightscoutEntry]()
private(set) var deviceStatuses = [[String: Any]]()
private(set) var treatmentsQueue = [NightscoutTreatment]()

private(set) var lastMeterMessageRxTime: Date?

public private(set) var observingPumpEventsSince: Date!
Expand Down Expand Up @@ -282,7 +282,7 @@ public class NightscoutUploader {
lastMeterMessageRxTime = date
}
}

// MARK: - Uploading

func flushAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ public class BGCheckNightscoutTreatment: NightscoutTreatment {
let glucoseType: GlucoseType
let units: Units

init(timestamp: Date, enteredBy: String, glucose: Int, glucoseType: GlucoseType, units: Units) {
public init(timestamp: Date, enteredBy: String, glucose: Int, glucoseType: GlucoseType, units: Units, notes: String? = nil) {
self.glucose = glucose
self.glucoseType = glucoseType
self.units = units
super.init(timestamp: timestamp, enteredBy: enteredBy)
super.init(timestamp: timestamp, enteredBy: enteredBy, notes: notes, eventType: "BG Check")
}

override public var dictionaryRepresentation: [String: Any] {
var rval = super.dictionaryRepresentation
rval["eventType"] = "BG Check"
rval["glucose"] = glucose
rval["glucoseType"] = glucoseType.rawValue
rval["units"] = units.rawValue
Expand Down
17 changes: 8 additions & 9 deletions NightscoutUploadKit/Treatments/BolusNightscoutTreatment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,38 @@ import Foundation

public class BolusNightscoutTreatment: NightscoutTreatment {

enum BolusType: String {
public enum BolusType: String {
case Normal = "normal"
case Square = "square"
case DualWave = "dual"
}

let bolusType: BolusType
let amount: Double
let programmed: Double
let unabsorbed: Double
let duration: TimeInterval
let carbs: Int
let ratio: Double
init(timestamp: Date, enteredBy: String, bolusType: BolusType, amount: Double, programmed: Double, unabsorbed: Double, duration: TimeInterval, carbs: Int, ratio: Double) {

public init(timestamp: Date, enteredBy: String, bolusType: BolusType, amount: Double, programmed: Double, unabsorbed: Double, duration: TimeInterval, carbs: Int, ratio: Double, notes: String? = nil) {
self.bolusType = bolusType
self.amount = amount
self.programmed = programmed
self.unabsorbed = unabsorbed
self.duration = duration
self.carbs = carbs
self.ratio = ratio
super.init(timestamp: timestamp, enteredBy: enteredBy)
super.init(timestamp: timestamp, enteredBy: enteredBy, notes: notes,
eventType: (carbs > 0) ? "Meal Bolus" : "Correction Bolus")

}

override public var dictionaryRepresentation: [String: Any] {
var rval = super.dictionaryRepresentation
if carbs > 0 {
rval["eventType"] = "Meal Bolus"
rval["carbs"] = carbs
rval["ratio"] = ratio
} else {
rval["eventType"] = "Correction Bolus"
}
rval["type"] = bolusType.rawValue
rval["insulin"] = amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ public class MealBolusNightscoutTreatment: NightscoutTreatment {
let units: Units? // of glucose entry
let glucoseType: GlucoseType?

public init(timestamp: Date, enteredBy: String, id: String?, carbs: Int, absorptionTime: TimeInterval? = nil, insulin: Double? = nil, glucose: Int? = nil, glucoseType: GlucoseType? = nil, units: Units? = nil) {
public init(timestamp: Date, enteredBy: String, id: String?, carbs: Int, absorptionTime: TimeInterval? = nil, insulin: Double? = nil, glucose: Int? = nil, glucoseType: GlucoseType? = nil, units: Units? = nil, notes: String? = nil) {
self.carbs = carbs
self.absorptionTime = absorptionTime
self.glucose = glucose
self.glucoseType = glucoseType
self.units = units
self.insulin = insulin
super.init(timestamp: timestamp, enteredBy: enteredBy, id: id)
super.init(timestamp: timestamp, enteredBy: enteredBy, notes: notes, id: id, eventType: "Meal Bolus")
}

override public var dictionaryRepresentation: [String: Any] {
var rval = super.dictionaryRepresentation
rval["eventType"] = "Meal Bolus"
rval["carbs"] = carbs
if let absorptionTime = absorptionTime {
rval["absorptionTime"] = absorptionTime.minutes
Expand Down
13 changes: 12 additions & 1 deletion NightscoutUploadKit/Treatments/NightscoutTreatment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ public class NightscoutTreatment: DictionaryRepresentable {

let timestamp: Date
let enteredBy: String
let notes: String?
let id: String?
let eventType: String?

init(timestamp: Date, enteredBy: String, id: String? = nil) {

public init(timestamp: Date, enteredBy: String, notes: String? = nil, id: String? = nil, eventType: String? = nil) {
self.timestamp = timestamp
self.enteredBy = enteredBy
self.id = id
self.notes = notes
self.eventType = eventType
}

public var dictionaryRepresentation: [String: Any] {
Expand All @@ -39,6 +44,12 @@ public class NightscoutTreatment: DictionaryRepresentable {
if let id = id {
rval["_id"] = id
}
if let notes = notes {
rval["notes"] = notes
}
if let eventType = eventType {
rval["eventType"] = eventType
}
return rval
}
}
17 changes: 17 additions & 0 deletions NightscoutUploadKit/Treatments/NoteNightscoutTreatment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NoteNightscoutTreatment.swift
// RileyLink
//
// Copyright © 2017 Pete Schwamb. All rights reserved.
//

import Foundation


public class NoteNightscoutTreatment: NightscoutTreatment {

public init(timestamp: Date, enteredBy: String, notes: String? = nil, id: String? = nil) {
super.init(timestamp: timestamp, enteredBy: enteredBy, notes: notes, id: id, eventType: "Note")
}

}
17 changes: 17 additions & 0 deletions NightscoutUploadKit/Treatments/PumpResumeTreatment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// PumpResumeTreatment.swift
// RileyLink
//
// Created by Pete Schwamb on 3/27/17.
// Copyright © 2017 Pete Schwamb. All rights reserved.
//

import Foundation

public class PumpResumeTreatment: NightscoutTreatment {

public init(timestamp: Date, enteredBy: String) {
super.init(timestamp: timestamp, enteredBy: enteredBy, eventType: "Resume Pump")
}

}
17 changes: 17 additions & 0 deletions NightscoutUploadKit/Treatments/PumpSuspendTreatment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// PumpSuspendTreatment.swift
// RileyLink
//
// Created by Pete Schwamb on 3/27/17.
// Copyright © 2017 Pete Schwamb. All rights reserved.
//

import Foundation

public class PumpSuspendTreatment: NightscoutTreatment {

public init(timestamp: Date, enteredBy: String) {
super.init(timestamp: timestamp, enteredBy: enteredBy, eventType: "Suspend Pump")
}

}
27 changes: 0 additions & 27 deletions NightscoutUploadKit/Treatments/SuspendPumpTreatment.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ public class TempBasalNightscoutTreatment: NightscoutTreatment {
self.temp = temp
self.duration = duration

super.init(timestamp: timestamp, enteredBy: enteredBy)
super.init(timestamp: timestamp, enteredBy: enteredBy, eventType: "Temp Basal")
}

override public var dictionaryRepresentation: [String: Any] {
var rval = super.dictionaryRepresentation
rval["eventType"] = "Temp Basal"
rval["temp"] = temp.rawValue
rval["rate"] = rate
if let absolute = absolute {
Expand Down
2 changes: 1 addition & 1 deletion NightscoutUploadKitTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
Loading

0 comments on commit b0dcd07

Please sign in to comment.