-
Notifications
You must be signed in to change notification settings - Fork 16
Add Stelo support #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
marionbarker
wants to merge
5
commits into
LoopKit:main
Choose a base branch
from
loopandlearn:add_stelo_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bcf6447
Add Stelo support
marionbarker 8b18b0f
add warning about no glucose alerts for Stelo
marionbarker 6ee0cb4
Add manager for G7 platform sensors (G7, ONE+, Stelo)
codebymini 74f8d26
Merge branch 'main' into add_stelo_support
marionbarker 0f03719
Merge branch 'main' into add_stelo_support
marionbarker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,98 @@ | ||
| // | ||
| // G7SensorType.swift | ||
| // G7SensorKit | ||
| // | ||
| // Created by Daniel Johansson on 12/19/24. | ||
| // Copyright © 2024 LoopKit Authors. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| public enum G7SensorType: String, CaseIterable, CustomStringConvertible { | ||
| case g7 = "G7" | ||
| case onePlus = "ONE+" | ||
| case stelo = "Stelo" | ||
| case unknown = "Unknown" | ||
|
|
||
| public var description: String { | ||
| switch self { | ||
| case .g7: | ||
| return "Dexcom G7" | ||
| case .onePlus: | ||
| return "Dexcom ONE+" | ||
| case .stelo: | ||
| return "Dexcom Stelo" | ||
| case .unknown: | ||
| return "Unknown Sensor" | ||
| } | ||
| } | ||
|
|
||
| public var displayName: String { | ||
| return description | ||
| } | ||
|
|
||
| public var lifetime: TimeInterval { | ||
| switch self { | ||
| case .g7: | ||
| return TimeInterval(hours: 10 * 24) // 10 days | ||
| case .onePlus: | ||
| return TimeInterval(hours: 10 * 24) // 10 days | ||
| case .stelo: | ||
| return TimeInterval(hours: 15 * 24) // 15 days | ||
| case .unknown: | ||
| return TimeInterval(hours: 10 * 24) // Default to 10 days | ||
| } | ||
| } | ||
|
|
||
| public var gracePeriod: TimeInterval { | ||
| switch self { | ||
| case .g7, .onePlus, .stelo, .unknown: | ||
| return TimeInterval(hours: 12) // 12 hours for all | ||
| } | ||
| } | ||
|
|
||
| public var warmupDuration: TimeInterval { | ||
| switch self { | ||
| case .g7, .onePlus, .stelo, .unknown: | ||
| return TimeInterval(minutes: 25) // 25 minutes for all | ||
| } | ||
| } | ||
| public var totalLifetimeHours: Double { | ||
| return (lifetime + gracePeriod).hours | ||
| } | ||
|
|
||
| public var warmupHours: Double { | ||
| return warmupDuration.hours | ||
| } | ||
|
|
||
| public var dexcomAppURL: String { | ||
| switch self { | ||
| case .g7: | ||
| return "dexcomg7://" | ||
| case .onePlus: | ||
| return "dexcomg7://" // ONE+ Uses same URL as G7 app. If G7 and One+ is installed, the G7 app will open | ||
| case .stelo: | ||
| return "stelo://" | ||
| case .unknown: | ||
| return "dexcomg7://" // Default to G7 app | ||
| } | ||
| } | ||
|
|
||
| /// Detects sensor type based on the sensor name/ID | ||
| public static func detect(from sensorName: String) -> G7SensorType { | ||
| let name = sensorName.uppercased() | ||
|
|
||
| if name.hasPrefix("DXCM") { | ||
| // Check for 15-day G7 sensors (these might have a different prefix pattern) | ||
| // For now, assume all DXCM are 10-day G7, but this could be enhanced | ||
| // based on additional sensor data or naming patterns | ||
| return .g7 | ||
| } else if name.hasPrefix("DX01") { | ||
| return .stelo | ||
| } else if name.hasPrefix("DX02") { | ||
| return .onePlus | ||
| } else { | ||
| return .unknown | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this long string should be broken into two localized strings that are concatenated together. I think this would make it easier for localization tasks moving forward.
It is not true that Stelo provides no alerts or alarms. After wearing one for 15 days, I got plenty of alerts. Also, we want this submodule to be suitable for use with Trio as well as Loop. (And Trio does have alerts.) Perhaps we could say:
"Dexcom Stelo app does not provide the same critical alarms as G7 or ONE+."