Skip to content

Commit ad2e2a0

Browse files
authored
Merge pull request #224 from ps2/dev
v0.11.2
2 parents e2a6adc + 7888ff2 commit ad2e2a0

File tree

12 files changed

+57
-40
lines changed

12 files changed

+57
-40
lines changed

MinimedKit/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

MinimedKitTests/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

NightscoutUploadKit/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

NightscoutUploadKit/NightscoutPumpEvents.swift

+29-12
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class NightscoutPumpEvents: NSObject {
1515
var results = [NightscoutTreatment]()
1616
var lastBolusWizard: BolusWizardEstimatePumpEvent?
1717
var lastBolusWizardDate: NSDate?
18-
var lastTempBasal: TempBasalPumpEvent?
18+
var lastBasalRate: TempBasalPumpEvent?
19+
var lastBasalRateDate: NSDate?
20+
var lastBasalDuration: TempBasalDurationPumpEvent?
21+
var lastBasalDurationDate: NSDate?
1922
for event in events {
2023
switch event.pumpEvent {
2124
case let bgReceived as BGReceivedPumpEvent:
@@ -50,23 +53,37 @@ class NightscoutPumpEvents: NSObject {
5053
lastBolusWizard = bolusWizard
5154
lastBolusWizardDate = event.date
5255
case let tempBasal as TempBasalPumpEvent:
53-
lastTempBasal = tempBasal
56+
lastBasalRate = tempBasal
57+
lastBasalRateDate = event.date
5458
case let tempBasalDuration as TempBasalDurationPumpEvent:
55-
if let tempBasal = lastTempBasal {
56-
let absolute: Double? = tempBasal.rateType == .Absolute ? tempBasal.rate : nil
57-
let entry = TempBasalNightscoutTreatment(
58-
timestamp: event.date,
59-
enteredBy: eventSource,
60-
temp: tempBasal.rateType == .Absolute ? .Absolute : .Percentage,
61-
rate: tempBasal.rate, absolute: absolute, duration: tempBasalDuration.duration)
62-
63-
results.append(entry)
64-
}
59+
lastBasalDuration = tempBasalDuration
60+
lastBasalDurationDate = event.date
6561
default:
6662
break
6763
}
64+
65+
if let basalRate = lastBasalRate, basalDuration = lastBasalDuration, basalRateDate = lastBasalRateDate, basalDurationDate = lastBasalDurationDate
66+
where fabs(basalRateDate.timeIntervalSinceDate(basalDurationDate)) <= 2 {
67+
let entry = basalPairToNSTreatment(basalRate, basalDuration: basalDuration, eventSource: eventSource, timestamp: event.date)
68+
results.append(entry)
69+
lastBasalRate = nil
70+
lastBasalRateDate = nil
71+
lastBasalDuration = nil
72+
lastBasalDurationDate = nil
73+
}
6874
}
6975
return results
7076
}
77+
78+
private class func basalPairToNSTreatment(basalRate: TempBasalPumpEvent, basalDuration: TempBasalDurationPumpEvent, eventSource: String, timestamp: NSDate) -> TempBasalNightscoutTreatment {
79+
let absolute: Double? = basalRate.rateType == .Absolute ? basalRate.rate : nil
80+
return TempBasalNightscoutTreatment(
81+
timestamp: timestamp,
82+
enteredBy: eventSource,
83+
temp: basalRate.rateType == .Absolute ? .Absolute : .Percentage,
84+
rate: basalRate.rate,
85+
absolute: absolute,
86+
duration: basalDuration.duration)
87+
}
7188
}
7289

NightscoutUploadKitTests/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

RileyLink.xcodeproj/project.pbxproj

