payfrit-beacon-ios/PayfritBeacon/Provisioners/ProvisionerProtocol.swift
Schwifty 6965fe4ca8 refactor: strip all non-CP-28 beacon code
Remove BlueCharmProvisioner, KBeaconProvisioner, and FallbackProvisioner.
Simplify BeaconType enum to DX-Smart only. Simplify BLE detection to only
show CP-28 beacons. Remove multi-type provisioner factory from ScanView.

-989 lines of dead code removed. Other beacon types will be re-added
when we start using different hardware.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 02:55:22 +00:00

42 lines
1.5 KiB
Swift

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
}