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>
34 lines
932 B
Swift
34 lines
932 B
Swift
import Foundation
|
|
|
|
/// Configuration to write to a physical beacon
|
|
struct BeaconConfig {
|
|
let uuid: String // 32 hex chars, no dashes
|
|
let major: UInt16
|
|
let minor: UInt16
|
|
let measuredPower: Int8 // RSSI @ 1m, typically -100
|
|
let advInterval: UInt16 // in units of 100ms (2 = 200ms)
|
|
let txPower: UInt8 // 0-7
|
|
let servicePointName: String
|
|
let businessName: String
|
|
|
|
/// UUID formatted with dashes (8-4-4-4-12)
|
|
var formattedUUID: String { uuid.uuidWithDashes }
|
|
|
|
static let defaultMeasuredPower: Int8 = -100
|
|
static let defaultAdvInterval: UInt16 = 2
|
|
static let defaultTxPower: UInt8 = 1
|
|
}
|
|
|
|
/// Result from provisioning a beacon
|
|
struct ProvisionResult {
|
|
let success: Bool
|
|
let message: String
|
|
let config: BeaconConfig?
|
|
}
|
|
|
|
/// Result from verifying a beacon broadcast
|
|
struct VerifyResult {
|
|
let found: Bool
|
|
let rssi: Int?
|
|
let message: String
|
|
}
|