A simple heart rate monitor
Go to file
Greg Pomerantz 689990639d Migrate to gioui.org v0.10.2; fix Android BLE flow, rendering, and circle.
Main changes:
- go.mod: gioui.org v0.10.2, go 1.24, git.wow.st/gmp/ble
  e53c7be (commitNowAllowingStateLoss + BLUETOOTH_SCAN/CONNECT
  permission request from BlessedConnect.onAttach).
- main.go: ported to the v0.10 API (app.Main + single-goroutine
  event loop, app.FrameEvent.Frame, material.* styles, op.Offset/
  Affine, clip.Path for the circle).
- On-demand rendering: no fixed 30 FPS ticker redraws. Frames are
  produced by Bluetooth events and input; 30 FPS only while the live
  stopwatch runs. The worker goroutine only polls the runtime
  permission (while a scan is pending) and starts the deferred scan.
- widget.Clickable.Clicked must be called before Layout in v0.10:
  the Clickable consumes its click events during Layout.
- circleClip: the clip.Path.Cube control points are relative to the
  pen; the second control point of each segment must be at (k-r),
  not (k). The old code drew a distorted, non-circular shape.
- Android: perm_android.go pins a worker goroutine to one OS thread
  attached to the JVM for the life of the app (repeated
  attach/detach stack-overflows ART); the BLE view handle and scan
  permission state are shared with the render loop under bleMu.
- os_android.go: AndroidViewEvent attach handling; os_others.go:
  no-op stubs for other platforms.

New:
- scripts/build.sh: gogio -> apktool decode -> inject
  BLUETOOTH_SCAN/BLUETOOTH_CONNECT into the manifest -> rebuild ->
  debug-sign -> install. Usage: ./scripts/build.sh [phone|emu]
  [--no-install].
- .gitignore: .DS_Store, *.idsig.
2026-08-22 07:50:05 -04:00
depjars Restructure to add depjars directory so that I can cause go to 2019-12-13 14:24:31 -05:00
fastlane/metadata/android/en-US Add fastlane/ metadata for F-Droid. 2020-01-06 17:07:38 -05:00
hrm Migrate to gioui.org v0.10.2; fix Android BLE flow, rendering, and circle. 2026-08-22 07:50:05 -04:00
scripts Migrate to gioui.org v0.10.2; fix Android BLE flow, rendering, and circle. 2026-08-22 07:50:05 -04:00
.gitignore Migrate to gioui.org v0.10.2; fix Android BLE flow, rendering, and circle. 2026-08-22 07:50:05 -04:00
LICENSE Add appicon.png and license information. 2019-12-11 09:59:19 -05:00
README.md Doc updates. 2019-12-16 08:56:32 -05:00

HRM

An example heart rate monitor app for Android and MacOS using git.wow.st/gmp/ble and Gio.

The MacOS implementation uses a Core Bluetooth binding created by NSWrap. On Android, Martijn van Welie's Blessed library is used to simplify access to the Bluetooth Low-Energy hardware.

MacOS:

git clone https://git.wow.st/gmp/hrm
cd hrm/hrm
go build
./hrm

Android:

The gogio command from gioui.org/cmd/gogio must be installed to build an Android APK.

git clone https://git.wow.st/gmp/hrm
cd hrm/hrm
gogio -target android .
adb install -r hrm.apk

The compiled Java code for the Android implementation is pre-packaged in jar files. If you want to, you can re-compile these dependencies by running go generate from the depjars directory. You will need to have gradle, an Android SDK, and who knows what else installed on your machine.