Meshtastic-Apple/Meshtastic/Enums/BluetoothModes.swift

37 lines
795 B
Swift
Raw Normal View History

2022-08-19 23:26:02 -07:00
//
// BluetoothModes.swift
// Meshtastic
//
// Copyright(c) Garth Vander Houwen 8/19/22.
//
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:
return "bluetooth.mode.randompin".localized
2023-03-06 13:26:04 -08:00
case .fixedPin:
return "bluetooth.mode.fixedpin".localized
2023-03-06 13:26:04 -08:00
case .noPin:
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
}
}
}