+18-18
Original file line numberDiff line numberDiff line change
@@ -2024,11 +2024,11 @@
20242024
CLANG_WARN_UNREACHABLE_CODE = YES;
20252025
CODE_SIGN_IDENTITY = "iPhone Developer";
20262026
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2027-
CURRENT_PROJECT_VERSION = 15;
2027+
CURRENT_PROJECT_VERSION = 16;
20282028
DEBUG_INFORMATION_FORMAT = dwarf;
20292029
DEFINES_MODULE = YES;
20302030
DYLIB_COMPATIBILITY_VERSION = 1;
2031-
DYLIB_CURRENT_VERSION = 15;
2031+
DYLIB_CURRENT_VERSION = 16;
20322032
DYLIB_INSTALL_NAME_BASE = "@rpath";
20332033
ENABLE_STRICT_OBJC_MSGSEND = YES;
20342034
GCC_NO_COMMON_BLOCKS = YES;
@@ -2052,11 +2052,11 @@
20522052
CODE_SIGN_IDENTITY = "iPhone Developer";
20532053
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
20542054
COPY_PHASE_STRIP = NO;
2055-
CURRENT_PROJECT_VERSION = 15;
2055+
CURRENT_PROJECT_VERSION = 16;
20562056
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
20572057
DEFINES_MODULE = YES;
20582058
DYLIB_COMPATIBILITY_VERSION = 1;
2059-
DYLIB_CURRENT_VERSION = 15;
2059+
DYLIB_CURRENT_VERSION = 16;
20602060
DYLIB_INSTALL_NAME_BASE = "@rpath";
20612061
ENABLE_STRICT_OBJC_MSGSEND = YES;
20622062
GCC_NO_COMMON_BLOCKS = YES;
@@ -2115,11 +2115,11 @@
21152115
CLANG_WARN_UNREACHABLE_CODE = YES;
21162116
CODE_SIGN_IDENTITY = "iPhone Developer";
21172117
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2118-
CURRENT_PROJECT_VERSION = 15;
2118+
CURRENT_PROJECT_VERSION = 16;
21192119
DEBUG_INFORMATION_FORMAT = dwarf;
21202120
DEFINES_MODULE = YES;
21212121
DYLIB_COMPATIBILITY_VERSION = 1;
2122-
DYLIB_CURRENT_VERSION = 15;
2122+
DYLIB_CURRENT_VERSION = 16;
21232123
DYLIB_INSTALL_NAME_BASE = "@rpath";
21242124
ENABLE_STRICT_OBJC_MSGSEND = YES;
21252125
GCC_NO_COMMON_BLOCKS = YES;
@@ -2145,11 +2145,11 @@
21452145
CODE_SIGN_IDENTITY = "iPhone Developer";
21462146
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
21472147
COPY_PHASE_STRIP = NO;
2148-
CURRENT_PROJECT_VERSION = 15;
2148+
CURRENT_PROJECT_VERSION = 16;
21492149
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
21502150
DEFINES_MODULE = YES;
21512151
DYLIB_COMPATIBILITY_VERSION = 1;
2152-
DYLIB_CURRENT_VERSION = 15;
2152+
DYLIB_CURRENT_VERSION = 16;
21532153
DYLIB_INSTALL_NAME_BASE = "@rpath";
21542154
ENABLE_STRICT_OBJC_MSGSEND = YES;
21552155
GCC_NO_COMMON_BLOCKS = YES;
@@ -2208,11 +2208,11 @@
22082208
CLANG_WARN_UNREACHABLE_CODE = YES;
22092209
CODE_SIGN_IDENTITY = "iPhone Developer";
22102210
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2211-
CURRENT_PROJECT_VERSION = 15;
2211+
CURRENT_PROJECT_VERSION = 16;
22122212
DEBUG_INFORMATION_FORMAT = dwarf;
22132213
DEFINES_MODULE = YES;
22142214
DYLIB_COMPATIBILITY_VERSION = 1;
2215-
DYLIB_CURRENT_VERSION = 15;
2215+
DYLIB_CURRENT_VERSION = 16;
22162216
DYLIB_INSTALL_NAME_BASE = "@rpath";
22172217
ENABLE_STRICT_OBJC_MSGSEND = YES;
22182218
GCC_NO_COMMON_BLOCKS = YES;
@@ -2237,11 +2237,11 @@
22372237
CODE_SIGN_IDENTITY = "iPhone Developer";
22382238
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
22392239
COPY_PHASE_STRIP = NO;
2240-
CURRENT_PROJECT_VERSION = 15;
2240+
CURRENT_PROJECT_VERSION = 16;
22412241
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
22422242
DEFINES_MODULE = YES;
22432243
DYLIB_COMPATIBILITY_VERSION = 1;
2244-
DYLIB_CURRENT_VERSION = 15;
2244+
DYLIB_CURRENT_VERSION = 16;
22452245
DYLIB_INSTALL_NAME_BASE = "@rpath";
22462246
ENABLE_STRICT_OBJC_MSGSEND = YES;
22472247
GCC_NO_COMMON_BLOCKS = YES;
@@ -2310,7 +2310,7 @@
23102310
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
23112311
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23122312
COPY_PHASE_STRIP = NO;
2313-
CURRENT_PROJECT_VERSION = 15;
2313+
CURRENT_PROJECT_VERSION = 16;
23142314
ENABLE_TESTABILITY = YES;
23152315
GCC_C_LANGUAGE_STANDARD = gnu99;
23162316
GCC_DYNAMIC_NO_PIC = NO;
@@ -2352,7 +2352,7 @@
23522352
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
23532353
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
23542354
COPY_PHASE_STRIP = YES;
2355-
CURRENT_PROJECT_VERSION = 15;
2355+
CURRENT_PROJECT_VERSION = 16;
23562356
ENABLE_NS_ASSERTIONS = NO;
23572357
GCC_C_LANGUAGE_STANDARD = gnu99;
23582358
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -2457,11 +2457,11 @@
24572457
CLANG_WARN_UNREACHABLE_CODE = YES;
24582458
CODE_SIGN_IDENTITY = "iPhone Developer";
24592459
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2460-
CURRENT_PROJECT_VERSION = 15;
2460+
CURRENT_PROJECT_VERSION = 16;
24612461
DEBUG_INFORMATION_FORMAT = dwarf;
24622462
DEFINES_MODULE = YES;
24632463
DYLIB_COMPATIBILITY_VERSION = 1;
2464-
DYLIB_CURRENT_VERSION = 15;
2464+
DYLIB_CURRENT_VERSION = 16;
24652465
DYLIB_INSTALL_NAME_BASE = "@rpath";
24662466
ENABLE_STRICT_OBJC_MSGSEND = YES;
24672467
FRAMEWORK_SEARCH_PATHS = (
@@ -2490,11 +2490,11 @@
24902490
CODE_SIGN_IDENTITY = "iPhone Developer";
24912491
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
24922492
COPY_PHASE_STRIP = NO;
2493-
CURRENT_PROJECT_VERSION = 15;
2493+
CURRENT_PROJECT_VERSION = 16;
24942494
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
24952495
DEFINES_MODULE = YES;
24962496
DYLIB_COMPATIBILITY_VERSION = 1;
2497-
DYLIB_CURRENT_VERSION = 15;
2497+
DYLIB_CURRENT_VERSION = 16;
24982498
DYLIB_INSTALL_NAME_BASE = "@rpath";
24992499
ENABLE_STRICT_OBJC_MSGSEND = YES;
25002500
FRAMEWORK_SEARCH_PATHS = (

RileyLink/RileyLink-Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundlePackageType</key>
2020
<string>APPL</string>
2121
<key>CFBundleShortVersionString</key>
22-
<string>0.11.1</string>
22+
<string>0.11.2</string>
2323
<key>CFBundleSignature</key>
2424
<string>????</string>
2525
<key>CFBundleVersion</key>

RileyLinkBLEKit/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

RileyLinkBLEKitTests/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

RileyLinkKit/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

RileyLinkKitTests/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.11.1</string>
18+
<string>0.11.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

RileyLinkTests/RileyLinkTests-Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>CFBundlePackageType</key>
1414
<string>BNDL</string>
1515
<key>CFBundleShortVersionString</key>
16-
<string>0.11.1</string>
16+
<string>0.11.2</string>
1717
<key>CFBundleSignature</key>
1818
<string>????</string>
1919
<key>CFBundleVersion</key>

0 commit comments

Comments
 (0)