mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
refactor: Add BlePodSnapshot and BlePodMonitor type aliases
Introduce type aliases for the planned rename (PodDevice -> BlePodSnapshot, PodMonitor -> BlePodMonitor). New code uses the aliases to clarify BLE-specific types vs the unified MonitoredDevice facade. Full codebase rename deferred to IDE refactoring pass (103 files, 470 occurrences).
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
package eu.darken.capod.monitor.core
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type alias for the BLE scan pipeline.
|
||||||
|
*
|
||||||
|
* The [PodMonitor] class handles BLE advertisement scanning and device detection.
|
||||||
|
* New code should use [BlePodMonitor] to clarify that this is the BLE-only monitor,
|
||||||
|
* not the unified merge point ([DeviceMonitor]).
|
||||||
|
*
|
||||||
|
* Full rename deferred to IDE refactoring pass.
|
||||||
|
*/
|
||||||
|
typealias BlePodMonitor = PodMonitor
|
||||||
@@ -7,19 +7,17 @@ import javax.inject.Inject
|
|||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single merge point: combines BLE scan data ([PodMonitor]) with AAP connection data
|
* Single merge point: combines BLE scan data ([BlePodMonitor]) with AAP connection data
|
||||||
* ([AapConnectionManager]) into unified [MonitoredDevice] objects.
|
* ([AapConnectionManager]) into unified [MonitoredDevice] objects.
|
||||||
*
|
*
|
||||||
* ViewModels should observe [devices] instead of accessing PodMonitor directly.
|
* ViewModels should observe [devices] instead of accessing BlePodMonitor directly.
|
||||||
*
|
|
||||||
* TODO: Rename to PodMonitor once old PodMonitor is renamed to BlePodMonitor.
|
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
class DeviceMonitor @Inject constructor(
|
class DeviceMonitor @Inject constructor(
|
||||||
private val podMonitor: PodMonitor,
|
private val blePodMonitor: BlePodMonitor,
|
||||||
private val aapManager: AapConnectionManager,
|
private val aapManager: AapConnectionManager,
|
||||||
) {
|
) {
|
||||||
val devices: Flow<List<MonitoredDevice>> = podMonitor.devices
|
val devices: Flow<List<MonitoredDevice>> = blePodMonitor.devices
|
||||||
.combine(aapManager.allStates) { pods, aapStates ->
|
.combine(aapManager.allStates) { pods, aapStates ->
|
||||||
pods.map { pod ->
|
pods.map { pod ->
|
||||||
MonitoredDevice(
|
MonitoredDevice(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package eu.darken.capod.monitor.core
|
package eu.darken.capod.monitor.core
|
||||||
|
|
||||||
import eu.darken.capod.common.bluetooth.BluetoothAddress
|
import eu.darken.capod.common.bluetooth.BluetoothAddress
|
||||||
|
import eu.darken.capod.pods.core.BlePodSnapshot
|
||||||
import eu.darken.capod.pods.core.DualPodDevice
|
import eu.darken.capod.pods.core.DualPodDevice
|
||||||
import eu.darken.capod.pods.core.HasCase
|
import eu.darken.capod.pods.core.HasCase
|
||||||
import eu.darken.capod.pods.core.HasEarDetectionDual
|
import eu.darken.capod.pods.core.HasEarDetectionDual
|
||||||
@@ -14,11 +15,9 @@ import eu.darken.capod.pods.core.apple.protocol.aap.AapSetting
|
|||||||
* Unified device facade combining BLE scan data and AAP connection data.
|
* Unified device facade combining BLE scan data and AAP connection data.
|
||||||
* All properties are dynamically resolved from the best available source.
|
* All properties are dynamically resolved from the best available source.
|
||||||
* Consumers don't need to know whether data came from BLE or AAP.
|
* Consumers don't need to know whether data came from BLE or AAP.
|
||||||
*
|
|
||||||
* TODO: Rename to PodDevice once old PodDevice interface is renamed to BlePodSnapshot.
|
|
||||||
*/
|
*/
|
||||||
data class MonitoredDevice(
|
data class MonitoredDevice(
|
||||||
internal val ble: PodDevice?,
|
internal val ble: BlePodSnapshot?,
|
||||||
internal val aap: AapPodState?,
|
internal val aap: AapPodState?,
|
||||||
) {
|
) {
|
||||||
// Identity
|
// Identity
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package eu.darken.capod.pods.core
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type alias for the BLE-sourced device snapshot.
|
||||||
|
*
|
||||||
|
* The [PodDevice] interface represents BLE scan data (battery, ear detection, case state)
|
||||||
|
* extracted from Apple Continuity Protocol advertisements.
|
||||||
|
*
|
||||||
|
* New code should use [BlePodSnapshot] to clarify that this is the BLE data source,
|
||||||
|
* not the unified facade ([eu.darken.capod.monitor.core.MonitoredDevice]).
|
||||||
|
*
|
||||||
|
* Full rename of [PodDevice] → [BlePodSnapshot] across the codebase is deferred to
|
||||||
|
* an IDE refactoring pass (103 files, 470 occurrences).
|
||||||
|
*/
|
||||||
|
typealias BlePodSnapshot = PodDevice
|
||||||
Reference in New Issue
Block a user