Skip to content
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

Bluetooth Device Pairing Infrastructure and Health Measurements #1

Merged
merged 77 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
cb77d17
Basic project setup
Supereg Jun 9, 2024
add69bb
Omron services
Supereg Jun 10, 2024
c54b3f4
Upgrade to SpeziNetworking 2.0
Supereg Jun 13, 2024
a04c44b
Move all infrastructure to SpeziDevices
Supereg Jun 21, 2024
6687758
Make some interface public
Supereg Jun 21, 2024
b9e1856
Add dedicated HealthDevice protocol
Supereg Jun 21, 2024
f914a4a
Ensure UserSlot is publicy accessible
Supereg Jun 21, 2024
ae86e0e
A bunch of documentation and adjustments
Supereg Jun 21, 2024
3c64ead
Resolve some issues
Supereg Jun 21, 2024
7510c5d
Move BluetoothViews to SpeziDevices
Supereg Jun 21, 2024
4aa2d0a
Minor fixes
Supereg Jun 21, 2024
6ca3147
Fix pairing session check
Supereg Jun 22, 2024
4ac6757
Move HealthMeasurements to SpeziDevices
Supereg Jun 22, 2024
deeb620
Make accessible
Supereg Jun 22, 2024
0d633cb
Provide access to state
Supereg Jun 22, 2024
f3212fa
Item bidning fix
Supereg Jun 22, 2024
e451b2d
A bunch of progress, updating to latest SpeziBluetooth prototype
Supereg Jun 24, 2024
df765ba
Rename and provide new configure interface
Supereg Jun 24, 2024
02fd0c9
Provide similar mechnaism for health measurements
Supereg Jun 24, 2024
dbc96bf
Resolve a lot of todos and restructure some parts
Supereg Jun 24, 2024
1c6450f
Final touches on the API design
Supereg Jun 25, 2024
c66bcea
Fix closure
Supereg Jun 25, 2024
45d3498
signalDevicePaired
Supereg Jun 25, 2024
797c72f
Only update last seen if we were previously connected
Supereg Jun 25, 2024
3519a06
Small changes
Supereg Jun 25, 2024
6927155
Debug
Supereg Jun 25, 2024
cc0ac93
Move NavigationLink into dedicated view?
Supereg Jun 25, 2024
55ac1ee
Resolve all todos
Supereg Jun 25, 2024
5011ef2
Some docs structuring and REUSE
Supereg Jun 25, 2024
77d93db
Remove support for macOS, tvOS and watchOS
Supereg Jun 25, 2024
151e164
Fix workflow
Supereg Jun 25, 2024
561eee2
Setup UITest App
Supereg Jun 25, 2024
5835b20
Run with StanfordSpezi workflows
Supereg Jun 25, 2024
8e28290
Project setup
Supereg Jun 25, 2024
52606e1
fix
Supereg Jun 25, 2024
ef11156
Other name?
Supereg Jun 25, 2024
7f7d6e7
Can't run visionOS simulator right now
Supereg Jun 25, 2024
1e3a084
Fix coverage reports
Supereg Jun 25, 2024
3f2a440
Add HealthMeasurements Tests
Supereg Jun 26, 2024
f4f0591
Update SpeziViews
Supereg Jun 26, 2024
e7f1328
Add PairedDevices tests
Supereg Jun 26, 2024
8e3698b
Add SpeziOmron tests and some fixes
Supereg Jun 26, 2024
13218c3
Add UI test app
Supereg Jun 26, 2024
ca16a2f
Add UI tests
Supereg Jun 27, 2024
c2ac2d7
Include other targets in coverage reports as well
Supereg Jun 27, 2024
833e57d
Add UI tests for generic views, fix unit tests
Supereg Jun 27, 2024
0143dd2
Resolve last few todos
Supereg Jun 27, 2024
8e19309
Test pairing hint
Supereg Jun 27, 2024
0d2c3b1
Fix swiftlint
Supereg Jun 27, 2024
c349ac0
Allow to detect if a pairing was successful.
Supereg Jun 27, 2024
f23dd2b
Don't do if debug || test
Supereg Jun 27, 2024
c617acc
Move Omron devices to SpeziDevices
Supereg Jun 27, 2024
947e7c4
Make sure to automatically update stored ImageReference
Supereg Jun 27, 2024
7113fee
Logging
Supereg Jun 27, 2024
59d9265
Fix double storage
Supereg Jun 27, 2024
8cc8ae7
Discaridng?
Supereg Jun 27, 2024
0571017
Minor fixes and new todos
Supereg Jun 27, 2024
d1d1a82
Less todos and always update icon
Supereg Jun 27, 2024
15306ed
Minor tests
Supereg Jun 27, 2024
9b00baa
Release versions
Supereg Jun 27, 2024
7da6d65
Always determine icon at runtime
Supereg Jun 27, 2024
bce9494
Fix HealthMeasurements Storage issue
Supereg Jun 27, 2024
e123dfe
Move to SwiftData for paired devices
Supereg Jun 28, 2024
0340294
Revert some changes for now
Supereg Jun 28, 2024
1fc7fad
Some progress with SwiftData
Supereg Jun 28, 2024
169da42
Seems to consistently NOT crash for now
Supereg Jun 28, 2024
a4046a8
Replace carousel with TabView
Supereg Jul 1, 2024
a7283f9
Remove ACarousel, replacing with TabView
Supereg Jul 1, 2024
2a54884
feedback
Supereg Jul 1, 2024
5daa2c1
Make storage work
Supereg Jul 1, 2024
8af78d0
Documentation progress and resolved some feebdack
Supereg Jul 2, 2024
dc365b1
Dedicated storage location
Supereg Jul 2, 2024
7d27b53
Full workarounds
Supereg Jul 2, 2024
59e35a3
Fix last measurement appearing
Supereg Jul 2, 2024
cee44d8
Docs and README
Supereg Jul 2, 2024
2b500c7
Final touches
Supereg Jul 2, 2024
50a6c0a
Update page indicator tests
Supereg Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 11 additions & 82 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford SpeziDevices open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -18,107 +18,36 @@ on:
jobs:
packageios:
name: Build and Test Swift Package iOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
scheme: TemplatePackage
resultBundle: TemplatePackage-iOS.xcresult
artifactname: TemplatePackage-iOS.xcresult
packagewatchos:
name: Build and Test Swift Package watchOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
scheme: TemplatePackage
destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)'
resultBundle: TemplatePackage-watchOS.xcresult
artifactname: TemplatePackage-watchOS.xcresult
packagevisionos:
name: Build and Test Swift Package visionOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
scheme: TemplatePackage
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
resultBundle: TemplatePackage-visionOS.xcresult
artifactname: TemplatePackage-visionOS.xcresult
packagetvos:
name: Build and Test Swift Package tvOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
scheme: TemplatePackage
resultBundle: TemplatePackage-tvOS.xcresult
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
artifactname: TemplatePackage-tvOS.xcresult
packagemacos:
name: Build and Test Swift Package macOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
scheme: TemplatePackage
resultBundle: TemplatePackage-macOS.xcresult
destination: 'platform=macOS,arch=arm64'
artifactname: TemplatePackage-macOS.xcresult
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziDevices-Package
resultBundle: SpeziDevices-iOS.xcresult
artifactname: SpeziDevices-iOS.xcresult
ios:
name: Build and Test iOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
resultBundle: TestApp-iOS.xcresult
artifactname: TestApp-iOS.xcresult
ipados:
name: Build and Test iPadOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=iOS Simulator,name=iPad Air (5th generation)'
resultBundle: TestApp-iPadOS.xcresult
artifactname: TestApp-iPadOS.xcresult
watchos:
name: Build and Test watchOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestAppWatchApp
destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)'
resultBundle: TestApp-watchOS.xcresult
artifactname: TestApp-watchOS.xcresult
visionos:
name: Build and Test visionOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
resultBundle: TestApp-visionOS.xcresult
artifactname: TestApp-visionOS.xcresult
tvos:
name: Build and Test tvOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
resultBundle: TestApp-tvOS.xcresult
artifactname: TestApp-tvOS.xcresult
codeql:
name: CodeQL
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
codeql: true
test: false
scheme: TemplatePackage
scheme: SpeziDevices-Package
permissions:
security-events: write
actions: read
uploadcoveragereport:
name: Upload Coverage Report
needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos]
needs: [packageios, ios]
uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
with:
coveragereports: TemplatePackage-iOS.xcresult TemplatePackage-watchOS.xcresult TemplatePackage-visionOS.xcresult TemplatePackage-tvOS.xcresult TemplatePackage-macOS.xcresult TestApp-iOS.xcresult TestApp-iPadOS.xcresult TestApp-watchOS.xcresult TestApp-visionOS.xcresult TestApp-tvOS.xcresult
coveragereports: SpeziDevices-iOS.xcresult TestApp-iOS.xcresult
secrets:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford SpeziDevices open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford SpeziDevices open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
6 changes: 4 additions & 2 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford SpeziDevices open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -11,4 +11,6 @@ builder:
configs:
- platform: ios
documentation_targets:
- TemplatePackage
- SpeziDevices
- SpeziDevicesUI
- SpeziOmron
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford SpeziDevices open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
12 changes: 6 additions & 6 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford SpeziDevices open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -12,9 +12,9 @@ authors:
- family-names: "Schmiedmayer"
given-names: "Paul"
orcid: "https://orcid.org/0000-0002-8607-9148"
- family-names: "Ravi"
given-names: "Vishnu"
orcid: "https://orcid.org/0000-0003-0359-1275"
title: "TemplatePackage"
- family-names: "Bauer"
Supereg marked this conversation as resolved.
Show resolved Hide resolved
given-names: "Andreas"
orcid: "https://orcid.org/0000-0002-1680-237X"
title: "SpeziDevices"
doi: 10.5281/zenodo.7538165
url: "https://github.com/StanfordBDHG/SwiftPackageTemplate"
url: "https://github.com/StanfordSpezi/SpeziDevices"
4 changes: 2 additions & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--

