Skip to content

Commit

Permalink
Add additional action buttons to read data (#43)
Browse files Browse the repository at this point in the history
# Add additional action buttons to read data

## ♻️ Current situation & Problem
This PR adds additional buttons to read readable action buttons for the
Biopot.


## ⚙️ Release Notes 
* Add additional action buttons for Biopot


## 📚 Documentation
--


## ✅ Testing
--


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
Supereg authored Nov 18, 2023
1 parent d47ccf3 commit 0fb6b89
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
24 changes: 18 additions & 6 deletions NAMS/BioPot/Biopot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ struct Biopot: View {
}
}

Section("Actions") { // section of testing actions
AsyncButton("Read Device Configuration", state: $viewState) {
try biopot.readBiopot(characteristic: BiopotDevice.Characteristic.biopotDeviceConfiguration)
}
}
actionButtons
} else if biopot.bluetoothState == .scanning {
Section {
ProgressView()
Expand All @@ -65,7 +61,6 @@ struct Biopot: View {
}
}


@MainActor @ViewBuilder private var testingSupport: some View {
if FeatureFlags.testBiopot {
Button("Receive Device Info") {
Expand All @@ -81,6 +76,23 @@ struct Biopot: View {
}
}
}

@MainActor @ViewBuilder private var actionButtons: some View {
Section("Actions") { // section of testing actions
AsyncButton("Read Device Configuration", state: $viewState) {
try biopot.readBiopot(characteristic: BiopotDevice.Characteristic.biopotDeviceConfiguration)
}
AsyncButton("Read Data Control", state: $viewState) {
try biopot.readBiopot(characteristic: BiopotDevice.Characteristic.biopotDataControl)
}
AsyncButton("Read Data Acquisition", state: $viewState) {
try biopot.readBiopot(characteristic: BiopotDevice.Characteristic.biopotDataAcquisition)
}
AsyncButton("Read Sample Configuration", state: $viewState) {
try biopot.readBiopot(characteristic: BiopotDevice.Characteristic.biopotSamplingConfiguration)
}
}
}
}


Expand Down
8 changes: 6 additions & 2 deletions NAMS/NAMSAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ class NAMSAppDelegate: SpeziAppDelegate {
BluetoothService(
serviceUUID: BiopotDevice.Service.biopot,
characteristicUUIDs: [
BiopotDevice.Characteristic.biopotDeviceInfo,
BiopotDevice.Characteristic.biopotDeviceConfiguration
BiopotDevice.Characteristic.biopotDeviceConfiguration,
BiopotDevice.Characteristic.biopotDataControl,
BiopotDevice.Characteristic.biopotDataAcquisition,
BiopotDevice.Characteristic.biopotDataStream,
BiopotDevice.Characteristic.biopotSamplingConfiguration,
BiopotDevice.Characteristic.biopotDeviceInfo
]
)
])
Expand Down
9 changes: 9 additions & 0 deletions NAMS/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,18 @@
}
}
}
},
"Read Data Acquisition" : {

},
"Read Data Control" : {

},
"Read Device Configuration" : {

},
"Read Sample Configuration" : {

},
"Receive Device Info" : {

Expand Down

0 comments on commit 0fb6b89

Please sign in to comment.