BoundDevice.swift 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import Foundation
  2. /// Represents a physical recording device bound to a user account via BLE.
  3. struct BoundDevice: Codable, Identifiable, Equatable {
  4. let id: String // Unique device hardware ID / MAC / Serial
  5. var name: String // Display name of the device
  6. var peripheralUUID: String // CoreBluetooth Peripheral UUID
  7. var boundAt: Date // Date when bound to user account
  8. var isConnected: Bool // Connection status (runtime state)
  9. var batteryLevel: Int? // Battery percentage (0 - 100)
  10. var firmwareVersion: String? // Firmware version
  11. var boundUserId: String // User account ID owning this device
  12. init(
  13. id: String = UUID().uuidString,
  14. name: String,
  15. peripheralUUID: String = UUID().uuidString,
  16. boundAt: Date = Date(),
  17. isConnected: Bool = false,
  18. batteryLevel: Int? = 85,
  19. firmwareVersion: String? = "v1.2.0",
  20. boundUserId: String
  21. ) {
  22. self.id = id
  23. self.name = name
  24. self.peripheralUUID = peripheralUUID
  25. self.boundAt = boundAt
  26. self.isConnected = isConnected
  27. self.batteryLevel = batteryLevel
  28. self.firmwareVersion = firmwareVersion
  29. self.boundUserId = boundUserId
  30. }
  31. }
  32. /// Helper structure for BLE scanning discovery results
  33. struct DiscoveredBLEDevice: Identifiable, Equatable {
  34. let id: String
  35. let name: String
  36. let rssi: Int
  37. let peripheralUUID: String
  38. }