mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Proto updates
This commit is contained in:
parent
2a7ab321c7
commit
27afad6e86
2 changed files with 102 additions and 0 deletions
|
|
@ -302,6 +302,16 @@ struct AdminMessage {
|
|||
set {payloadVariant = .factoryReset(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Tell the node to reset the nodedb.
|
||||
var nodedbReset: Int32 {
|
||||
get {
|
||||
if case .nodedbReset(let v)? = payloadVariant {return v}
|
||||
return 0
|
||||
}
|
||||
set {payloadVariant = .nodedbReset(newValue)}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
|
|
@ -394,6 +404,9 @@ struct AdminMessage {
|
|||
///
|
||||
/// Tell the node to factory reset, all device settings will be returned to factory defaults.
|
||||
case factoryReset(Int32)
|
||||
///
|
||||
/// Tell the node to reset the nodedb.
|
||||
case nodedbReset(Int32)
|
||||
|
||||
#if !swift(>=4.1)
|
||||
static func ==(lhs: AdminMessage.OneOf_PayloadVariant, rhs: AdminMessage.OneOf_PayloadVariant) -> Bool {
|
||||
|
|
@ -505,6 +518,10 @@ struct AdminMessage {
|
|||
guard case .factoryReset(let l) = lhs, case .factoryReset(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.nodedbReset, .nodedbReset): return {
|
||||
guard case .nodedbReset(let l) = lhs, case .nodedbReset(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
|
|
@ -714,6 +731,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
97: .standard(proto: "reboot_seconds"),
|
||||
98: .standard(proto: "shutdown_seconds"),
|
||||
99: .standard(proto: "factory_reset"),
|
||||
100: .standard(proto: "nodedb_reset"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -975,6 +993,14 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
self.payloadVariant = .factoryReset(v)
|
||||
}
|
||||
}()
|
||||
case 100: try {
|
||||
var v: Int32?
|
||||
try decoder.decodeSingularInt32Field(value: &v)
|
||||
if let v = v {
|
||||
if self.payloadVariant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .nodedbReset(v)
|
||||
}
|
||||
}()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
|
@ -1090,6 +1116,10 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
guard case .factoryReset(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularInt32Field(value: v, fieldNumber: 99)
|
||||
}()
|
||||
case .nodedbReset?: try {
|
||||
guard case .nodedbReset(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularInt32Field(value: v, fieldNumber: 100)
|
||||
}()
|
||||
case nil: break
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
|
|
|
|||
|
|
@ -526,6 +526,14 @@ struct Config {
|
|||
/// (top of display is heading direction) is used.
|
||||
var compassNorthTop: Bool = false
|
||||
|
||||
///
|
||||
/// Flip screen vertically, for cases that mount the screen upside down
|
||||
var flipScreen: Bool = false
|
||||
|
||||
///
|
||||
/// Perferred display units
|
||||
var units: Config.DisplayConfig.DisplayUnits = .metric
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
|
|
@ -595,6 +603,42 @@ struct Config {
|
|||
|
||||
}
|
||||
|
||||
///
|
||||
/// Unit display preference
|
||||
enum DisplayUnits: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// Metric (Default)
|
||||
case metric // = 0
|
||||
|
||||
///
|
||||
/// Imperial
|
||||
case imperial // = 1
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .metric
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .metric
|
||||
case 1: self = .imperial
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .metric: return 0
|
||||
case .imperial: return 1
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
|
|
@ -954,6 +998,14 @@ extension Config.DisplayConfig.GpsCoordinateFormat: CaseIterable {
|
|||
]
|
||||
}
|
||||
|
||||
extension Config.DisplayConfig.DisplayUnits: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [Config.DisplayConfig.DisplayUnits] = [
|
||||
.metric,
|
||||
.imperial,
|
||||
]
|
||||
}
|
||||
|
||||
extension Config.LoRaConfig.RegionCode: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [Config.LoRaConfig.RegionCode] = [
|
||||
|
|
@ -1009,6 +1061,7 @@ extension Config.NetworkConfig: @unchecked Sendable {}
|
|||
extension Config.NetworkConfig.WiFiMode: @unchecked Sendable {}
|
||||
extension Config.DisplayConfig: @unchecked Sendable {}
|
||||
extension Config.DisplayConfig.GpsCoordinateFormat: @unchecked Sendable {}
|
||||
extension Config.DisplayConfig.DisplayUnits: @unchecked Sendable {}
|
||||
extension Config.LoRaConfig: @unchecked Sendable {}
|
||||
extension Config.LoRaConfig.RegionCode: @unchecked Sendable {}
|
||||
extension Config.LoRaConfig.ModemPreset: @unchecked Sendable {}
|
||||
|
|
@ -1460,6 +1513,8 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
|
|||
2: .standard(proto: "gps_format"),
|
||||
3: .standard(proto: "auto_screen_carousel_secs"),
|
||||
4: .standard(proto: "compass_north_top"),
|
||||
5: .standard(proto: "flip_screen"),
|
||||
6: .same(proto: "units"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
|
|
@ -1472,6 +1527,8 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
|
|||
case 2: try { try decoder.decodeSingularEnumField(value: &self.gpsFormat) }()
|
||||
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.autoScreenCarouselSecs) }()
|
||||
case 4: try { try decoder.decodeSingularBoolField(value: &self.compassNorthTop) }()
|
||||
case 5: try { try decoder.decodeSingularBoolField(value: &self.flipScreen) }()
|
||||
case 6: try { try decoder.decodeSingularEnumField(value: &self.units) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
|
@ -1490,6 +1547,12 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
|
|||
if self.compassNorthTop != false {
|
||||
try visitor.visitSingularBoolField(value: self.compassNorthTop, fieldNumber: 4)
|
||||
}
|
||||
if self.flipScreen != false {
|
||||
try visitor.visitSingularBoolField(value: self.flipScreen, fieldNumber: 5)
|
||||
}
|
||||
if self.units != .metric {
|
||||
try visitor.visitSingularEnumField(value: self.units, fieldNumber: 6)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
|
|
@ -1498,6 +1561,8 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
|
|||
if lhs.gpsFormat != rhs.gpsFormat {return false}
|
||||
if lhs.autoScreenCarouselSecs != rhs.autoScreenCarouselSecs {return false}
|
||||
if lhs.compassNorthTop != rhs.compassNorthTop {return false}
|
||||
if lhs.flipScreen != rhs.flipScreen {return false}
|
||||
if lhs.units != rhs.units {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
|
|
@ -1514,6 +1579,13 @@ extension Config.DisplayConfig.GpsCoordinateFormat: SwiftProtobuf._ProtoNameProv
|
|||
]
|
||||
}
|
||||
|
||||
extension Config.DisplayConfig.DisplayUnits: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "METRIC"),
|
||||
1: .same(proto: "IMPERIAL"),
|
||||
]
|
||||
}
|
||||
|
||||
extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = Config.protoMessageName + ".LoRaConfig"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue