mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Add TracerouteIntent for iOS Shortcuts integration
This commit adds a new AppIntent called TracerouteIntent, allowing users to send a traceroute request to a specific Meshtastic node directly via iOS Shortcuts or Siri. The intent calls BLEManager.shared.sendTraceRouteRequest(destNum:wantResponse:) and provides basic validation to ensure the device is connected. No other files or logic were modified. This follows the same structural pattern as MessageNodeIntent.swift.
This commit is contained in:
parent
0f4728cdf3
commit
aa73a82404
1 changed files with 27 additions and 0 deletions
27
Meshtastic/AppIntents/TracerouteIntent.swift
Normal file
27
Meshtastic/AppIntents/TracerouteIntent.swift
Normal 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()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue