2022-08-21 08:15:27 -07:00
|
|
|
//
|
|
|
|
|
// GpsFormats.swift
|
|
|
|
|
// Meshtastic
|
|
|
|
|
//
|
|
|
|
|
// Copyright(c) Garth Vander Houwen 8/20/22.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
enum GpsFormats: Int, CaseIterable, Identifiable {
|
|
|
|
|
|
|
|
|
|
case gpsFormatDec = 0
|
|
|
|
|
case gpsFormatDms = 1
|
|
|
|
|
case gpsFormatUtm = 2
|
|
|
|
|
case gpsFormatMgrs = 3
|
|
|
|
|
case gpsFormatOlc = 4
|
|
|
|
|
case gpsFormatOsgr = 5
|
|
|
|
|
|
|
|
|
|
var id: Int { self.rawValue }
|
|
|
|
|
var description: String {
|
2023-03-06 13:26:04 -08:00
|
|
|
switch self {
|
|
|
|
|
case .gpsFormatDec:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "gpsformat.dec".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .gpsFormatDms:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "gpsformat.dms".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .gpsFormatUtm:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "gpsformat.utm".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .gpsFormatMgrs:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "gpsformat.mgrs".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .gpsFormatOlc:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "gpsformat.olc".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .gpsFormatOsgr:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "gpsformat.osgr".localized
|
2022-08-21 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
func protoEnumValue() -> Config.DisplayConfig.GpsCoordinateFormat {
|
2023-03-06 10:33:18 -08:00
|
|
|
|
2022-08-21 08:15:27 -07:00
|
|
|
switch self {
|
2023-03-06 10:33:18 -08:00
|
|
|
|
2022-08-21 08:15:27 -07:00
|
|
|
case .gpsFormatDec:
|
2022-09-07 22:33:44 -07:00
|
|
|
return Config.DisplayConfig.GpsCoordinateFormat.dec
|
2022-08-21 08:15:27 -07:00
|
|
|
case .gpsFormatDms:
|
2022-09-07 22:33:44 -07:00
|
|
|
return Config.DisplayConfig.GpsCoordinateFormat.dms
|
2022-08-21 08:15:27 -07:00
|
|
|
case .gpsFormatUtm:
|
2022-09-07 22:33:44 -07:00
|
|
|
return Config.DisplayConfig.GpsCoordinateFormat.utm
|
2022-08-21 08:15:27 -07:00
|
|
|
case .gpsFormatMgrs:
|
2022-09-07 22:33:44 -07:00
|
|
|
return Config.DisplayConfig.GpsCoordinateFormat.mgrs
|
2022-08-21 08:15:27 -07:00
|
|
|
case .gpsFormatOlc:
|
2022-09-07 22:33:44 -07:00
|
|
|
return Config.DisplayConfig.GpsCoordinateFormat.olc
|
2022-08-21 08:15:27 -07:00
|
|
|
case .gpsFormatOsgr:
|
2022-09-07 22:33:44 -07:00
|
|
|
return Config.DisplayConfig.GpsCoordinateFormat.osgr
|
2022-08-21 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum GpsUpdateIntervals: Int, CaseIterable, Identifiable {
|
|
|
|
|
|
|
|
|
|
case fiveSeconds = 5
|
|
|
|
|
case tenSeconds = 10
|
|
|
|
|
case fifteenSeconds = 15
|
2022-11-10 22:17:38 -08:00
|
|
|
case twentySeconds = 20
|
|
|
|
|
case twentyFiveSeconds = 25
|
2022-09-10 18:27:44 -07:00
|
|
|
case thirtySeconds = 30
|
2023-05-01 10:39:49 -07:00
|
|
|
case fortyFiveSeconds = 45
|
2022-08-21 08:15:27 -07:00
|
|
|
case oneMinute = 60
|
2022-10-04 18:10:40 -07:00
|
|
|
case twoMinutes = 120
|
2022-08-21 08:15:27 -07:00
|
|
|
case fiveMinutes = 300
|
|
|
|
|
case tenMinutes = 600
|
|
|
|
|
case fifteenMinutes = 900
|
|
|
|
|
case thirtyMinutes = 1800
|
|
|
|
|
case oneHour = 3600
|
2022-09-01 19:00:41 -07:00
|
|
|
case sixHours = 21600
|
|
|
|
|
case twelveHours = 43200
|
|
|
|
|
case twentyFourHours = 86400
|
2022-08-21 08:15:27 -07:00
|
|
|
case maxInt32 = 2147483647
|
|
|
|
|
|
|
|
|
|
var id: Int { self.rawValue }
|
|
|
|
|
var description: String {
|
2023-03-06 13:26:04 -08:00
|
|
|
switch self {
|
|
|
|
|
case .fiveSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.five.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .tenSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.ten.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fifteenSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.fifteen.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twentySeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.twenty.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twentyFiveSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.twentyfive.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .thirtySeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.thirty.seconds".localized
|
2023-05-01 10:39:49 -07:00
|
|
|
case .fortyFiveSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.fortyfive.seconds".localized
|
|
|
|
|
case .oneMinute:
|
|
|
|
|
return "interval.one.minute".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twoMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.two.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fiveMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.five.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .tenMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.ten.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fifteenMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.fifteen.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .thirtyMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.thirty.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .oneHour:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.one.hour".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .sixHours:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.six.hours".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twelveHours:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.twelve.hours".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twentyFourHours:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.twentyfour.hours".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .maxInt32:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "on.boot"
|
2022-08-21 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum GpsAttemptTimes: Int, CaseIterable, Identifiable {
|
|
|
|
|
|
2022-11-10 22:17:38 -08:00
|
|
|
case twoSeconds = 2
|
2022-09-01 19:00:41 -07:00
|
|
|
case fiveSeconds = 5
|
|
|
|
|
case tenSeconds = 10
|
2022-09-01 18:37:41 -07:00
|
|
|
case fifteenSeconds = 15
|
2022-11-10 22:17:38 -08:00
|
|
|
case twentySeconds = 20
|
|
|
|
|
case twentyFiveSeconds = 25
|
2022-09-10 18:27:44 -07:00
|
|
|
case thirtySeconds = 30
|
2023-05-01 10:39:49 -07:00
|
|
|
case fortyFiveSeconds = 45
|
2022-08-21 08:15:27 -07:00
|
|
|
case oneMinute = 60
|
2022-12-13 17:47:23 -08:00
|
|
|
case twoMinutes = 120
|
2022-08-21 08:15:27 -07:00
|
|
|
case fiveMinutes = 300
|
2022-12-30 17:44:39 -08:00
|
|
|
case tenMinutes = 600
|
|
|
|
|
case fifteenMinutes = 900
|
2022-08-21 08:15:27 -07:00
|
|
|
|
|
|
|
|
var id: Int { self.rawValue }
|
|
|
|
|
var description: String {
|
2023-03-06 13:26:04 -08:00
|
|
|
switch self {
|
|
|
|
|
case .twoSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.two.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fiveSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.five.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .tenSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.ten.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fifteenSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.fifteen.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twentySeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.twenty.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twentyFiveSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.twentyfive.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .thirtySeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.thirty.seconds".localized
|
2023-05-01 10:39:49 -07:00
|
|
|
case .fortyFiveSeconds:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.fortyfive.seconds".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .oneMinute:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.one.minute".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .twoMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.two.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fiveMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.five.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .tenMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.ten.minutes".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fifteenMinutes:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "interval.fifteen.minutes".localized
|
2022-08-21 08:15:27 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|