-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from ps2/dev
Release 0.7.0
- Loading branch information
Showing
54 changed files
with
1,656 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
github "loudnate/Crypto" "e0ef5b498f2c373d676135dabf5d1803b8558509" | ||
github "loudnate/Crypto" "13fee45175b88629aeabe60b4b4fc3daf86fa0a3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
MinimedKit/PumpEvents/JournalEntryInsulinMarkerPumpEvent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// JournalEntryInsulinMarkerPumpEvent.swift | ||
// RileyLink | ||
// | ||
// Created by Pete Schwamb on 7/16/16. | ||
// Copyright © 2016 Pete Schwamb. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct JournalEntryInsulinMarkerPumpEvent: TimestampedPumpEvent { | ||
public let length: Int | ||
public let rawData: NSData | ||
public let timestamp: NSDateComponents | ||
public let amount: Double | ||
|
||
public init?(availableData: NSData, pumpModel: PumpModel) { | ||
length = 8 | ||
|
||
guard length <= availableData.length else { | ||
return nil | ||
} | ||
|
||
rawData = availableData[0..<length] | ||
|
||
timestamp = NSDateComponents(pumpEventData: availableData, offset: 2) | ||
|
||
let lowBits = rawData[1] as UInt8 | ||
let highBits = rawData[4] as UInt8 | ||
amount = Double((Int(highBits & 0b1100000) << 3) + Int(lowBits)) / 10.0 | ||
} | ||
|
||
public var dictionaryRepresentation: [String: AnyObject] { | ||
return [ | ||
"_type": "JournalEntryInsulinMarker", | ||
"amount": amount, | ||
] | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
MinimedKit/PumpEvents/JournalEntryMealMarkerPumpEvent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// JournalEntryMealMarkerPumpEvent.swift | ||
// RileyLink | ||
// | ||
// Created by Pete Schwamb on 7/14/16. | ||
// Copyright © 2016 Pete Schwamb. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct JournalEntryMealMarkerPumpEvent: TimestampedPumpEvent { | ||
public let length: Int | ||
public let rawData: NSData | ||
public let timestamp: NSDateComponents | ||
public let carbohydrates: Double | ||
public let carbUnits: CarbUnits | ||
|
||
public enum CarbUnits: String { | ||
case Exchanges | ||
case Grams | ||
} | ||
|
||
public init?(availableData: NSData, pumpModel: PumpModel) { | ||
length = 9 | ||
|
||
let useExchangesBit = ((availableData[8] as UInt8) >> 1) & 0b1 | ||
carbUnits = (useExchangesBit != 0) ? .Exchanges : .Grams | ||
|
||
let carbHighBit = (availableData[8] as UInt8) & 0b1 | ||
let carbLowBits = availableData[7] as UInt8 | ||
|
||
if carbUnits == .Exchanges { | ||
carbohydrates = Double(carbLowBits) / 10.0 | ||
} else { | ||
carbohydrates = Double(Int(carbHighBit) << 8 + Int(carbLowBits)) | ||
} | ||
|
||
guard length <= availableData.length else { | ||
return nil | ||
} | ||
|
||
rawData = availableData[0..<length] | ||
|
||
timestamp = NSDateComponents(pumpEventData: availableData, offset: 2) | ||
} | ||
|
||
public var dictionaryRepresentation: [String: AnyObject] { | ||
return [ | ||
"_type": "JournalEntryMealMarker", | ||
"carbohydrates": carbohydrates, | ||
"carbUnits": carbUnits.rawValue, | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.