2022-06-14 16:45:43 -07:00
|
|
|
//
|
|
|
|
|
// TelemetryConfig.swift
|
|
|
|
|
// Meshtastic Apple
|
|
|
|
|
//
|
|
|
|
|
// Copyright (c) Garth Vander Houwen 6/13/22.
|
|
|
|
|
//
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
|
|
struct RangeTestConfig: View {
|
|
|
|
|
|
|
|
|
|
@Environment(\.managedObjectContext) var context
|
|
|
|
|
@EnvironmentObject var bleManager: BLEManager
|
|
|
|
|
|
|
|
|
|
@State var enabled = false
|
|
|
|
|
@State var sender = false
|
|
|
|
|
@State var save = false
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
|
|
|
|
|
VStack {
|
|
|
|
|
|
|
|
|
|
Form {
|
|
|
|
|
|
|
|
|
|
Section(header: Text("Options")) {
|
|
|
|
|
|
|
|
|
|
Toggle(isOn: $enabled) {
|
|
|
|
|
|
2022-06-22 15:52:51 -07:00
|
|
|
Label("Enabled", systemImage: "figure.walk")
|
2022-06-14 16:45:43 -07:00
|
|
|
}
|
2022-06-22 15:52:51 -07:00
|
|
|
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
2022-06-14 16:45:43 -07:00
|
|
|
|
|
|
|
|
Toggle(isOn: $sender) {
|
|
|
|
|
|
|
|
|
|
Label("Sender", systemImage: "paperplane")
|
|
|
|
|
}
|
2022-06-22 15:52:51 -07:00
|
|
|
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
2022-06-14 16:45:43 -07:00
|
|
|
Text("This device will send out range test messages.")
|
|
|
|
|
.font(.caption)
|
|
|
|
|
|
|
|
|
|
Toggle(isOn: $save) {
|
|
|
|
|
|
|
|
|
|
Label("Save", systemImage: "square.and.arrow.down.fill")
|
|
|
|
|
}
|
2022-06-22 15:52:51 -07:00
|
|
|
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
|
|
|
|
|
2022-06-14 16:45:43 -07:00
|
|
|
Text("Saves a CSV with the range test message details, only available on ESP32 devices with a web server.")
|
|
|
|
|
.font(.caption)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.navigationTitle("Range Test Config")
|
|
|
|
|
.navigationBarItems(trailing:
|
|
|
|
|
|
|
|
|
|
ZStack {
|
|
|
|
|
|
2022-06-17 18:20:30 -07:00
|
|
|
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?????")
|
2022-06-14 16:45:43 -07:00
|
|
|
})
|
|
|
|
|
.onAppear {
|
|
|
|
|
|
|
|
|
|
self.bleManager.context = context
|
|
|
|
|
}
|
|
|
|
|
.navigationViewStyle(StackNavigationViewStyle())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|