feat: read-only getDevices() to list paired glasses#12
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a read-only
MetaWearablesDat.getDevices()returningList<WearableDevice>so apps can enumerate the paired glasses, tell two pairs of the same model apart (byname/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 onid) will follow.What's included
WearableDevice+WearableDeviceType/WearableLinkState/WearableCompatibilityenums (tolerantfromMap, non-emptyidrequired); facade, platform interface, method-channel decode.getDevicesoverWearables.shared.devices+deviceForIdentifier(complete fallback on nil); canonical codes with@unknown defaulton the non-frozenDeviceType/Compatibility.getDevicesoverWearables.devices/devicesMetadatawith aNOT_INITIALIZEDguard;sessionDeviceIdcaptured beforecreateSessionand cleared on teardown.PairedDevicesSheet+ Devices FAB (visible while streaming); providerrefreshDevices()with coalescing, name/id sort, and refresh on active-device + session-state transitions.fromMap, enum fallbacks, channel decode incl.null→[]andPlatformException, facade delegation).0.6.0, README, AGENTS.Key design notes
isActive(the auto-selector's current pick — what a new stream would bind to) is distinct fromisStreamingDevice(the pair the live stream is using). They can differ with 2+ connected pairs, and the device session outlives the camera stream — soisStreamingDevicereads the actualStream.state == streamingrather than a possibly-stale non-null reference.id(DeviceIdentifier) is the canonical identifier and the future pinning key; nodeviceUUIDis exposed (it's iOS-only and not the selection key).Verification
dart analyzeclean; 16 Dart unit tests pass.flutter build apk✓ andflutter build ios --no-codesign✓.Release note
Core is bumped to
0.6.0; theflutter_meta_wearables_dat_mock_deviceadd-on is still at0.5.3— align it at release time. Step 2 (device pinning) can fold into the same unreleased0.6.0.🤖 Generated with Claude Code