import Foundation import CoreBluetooth /// Common protocol for all beacon provisioners protocol BeaconProvisioner { /// Connect to the beacon and authenticate func connect() async throws /// Write the full beacon configuration func writeConfig(_ config: BeaconConfig) async throws /// Disconnect from the beacon func disconnect() /// Whether we're currently connected var isConnected: Bool { get } /// Optional diagnostic log for tracing provisioning steps var diagnosticLog: ProvisionLog? { get set } /// BLE manager reference for connection callbacks var bleManager: BLEManager? { get set } } /// GATT UUIDs for CP-28 (DX-Smart) beacons /// FFE0 service with FFE1 (notify), FFE2 (write), FFE3 (password) enum GATTConstants { static let ffe0Service = CBUUID(string: "0000FFE0-0000-1000-8000-00805F9B34FB") static let ffe1Char = CBUUID(string: "0000FFE1-0000-1000-8000-00805F9B34FB") static let ffe2Char = CBUUID(string: "0000FFE2-0000-1000-8000-00805F9B34FB") static let ffe3Char = CBUUID(string: "0000FFE3-0000-1000-8000-00805F9B34FB") // CCCD for enabling notifications static let cccd = CBUUID(string: "00002902-0000-1000-8000-00805F9B34FB") // Timeouts static let connectionTimeout: TimeInterval = 10.0 static let operationTimeout: TimeInterval = 5.0 static let maxRetries = 3 static let retryDelay: TimeInterval = 1.0 static let postFlashDelay: TimeInterval = 3.0 }