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

EEG Device Pairing #19

Merged
merged 39 commits into from
Oct 23, 2023
Merged

EEG Device Pairing #19

merged 39 commits into from
Oct 23, 2023

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Sep 15, 2023

EEG Device Pairing

♻️ Current situation & Problem

As of right now the app doesn't integrate any EEG devices to connect to and perform EEG measurements.

💡 Proposed solution

This PR adds an initial version of integration with Muse EEG devices for pairing. Particularly we add a Nearby Devices view to discovery and pair with nearby Muse EEG headbands and view the device details of a currently connected headband.
Additionally, we add a very basic view to explore the live EEG measurement stream of the currently connected Muse headband.

Below are some visual illustrations of the new functionality:

Nearby Devices Screen. One device connected. Detailed Information of the currently paired headband. EEG Recording screen show four separate charts for all four electrodes of the Muse Headband.

The Muse SDK is available as invite only (see here). Therefore, the SDK itself is pulled in as a git submodule.

As the SDK only compiles for iOS and not for the iOS simulator, the Xcode project adds a new NAMS Muse target. The NAMS target uses a Mock Device Layer for previewing and testing while NAMS Muse includes the live Muse SDK used to deploy the app.

⚙️ Release Notes

  • Integrate Muse EEG Headband devices

➕ Additional Information

Related PRs

--

Testing

Unit tests were added based on the mock device implementation. The Muse code cannot be tested in the CI setup as of right now.

Reviewer Nudging

It might make sense to visually navigate the new UI and, from that point, review the device layer implementation. It makes sense to review the device layer in conjunction with the Muse SDK implementation as this was one of the driving factors for the thin abstraction layer.

Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

Merging #19 (059076e) into main (3508c6c) will increase coverage by 2.47%.
The diff coverage is 82.93%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   78.82%   81.29%   +2.47%     
==========================================
  Files          28       49      +21     
  Lines         708     1608     +900     
==========================================
+ Hits          558     1307     +749     
- Misses        150      301     +151     
Files Coverage Δ
NAMS/Bluetooth/BluetoothManager.swift 100.00% <100.00%> (ø)
NAMS/EEG/EEGChannelMark.swift 100.00% <100.00%> (ø)
NAMS/EEG/EEGDeviceList.swift 100.00% <100.00%> (ø)
NAMS/EEG/ListRow.swift 100.00% <100.00%> (ø)
NAMS/EEG/Recording/EEGFrequency.swift 100.00% <100.00%> (ø)
NAMS/EEG/Recording/EEGReading.swift 100.00% <100.00%> (ø)
NAMS/Schedule/ModalView.swift 0.00% <ø> (ø)
NAMS/EEG/Mock/MockDeviceManager.swift 96.16% <96.16%> (ø)
NAMS/Schedule/NAMSTaskContext.swift 43.75% <66.67%> (ø)
NAMS/Schedule/ScheduleView.swift 91.59% <97.15%> (+5.88%) ⬆️
... and 14 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3508c6c...059076e. Read the comment docs.

@PSchmiedmayer
Copy link
Member

@Supereg As discussed in the last meeting: I took a look at the fastlane setup and changed it so the test are run on the main target while releases are created using the Muse target. Also updated some other elements in the scheme to allow testing for the different schemes using the test plan.

I have seen some failing builds due to the settings app crashing in the simulator and just restarted our VM that host the builds here. Hope this will fix this.

@PSchmiedmayer
Copy link
Member

@Supereg Let me know if you continuously run into build errors due to our build agents.

@Supereg
Copy link
Member Author

Supereg commented Oct 16, 2023

@Supereg Let me know if you continuously run into build errors due to our build agents.

Seems like there were some issues with the Schemes. Xcode seemingly changed them itself? Or I messed up? Whatever, it works now. And I disabled CodeQL as the PR bumps the deployment target to iOS 17 due to new API usage (see StanfordSpezi/SpeziTemplateApplication#43).

@Supereg
Copy link
Member Author

Supereg commented Oct 17, 2023

@PSchmiedmayer I'm fighting a bit with code coverage right now. It seems like codecov suddenly counts all previews as "Not covered" where they previously were seemingly excluded from code coverage. Do you have any experience or ideas where this might stem from?
Apart from that, I would propose to ignore any decrease that comes from the not-covered Muse code.

EDIT: it doesn't seem like CodeCov doesn't pick up any of the code coverage of the added tests 🙈

EDIT: Resolved.

@Supereg Supereg marked this pull request as ready for review October 17, 2023 07:04
.github/workflows/beta-deployment.yml Outdated Show resolved Hide resolved
fastlane/Fastfile Outdated Show resolved Hide resolved
@Supereg Supereg merged commit e7e2c04 into main Oct 23, 2023
6 checks passed
@Supereg Supereg deleted the feature/eeg-device-pairing branch October 23, 2023 21:58
@PSchmiedmayer
Copy link
Member

Nice job @Supereg! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants