mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #791 from meshtastic/add-exchange-positions-back-to-the-node-list
Restore the Exchange Positions and TraceRoute button back to the node list context menu
This commit is contained in:
commit
e0640143df
2 changed files with 17 additions and 3 deletions
|
|
@ -1217,9 +1217,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
}
|
||||
|
||||
public func sendPosition(channel: Int32, destNum: Int64, wantResponse: Bool) -> Bool {
|
||||
var success = false
|
||||
let fromNodeNum = connectedPeripheral.num
|
||||
guard let positionPacket = getPositionFromPhoneGPS(destNum: destNum) else {
|
||||
Logger.services.error("Unable to get position data from device GPS to send to node")
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -1234,6 +1234,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
dataMessage.wantResponse = wantResponse
|
||||
meshPacket.decoded = dataMessage
|
||||
} else {
|
||||
Logger.services.error("Failed to serialize position packet data")
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -1241,15 +1242,19 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate
|
|||
toRadio = ToRadio()
|
||||
toRadio.packet = meshPacket
|
||||
guard let binaryData: Data = try? toRadio.serializedData() else {
|
||||
Logger.services.error("Failed to serialize position packet")
|
||||
return false
|
||||
}
|
||||
if connectedPeripheral?.peripheral.state ?? CBPeripheralState.disconnected == CBPeripheralState.connected {
|
||||
connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse)
|
||||
success = true
|
||||
|
||||
let logString = String.localizedStringWithFormat("mesh.log.sharelocation %@".localized, String(fromNodeNum))
|
||||
Logger.services.debug("📍 \(logString)")
|
||||
return true
|
||||
} else {
|
||||
Logger.services.error("Device no longer connected. Unable to send position information.")
|
||||
return false
|
||||
}
|
||||
return success
|
||||
}
|
||||
@objc func positionTimerFired(timer: Timer) {
|
||||
// Check for connected node
|
||||
|
|
|
|||
|
|
@ -68,7 +68,16 @@ struct NodeList: View {
|
|||
user: user
|
||||
)
|
||||
}
|
||||
|
||||
if let connectedNode {
|
||||
ExchangePositionsButton(
|
||||
bleManager: bleManager,
|
||||
node: node
|
||||
)
|
||||
TraceRouteButton(
|
||||
bleManager: bleManager,
|
||||
node: node
|
||||
)
|
||||
DeleteNodeButton(
|
||||
bleManager: bleManager,
|
||||
context: context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue