2022-08-19 23:26:02 -07:00
|
|
|
//
|
|
|
|
|
// BluetoothModes.swift
|
|
|
|
|
// Meshtastic
|
|
|
|
|
//
|
|
|
|
|
// Copyright(c) Garth Vander Houwen 8/19/22.
|
|
|
|
|
//
|
2022-12-13 17:47:23 -08:00
|
|
|
import Foundation
|
2022-08-19 23:26:02 -07:00
|
|
|
|
|
|
|
|
enum BluetoothModes: Int, CaseIterable, Identifiable {
|
|
|
|
|
|
|
|
|
|
case randomPin = 0
|
|
|
|
|
case fixedPin = 1
|
|
|
|
|
case noPin = 2
|
|
|
|
|
|
|
|
|
|
var id: Int { self.rawValue }
|
|
|
|
|
var description: String {
|
2023-03-06 13:26:04 -08:00
|
|
|
switch self {
|
|
|
|
|
case .randomPin:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "bluetooth.mode.randompin".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .fixedPin:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "bluetooth.mode.fixedpin".localized
|
2023-03-06 13:26:04 -08:00
|
|
|
case .noPin:
|
2023-05-05 09:27:24 -07:00
|
|
|
return "bluetooth.mode.nopin".localized
|
2022-08-19 23:26:02 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
func protoEnumValue() -> Config.BluetoothConfig.PairingMode {
|
|
|
|
|
switch self {
|
|
|
|
|
case .randomPin:
|
|
|
|
|
return Config.BluetoothConfig.PairingMode.randomPin
|
|
|
|
|
case .fixedPin:
|
|
|
|
|
return Config.BluetoothConfig.PairingMode.fixedPin
|
|
|
|
|
case .noPin:
|
|
|
|
|
return Config.BluetoothConfig.PairingMode.noPin
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|