Skip to content

BLE Integration with TestFlight #109

@samuelbaldwin05

Description

@samuelbaldwin05
  1. Capacitor Setup

In frontend/:
bun add @capacitor/core @capacitor/cli @capacitor/ios @capacitor-community/bluetooth-le
bunx cap init
bunx cap add ios
bunx cap sync

Add to ios/App/App/Info.plist:
NSBluetoothAlwaysUsageDescription
Required to connect to force plate sensors

Verify the existing app loads in the iOS simulator before touching anything else:
bunx cap open ios


  1. RecordRunPage.tsx Changes

The timer is missing functionality to actually get data from the device.

  • On "Start": scan for the force plate via @capacitor-community/bluetooth-le, connect, and begin buffering incoming Time, Force_Foot1, Force_Foot2 rows. Record start_time.
  • Mid-recording disconnect: if the device drops out of range, keep buffering timestamp and continue the UI as normal do not stop the recording.
  • On "Stop": record stop_time, stop buffering.
  • On reconnect after stop: when the device comes back in range, receive the remaining buffered data from the shoe sensor
  • On "Save": truncate the full data buffer to only rows within [start_time, stop_time], convert to CSV, and POST to POST /csv/upload-run with athlete_id, event_type, and the CSV as
    multipart/form-data.
  • Additionally, if the device is not Bluetooth compatible, do even allow a user to start a run, instead just show a message that is like download StrideTrack on the appstore or something idk.

  1. Python Mock BLE Peripheral

Create data/mock_ble_client.py.

Uses bless to mock BLE
uvinstall bless

The script should run through this scenario in sequence:

  1. Advertise as the shoe sensor and wait for the app to connect
  2. Stream mock Time, Force_Foot1, Force_Foot2 rows at ~100hz
  3. After a few seconds, simulate going out of range and disconnect device
  4. 20 seconds after run is stopped, reconnect and resume streaming (simulates athlete walking back)
  5. When the stop button is pressed we should stop streaming and backfill remaining data. If stop button was pressed before reconnect we should stop streaming once connected.

This should work with any mock data file we have with the single csv sensor set up.


Tasks

  • Capacitor setup, verify app loads in iOS simulator
  • Update RecordRunPage.tsx with BLE connect/buffer/truncate/upload flow
  • Write data/mock_ble_client.py and verify the full scenario end-to-end against it
  • Build and upload to TestFlight via Xcode

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions