Compare commits
No commits in common. "640bc32f9294f89f827b4c9d8a51b63b053d1a0b" and "ce81a1a3d8a7223b8c2eee165704e9f008b23d5a" have entirely different histories.
640bc32f92
...
ce81a1a3d8
3 changed files with 7 additions and 11 deletions
|
|
@ -174,12 +174,9 @@ final class DXSmartProvisioner: NSObject, BeaconProvisioner {
|
||||||
await diagnosticLog?.log("write", "[\(index + 1)/\(commands.count)] \(name) (\(packet.count) bytes)")
|
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.
|
// SaveConfig (last command) causes beacon MCU to reboot — it never sends an ACK.
|
||||||
// Use .withoutResponse so CoreBluetooth fires the bytes immediately into the
|
// Fire the BLE write and return immediately; the disconnect is expected.
|
||||||
// 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.
|
|
||||||
if name == "SaveConfig" {
|
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", "✅ [\(index + 1)/\(commands.count)] SaveConfig sent — beacon will reboot")
|
||||||
await diagnosticLog?.log("write", "✅ All commands written successfully")
|
await diagnosticLog?.log("write", "✅ All commands written successfully")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ actor APIClient {
|
||||||
uuid: String,
|
uuid: String,
|
||||||
major: Int,
|
major: Int,
|
||||||
minor: Int,
|
minor: Int,
|
||||||
hardwareId: String,
|
macAddress: String?,
|
||||||
beaconType: String,
|
beaconType: String,
|
||||||
token: String
|
token: String
|
||||||
) async throws {
|
) async throws {
|
||||||
|
|
@ -230,9 +230,9 @@ actor APIClient {
|
||||||
"UUID": uuid,
|
"UUID": uuid,
|
||||||
"Major": major,
|
"Major": major,
|
||||||
"Minor": minor,
|
"Minor": minor,
|
||||||
"HardwareId": hardwareId,
|
|
||||||
"BeaconType": beaconType
|
"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 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)
|
let resp = try JSONDecoder().decode(OKResponse.self, from: data)
|
||||||
guard resp.OK else {
|
guard resp.OK else {
|
||||||
|
|
@ -241,13 +241,12 @@ actor APIClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyBeaconBroadcast(
|
func verifyBeaconBroadcast(
|
||||||
hardwareId: String,
|
|
||||||
uuid: String,
|
uuid: String,
|
||||||
major: Int,
|
major: Int,
|
||||||
minor: Int,
|
minor: Int,
|
||||||
token: String
|
token: String
|
||||||
) async throws {
|
) 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 data = try await post(path: "/beacon-sharding/verify_beacon_broadcast.php", body: body, token: token)
|
||||||
let resp = try JSONDecoder().decode(OKResponse.self, from: data)
|
let resp = try JSONDecoder().decode(OKResponse.self, from: data)
|
||||||
guard resp.OK else {
|
guard resp.OK else {
|
||||||
|
|
|
||||||
|
|
@ -706,7 +706,7 @@ struct ScanView: View {
|
||||||
uuid: ns.uuid,
|
uuid: ns.uuid,
|
||||||
major: ns.major,
|
major: ns.major,
|
||||||
minor: Int(config.minor),
|
minor: Int(config.minor),
|
||||||
hardwareId: selectedBeacon?.id.uuidString ?? "unknown-ios",
|
macAddress: nil,
|
||||||
beaconType: BeaconType.dxsmart.rawValue,
|
beaconType: BeaconType.dxsmart.rawValue,
|
||||||
token: token
|
token: token
|
||||||
)
|
)
|
||||||
|
|
@ -739,7 +739,7 @@ struct ScanView: View {
|
||||||
uuid: ns.uuid,
|
uuid: ns.uuid,
|
||||||
major: ns.major,
|
major: ns.major,
|
||||||
minor: Int(config.minor),
|
minor: Int(config.minor),
|
||||||
hardwareId: selectedBeacon?.id.uuidString ?? "unknown-ios",
|
macAddress: nil,
|
||||||
beaconType: selectedBeacon?.type.rawValue ?? "Unknown",
|
beaconType: selectedBeacon?.type.rawValue ?? "Unknown",
|
||||||
token: token
|
token: token
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue