Compare commits

..

No commits in common. "640bc32f9294f89f827b4c9d8a51b63b053d1a0b" and "ce81a1a3d8a7223b8c2eee165704e9f008b23d5a" have entirely different histories.

3 changed files with 7 additions and 11 deletions

View file

@ -174,12 +174,9 @@ final class DXSmartProvisioner: NSObject, BeaconProvisioner {
await diagnosticLog?.log("write", "[\(index + 1)/\(commands.count)] \(name) (\(packet.count) bytes)")
// SaveConfig (last command) causes beacon MCU to reboot it never sends an ACK.
// Use .withoutResponse so CoreBluetooth fires the bytes immediately into the
// BLE radio buffer without waiting for a GATT round-trip. With .withResponse,
// the beacon reboots before the ACK arrives, and CoreBluetooth may silently
// drop the write leaving the config unsaved and the beacon still flashing.
// Fire the BLE write and return immediately; the disconnect is expected.
if name == "SaveConfig" {
peripheral.writeValue(packet, for: writeChar, type: .withoutResponse)
peripheral.writeValue(packet, for: writeChar, type: .withResponse)
await diagnosticLog?.log("write", "✅ [\(index + 1)/\(commands.count)] SaveConfig sent — beacon will reboot")
await diagnosticLog?.log("write", "✅ All commands written successfully")
return

View file

@ -220,7 +220,7 @@ actor APIClient {
uuid: String,
major: Int,
minor: Int,
hardwareId: String,
macAddress: String?,
beaconType: String,
token: String
) async throws {
@ -230,9 +230,9 @@ actor APIClient {
"UUID": uuid,
"Major": major,
"Minor": minor,
"HardwareId": hardwareId,
"BeaconType": beaconType
]
if let mac = macAddress { body["MacAddress"] = mac }
let data = try await post(path: "/beacon-sharding/register_beacon_hardware.php", body: body, token: token, businessId: businessId)
let resp = try JSONDecoder().decode(OKResponse.self, from: data)
guard resp.OK else {
@ -241,13 +241,12 @@ actor APIClient {
}
func verifyBeaconBroadcast(
hardwareId: String,
uuid: String,
major: Int,
minor: Int,
token: String
) async throws {
let body: [String: Any] = ["HardwareId": hardwareId, "UUID": uuid, "Major": major, "Minor": minor]
let body: [String: Any] = ["UUID": uuid, "Major": major, "Minor": minor]
let data = try await post(path: "/beacon-sharding/verify_beacon_broadcast.php", body: body, token: token)
let resp = try JSONDecoder().decode(OKResponse.self, from: data)
guard resp.OK else {

View file

@ -706,7 +706,7 @@ struct ScanView: View {
uuid: ns.uuid,
major: ns.major,
minor: Int(config.minor),
hardwareId: selectedBeacon?.id.uuidString ?? "unknown-ios",
macAddress: nil,
beaconType: BeaconType.dxsmart.rawValue,
token: token
)
@ -739,7 +739,7 @@ struct ScanView: View {
uuid: ns.uuid,
major: ns.major,
minor: Int(config.minor),
hardwareId: selectedBeacon?.id.uuidString ?? "unknown-ios",
macAddress: nil,
beaconType: selectedBeacon?.type.rawValue ?? "Unknown",
token: token
)