payfrit-beacon-ios/PayfritBeacon/Provisioners/ProvisionError.swift
Schwifty cfa78679be feat: complete rebuild of PayfritBeacon iOS from scratch
100% fresh codebase — no legacy code carried over. Built against
the Android beacon app as the behavioral spec.

Architecture:
- App: SwiftUI @main, AppState-driven navigation, Keychain storage
- Views: LoginView (OTP + biometric), BusinessListView, ScanView (provisioning hub)
- Models: Business, ServicePoint, BeaconConfig, BeaconType, DiscoveredBeacon
- Services: APIClient (actor, async/await), BLEManager (CoreBluetooth scanner)
- Provisioners: KBeacon, DXSmart (2-step auth + flashing), BlueCharm
- Utils: UUIDFormatting, BeaconBanList, BeaconShardPool (64 shards)

Matches Android feature parity:
- 4-screen flow: Login → Business Select → Scan/Provision
- 3 beacon types with correct GATT protocols and timeouts
- Namespace allocation via beacon-sharding API
- Smart service point naming (Table N auto-increment)
- DXSmart special flow (connect → flash → user confirms → write)
- Biometric auth, dev/prod build configs, DEV banner overlay

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

30 lines
1.1 KiB
Swift

import Foundation
/// Errors during beacon provisioning
enum ProvisionError: LocalizedError {
case connectionTimeout
case serviceDiscoveryTimeout
case operationTimeout
case serviceNotFound
case characteristicNotFound
case authFailed
case notConnected
case writeFailed(String)
case saveFailed
case verifyFailed
var errorDescription: String? {
switch self {
case .connectionTimeout: return "Connection timed out"
case .serviceDiscoveryTimeout: return "Service discovery timed out"
case .operationTimeout: return "Operation timed out"
case .serviceNotFound: return "GATT service not found"
case .characteristicNotFound: return "GATT characteristic not found"
case .authFailed: return "Beacon authentication failed"
case .notConnected: return "Not connected to beacon"
case .writeFailed(let msg): return "Write failed: \(msg)"
case .saveFailed: return "Failed to save config to flash"
case .verifyFailed: return "Beacon broadcast verification failed"
}
}
}