Merge pull request #1291 from dborup/main

Add TracerouteIntent for iOS Shortcuts integration
This commit is contained in:
Garth Vander Houwen 2025-06-28 09:43:40 -07:00 committed by GitHub
commit dd7b5f626d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,27 @@
import Foundation
import AppIntents
struct TracerouteIntent: AppIntent {
static var title: LocalizedStringResource = "Send a Traceroute"
static var description: IntentDescription = "Send a traceroute request to a certain Meshtastic node"
@Parameter(title: "Node Number")
var nodeNumber: Int
static var parameterSummary: some ParameterSummary {
Summary("Send traceroute to \(\.$nodeNumber)")
}
func perform() async throws -> some IntentResult {
if !BLEManager.shared.isConnected {
throw AppIntentErrors.AppIntentError.notConnected
}
if !BLEManager.shared.sendTraceRouteRequest(destNum: Int64(nodeNumber), wantResponse: true) {
throw AppIntentErrors.AppIntentError.message("Failed to send traceroute request")
}
return .result()
}
}