generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# BP7000 and EVOLV Support ## ♻️ Current situation & Problem This PR adds support for Omron BP7000 and Omron EVOLV blood pressure cuffs. The implementation of both devices is still achieved using the `OmronBloodPressureCuff` device. The device icon can now be supplied dynamically by the device class based on device features. This makes it possible for a device implementation to visually distinguish between multiple different models. Currently, we only support to differentiate between different based on the peripheral name. ## ⚙️ Release Notes * Add support for Omron BP7000 and Omron EVOLV blood pressure cuffs. * Dynamically select the device icon based on device features. * Provide dark-mode compatible images for all supported devices. ## 📚 Documentation Documentation was updated to reflect the changes made by this PR. ## ✅ Testing Testing was added to test new components. ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
- Loading branch information
Showing
48 changed files
with
456 additions
and
81 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Refer to https://www.omron-healthcare.com/terms-of-use. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open-project | ||
// | ||
// SPDX-FileCopyrightText: 2024 Stanford University | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
|
||
/// Description of a asset for a device. | ||
public struct DeviceAsset { | ||
enum DeviceDescriptor { | ||
case name(_ substring: String, isSubstring: Bool) | ||
} | ||
|
||
private let descriptor: DeviceDescriptor | ||
fileprivate let asset: ImageReference | ||
|
||
|
||
func matches(for pairedDevice: PairedDeviceInfo) -> Bool { | ||
switch descriptor { | ||
case let .name(substring, isSubstring): | ||
return isSubstring | ||
? pairedDevice.peripheralName?.hasPrefix(substring) == true | ||
: pairedDevice.peripheralName == substring | ||
} | ||
} | ||
|
||
func matches(for device: some GenericDevice) -> Bool { | ||
switch descriptor { | ||
case let .name(substring, isSubstring): | ||
return isSubstring | ||
? device.name?.hasPrefix(substring) == true | ||
: device.name == substring | ||
} | ||
} | ||
} | ||
|
||
|
||
extension DeviceAsset { | ||
/// Define an asset for devices with a given name. | ||
/// | ||
/// - Parameters: | ||
/// - name: The name of the peripheral. The provided `asset` will be used if the name matches the peripherals name. | ||
/// - asset: The image to use. | ||
public static func name(_ name: String, _ asset: ImageReference) -> DeviceAsset { | ||
DeviceAsset(descriptor: .name(name, isSubstring: false), asset: asset) | ||
} | ||
} | ||
|
||
|
||
extension Array where Element == DeviceAsset { | ||
/// Retrieve the first matching asset for the given paired device info. | ||
/// - Parameter pairedDevice: The paired device info. | ||
/// - Returns: The first matching asset or `nil` if none were found. | ||
public func firstAsset(for pairedDevice: PairedDeviceInfo) -> ImageReference? { | ||
first { asset in | ||
asset.matches(for: pairedDevice) | ||
}?.asset | ||
} | ||
|
||
|
||
/// Retrieve the first matching asset for the given device. | ||
/// - Parameter device: The device. | ||
/// - Returns: The first matching asset or `nil` if none were found. | ||
public func firstAsset(for device: some GenericDevice) -> ImageReference? { | ||
first { asset in | ||
asset.matches(for: device) | ||
}?.asset | ||
} | ||
} |
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
Binary file modified
BIN
+15 KB
(110%)
Sources/SpeziDevicesUI/SpeziDevicesUI.docc/Resources/DeviceDetails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16.4 KB
(110%)
Sources/SpeziDevicesUI/SpeziDevicesUI.docc/Resources/DeviceDetails~dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+25 KB
(110%)
Sources/SpeziDevicesUI/SpeziDevicesUI.docc/Resources/PairedDevices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+21.1 KB
(110%)
Sources/SpeziDevicesUI/SpeziDevicesUI.docc/Resources/PairedDevices~dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.