Repository navigation
Lights 1: fixtures foundation, Worker sync, BLE link and pairing (#208) - #264
Merged
Merged
Conversation
Shared fixture kinds and capabilities in packages/vocab/src/lighting.ts. Migration 0027 adds fixtures and mesh_networks (no key material); /api/fixtures and /api/mesh-networks follow the rigs' upsert and workspace rules, with strict kind, address and mesh checks. Both are in the tenancy map and the test world; fixtures.test.ts covers the rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one (#208) Adds the Bluetooth library (@sfourdrinier/react-native-ble-plx 3.9.3, config plugin with scanning marked as never used for location) behind src/ble/link.ts. src/fixtures holds the driver seams (Link, Driver, Session), a per-link command queue with latest-wins coalescing, and a React-Native-free connection manager with leases, grace period, backoff and background suspend, all unit-tested with a fake link and fake timers. The fixture list syncs like the rigs and on every flush. Setup gains Lights: list, scan and pair, edit, and a light's screen showing its connection. No driver yet, so nothing can be controlled. Docs: features/lights.md, phone app, testing, known issues. The mobile test script now runs src/**/*.test.ts. Co-Authored-By: Claude Opus 5.5 <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.
Closes #208. Part of the Lights epic #206.
Everything the lights need that does not depend on a fixture protocol: shared kinds, the server side, the Bluetooth library, the connection manager, the synced list and the screens. No driver yet, so nothing can be controlled; a light's screen says so. The first driver is #209 (NEEWER), which needs the snoop log from #207.
What changed
Shared (
packages/vocab/src/lighting.ts):FIXTURE_KINDS(FS230B, FS300B, PS099S, Aputure MC) with transport, driver id and capabilities;CURVES;LightState; address and limit helpers.Worker
0027_fixtures.sql(additive):fixtures,mesh_networks. No key material.src/fixtures.ts:GET/PUT/DELETE /api/fixtures[/:id]and/api/mesh-networks[/:id], rigs' upsert and workspace rules. Strict checks: known kind, address format, mesh fields only on a mesh kind and only with a network of the same workspace (another workspace's network answers 400 like a missing one), one unicast address per network (409). Deleting a network leaves its fixtures, unprovisioned.fixture,mesh_network; all six routes in the tenancy map, a fixture and network in the test world, four reference cases;fixtures.test.tsfor the rules.Phone
@sfourdrinier/react-native-ble-plx3.9.3 (pinned; published 2026-07-28, MIT, no install script) with its config plugin: no background mode, scanning declared as never used for location. Needs a new dev build.src/ble/link.tsis the only user of the library;src/ble/permissions.tsasks for Nearby devices (Android 12+) or location (older).src/fixtures/: driver seams (Link,Driver,Session),queue.ts(one write at a time per connection, newer command of the same op replaces a queued one and moves to the back),hubCore.ts(leases per screen or sequence, 2 s grace, backoff 1/2/5/15/30 s, close in the background and reopen on return),registry.ts(empty driver table, model guess from the scan),library.ts(synced like rigs, also on every flush).Decisions
src/**/*.test.ts, so tests in subfolders run.Checked
make check: lint, typecheck, all unit and route tests (121 in fixtures + tenancy), build dry runs, Expo export. Green.expo prebuildonce locally: the manifest keeps the app's unconditional location permission; the plugin's extra location entries are capped at Android 11. The generated folder was removed.curl: network, MC on it, refused FS230B with mesh fields, list, network delete leaves the fixture unprovisioned, delete.Not clicked through
Nothing ran on a phone: the permission prompt, scanning, pairing, the list sync and GPS still working after the manifest change. Listed in
docs/known-issues.md. Migration 0027 is not applied remotely.🤖 Generated with Claude Code