Extract KnownDeviceRegistry, use it in all device factories#95
Conversation
Centralizes the previously duplicated known-device lookup/creation/persist logic (found in SlvCtrlPlusDeviceFactory, ButtplugIoDeviceFactory, AiroticDeviceProvider and Zc95DeviceFactory) into a single shared KnownDeviceRegistry, and skips the settings.json write/broadcast when persisting an already-known, unchanged identity. Estim2bDeviceFactory now resolves an identity through the registry too (for a stable, human-readable device name during a single connection) but never persists it, since the estim2b transport has no way to derive a deterministic device id, unlike zc95 (firmware-reported serial no.) or slvCtrlPlus/Airotic/ Buttplug.io.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughA shared ChangesKnown device registry integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant DeviceProvider
participant DeviceFactory
participant KnownDeviceRegistry
participant Settings
DeviceProvider->>KnownDeviceRegistry: resolve device identity
DeviceFactory->>KnownDeviceRegistry: resolve device identity
KnownDeviceRegistry->>Settings: read known-device entry
Settings-->>KnownDeviceRegistry: existing entry or none
KnownDeviceRegistry-->>DeviceFactory: resolved KnownDevice
DeviceFactory->>KnownDeviceRegistry: persist after successful creation
KnownDeviceRegistry->>Settings: add new instance when required
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Centralizes the previously duplicated known-device lookup/creation/persist logic (found in SlvCtrlPlusDeviceFactory, ButtplugIoDeviceFactory, AiroticDeviceProvider and Zc95DeviceFactory) into a single shared KnownDeviceRegistry, and skips the settings.json write/broadcast when persisting an already-known, unchanged identity.
Estim2bDeviceFactory now resolves an identity through the registry too (for a stable, human-readable device name during a single connection) but never persists it, since the estim2b transport has no way to derive a deterministic device id, unlike zc95 (firmware-reported serial no.) or slvCtrlPlus/Airotic/ Buttplug.io.
Summary by CodeRabbit
New Features
Bug Fixes
Tests