Skip to content

feat: read-only getDevices() to list paired glasses#12

Merged
gdelataillade merged 3 commits into
mainfrom
feat/get-devices-api
Jun 19, 2026
Merged

feat: read-only getDevices() to list paired glasses#12
gdelataillade merged 3 commits into
mainfrom
feat/get-devices-api

Conversation

@gdelataillade

Copy link
Copy Markdown
Collaborator

Summary

Adds a read-only MetaWearablesDat.getDevices() returning List<WearableDevice> so apps can enumerate the paired glasses, tell two pairs of the same model apart (by name/id), and see which pair is actually streaming.

This is step 1 of 2 — read-only listing. Step 2 (pinning a specific pair via the SDK's SpecificDeviceSelector, keyed on id) will follow.

What's included

  • Dart: WearableDevice + WearableDeviceType / WearableLinkState / WearableCompatibility enums (tolerant fromMap, non-empty id required); facade, platform interface, method-channel decode.
  • iOS: getDevices over Wearables.shared.devices + deviceForIdentifier (complete fallback on nil); canonical codes with @unknown default on the non-frozen DeviceType/Compatibility.
  • Android: getDevices over Wearables.devices / devicesMetadata with a NOT_INITIALIZED guard; sessionDeviceId captured before createSession and cleared on teardown.
  • Example app: PairedDevicesSheet + Devices FAB (visible while streaming); provider refreshDevices() with coalescing, name/id sort, and refresh on active-device + session-state transitions.
  • Tests: the repo's first Dart unit tests (model fromMap, enum fallbacks, channel decode incl. null[] and PlatformException, facade delegation).
  • Docs: CHANGELOG 0.6.0, README, AGENTS.

Key design notes

  • isActive (the auto-selector's current pick — what a new stream would bind to) is distinct from isStreamingDevice (the pair the live stream is using). They can differ with 2+ connected pairs, and the device session outlives the camera stream — so isStreamingDevice reads the actual Stream.state == streaming rather than a possibly-stale non-null reference.
  • id (DeviceIdentifier) is the canonical identifier and the future pinning key; no deviceUUID is exposed (it's iOS-only and not the selection key).
  • Canonical lowerCamelCase codes are emitted identically on iOS and Android.

Verification

  • dart analyze clean; 16 Dart unit tests pass.
  • flutter build apk ✓ and flutter build ios --no-codesign ✓.

Release note

Core is bumped to 0.6.0; the flutter_meta_wearables_dat_mock_device add-on is still at 0.5.3 — align it at release time. Step 2 (device pinning) can fold into the same unreleased 0.6.0.

🤖 Generated with Claude Code

gdelataillade and others added 2 commits June 18, 2026 15:53
Adds MetaWearablesDat.getDevices() returning List<WearableDevice> so apps
can enumerate paired Ray-Ban Meta / Oakley devices, tell two pairs of the
same model apart (by name/id), and see which pair is actually streaming
(isStreamingDevice) vs the auto-selector's current pick (isActive).

- Dart: WearableDevice model + WearableDeviceType / WearableLinkState /
  WearableCompatibility enums (tolerant fromMap, non-empty id required);
  facade, platform interface, and method-channel decode.
- iOS: getDevices over Wearables.shared.devices + deviceForIdentifier
  (complete fallback on nil), canonical codes (@unknown default on the
  non-frozen DeviceType/Compatibility); isStreamingDevice gated on
  Stream.state == .streaming, not a stale reference.
- Android: getDevices over Wearables.devices / devicesMetadata with a
  NOT_INITIALIZED guard; sessionDeviceId captured before createSession
  and cleared on teardown; isStreamingDevice gated on Stream.state ==
  STREAMING.
- Example: PairedDevicesSheet + Devices FAB (visible while streaming);
  provider refreshDevices() with coalescing, name/id sort, and refresh
  on active-device and session-state transitions.
- Tests: first Dart unit tests (model fromMap, enum fallbacks, channel
  decode incl. null->[] and PlatformException, facade delegation).
- Docs: CHANGELOG 0.6.0, README, AGENTS; pubspec bumped to 0.6.0.

Read-only; device pinning (SpecificDeviceSelector via id) to follow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Adopt the Settings-sheet chrome: fixed-height SizedBox (90% screen),
  centered headlineSmall title, theme colorScheme colors instead of
  hardcoded white cards.
- Tiles now show the model (device.type) as the title and the device
  name as the subtitle, per request.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The core and mock-device packages release in lockstep; core was bumped to
0.6.0 for the read-only getDevices() addition, so align the mock add-on to
satisfy the versions-in-sync CI gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gdelataillade gdelataillade merged commit 0736aa7 into main Jun 19, 2026
9 checks passed
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.

1 participant