Meshtastic-Apple/MeshtasticClient/Protobufs/deviceonly.pb.swift
Garth Vander Houwen 575f598c83 Upgrade protos
2022-05-05 18:01:20 -07:00

386 lines
13 KiB
Swift

// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: deviceonly.proto
//
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/
import Foundation
import SwiftProtobuf
// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that you are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
typealias Version = _2
}
///
/// TODO: REPLACE
enum ScreenFonts: SwiftProtobuf.Enum {
typealias RawValue = Int
///
/// TODO: REPLACE
case fontSmall // = 0
///
/// TODO: REPLACE
case fontMedium // = 1
///
/// TODO: REPLACE
case fontLarge // = 2
case UNRECOGNIZED(Int)
init() {
self = .fontSmall
}
init?(rawValue: Int) {
switch rawValue {
case 0: self = .fontSmall
case 1: self = .fontMedium
case 2: self = .fontLarge
default: self = .UNRECOGNIZED(rawValue)
}
}
var rawValue: Int {
switch self {
case .fontSmall: return 0
case .fontMedium: return 1
case .fontLarge: return 2
case .UNRECOGNIZED(let i): return i
}
}
}
#if swift(>=4.2)
extension ScreenFonts: CaseIterable {
// The compiler won't synthesize support with the UNRECOGNIZED case.
static var allCases: [ScreenFonts] = [
.fontSmall,
.fontMedium,
.fontLarge,
]
}
#endif // swift(>=4.2)
///
/// This message is never sent over the wire, but it is used for serializing DB
/// state to flash in the device code
/// FIXME, since we write this each time we enter deep sleep (and have infinite
/// flash) it would be better to use some sort of append only data structure for
/// the receive queue and use the preferences store for the other stuff
struct DeviceState {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
///
/// Read only settings/info about this node
var myNode: MyNodeInfo {
get {return _myNode ?? MyNodeInfo()}
set {_myNode = newValue}
}
/// Returns true if `myNode` has been explicitly set.
var hasMyNode: Bool {return self._myNode != nil}
/// Clears the value of `myNode`. Subsequent reads from it will return its default value.
mutating func clearMyNode() {self._myNode = nil}
///
/// My owner info
var owner: User {
get {return _owner ?? User()}
set {_owner = newValue}
}
/// Returns true if `owner` has been explicitly set.
var hasOwner: Bool {return self._owner != nil}
/// Clears the value of `owner`. Subsequent reads from it will return its default value.
mutating func clearOwner() {self._owner = nil}
///
/// TODO: REPLACE
var nodeDb: [NodeInfo] = []
///
/// Received packets saved for delivery to the phone
var receiveQueue: [MeshPacket] = []
///
/// A version integer used to invalidate old save files when we make
/// incompatible changes This integer is set at build time and is private to
/// NodeDB.cpp in the device code.
var version: UInt32 = 0
///
/// We keep the last received text message (only) stored in the device flash,
/// so we can show it on the screen.
/// Might be null
var rxTextMessage: MeshPacket {
get {return _rxTextMessage ?? MeshPacket()}
set {_rxTextMessage = newValue}
}
/// Returns true if `rxTextMessage` has been explicitly set.
var hasRxTextMessage: Bool {return self._rxTextMessage != nil}
/// Clears the value of `rxTextMessage`. Subsequent reads from it will return its default value.
mutating func clearRxTextMessage() {self._rxTextMessage = nil}
///
/// Used only during development.
/// Indicates developer is testing and changes should never be saved to flash.
var noSave: Bool = false
///
/// Some GPSes seem to have bogus settings from the factory, so we always do one factory reset.
var didGpsReset: Bool = false
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
fileprivate var _myNode: MyNodeInfo? = nil
fileprivate var _owner: User? = nil
fileprivate var _rxTextMessage: MeshPacket? = nil
}
///
/// The on-disk saved channels
struct ChannelFile {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
///
/// The channels our node knows about
var channels: [Channel] = []
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
}
///
/// This can be used for customizing the firmware distribution. If populated,
/// show a secondary bootup screen with cuatom logo and text for 2.5 seconds.
struct OEMStore {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.
///
/// The Logo width in Px
var oemIconWidth: UInt32 = 0
///
/// The Logo height in Px
var oemIconHeight: UInt32 = 0
///
/// The Logo in xbm bytechar format
var oemIconBits: Data = Data()
///
/// Use this font for the OEM text.
var oemFont: ScreenFonts = .fontSmall
///
/// Use this font for the OEM text.
var oemText: String = String()
var unknownFields = SwiftProtobuf.UnknownStorage()
init() {}
}
#if swift(>=5.5) && canImport(_Concurrency)
extension ScreenFonts: @unchecked Sendable {}
extension DeviceState: @unchecked Sendable {}
extension ChannelFile: @unchecked Sendable {}
extension OEMStore: @unchecked Sendable {}
#endif // swift(>=5.5) && canImport(_Concurrency)
// MARK: - Code below here is support for the SwiftProtobuf runtime.
extension ScreenFonts: SwiftProtobuf._ProtoNameProviding {
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
0: .same(proto: "FONT_SMALL"),
1: .same(proto: "FONT_MEDIUM"),
2: .same(proto: "FONT_LARGE"),
]
}
extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = "DeviceState"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
2: .standard(proto: "my_node"),
3: .same(proto: "owner"),
4: .standard(proto: "node_db"),
5: .standard(proto: "receive_queue"),
8: .same(proto: "version"),
7: .standard(proto: "rx_text_message"),
9: .standard(proto: "no_save"),
11: .standard(proto: "did_gps_reset"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 2: try { try decoder.decodeSingularMessageField(value: &self._myNode) }()
case 3: try { try decoder.decodeSingularMessageField(value: &self._owner) }()
case 4: try { try decoder.decodeRepeatedMessageField(value: &self.nodeDb) }()
case 5: try { try decoder.decodeRepeatedMessageField(value: &self.receiveQueue) }()
case 7: try { try decoder.decodeSingularMessageField(value: &self._rxTextMessage) }()
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.version) }()
case 9: try { try decoder.decodeSingularBoolField(value: &self.noSave) }()
case 11: try { try decoder.decodeSingularBoolField(value: &self.didGpsReset) }()
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._myNode {
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
} }()
try { if let v = self._owner {
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
} }()
if !self.nodeDb.isEmpty {
try visitor.visitRepeatedMessageField(value: self.nodeDb, fieldNumber: 4)
}
if !self.receiveQueue.isEmpty {
try visitor.visitRepeatedMessageField(value: self.receiveQueue, fieldNumber: 5)
}
try { if let v = self._rxTextMessage {
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
} }()
if self.version != 0 {
try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 8)
}
if self.noSave != false {
try visitor.visitSingularBoolField(value: self.noSave, fieldNumber: 9)
}
if self.didGpsReset != false {
try visitor.visitSingularBoolField(value: self.didGpsReset, fieldNumber: 11)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: DeviceState, rhs: DeviceState) -> Bool {
if lhs._myNode != rhs._myNode {return false}
if lhs._owner != rhs._owner {return false}
if lhs.nodeDb != rhs.nodeDb {return false}
if lhs.receiveQueue != rhs.receiveQueue {return false}
if lhs.version != rhs.version {return false}
if lhs._rxTextMessage != rhs._rxTextMessage {return false}
if lhs.noSave != rhs.noSave {return false}
if lhs.didGpsReset != rhs.didGpsReset {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = "ChannelFile"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .same(proto: "channels"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.channels) }()
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.channels.isEmpty {
try visitor.visitRepeatedMessageField(value: self.channels, fieldNumber: 1)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: ChannelFile, rhs: ChannelFile) -> Bool {
if lhs.channels != rhs.channels {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}
extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = "OEMStore"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "oem_icon_width"),
2: .standard(proto: "oem_icon_height"),
3: .standard(proto: "oem_icon_bits"),
4: .standard(proto: "oem_font"),
5: .standard(proto: "oem_text"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularUInt32Field(value: &self.oemIconWidth) }()
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.oemIconHeight) }()
case 3: try { try decoder.decodeSingularBytesField(value: &self.oemIconBits) }()
case 4: try { try decoder.decodeSingularEnumField(value: &self.oemFont) }()
case 5: try { try decoder.decodeSingularStringField(value: &self.oemText) }()
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.oemIconWidth != 0 {
try visitor.visitSingularUInt32Field(value: self.oemIconWidth, fieldNumber: 1)
}
if self.oemIconHeight != 0 {
try visitor.visitSingularUInt32Field(value: self.oemIconHeight, fieldNumber: 2)
}
if !self.oemIconBits.isEmpty {
try visitor.visitSingularBytesField(value: self.oemIconBits, fieldNumber: 3)
}
if self.oemFont != .fontSmall {
try visitor.visitSingularEnumField(value: self.oemFont, fieldNumber: 4)
}
if !self.oemText.isEmpty {
try visitor.visitSingularStringField(value: self.oemText, fieldNumber: 5)
}
try unknownFields.traverse(visitor: &visitor)
}
static func ==(lhs: OEMStore, rhs: OEMStore) -> Bool {
if lhs.oemIconWidth != rhs.oemIconWidth {return false}
if lhs.oemIconHeight != rhs.oemIconHeight {return false}
if lhs.oemIconBits != rhs.oemIconBits {return false}
if lhs.oemFont != rhs.oemFont {return false}
if lhs.oemText != rhs.oemText {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}