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 shared across provisioner types enum GATTConstants { // FFE0 service (KBeacon, DXSmart) 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") // FFF0 service (BlueCharm) static let fff0Service = CBUUID(string: "0000FFF0-0000-1000-8000-00805F9B34FB") static let fea0Service = CBUUID(string: "0000FEA0-0000-1000-8000-00805F9B34FB") // CCCD for enabling notifications static let cccd = CBUUID(string: "00002902-0000-1000-8000-00805F9B34FB") // Timeouts (matching Android) static let connectionTimeout: TimeInterval = 10.0 // Increased from 5s — BLE connections can be slow static let operationTimeout: TimeInterval = 5.0 static let maxRetries = 3 static let retryDelay: TimeInterval = 1.0 static let postFlashDelay: TimeInterval = 3.0 }