#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford SpeziDevices open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -14,4 +14,4 @@ TemplatePackage contributors
====================

* [Paul Schmiedmayer](https://github.com/PSchmiedmayer)
* [Vishnu Ravi](https://github.com/vishnuravi)
* [Andreas Bauer](https://github.com/Supereg)
122 changes: 111 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,37 +1,137 @@
// swift-tools-version:5.9

//
// This source file is part of the TemplatePackage open source project
// This source file is part of the Stanford SpeziDevices open source project
//
// SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//

import class Foundation.ProcessInfo
import PackageDescription


#if swift(<6)
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("StrictConcurrency")
#else
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("StrictConcurrency")
#endif


let package = Package(
name: "TemplatePackage",
name: "SpeziDevices",
defaultLocalization: "en",
platforms: [
.iOS(.v17),
.watchOS(.v10),
.visionOS(.v1),
.tvOS(.v17),
.macOS(.v14)
.visionOS(.v1)
],
products: [
.library(name: "TemplatePackage", targets: ["TemplatePackage"])
.library(name: "SpeziDevices", targets: ["SpeziDevices"]),
.library(name: "SpeziDevicesUI", targets: ["SpeziDevicesUI"]),
.library(name: "SpeziOmron", targets: ["SpeziOmron"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.1"),
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation", from: "1.1.1"),
.package(url: "https://github.com/StanfordSpezi/Spezi.git", from: "1.4.0"),
.package(url: "https://github.com/StanfordSpezi/SpeziViews.git", from: "1.5.0"),
.package(url: "https://github.com/StanfordSpezi/SpeziBluetooth", from: "2.0.0"),
.package(url: "https://github.com/StanfordSpezi/SpeziNetworking", from: "2.1.1"),
.package(url: "https://github.com/StanfordBDHG/XCTestExtensions.git", .upToNextMinor(from: "0.4.12"))
] + swiftLintPackage(),
targets: [
.target(
name: "TemplatePackage"
name: "SpeziDevices",
dependencies: [
.product(name: "OrderedCollections", package: "swift-collections"),
.product(name: "SpeziFoundation", package: "SpeziFoundation"),
.product(name: "SpeziBluetooth", package: "SpeziBluetooth"),
.product(name: "SpeziBluetoothServices", package: "SpeziBluetooth"),
.product(name: "SpeziViews", package: "SpeziViews"),
.product(name: "Spezi", package: "Spezi")
],
swiftSettings: [
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
),
.target(
name: "SpeziDevicesUI",
dependencies: [
.target(name: "SpeziDevices"),
.product(name: "SpeziViews", package: "SpeziViews"),
.product(name: "SpeziValidation", package: "SpeziViews"),
.product(name: "SpeziBluetooth", package: "SpeziBluetooth")
],
resources: [
.process("Resources")
],
swiftSettings: [
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
),
.target(
name: "SpeziOmron",
dependencies: [
.target(name: "SpeziDevices"),
.product(name: "SpeziBluetooth", package: "SpeziBluetooth"),
.product(name: "SpeziBluetoothServices", package: "SpeziBluetooth")
],
resources: [
.process("Resources")
],
swiftSettings: [
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "SpeziDevicesTests",
dependencies: [
.target(name: "SpeziDevices"),
.product(name: "SpeziFoundation", package: "SpeziFoundation"),
.product(name: "XCTSpezi", package: "Spezi"),
.product(name: "SpeziBluetooth", package: "SpeziBluetooth"),
.product(name: "SpeziBluetoothServices", package: "SpeziBluetooth"),
.product(name: "XCTestExtensions", package: "XCTestExtensions")
],
swiftSettings: [
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "TemplatePackageTests",
name: "SpeziOmronTests",
dependencies: [
.target(name: "TemplatePackage")
]
.target(name: "SpeziOmron"),
.product(name: "SpeziBluetooth", package: "SpeziBluetooth"),
.product(name: "XCTByteCoding", package: "SpeziNetworking"),
.product(name: "XCTestExtensions", package: "XCTestExtensions")
],
swiftSettings: [
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
)
]
)


func swiftLintPlugin() -> [Target.PluginUsage] {
// Fully quit Xcode and open again with `open --env SPEZI_DEVELOPMENT_SWIFTLINT /Applications/Xcode.app`
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]
} else {
[]
}
}

func swiftLintPackage() -> [PackageDescription.Package.Dependency] {
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.package(url: "https://github.com/realm/SwiftLint.git", .upToNextMinor(from: "0.55.1"))]
} else {
[]
}
}
Loading
Loading