mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Add protos folder
This commit is contained in:
parent
b12067e7ef
commit
3d0d13404e
18 changed files with 13524 additions and 0 deletions
1374
Meshtastic/Protobufs/meshtastic/admin.pb.swift
Normal file
1374
Meshtastic/Protobufs/meshtastic/admin.pb.swift
Normal file
File diff suppressed because it is too large
Load diff
104
Meshtastic/Protobufs/meshtastic/apponly.pb.swift
Normal file
104
Meshtastic/Protobufs/meshtastic/apponly.pb.swift
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/apponly.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
|
||||
}
|
||||
|
||||
///
|
||||
/// This is the most compact possible representation for a set of channels.
|
||||
/// It includes only one PRIMARY channel (which must be first) and
|
||||
/// any SECONDARY channels.
|
||||
/// No DISABLED channels are included.
|
||||
/// This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL
|
||||
struct ChannelSet {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Channel list with settings
|
||||
var settings: [ChannelSettings] = []
|
||||
|
||||
///
|
||||
/// LoRa config
|
||||
var loraConfig: Config.LoRaConfig {
|
||||
get {return _loraConfig ?? Config.LoRaConfig()}
|
||||
set {_loraConfig = newValue}
|
||||
}
|
||||
/// Returns true if `loraConfig` has been explicitly set.
|
||||
var hasLoraConfig: Bool {return self._loraConfig != nil}
|
||||
/// Clears the value of `loraConfig`. Subsequent reads from it will return its default value.
|
||||
mutating func clearLoraConfig() {self._loraConfig = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _loraConfig: Config.LoRaConfig? = nil
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension ChannelSet: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension ChannelSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".ChannelSet"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "settings"),
|
||||
2: .standard(proto: "lora_config"),
|
||||
]
|
||||
|
||||
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.settings) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._loraConfig) }()
|
||||
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
|
||||
if !self.settings.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.settings, fieldNumber: 1)
|
||||
}
|
||||
try { if let v = self._loraConfig {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: ChannelSet, rhs: ChannelSet) -> Bool {
|
||||
if lhs.settings != rhs.settings {return false}
|
||||
if lhs._loraConfig != rhs._loraConfig {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
77
Meshtastic/Protobufs/meshtastic/cannedmessages.pb.swift
Normal file
77
Meshtastic/Protobufs/meshtastic/cannedmessages.pb.swift
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/cannedmessages.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
|
||||
}
|
||||
|
||||
///
|
||||
/// Canned message module configuration.
|
||||
struct CannedMessageModuleConfig {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Predefined messages for canned message module separated by '|' characters.
|
||||
var messages: String = String()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension CannedMessageModuleConfig: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension CannedMessageModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".CannedMessageModuleConfig"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "messages"),
|
||||
]
|
||||
|
||||
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.decodeSingularStringField(value: &self.messages) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.messages.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.messages, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: CannedMessageModuleConfig, rhs: CannedMessageModuleConfig) -> Bool {
|
||||
if lhs.messages != rhs.messages {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
328
Meshtastic/Protobufs/meshtastic/channel.pb.swift
Normal file
328
Meshtastic/Protobufs/meshtastic/channel.pb.swift
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/channel.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
|
||||
}
|
||||
|
||||
///
|
||||
/// Full settings (center freq, spread factor, pre-shared secret key etc...)
|
||||
/// needed to configure a radio for speaking on a particular channel This
|
||||
/// information can be encoded as a QRcode/url so that other users can configure
|
||||
/// their radio to join the same channel.
|
||||
/// A note about how channel names are shown to users: channelname-Xy
|
||||
/// poundsymbol is a prefix used to indicate this is a channel name (idea from @professr).
|
||||
/// Where X is a letter from A-Z (base 26) representing a hash of the PSK for this
|
||||
/// channel - so that if the user changes anything about the channel (which does
|
||||
/// force a new PSK) this letter will also change. Thus preventing user confusion if
|
||||
/// two friends try to type in a channel name of "BobsChan" and then can't talk
|
||||
/// because their PSKs will be different.
|
||||
/// The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26"
|
||||
/// This also allows the option of someday if people have the PSK off (zero), the
|
||||
/// users COULD type in a channel name and be able to talk.
|
||||
/// Y is a lower case letter from a-z that represents the channel 'speed' settings
|
||||
/// (for some future definition of speed)
|
||||
/// FIXME: Add description of multi-channel support and how primary vs secondary channels are used.
|
||||
/// FIXME: explain how apps use channels for security.
|
||||
/// explain how remote settings and remote gpio are managed as an example
|
||||
struct ChannelSettings {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Deprecated in favor of LoraConfig.channel_num
|
||||
var channelNum: UInt32 = 0
|
||||
|
||||
///
|
||||
/// A simple pre-shared key for now for crypto.
|
||||
/// Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256).
|
||||
/// A special shorthand is used for 1 byte long psks.
|
||||
/// These psks should be treated as only minimally secure,
|
||||
/// because they are listed in this source code.
|
||||
/// Those bytes are mapped using the following scheme:
|
||||
/// `0` = No crypto
|
||||
/// `1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf}
|
||||
/// `2` through 10 = The default channel key, except with 1 through 9 added to the last byte.
|
||||
/// Shown to user as simple1 through 10
|
||||
var psk: Data = Data()
|
||||
|
||||
///
|
||||
/// A SHORT name that will be packed into the URL.
|
||||
/// Less than 12 bytes.
|
||||
/// Something for end users to call the channel
|
||||
/// If this is the empty string it is assumed that this channel
|
||||
/// is the special (minimally secure) "Default"channel.
|
||||
/// In user interfaces it should be rendered as a local language translation of "X".
|
||||
/// For channel_num hashing empty string will be treated as "X".
|
||||
/// Where "X" is selected based on the English words listed above for ModemPreset
|
||||
var name: String = String()
|
||||
|
||||
///
|
||||
/// Used to construct a globally unique channel ID.
|
||||
/// The full globally unique ID will be: "name.id" where ID is shown as base36.
|
||||
/// Assuming that the number of meshtastic users is below 20K (true for a long time)
|
||||
/// the chance of this 64 bit random number colliding with anyone else is super low.
|
||||
/// And the penalty for collision is low as well, it just means that anyone trying to decrypt channel messages might need to
|
||||
/// try multiple candidate channels.
|
||||
/// Any time a non wire compatible change is made to a channel, this field should be regenerated.
|
||||
/// There are a small number of 'special' globally known (and fairly) insecure standard channels.
|
||||
/// Those channels do not have a numeric id included in the settings, but instead it is pulled from
|
||||
/// a table of well known IDs.
|
||||
/// (see Well Known Channels FIXME)
|
||||
var id: UInt32 = 0
|
||||
|
||||
///
|
||||
/// If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe
|
||||
var uplinkEnabled: Bool = false
|
||||
|
||||
///
|
||||
/// If true, messages seen on the internet will be forwarded to the local mesh.
|
||||
var downlinkEnabled: Bool = false
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// A pair of a channel number, mode and the (sharable) settings for that channel
|
||||
struct Channel {
|
||||
// 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 index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1)
|
||||
/// (Someday - not currently implemented) An index of -1 could be used to mean "set by name",
|
||||
/// in which case the target node will find and set the channel by settings.name.
|
||||
var index: Int32 = 0
|
||||
|
||||
///
|
||||
/// The new settings, or NULL to disable that channel
|
||||
var settings: ChannelSettings {
|
||||
get {return _settings ?? ChannelSettings()}
|
||||
set {_settings = newValue}
|
||||
}
|
||||
/// Returns true if `settings` has been explicitly set.
|
||||
var hasSettings: Bool {return self._settings != nil}
|
||||
/// Clears the value of `settings`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSettings() {self._settings = nil}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var role: Channel.Role = .disabled
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
/// How this channel is being used (or not).
|
||||
/// Note: this field is an enum to give us options for the future.
|
||||
/// In particular, someday we might make a 'SCANNING' option.
|
||||
/// SCANNING channels could have different frequencies and the radio would
|
||||
/// occasionally check that freq to see if anything is being transmitted.
|
||||
/// For devices that have multiple physical radios attached, we could keep multiple PRIMARY/SCANNING channels active at once to allow
|
||||
/// cross band routing as needed.
|
||||
/// If a device has only a single radio (the common case) only one channel can be PRIMARY at a time
|
||||
/// (but any number of SECONDARY channels can't be sent received on that common frequency)
|
||||
enum Role: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// This channel is not in use right now
|
||||
case disabled // = 0
|
||||
|
||||
///
|
||||
/// This channel is used to set the frequency for the radio - all other enabled channels must be SECONDARY
|
||||
case primary // = 1
|
||||
|
||||
///
|
||||
/// Secondary channels are only used for encryption/decryption/authentication purposes.
|
||||
/// Their radio settings (freq etc) are ignored, only psk is used.
|
||||
case secondary // = 2
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .disabled
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .disabled
|
||||
case 1: self = .primary
|
||||
case 2: self = .secondary
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .disabled: return 0
|
||||
case .primary: return 1
|
||||
case .secondary: return 2
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _settings: ChannelSettings? = nil
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension Channel.Role: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [Channel.Role] = [
|
||||
.disabled,
|
||||
.primary,
|
||||
.secondary,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension ChannelSettings: @unchecked Sendable {}
|
||||
extension Channel: @unchecked Sendable {}
|
||||
extension Channel.Role: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".ChannelSettings"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "channel_num"),
|
||||
2: .same(proto: "psk"),
|
||||
3: .same(proto: "name"),
|
||||
4: .same(proto: "id"),
|
||||
5: .standard(proto: "uplink_enabled"),
|
||||
6: .standard(proto: "downlink_enabled"),
|
||||
]
|
||||
|
||||
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.channelNum) }()
|
||||
case 2: try { try decoder.decodeSingularBytesField(value: &self.psk) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.name) }()
|
||||
case 4: try { try decoder.decodeSingularFixed32Field(value: &self.id) }()
|
||||
case 5: try { try decoder.decodeSingularBoolField(value: &self.uplinkEnabled) }()
|
||||
case 6: try { try decoder.decodeSingularBoolField(value: &self.downlinkEnabled) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.channelNum != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.channelNum, fieldNumber: 1)
|
||||
}
|
||||
if !self.psk.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.psk, fieldNumber: 2)
|
||||
}
|
||||
if !self.name.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.name, fieldNumber: 3)
|
||||
}
|
||||
if self.id != 0 {
|
||||
try visitor.visitSingularFixed32Field(value: self.id, fieldNumber: 4)
|
||||
}
|
||||
if self.uplinkEnabled != false {
|
||||
try visitor.visitSingularBoolField(value: self.uplinkEnabled, fieldNumber: 5)
|
||||
}
|
||||
if self.downlinkEnabled != false {
|
||||
try visitor.visitSingularBoolField(value: self.downlinkEnabled, fieldNumber: 6)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: ChannelSettings, rhs: ChannelSettings) -> Bool {
|
||||
if lhs.channelNum != rhs.channelNum {return false}
|
||||
if lhs.psk != rhs.psk {return false}
|
||||
if lhs.name != rhs.name {return false}
|
||||
if lhs.id != rhs.id {return false}
|
||||
if lhs.uplinkEnabled != rhs.uplinkEnabled {return false}
|
||||
if lhs.downlinkEnabled != rhs.downlinkEnabled {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".Channel"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "index"),
|
||||
2: .same(proto: "settings"),
|
||||
3: .same(proto: "role"),
|
||||
]
|
||||
|
||||
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.decodeSingularInt32Field(value: &self.index) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._settings) }()
|
||||
case 3: try { try decoder.decodeSingularEnumField(value: &self.role) }()
|
||||
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
|
||||
if self.index != 0 {
|
||||
try visitor.visitSingularInt32Field(value: self.index, fieldNumber: 1)
|
||||
}
|
||||
try { if let v = self._settings {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
if self.role != .disabled {
|
||||
try visitor.visitSingularEnumField(value: self.role, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Channel, rhs: Channel) -> Bool {
|
||||
if lhs.index != rhs.index {return false}
|
||||
if lhs._settings != rhs._settings {return false}
|
||||
if lhs.role != rhs.role {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Channel.Role: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "DISABLED"),
|
||||
1: .same(proto: "PRIMARY"),
|
||||
2: .same(proto: "SECONDARY"),
|
||||
]
|
||||
}
|
||||
2257
Meshtastic/Protobufs/meshtastic/config.pb.swift
Normal file
2257
Meshtastic/Protobufs/meshtastic/config.pb.swift
Normal file
File diff suppressed because it is too large
Load diff
493
Meshtastic/Protobufs/meshtastic/connection_status.pb.swift
Normal file
493
Meshtastic/Protobufs/meshtastic/connection_status.pb.swift
Normal file
|
|
@ -0,0 +1,493 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/connection_status.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
|
||||
}
|
||||
|
||||
struct DeviceConnectionStatus {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// WiFi Status
|
||||
var wifi: WifiConnectionStatus {
|
||||
get {return _wifi ?? WifiConnectionStatus()}
|
||||
set {_wifi = newValue}
|
||||
}
|
||||
/// Returns true if `wifi` has been explicitly set.
|
||||
var hasWifi: Bool {return self._wifi != nil}
|
||||
/// Clears the value of `wifi`. Subsequent reads from it will return its default value.
|
||||
mutating func clearWifi() {self._wifi = nil}
|
||||
|
||||
///
|
||||
/// WiFi Status
|
||||
var ethernet: EthernetConnectionStatus {
|
||||
get {return _ethernet ?? EthernetConnectionStatus()}
|
||||
set {_ethernet = newValue}
|
||||
}
|
||||
/// Returns true if `ethernet` has been explicitly set.
|
||||
var hasEthernet: Bool {return self._ethernet != nil}
|
||||
/// Clears the value of `ethernet`. Subsequent reads from it will return its default value.
|
||||
mutating func clearEthernet() {self._ethernet = nil}
|
||||
|
||||
///
|
||||
/// Bluetooth Status
|
||||
var bluetooth: BluetoothConnectionStatus {
|
||||
get {return _bluetooth ?? BluetoothConnectionStatus()}
|
||||
set {_bluetooth = newValue}
|
||||
}
|
||||
/// Returns true if `bluetooth` has been explicitly set.
|
||||
var hasBluetooth: Bool {return self._bluetooth != nil}
|
||||
/// Clears the value of `bluetooth`. Subsequent reads from it will return its default value.
|
||||
mutating func clearBluetooth() {self._bluetooth = nil}
|
||||
|
||||
///
|
||||
/// Serial Status
|
||||
var serial: SerialConnectionStatus {
|
||||
get {return _serial ?? SerialConnectionStatus()}
|
||||
set {_serial = newValue}
|
||||
}
|
||||
/// Returns true if `serial` has been explicitly set.
|
||||
var hasSerial: Bool {return self._serial != nil}
|
||||
/// Clears the value of `serial`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSerial() {self._serial = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _wifi: WifiConnectionStatus? = nil
|
||||
fileprivate var _ethernet: EthernetConnectionStatus? = nil
|
||||
fileprivate var _bluetooth: BluetoothConnectionStatus? = nil
|
||||
fileprivate var _serial: SerialConnectionStatus? = nil
|
||||
}
|
||||
|
||||
///
|
||||
/// WiFi connection status
|
||||
struct WifiConnectionStatus {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Connection status
|
||||
var status: NetworkConnectionStatus {
|
||||
get {return _status ?? NetworkConnectionStatus()}
|
||||
set {_status = newValue}
|
||||
}
|
||||
/// Returns true if `status` has been explicitly set.
|
||||
var hasStatus: Bool {return self._status != nil}
|
||||
/// Clears the value of `status`. Subsequent reads from it will return its default value.
|
||||
mutating func clearStatus() {self._status = nil}
|
||||
|
||||
///
|
||||
/// WiFi access point ssid
|
||||
var ssid: String = String()
|
||||
|
||||
///
|
||||
/// Rssi of wireless connection
|
||||
var rssi: Int32 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _status: NetworkConnectionStatus? = nil
|
||||
}
|
||||
|
||||
///
|
||||
/// Ethernet connection status
|
||||
struct EthernetConnectionStatus {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Connection status
|
||||
var status: NetworkConnectionStatus {
|
||||
get {return _status ?? NetworkConnectionStatus()}
|
||||
set {_status = newValue}
|
||||
}
|
||||
/// Returns true if `status` has been explicitly set.
|
||||
var hasStatus: Bool {return self._status != nil}
|
||||
/// Clears the value of `status`. Subsequent reads from it will return its default value.
|
||||
mutating func clearStatus() {self._status = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _status: NetworkConnectionStatus? = nil
|
||||
}
|
||||
|
||||
///
|
||||
/// Ethernet or WiFi connection status
|
||||
struct NetworkConnectionStatus {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// IP address of device
|
||||
var ipAddress: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Whether the device has an active connection or not
|
||||
var isConnected: Bool = false
|
||||
|
||||
///
|
||||
/// Whether the device has an active connection to an MQTT broker or not
|
||||
var isMqttConnected: Bool = false
|
||||
|
||||
///
|
||||
/// Whether the device is actively remote syslogging or not
|
||||
var isSyslogConnected: Bool = false
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// Bluetooth connection status
|
||||
struct BluetoothConnectionStatus {
|
||||
// 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 pairing pin for bluetooth
|
||||
var pin: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Rssi of bluetooth connection
|
||||
var rssi: Int32 = 0
|
||||
|
||||
///
|
||||
/// Whether the device has an active connection or not
|
||||
var isConnected: Bool = false
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// Serial connection status
|
||||
struct SerialConnectionStatus {
|
||||
// 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 serial baud rate
|
||||
var baud: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Whether the device has an active connection or not
|
||||
var isConnected: Bool = false
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension DeviceConnectionStatus: @unchecked Sendable {}
|
||||
extension WifiConnectionStatus: @unchecked Sendable {}
|
||||
extension EthernetConnectionStatus: @unchecked Sendable {}
|
||||
extension NetworkConnectionStatus: @unchecked Sendable {}
|
||||
extension BluetoothConnectionStatus: @unchecked Sendable {}
|
||||
extension SerialConnectionStatus: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension DeviceConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".DeviceConnectionStatus"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "wifi"),
|
||||
2: .same(proto: "ethernet"),
|
||||
3: .same(proto: "bluetooth"),
|
||||
4: .same(proto: "serial"),
|
||||
]
|
||||
|
||||
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.decodeSingularMessageField(value: &self._wifi) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._ethernet) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &self._bluetooth) }()
|
||||
case 4: try { try decoder.decodeSingularMessageField(value: &self._serial) }()
|
||||
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._wifi {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
try { if let v = self._ethernet {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = self._bluetooth {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
try { if let v = self._serial {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
} }()
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: DeviceConnectionStatus, rhs: DeviceConnectionStatus) -> Bool {
|
||||
if lhs._wifi != rhs._wifi {return false}
|
||||
if lhs._ethernet != rhs._ethernet {return false}
|
||||
if lhs._bluetooth != rhs._bluetooth {return false}
|
||||
if lhs._serial != rhs._serial {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension WifiConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".WifiConnectionStatus"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "status"),
|
||||
2: .same(proto: "ssid"),
|
||||
3: .same(proto: "rssi"),
|
||||
]
|
||||
|
||||
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.decodeSingularMessageField(value: &self._status) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &self.ssid) }()
|
||||
case 3: try { try decoder.decodeSingularInt32Field(value: &self.rssi) }()
|
||||
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._status {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
if !self.ssid.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.ssid, fieldNumber: 2)
|
||||
}
|
||||
if self.rssi != 0 {
|
||||
try visitor.visitSingularInt32Field(value: self.rssi, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: WifiConnectionStatus, rhs: WifiConnectionStatus) -> Bool {
|
||||
if lhs._status != rhs._status {return false}
|
||||
if lhs.ssid != rhs.ssid {return false}
|
||||
if lhs.rssi != rhs.rssi {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension EthernetConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".EthernetConnectionStatus"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "status"),
|
||||
]
|
||||
|
||||
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.decodeSingularMessageField(value: &self._status) }()
|
||||
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._status {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: EthernetConnectionStatus, rhs: EthernetConnectionStatus) -> Bool {
|
||||
if lhs._status != rhs._status {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension NetworkConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".NetworkConnectionStatus"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "ip_address"),
|
||||
2: .standard(proto: "is_connected"),
|
||||
3: .standard(proto: "is_mqtt_connected"),
|
||||
4: .standard(proto: "is_syslog_connected"),
|
||||
]
|
||||
|
||||
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.decodeSingularFixed32Field(value: &self.ipAddress) }()
|
||||
case 2: try { try decoder.decodeSingularBoolField(value: &self.isConnected) }()
|
||||
case 3: try { try decoder.decodeSingularBoolField(value: &self.isMqttConnected) }()
|
||||
case 4: try { try decoder.decodeSingularBoolField(value: &self.isSyslogConnected) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.ipAddress != 0 {
|
||||
try visitor.visitSingularFixed32Field(value: self.ipAddress, fieldNumber: 1)
|
||||
}
|
||||
if self.isConnected != false {
|
||||
try visitor.visitSingularBoolField(value: self.isConnected, fieldNumber: 2)
|
||||
}
|
||||
if self.isMqttConnected != false {
|
||||
try visitor.visitSingularBoolField(value: self.isMqttConnected, fieldNumber: 3)
|
||||
}
|
||||
if self.isSyslogConnected != false {
|
||||
try visitor.visitSingularBoolField(value: self.isSyslogConnected, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: NetworkConnectionStatus, rhs: NetworkConnectionStatus) -> Bool {
|
||||
if lhs.ipAddress != rhs.ipAddress {return false}
|
||||
if lhs.isConnected != rhs.isConnected {return false}
|
||||
if lhs.isMqttConnected != rhs.isMqttConnected {return false}
|
||||
if lhs.isSyslogConnected != rhs.isSyslogConnected {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension BluetoothConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".BluetoothConnectionStatus"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "pin"),
|
||||
2: .same(proto: "rssi"),
|
||||
3: .standard(proto: "is_connected"),
|
||||
]
|
||||
|
||||
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.pin) }()
|
||||
case 2: try { try decoder.decodeSingularInt32Field(value: &self.rssi) }()
|
||||
case 3: try { try decoder.decodeSingularBoolField(value: &self.isConnected) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.pin != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.pin, fieldNumber: 1)
|
||||
}
|
||||
if self.rssi != 0 {
|
||||
try visitor.visitSingularInt32Field(value: self.rssi, fieldNumber: 2)
|
||||
}
|
||||
if self.isConnected != false {
|
||||
try visitor.visitSingularBoolField(value: self.isConnected, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: BluetoothConnectionStatus, rhs: BluetoothConnectionStatus) -> Bool {
|
||||
if lhs.pin != rhs.pin {return false}
|
||||
if lhs.rssi != rhs.rssi {return false}
|
||||
if lhs.isConnected != rhs.isConnected {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension SerialConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".SerialConnectionStatus"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "baud"),
|
||||
2: .standard(proto: "is_connected"),
|
||||
]
|
||||
|
||||
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.baud) }()
|
||||
case 2: try { try decoder.decodeSingularBoolField(value: &self.isConnected) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.baud != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.baud, fieldNumber: 1)
|
||||
}
|
||||
if self.isConnected != false {
|
||||
try visitor.visitSingularBoolField(value: self.isConnected, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: SerialConnectionStatus, rhs: SerialConnectionStatus) -> Bool {
|
||||
if lhs.baud != rhs.baud {return false}
|
||||
if lhs.isConnected != rhs.isConnected {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
157
Meshtastic/Protobufs/meshtastic/device_metadata.pb.swift
Normal file
157
Meshtastic/Protobufs/meshtastic/device_metadata.pb.swift
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/device_metadata.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
|
||||
}
|
||||
|
||||
///
|
||||
/// Device metadata response
|
||||
struct DeviceMetadata {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Device firmware version string
|
||||
var firmwareVersion: String = String()
|
||||
|
||||
///
|
||||
/// Device state version
|
||||
var deviceStateVersion: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Indicates whether the device can shutdown CPU natively or via power management chip
|
||||
var canShutdown: Bool = false
|
||||
|
||||
///
|
||||
/// Indicates that the device has native wifi capability
|
||||
var hasWifi_p: Bool = false
|
||||
|
||||
///
|
||||
/// Indicates that the device has native bluetooth capability
|
||||
var hasBluetooth_p: Bool = false
|
||||
|
||||
///
|
||||
/// Indicates that the device has an ethernet peripheral
|
||||
var hasEthernet_p: Bool = false
|
||||
|
||||
///
|
||||
/// Indicates that the device's role in the mesh
|
||||
var role: Config.DeviceConfig.Role = .client
|
||||
|
||||
///
|
||||
/// Indicates the device's current enabled position flags
|
||||
var positionFlags: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Device hardware model
|
||||
var hwModel: HardwareModel = .unset
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension DeviceMetadata: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension DeviceMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".DeviceMetadata"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "firmware_version"),
|
||||
2: .standard(proto: "device_state_version"),
|
||||
3: .same(proto: "canShutdown"),
|
||||
4: .same(proto: "hasWifi"),
|
||||
5: .same(proto: "hasBluetooth"),
|
||||
6: .same(proto: "hasEthernet"),
|
||||
7: .same(proto: "role"),
|
||||
8: .standard(proto: "position_flags"),
|
||||
9: .standard(proto: "hw_model"),
|
||||
]
|
||||
|
||||
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.decodeSingularStringField(value: &self.firmwareVersion) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.deviceStateVersion) }()
|
||||
case 3: try { try decoder.decodeSingularBoolField(value: &self.canShutdown) }()
|
||||
case 4: try { try decoder.decodeSingularBoolField(value: &self.hasWifi_p) }()
|
||||
case 5: try { try decoder.decodeSingularBoolField(value: &self.hasBluetooth_p) }()
|
||||
case 6: try { try decoder.decodeSingularBoolField(value: &self.hasEthernet_p) }()
|
||||
case 7: try { try decoder.decodeSingularEnumField(value: &self.role) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.positionFlags) }()
|
||||
case 9: try { try decoder.decodeSingularEnumField(value: &self.hwModel) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.firmwareVersion.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.firmwareVersion, fieldNumber: 1)
|
||||
}
|
||||
if self.deviceStateVersion != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.deviceStateVersion, fieldNumber: 2)
|
||||
}
|
||||
if self.canShutdown != false {
|
||||
try visitor.visitSingularBoolField(value: self.canShutdown, fieldNumber: 3)
|
||||
}
|
||||
if self.hasWifi_p != false {
|
||||
try visitor.visitSingularBoolField(value: self.hasWifi_p, fieldNumber: 4)
|
||||
}
|
||||
if self.hasBluetooth_p != false {
|
||||
try visitor.visitSingularBoolField(value: self.hasBluetooth_p, fieldNumber: 5)
|
||||
}
|
||||
if self.hasEthernet_p != false {
|
||||
try visitor.visitSingularBoolField(value: self.hasEthernet_p, fieldNumber: 6)
|
||||
}
|
||||
if self.role != .client {
|
||||
try visitor.visitSingularEnumField(value: self.role, fieldNumber: 7)
|
||||
}
|
||||
if self.positionFlags != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.positionFlags, fieldNumber: 8)
|
||||
}
|
||||
if self.hwModel != .unset {
|
||||
try visitor.visitSingularEnumField(value: self.hwModel, fieldNumber: 9)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: DeviceMetadata, rhs: DeviceMetadata) -> Bool {
|
||||
if lhs.firmwareVersion != rhs.firmwareVersion {return false}
|
||||
if lhs.deviceStateVersion != rhs.deviceStateVersion {return false}
|
||||
if lhs.canShutdown != rhs.canShutdown {return false}
|
||||
if lhs.hasWifi_p != rhs.hasWifi_p {return false}
|
||||
if lhs.hasBluetooth_p != rhs.hasBluetooth_p {return false}
|
||||
if lhs.hasEthernet_p != rhs.hasEthernet_p {return false}
|
||||
if lhs.role != rhs.role {return false}
|
||||
if lhs.positionFlags != rhs.positionFlags {return false}
|
||||
if lhs.hwModel != rhs.hwModel {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
510
Meshtastic/Protobufs/meshtastic/deviceonly.pb.swift
Normal file
510
Meshtastic/Protobufs/meshtastic/deviceonly.pb.swift
Normal file
|
|
@ -0,0 +1,510 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/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 _storage._myNode ?? MyNodeInfo()}
|
||||
set {_uniqueStorage()._myNode = newValue}
|
||||
}
|
||||
/// Returns true if `myNode` has been explicitly set.
|
||||
var hasMyNode: Bool {return _storage._myNode != nil}
|
||||
/// Clears the value of `myNode`. Subsequent reads from it will return its default value.
|
||||
mutating func clearMyNode() {_uniqueStorage()._myNode = nil}
|
||||
|
||||
///
|
||||
/// My owner info
|
||||
var owner: User {
|
||||
get {return _storage._owner ?? User()}
|
||||
set {_uniqueStorage()._owner = newValue}
|
||||
}
|
||||
/// Returns true if `owner` has been explicitly set.
|
||||
var hasOwner: Bool {return _storage._owner != nil}
|
||||
/// Clears the value of `owner`. Subsequent reads from it will return its default value.
|
||||
mutating func clearOwner() {_uniqueStorage()._owner = nil}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var nodeDb: [NodeInfo] {
|
||||
get {return _storage._nodeDb}
|
||||
set {_uniqueStorage()._nodeDb = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// Received packets saved for delivery to the phone
|
||||
var receiveQueue: [MeshPacket] {
|
||||
get {return _storage._receiveQueue}
|
||||
set {_uniqueStorage()._receiveQueue = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// 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 {
|
||||
get {return _storage._version}
|
||||
set {_uniqueStorage()._version = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// 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 _storage._rxTextMessage ?? MeshPacket()}
|
||||
set {_uniqueStorage()._rxTextMessage = newValue}
|
||||
}
|
||||
/// Returns true if `rxTextMessage` has been explicitly set.
|
||||
var hasRxTextMessage: Bool {return _storage._rxTextMessage != nil}
|
||||
/// Clears the value of `rxTextMessage`. Subsequent reads from it will return its default value.
|
||||
mutating func clearRxTextMessage() {_uniqueStorage()._rxTextMessage = nil}
|
||||
|
||||
///
|
||||
/// Used only during development.
|
||||
/// Indicates developer is testing and changes should never be saved to flash.
|
||||
var noSave: Bool {
|
||||
get {return _storage._noSave}
|
||||
set {_uniqueStorage()._noSave = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// Some GPSes seem to have bogus settings from the factory, so we always do one factory reset.
|
||||
var didGpsReset: Bool {
|
||||
get {return _storage._didGpsReset}
|
||||
set {_uniqueStorage()._didGpsReset = newValue}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
///
|
||||
/// 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] = []
|
||||
|
||||
///
|
||||
/// 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
|
||||
|
||||
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()
|
||||
|
||||
///
|
||||
/// The default device encryption key, 16 or 32 byte
|
||||
var oemAesKey: Data = Data()
|
||||
|
||||
///
|
||||
/// A Preset LocalConfig to apply during factory reset
|
||||
var oemLocalConfig: LocalConfig {
|
||||
get {return _oemLocalConfig ?? LocalConfig()}
|
||||
set {_oemLocalConfig = newValue}
|
||||
}
|
||||
/// Returns true if `oemLocalConfig` has been explicitly set.
|
||||
var hasOemLocalConfig: Bool {return self._oemLocalConfig != nil}
|
||||
/// Clears the value of `oemLocalConfig`. Subsequent reads from it will return its default value.
|
||||
mutating func clearOemLocalConfig() {self._oemLocalConfig = nil}
|
||||
|
||||
///
|
||||
/// A Preset LocalModuleConfig to apply during factory reset
|
||||
var oemLocalModuleConfig: LocalModuleConfig {
|
||||
get {return _oemLocalModuleConfig ?? LocalModuleConfig()}
|
||||
set {_oemLocalModuleConfig = newValue}
|
||||
}
|
||||
/// Returns true if `oemLocalModuleConfig` has been explicitly set.
|
||||
var hasOemLocalModuleConfig: Bool {return self._oemLocalModuleConfig != nil}
|
||||
/// Clears the value of `oemLocalModuleConfig`. Subsequent reads from it will return its default value.
|
||||
mutating func clearOemLocalModuleConfig() {self._oemLocalModuleConfig = nil}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _oemLocalConfig: LocalConfig? = nil
|
||||
fileprivate var _oemLocalModuleConfig: LocalModuleConfig? = nil
|
||||
}
|
||||
|
||||
#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.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
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 = _protobuf_package + ".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"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _myNode: MyNodeInfo? = nil
|
||||
var _owner: User? = nil
|
||||
var _nodeDb: [NodeInfo] = []
|
||||
var _receiveQueue: [MeshPacket] = []
|
||||
var _version: UInt32 = 0
|
||||
var _rxTextMessage: MeshPacket? = nil
|
||||
var _noSave: Bool = false
|
||||
var _didGpsReset: Bool = false
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_myNode = source._myNode
|
||||
_owner = source._owner
|
||||
_nodeDb = source._nodeDb
|
||||
_receiveQueue = source._receiveQueue
|
||||
_version = source._version
|
||||
_rxTextMessage = source._rxTextMessage
|
||||
_noSave = source._noSave
|
||||
_didGpsReset = source._didGpsReset
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
_ = _uniqueStorage()
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
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: &_storage._myNode) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &_storage._owner) }()
|
||||
case 4: try { try decoder.decodeRepeatedMessageField(value: &_storage._nodeDb) }()
|
||||
case 5: try { try decoder.decodeRepeatedMessageField(value: &_storage._receiveQueue) }()
|
||||
case 7: try { try decoder.decodeSingularMessageField(value: &_storage._rxTextMessage) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }()
|
||||
case 9: try { try decoder.decodeSingularBoolField(value: &_storage._noSave) }()
|
||||
case 11: try { try decoder.decodeSingularBoolField(value: &_storage._didGpsReset) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
// 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 = _storage._myNode {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = _storage._owner {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
if !_storage._nodeDb.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: _storage._nodeDb, fieldNumber: 4)
|
||||
}
|
||||
if !_storage._receiveQueue.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: _storage._receiveQueue, fieldNumber: 5)
|
||||
}
|
||||
try { if let v = _storage._rxTextMessage {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
} }()
|
||||
if _storage._version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 8)
|
||||
}
|
||||
if _storage._noSave != false {
|
||||
try visitor.visitSingularBoolField(value: _storage._noSave, fieldNumber: 9)
|
||||
}
|
||||
if _storage._didGpsReset != false {
|
||||
try visitor.visitSingularBoolField(value: _storage._didGpsReset, fieldNumber: 11)
|
||||
}
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: DeviceState, rhs: DeviceState) -> Bool {
|
||||
if lhs._storage !== rhs._storage {
|
||||
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
||||
let _storage = _args.0
|
||||
let rhs_storage = _args.1
|
||||
if _storage._myNode != rhs_storage._myNode {return false}
|
||||
if _storage._owner != rhs_storage._owner {return false}
|
||||
if _storage._nodeDb != rhs_storage._nodeDb {return false}
|
||||
if _storage._receiveQueue != rhs_storage._receiveQueue {return false}
|
||||
if _storage._version != rhs_storage._version {return false}
|
||||
if _storage._rxTextMessage != rhs_storage._rxTextMessage {return false}
|
||||
if _storage._noSave != rhs_storage._noSave {return false}
|
||||
if _storage._didGpsReset != rhs_storage._didGpsReset {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".ChannelFile"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "channels"),
|
||||
2: .same(proto: "version"),
|
||||
]
|
||||
|
||||
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) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.version) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.channels.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.channels, fieldNumber: 1)
|
||||
}
|
||||
if self.version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: ChannelFile, rhs: ChannelFile) -> Bool {
|
||||
if lhs.channels != rhs.channels {return false}
|
||||
if lhs.version != rhs.version {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".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"),
|
||||
6: .standard(proto: "oem_aes_key"),
|
||||
7: .standard(proto: "oem_local_config"),
|
||||
8: .standard(proto: "oem_local_module_config"),
|
||||
]
|
||||
|
||||
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) }()
|
||||
case 6: try { try decoder.decodeSingularBytesField(value: &self.oemAesKey) }()
|
||||
case 7: try { try decoder.decodeSingularMessageField(value: &self._oemLocalConfig) }()
|
||||
case 8: try { try decoder.decodeSingularMessageField(value: &self._oemLocalModuleConfig) }()
|
||||
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
|
||||
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)
|
||||
}
|
||||
if !self.oemAesKey.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.oemAesKey, fieldNumber: 6)
|
||||
}
|
||||
try { if let v = self._oemLocalConfig {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
} }()
|
||||
try { if let v = self._oemLocalModuleConfig {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
|
||||
} }()
|
||||
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.oemAesKey != rhs.oemAesKey {return false}
|
||||
if lhs._oemLocalConfig != rhs._oemLocalConfig {return false}
|
||||
if lhs._oemLocalModuleConfig != rhs._oemLocalModuleConfig {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
512
Meshtastic/Protobufs/meshtastic/localonly.pb.swift
Normal file
512
Meshtastic/Protobufs/meshtastic/localonly.pb.swift
Normal file
|
|
@ -0,0 +1,512 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/localonly.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
|
||||
}
|
||||
|
||||
struct LocalConfig {
|
||||
// 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 part of the config that is specific to the Device
|
||||
var device: Config.DeviceConfig {
|
||||
get {return _storage._device ?? Config.DeviceConfig()}
|
||||
set {_uniqueStorage()._device = newValue}
|
||||
}
|
||||
/// Returns true if `device` has been explicitly set.
|
||||
var hasDevice: Bool {return _storage._device != nil}
|
||||
/// Clears the value of `device`. Subsequent reads from it will return its default value.
|
||||
mutating func clearDevice() {_uniqueStorage()._device = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the GPS Position
|
||||
var position: Config.PositionConfig {
|
||||
get {return _storage._position ?? Config.PositionConfig()}
|
||||
set {_uniqueStorage()._position = newValue}
|
||||
}
|
||||
/// Returns true if `position` has been explicitly set.
|
||||
var hasPosition: Bool {return _storage._position != nil}
|
||||
/// Clears the value of `position`. Subsequent reads from it will return its default value.
|
||||
mutating func clearPosition() {_uniqueStorage()._position = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Power settings
|
||||
var power: Config.PowerConfig {
|
||||
get {return _storage._power ?? Config.PowerConfig()}
|
||||
set {_uniqueStorage()._power = newValue}
|
||||
}
|
||||
/// Returns true if `power` has been explicitly set.
|
||||
var hasPower: Bool {return _storage._power != nil}
|
||||
/// Clears the value of `power`. Subsequent reads from it will return its default value.
|
||||
mutating func clearPower() {_uniqueStorage()._power = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Wifi Settings
|
||||
var network: Config.NetworkConfig {
|
||||
get {return _storage._network ?? Config.NetworkConfig()}
|
||||
set {_uniqueStorage()._network = newValue}
|
||||
}
|
||||
/// Returns true if `network` has been explicitly set.
|
||||
var hasNetwork: Bool {return _storage._network != nil}
|
||||
/// Clears the value of `network`. Subsequent reads from it will return its default value.
|
||||
mutating func clearNetwork() {_uniqueStorage()._network = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Display
|
||||
var display: Config.DisplayConfig {
|
||||
get {return _storage._display ?? Config.DisplayConfig()}
|
||||
set {_uniqueStorage()._display = newValue}
|
||||
}
|
||||
/// Returns true if `display` has been explicitly set.
|
||||
var hasDisplay: Bool {return _storage._display != nil}
|
||||
/// Clears the value of `display`. Subsequent reads from it will return its default value.
|
||||
mutating func clearDisplay() {_uniqueStorage()._display = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Lora Radio
|
||||
var lora: Config.LoRaConfig {
|
||||
get {return _storage._lora ?? Config.LoRaConfig()}
|
||||
set {_uniqueStorage()._lora = newValue}
|
||||
}
|
||||
/// Returns true if `lora` has been explicitly set.
|
||||
var hasLora: Bool {return _storage._lora != nil}
|
||||
/// Clears the value of `lora`. Subsequent reads from it will return its default value.
|
||||
mutating func clearLora() {_uniqueStorage()._lora = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Bluetooth settings
|
||||
var bluetooth: Config.BluetoothConfig {
|
||||
get {return _storage._bluetooth ?? Config.BluetoothConfig()}
|
||||
set {_uniqueStorage()._bluetooth = newValue}
|
||||
}
|
||||
/// Returns true if `bluetooth` has been explicitly set.
|
||||
var hasBluetooth: Bool {return _storage._bluetooth != nil}
|
||||
/// Clears the value of `bluetooth`. Subsequent reads from it will return its default value.
|
||||
mutating func clearBluetooth() {_uniqueStorage()._bluetooth = nil}
|
||||
|
||||
///
|
||||
/// 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 {
|
||||
get {return _storage._version}
|
||||
set {_uniqueStorage()._version = newValue}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
struct LocalModuleConfig {
|
||||
// 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 part of the config that is specific to the MQTT module
|
||||
var mqtt: ModuleConfig.MQTTConfig {
|
||||
get {return _storage._mqtt ?? ModuleConfig.MQTTConfig()}
|
||||
set {_uniqueStorage()._mqtt = newValue}
|
||||
}
|
||||
/// Returns true if `mqtt` has been explicitly set.
|
||||
var hasMqtt: Bool {return _storage._mqtt != nil}
|
||||
/// Clears the value of `mqtt`. Subsequent reads from it will return its default value.
|
||||
mutating func clearMqtt() {_uniqueStorage()._mqtt = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Serial module
|
||||
var serial: ModuleConfig.SerialConfig {
|
||||
get {return _storage._serial ?? ModuleConfig.SerialConfig()}
|
||||
set {_uniqueStorage()._serial = newValue}
|
||||
}
|
||||
/// Returns true if `serial` has been explicitly set.
|
||||
var hasSerial: Bool {return _storage._serial != nil}
|
||||
/// Clears the value of `serial`. Subsequent reads from it will return its default value.
|
||||
mutating func clearSerial() {_uniqueStorage()._serial = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the ExternalNotification module
|
||||
var externalNotification: ModuleConfig.ExternalNotificationConfig {
|
||||
get {return _storage._externalNotification ?? ModuleConfig.ExternalNotificationConfig()}
|
||||
set {_uniqueStorage()._externalNotification = newValue}
|
||||
}
|
||||
/// Returns true if `externalNotification` has been explicitly set.
|
||||
var hasExternalNotification: Bool {return _storage._externalNotification != nil}
|
||||
/// Clears the value of `externalNotification`. Subsequent reads from it will return its default value.
|
||||
mutating func clearExternalNotification() {_uniqueStorage()._externalNotification = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Store & Forward module
|
||||
var storeForward: ModuleConfig.StoreForwardConfig {
|
||||
get {return _storage._storeForward ?? ModuleConfig.StoreForwardConfig()}
|
||||
set {_uniqueStorage()._storeForward = newValue}
|
||||
}
|
||||
/// Returns true if `storeForward` has been explicitly set.
|
||||
var hasStoreForward: Bool {return _storage._storeForward != nil}
|
||||
/// Clears the value of `storeForward`. Subsequent reads from it will return its default value.
|
||||
mutating func clearStoreForward() {_uniqueStorage()._storeForward = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the RangeTest module
|
||||
var rangeTest: ModuleConfig.RangeTestConfig {
|
||||
get {return _storage._rangeTest ?? ModuleConfig.RangeTestConfig()}
|
||||
set {_uniqueStorage()._rangeTest = newValue}
|
||||
}
|
||||
/// Returns true if `rangeTest` has been explicitly set.
|
||||
var hasRangeTest: Bool {return _storage._rangeTest != nil}
|
||||
/// Clears the value of `rangeTest`. Subsequent reads from it will return its default value.
|
||||
mutating func clearRangeTest() {_uniqueStorage()._rangeTest = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Telemetry module
|
||||
var telemetry: ModuleConfig.TelemetryConfig {
|
||||
get {return _storage._telemetry ?? ModuleConfig.TelemetryConfig()}
|
||||
set {_uniqueStorage()._telemetry = newValue}
|
||||
}
|
||||
/// Returns true if `telemetry` has been explicitly set.
|
||||
var hasTelemetry: Bool {return _storage._telemetry != nil}
|
||||
/// Clears the value of `telemetry`. Subsequent reads from it will return its default value.
|
||||
mutating func clearTelemetry() {_uniqueStorage()._telemetry = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Canned Message module
|
||||
var cannedMessage: ModuleConfig.CannedMessageConfig {
|
||||
get {return _storage._cannedMessage ?? ModuleConfig.CannedMessageConfig()}
|
||||
set {_uniqueStorage()._cannedMessage = newValue}
|
||||
}
|
||||
/// Returns true if `cannedMessage` has been explicitly set.
|
||||
var hasCannedMessage: Bool {return _storage._cannedMessage != nil}
|
||||
/// Clears the value of `cannedMessage`. Subsequent reads from it will return its default value.
|
||||
mutating func clearCannedMessage() {_uniqueStorage()._cannedMessage = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Audio module
|
||||
var audio: ModuleConfig.AudioConfig {
|
||||
get {return _storage._audio ?? ModuleConfig.AudioConfig()}
|
||||
set {_uniqueStorage()._audio = newValue}
|
||||
}
|
||||
/// Returns true if `audio` has been explicitly set.
|
||||
var hasAudio: Bool {return _storage._audio != nil}
|
||||
/// Clears the value of `audio`. Subsequent reads from it will return its default value.
|
||||
mutating func clearAudio() {_uniqueStorage()._audio = nil}
|
||||
|
||||
///
|
||||
/// The part of the config that is specific to the Remote Hardware module
|
||||
var remoteHardware: ModuleConfig.RemoteHardwareConfig {
|
||||
get {return _storage._remoteHardware ?? ModuleConfig.RemoteHardwareConfig()}
|
||||
set {_uniqueStorage()._remoteHardware = newValue}
|
||||
}
|
||||
/// Returns true if `remoteHardware` has been explicitly set.
|
||||
var hasRemoteHardware: Bool {return _storage._remoteHardware != nil}
|
||||
/// Clears the value of `remoteHardware`. Subsequent reads from it will return its default value.
|
||||
mutating func clearRemoteHardware() {_uniqueStorage()._remoteHardware = nil}
|
||||
|
||||
///
|
||||
/// 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 {
|
||||
get {return _storage._version}
|
||||
set {_uniqueStorage()._version = newValue}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension LocalConfig: @unchecked Sendable {}
|
||||
extension LocalModuleConfig: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".LocalConfig"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "device"),
|
||||
2: .same(proto: "position"),
|
||||
3: .same(proto: "power"),
|
||||
4: .same(proto: "network"),
|
||||
5: .same(proto: "display"),
|
||||
6: .same(proto: "lora"),
|
||||
7: .same(proto: "bluetooth"),
|
||||
8: .same(proto: "version"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _device: Config.DeviceConfig? = nil
|
||||
var _position: Config.PositionConfig? = nil
|
||||
var _power: Config.PowerConfig? = nil
|
||||
var _network: Config.NetworkConfig? = nil
|
||||
var _display: Config.DisplayConfig? = nil
|
||||
var _lora: Config.LoRaConfig? = nil
|
||||
var _bluetooth: Config.BluetoothConfig? = nil
|
||||
var _version: UInt32 = 0
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_device = source._device
|
||||
_position = source._position
|
||||
_power = source._power
|
||||
_network = source._network
|
||||
_display = source._display
|
||||
_lora = source._lora
|
||||
_bluetooth = source._bluetooth
|
||||
_version = source._version
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
_ = _uniqueStorage()
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
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.decodeSingularMessageField(value: &_storage._device) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &_storage._position) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &_storage._power) }()
|
||||
case 4: try { try decoder.decodeSingularMessageField(value: &_storage._network) }()
|
||||
case 5: try { try decoder.decodeSingularMessageField(value: &_storage._display) }()
|
||||
case 6: try { try decoder.decodeSingularMessageField(value: &_storage._lora) }()
|
||||
case 7: try { try decoder.decodeSingularMessageField(value: &_storage._bluetooth) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
// 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 = _storage._device {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
try { if let v = _storage._position {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = _storage._power {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
try { if let v = _storage._network {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
} }()
|
||||
try { if let v = _storage._display {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
|
||||
} }()
|
||||
try { if let v = _storage._lora {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
|
||||
} }()
|
||||
try { if let v = _storage._bluetooth {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
} }()
|
||||
if _storage._version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 8)
|
||||
}
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: LocalConfig, rhs: LocalConfig) -> Bool {
|
||||
if lhs._storage !== rhs._storage {
|
||||
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
||||
let _storage = _args.0
|
||||
let rhs_storage = _args.1
|
||||
if _storage._device != rhs_storage._device {return false}
|
||||
if _storage._position != rhs_storage._position {return false}
|
||||
if _storage._power != rhs_storage._power {return false}
|
||||
if _storage._network != rhs_storage._network {return false}
|
||||
if _storage._display != rhs_storage._display {return false}
|
||||
if _storage._lora != rhs_storage._lora {return false}
|
||||
if _storage._bluetooth != rhs_storage._bluetooth {return false}
|
||||
if _storage._version != rhs_storage._version {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".LocalModuleConfig"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "mqtt"),
|
||||
2: .same(proto: "serial"),
|
||||
3: .standard(proto: "external_notification"),
|
||||
4: .standard(proto: "store_forward"),
|
||||
5: .standard(proto: "range_test"),
|
||||
6: .same(proto: "telemetry"),
|
||||
7: .standard(proto: "canned_message"),
|
||||
9: .same(proto: "audio"),
|
||||
10: .standard(proto: "remote_hardware"),
|
||||
8: .same(proto: "version"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _mqtt: ModuleConfig.MQTTConfig? = nil
|
||||
var _serial: ModuleConfig.SerialConfig? = nil
|
||||
var _externalNotification: ModuleConfig.ExternalNotificationConfig? = nil
|
||||
var _storeForward: ModuleConfig.StoreForwardConfig? = nil
|
||||
var _rangeTest: ModuleConfig.RangeTestConfig? = nil
|
||||
var _telemetry: ModuleConfig.TelemetryConfig? = nil
|
||||
var _cannedMessage: ModuleConfig.CannedMessageConfig? = nil
|
||||
var _audio: ModuleConfig.AudioConfig? = nil
|
||||
var _remoteHardware: ModuleConfig.RemoteHardwareConfig? = nil
|
||||
var _version: UInt32 = 0
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_mqtt = source._mqtt
|
||||
_serial = source._serial
|
||||
_externalNotification = source._externalNotification
|
||||
_storeForward = source._storeForward
|
||||
_rangeTest = source._rangeTest
|
||||
_telemetry = source._telemetry
|
||||
_cannedMessage = source._cannedMessage
|
||||
_audio = source._audio
|
||||
_remoteHardware = source._remoteHardware
|
||||
_version = source._version
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
_ = _uniqueStorage()
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
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.decodeSingularMessageField(value: &_storage._mqtt) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &_storage._serial) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &_storage._externalNotification) }()
|
||||
case 4: try { try decoder.decodeSingularMessageField(value: &_storage._storeForward) }()
|
||||
case 5: try { try decoder.decodeSingularMessageField(value: &_storage._rangeTest) }()
|
||||
case 6: try { try decoder.decodeSingularMessageField(value: &_storage._telemetry) }()
|
||||
case 7: try { try decoder.decodeSingularMessageField(value: &_storage._cannedMessage) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }()
|
||||
case 9: try { try decoder.decodeSingularMessageField(value: &_storage._audio) }()
|
||||
case 10: try { try decoder.decodeSingularMessageField(value: &_storage._remoteHardware) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
// 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 = _storage._mqtt {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
try { if let v = _storage._serial {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = _storage._externalNotification {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
try { if let v = _storage._storeForward {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
} }()
|
||||
try { if let v = _storage._rangeTest {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
|
||||
} }()
|
||||
try { if let v = _storage._telemetry {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
|
||||
} }()
|
||||
try { if let v = _storage._cannedMessage {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
} }()
|
||||
if _storage._version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 8)
|
||||
}
|
||||
try { if let v = _storage._audio {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
|
||||
} }()
|
||||
try { if let v = _storage._remoteHardware {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
|
||||
} }()
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: LocalModuleConfig, rhs: LocalModuleConfig) -> Bool {
|
||||
if lhs._storage !== rhs._storage {
|
||||
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
||||
let _storage = _args.0
|
||||
let rhs_storage = _args.1
|
||||
if _storage._mqtt != rhs_storage._mqtt {return false}
|
||||
if _storage._serial != rhs_storage._serial {return false}
|
||||
if _storage._externalNotification != rhs_storage._externalNotification {return false}
|
||||
if _storage._storeForward != rhs_storage._storeForward {return false}
|
||||
if _storage._rangeTest != rhs_storage._rangeTest {return false}
|
||||
if _storage._telemetry != rhs_storage._telemetry {return false}
|
||||
if _storage._cannedMessage != rhs_storage._cannedMessage {return false}
|
||||
if _storage._audio != rhs_storage._audio {return false}
|
||||
if _storage._remoteHardware != rhs_storage._remoteHardware {return false}
|
||||
if _storage._version != rhs_storage._version {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
3783
Meshtastic/Protobufs/meshtastic/mesh.pb.swift
Normal file
3783
Meshtastic/Protobufs/meshtastic/mesh.pb.swift
Normal file
File diff suppressed because it is too large
Load diff
1738
Meshtastic/Protobufs/meshtastic/module_config.pb.swift
Normal file
1738
Meshtastic/Protobufs/meshtastic/module_config.pb.swift
Normal file
File diff suppressed because it is too large
Load diff
112
Meshtastic/Protobufs/meshtastic/mqtt.pb.swift
Normal file
112
Meshtastic/Protobufs/meshtastic/mqtt.pb.swift
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/mqtt.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
|
||||
}
|
||||
|
||||
///
|
||||
/// This message wraps a MeshPacket with extra metadata about the sender and how it arrived.
|
||||
struct ServiceEnvelope {
|
||||
// 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 (probably encrypted) packet
|
||||
var packet: MeshPacket {
|
||||
get {return _packet ?? MeshPacket()}
|
||||
set {_packet = newValue}
|
||||
}
|
||||
/// Returns true if `packet` has been explicitly set.
|
||||
var hasPacket: Bool {return self._packet != nil}
|
||||
/// Clears the value of `packet`. Subsequent reads from it will return its default value.
|
||||
mutating func clearPacket() {self._packet = nil}
|
||||
|
||||
///
|
||||
/// The global channel ID it was sent on
|
||||
var channelID: String = String()
|
||||
|
||||
///
|
||||
/// The sending gateway node ID. Can we use this to authenticate/prevent fake
|
||||
/// nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as
|
||||
/// the globally trusted nodenum
|
||||
var gatewayID: String = String()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _packet: MeshPacket? = nil
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension ServiceEnvelope: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".ServiceEnvelope"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "packet"),
|
||||
2: .standard(proto: "channel_id"),
|
||||
3: .standard(proto: "gateway_id"),
|
||||
]
|
||||
|
||||
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.decodeSingularMessageField(value: &self._packet) }()
|
||||
case 2: try { try decoder.decodeSingularStringField(value: &self.channelID) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.gatewayID) }()
|
||||
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._packet {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
if !self.channelID.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.channelID, fieldNumber: 2)
|
||||
}
|
||||
if !self.gatewayID.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.gatewayID, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: ServiceEnvelope, rhs: ServiceEnvelope) -> Bool {
|
||||
if lhs._packet != rhs._packet {return false}
|
||||
if lhs.channelID != rhs.channelID {return false}
|
||||
if lhs.gatewayID != rhs.gatewayID {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
278
Meshtastic/Protobufs/meshtastic/portnums.pb.swift
Normal file
278
Meshtastic/Protobufs/meshtastic/portnums.pb.swift
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/portnums.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
|
||||
}
|
||||
|
||||
///
|
||||
/// For any new 'apps' that run on the device or via sister apps on phones/PCs they should pick and use a
|
||||
/// unique 'portnum' for their application.
|
||||
/// If you are making a new app using meshtastic, please send in a pull request to add your 'portnum' to this
|
||||
/// master table.
|
||||
/// PortNums should be assigned in the following range:
|
||||
/// 0-63 Core Meshtastic use, do not use for third party apps
|
||||
/// 64-127 Registered 3rd party apps, send in a pull request that adds a new entry to portnums.proto to register your application
|
||||
/// 256-511 Use one of these portnums for your private applications that you don't want to register publically
|
||||
/// All other values are reserved.
|
||||
/// Note: This was formerly a Type enum named 'typ' with the same id #
|
||||
/// We have change to this 'portnum' based scheme for specifying app handlers for particular payloads.
|
||||
/// This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT values identically.
|
||||
enum PortNum: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// Deprecated: do not use in new code (formerly called OPAQUE)
|
||||
/// A message sent from a device outside of the mesh, in a form the mesh does not understand
|
||||
/// NOTE: This must be 0, because it is documented in IMeshService.aidl to be so
|
||||
case unknownApp // = 0
|
||||
|
||||
///
|
||||
/// A simple UTF-8 text message, which even the little micros in the mesh
|
||||
/// can understand and show on their screen eventually in some circumstances
|
||||
/// even signal might send messages in this form (see below)
|
||||
case textMessageApp // = 1
|
||||
|
||||
///
|
||||
/// Reserved for built-in GPIO/example app.
|
||||
/// See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number
|
||||
case remoteHardwareApp // = 2
|
||||
|
||||
///
|
||||
/// The built-in position messaging app.
|
||||
/// Payload is a [Position](/docs/developers/protobufs/api#position) message
|
||||
case positionApp // = 3
|
||||
|
||||
///
|
||||
/// The built-in user info app.
|
||||
/// Payload is a [User](/docs/developers/protobufs/api#user) message
|
||||
case nodeinfoApp // = 4
|
||||
|
||||
///
|
||||
/// Protocol control packets for mesh protocol use.
|
||||
/// Payload is a [Routing](/docs/developers/protobufs/api#routing) message
|
||||
case routingApp // = 5
|
||||
|
||||
///
|
||||
/// Admin control packets.
|
||||
/// Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message
|
||||
case adminApp // = 6
|
||||
|
||||
///
|
||||
/// Compressed TEXT_MESSAGE payloads.
|
||||
case textMessageCompressedApp // = 7
|
||||
|
||||
///
|
||||
/// Waypoint payloads.
|
||||
/// Payload is a [Waypoint](/docs/developers/protobufs/api#waypoint) message
|
||||
case waypointApp // = 8
|
||||
|
||||
/// Audio Payloads.
|
||||
/// Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now
|
||||
case audioApp // = 9
|
||||
|
||||
///
|
||||
/// Provides a 'ping' service that replies to any packet it receives.
|
||||
/// Also serves as a small example module.
|
||||
case replyApp // = 32
|
||||
|
||||
///
|
||||
/// Used for the python IP tunnel feature
|
||||
case ipTunnelApp // = 33
|
||||
|
||||
///
|
||||
/// Provides a hardware serial interface to send and receive from the Meshtastic network.
|
||||
/// Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic
|
||||
/// network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network.
|
||||
/// Maximum packet size of 240 bytes.
|
||||
/// Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp.
|
||||
case serialApp // = 64
|
||||
|
||||
///
|
||||
/// STORE_FORWARD_APP (Work in Progress)
|
||||
/// Maintained by Jm Casler (MC Hamster) : jm@casler.org
|
||||
case storeForwardApp // = 65
|
||||
|
||||
///
|
||||
/// Optional port for messages for the range test module.
|
||||
case rangeTestApp // = 66
|
||||
|
||||
///
|
||||
/// Provides a format to send and receive telemetry data from the Meshtastic network.
|
||||
/// Maintained by Charles Crossan (crossan007) : crossan007@gmail.com
|
||||
case telemetryApp // = 67
|
||||
|
||||
///
|
||||
/// Experimental tools for estimating node position without a GPS
|
||||
/// Maintained by Github user a-f-G-U-C (a Meshtastic contributor)
|
||||
/// Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS
|
||||
case zpsApp // = 68
|
||||
|
||||
///
|
||||
/// Used to let multiple instances of Linux native applications communicate
|
||||
/// as if they did using their LoRa chip.
|
||||
/// Maintained by GitHub user GUVWAF.
|
||||
/// Project files at https://github.com/GUVWAF/Meshtasticator
|
||||
case simulatorApp // = 69
|
||||
|
||||
///
|
||||
/// Provides a traceroute functionality to show the route a packet towards
|
||||
/// a certain destination would take on the mesh.
|
||||
case tracerouteApp // = 70
|
||||
|
||||
///
|
||||
/// Private applications should use portnums >= 256.
|
||||
/// To simplify initial development and testing you can use "PRIVATE_APP"
|
||||
/// in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh))
|
||||
case privateApp // = 256
|
||||
|
||||
///
|
||||
/// ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder
|
||||
case atakForwarder // = 257
|
||||
|
||||
///
|
||||
/// Currently we limit port nums to no higher than this value
|
||||
case max // = 511
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .unknownApp
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .unknownApp
|
||||
case 1: self = .textMessageApp
|
||||
case 2: self = .remoteHardwareApp
|
||||
case 3: self = .positionApp
|
||||
case 4: self = .nodeinfoApp
|
||||
case 5: self = .routingApp
|
||||
case 6: self = .adminApp
|
||||
case 7: self = .textMessageCompressedApp
|
||||
case 8: self = .waypointApp
|
||||
case 9: self = .audioApp
|
||||
case 32: self = .replyApp
|
||||
case 33: self = .ipTunnelApp
|
||||
case 64: self = .serialApp
|
||||
case 65: self = .storeForwardApp
|
||||
case 66: self = .rangeTestApp
|
||||
case 67: self = .telemetryApp
|
||||
case 68: self = .zpsApp
|
||||
case 69: self = .simulatorApp
|
||||
case 70: self = .tracerouteApp
|
||||
case 256: self = .privateApp
|
||||
case 257: self = .atakForwarder
|
||||
case 511: self = .max
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .unknownApp: return 0
|
||||
case .textMessageApp: return 1
|
||||
case .remoteHardwareApp: return 2
|
||||
case .positionApp: return 3
|
||||
case .nodeinfoApp: return 4
|
||||
case .routingApp: return 5
|
||||
case .adminApp: return 6
|
||||
case .textMessageCompressedApp: return 7
|
||||
case .waypointApp: return 8
|
||||
case .audioApp: return 9
|
||||
case .replyApp: return 32
|
||||
case .ipTunnelApp: return 33
|
||||
case .serialApp: return 64
|
||||
case .storeForwardApp: return 65
|
||||
case .rangeTestApp: return 66
|
||||
case .telemetryApp: return 67
|
||||
case .zpsApp: return 68
|
||||
case .simulatorApp: return 69
|
||||
case .tracerouteApp: return 70
|
||||
case .privateApp: return 256
|
||||
case .atakForwarder: return 257
|
||||
case .max: return 511
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension PortNum: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [PortNum] = [
|
||||
.unknownApp,
|
||||
.textMessageApp,
|
||||
.remoteHardwareApp,
|
||||
.positionApp,
|
||||
.nodeinfoApp,
|
||||
.routingApp,
|
||||
.adminApp,
|
||||
.textMessageCompressedApp,
|
||||
.waypointApp,
|
||||
.audioApp,
|
||||
.replyApp,
|
||||
.ipTunnelApp,
|
||||
.serialApp,
|
||||
.storeForwardApp,
|
||||
.rangeTestApp,
|
||||
.telemetryApp,
|
||||
.zpsApp,
|
||||
.simulatorApp,
|
||||
.tracerouteApp,
|
||||
.privateApp,
|
||||
.atakForwarder,
|
||||
.max,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension PortNum: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
extension PortNum: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "UNKNOWN_APP"),
|
||||
1: .same(proto: "TEXT_MESSAGE_APP"),
|
||||
2: .same(proto: "REMOTE_HARDWARE_APP"),
|
||||
3: .same(proto: "POSITION_APP"),
|
||||
4: .same(proto: "NODEINFO_APP"),
|
||||
5: .same(proto: "ROUTING_APP"),
|
||||
6: .same(proto: "ADMIN_APP"),
|
||||
7: .same(proto: "TEXT_MESSAGE_COMPRESSED_APP"),
|
||||
8: .same(proto: "WAYPOINT_APP"),
|
||||
9: .same(proto: "AUDIO_APP"),
|
||||
32: .same(proto: "REPLY_APP"),
|
||||
33: .same(proto: "IP_TUNNEL_APP"),
|
||||
64: .same(proto: "SERIAL_APP"),
|
||||
65: .same(proto: "STORE_FORWARD_APP"),
|
||||
66: .same(proto: "RANGE_TEST_APP"),
|
||||
67: .same(proto: "TELEMETRY_APP"),
|
||||
68: .same(proto: "ZPS_APP"),
|
||||
69: .same(proto: "SIMULATOR_APP"),
|
||||
70: .same(proto: "TRACEROUTE_APP"),
|
||||
256: .same(proto: "PRIVATE_APP"),
|
||||
257: .same(proto: "ATAK_FORWARDER"),
|
||||
511: .same(proto: "MAX"),
|
||||
]
|
||||
}
|
||||
196
Meshtastic/Protobufs/meshtastic/remote_hardware.pb.swift
Normal file
196
Meshtastic/Protobufs/meshtastic/remote_hardware.pb.swift
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/remote_hardware.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
|
||||
}
|
||||
|
||||
///
|
||||
/// An example app to show off the module system. This message is used for
|
||||
/// REMOTE_HARDWARE_APP PortNums.
|
||||
/// Also provides easy remote access to any GPIO.
|
||||
/// In the future other remote hardware operations can be added based on user interest
|
||||
/// (i.e. serial output, spi/i2c input/output).
|
||||
/// FIXME - currently this feature is turned on by default which is dangerous
|
||||
/// because no security yet (beyond the channel mechanism).
|
||||
/// It should be off by default and then protected based on some TBD mechanism
|
||||
/// (a special channel once multichannel support is included?)
|
||||
struct HardwareMessage {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// What type of HardwareMessage is this?
|
||||
var type: HardwareMessage.TypeEnum = .unset
|
||||
|
||||
///
|
||||
/// What gpios are we changing. Not used for all MessageTypes, see MessageType for details
|
||||
var gpioMask: UInt64 = 0
|
||||
|
||||
///
|
||||
/// For gpios that were listed in gpio_mask as valid, what are the signal levels for those gpios.
|
||||
/// Not used for all MessageTypes, see MessageType for details
|
||||
var gpioValue: UInt64 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
enum TypeEnum: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// Unset/unused
|
||||
case unset // = 0
|
||||
|
||||
///
|
||||
/// Set gpio gpios based on gpio_mask/gpio_value
|
||||
case writeGpios // = 1
|
||||
|
||||
///
|
||||
/// We are now interested in watching the gpio_mask gpios.
|
||||
/// If the selected gpios change, please broadcast GPIOS_CHANGED.
|
||||
/// Will implicitly change the gpios requested to be INPUT gpios.
|
||||
case watchGpios // = 2
|
||||
|
||||
///
|
||||
/// The gpios listed in gpio_mask have changed, the new values are listed in gpio_value
|
||||
case gpiosChanged // = 3
|
||||
|
||||
///
|
||||
/// Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated
|
||||
case readGpios // = 4
|
||||
|
||||
///
|
||||
/// A reply to READ_GPIOS. gpio_mask and gpio_value will be populated
|
||||
case readGpiosReply // = 5
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .unset
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .unset
|
||||
case 1: self = .writeGpios
|
||||
case 2: self = .watchGpios
|
||||
case 3: self = .gpiosChanged
|
||||
case 4: self = .readGpios
|
||||
case 5: self = .readGpiosReply
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .unset: return 0
|
||||
case .writeGpios: return 1
|
||||
case .watchGpios: return 2
|
||||
case .gpiosChanged: return 3
|
||||
case .readGpios: return 4
|
||||
case .readGpiosReply: return 5
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension HardwareMessage.TypeEnum: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [HardwareMessage.TypeEnum] = [
|
||||
.unset,
|
||||
.writeGpios,
|
||||
.watchGpios,
|
||||
.gpiosChanged,
|
||||
.readGpios,
|
||||
.readGpiosReply,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension HardwareMessage: @unchecked Sendable {}
|
||||
extension HardwareMessage.TypeEnum: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension HardwareMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".HardwareMessage"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "type"),
|
||||
2: .standard(proto: "gpio_mask"),
|
||||
3: .standard(proto: "gpio_value"),
|
||||
]
|
||||
|
||||
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.decodeSingularEnumField(value: &self.type) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.gpioMask) }()
|
||||
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.gpioValue) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.type != .unset {
|
||||
try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1)
|
||||
}
|
||||
if self.gpioMask != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.gpioMask, fieldNumber: 2)
|
||||
}
|
||||
if self.gpioValue != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.gpioValue, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: HardwareMessage, rhs: HardwareMessage) -> Bool {
|
||||
if lhs.type != rhs.type {return false}
|
||||
if lhs.gpioMask != rhs.gpioMask {return false}
|
||||
if lhs.gpioValue != rhs.gpioValue {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension HardwareMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "UNSET"),
|
||||
1: .same(proto: "WRITE_GPIOS"),
|
||||
2: .same(proto: "WATCH_GPIOS"),
|
||||
3: .same(proto: "GPIOS_CHANGED"),
|
||||
4: .same(proto: "READ_GPIOS"),
|
||||
5: .same(proto: "READ_GPIOS_REPLY"),
|
||||
]
|
||||
}
|
||||
77
Meshtastic/Protobufs/meshtastic/rtttl.pb.swift
Normal file
77
Meshtastic/Protobufs/meshtastic/rtttl.pb.swift
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/rtttl.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
|
||||
}
|
||||
|
||||
///
|
||||
/// Canned message module configuration.
|
||||
struct RTTTLConfig {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Ringtone for PWM Buzzer in RTTTL Format.
|
||||
var ringtone: String = String()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension RTTTLConfig: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension RTTTLConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".RTTTLConfig"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "ringtone"),
|
||||
]
|
||||
|
||||
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.decodeSingularStringField(value: &self.ringtone) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.ringtone.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.ringtone, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: RTTTLConfig, rhs: RTTTLConfig) -> Bool {
|
||||
if lhs.ringtone != rhs.ringtone {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
653
Meshtastic/Protobufs/meshtastic/storeforward.pb.swift
Normal file
653
Meshtastic/Protobufs/meshtastic/storeforward.pb.swift
Normal file
|
|
@ -0,0 +1,653 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/storeforward.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
|
||||
struct StoreAndForward {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var rr: StoreAndForward.RequestResponse = .unset
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var variant: StoreAndForward.OneOf_Variant? = nil
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var stats: StoreAndForward.Statistics {
|
||||
get {
|
||||
if case .stats(let v)? = variant {return v}
|
||||
return StoreAndForward.Statistics()
|
||||
}
|
||||
set {variant = .stats(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var history: StoreAndForward.History {
|
||||
get {
|
||||
if case .history(let v)? = variant {return v}
|
||||
return StoreAndForward.History()
|
||||
}
|
||||
set {variant = .history(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var heartbeat: StoreAndForward.Heartbeat {
|
||||
get {
|
||||
if case .heartbeat(let v)? = variant {return v}
|
||||
return StoreAndForward.Heartbeat()
|
||||
}
|
||||
set {variant = .heartbeat(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Empty Payload
|
||||
var empty: Bool {
|
||||
get {
|
||||
if case .empty(let v)? = variant {return v}
|
||||
return false
|
||||
}
|
||||
set {variant = .empty(newValue)}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
enum OneOf_Variant: Equatable {
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case stats(StoreAndForward.Statistics)
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case history(StoreAndForward.History)
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case heartbeat(StoreAndForward.Heartbeat)
|
||||
///
|
||||
/// Empty Payload
|
||||
case empty(Bool)
|
||||
|
||||
#if !swift(>=4.1)
|
||||
static func ==(lhs: StoreAndForward.OneOf_Variant, rhs: StoreAndForward.OneOf_Variant) -> Bool {
|
||||
// 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 (lhs, rhs) {
|
||||
case (.stats, .stats): return {
|
||||
guard case .stats(let l) = lhs, case .stats(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.history, .history): return {
|
||||
guard case .history(let l) = lhs, case .history(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.heartbeat, .heartbeat): return {
|
||||
guard case .heartbeat(let l) = lhs, case .heartbeat(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.empty, .empty): return {
|
||||
guard case .empty(let l) = lhs, case .empty(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
///
|
||||
/// 001 - 063 = From Router
|
||||
/// 064 - 127 = From Client
|
||||
enum RequestResponse: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// Unset/unused
|
||||
case unset // = 0
|
||||
|
||||
///
|
||||
/// Router is an in error state.
|
||||
case routerError // = 1
|
||||
|
||||
///
|
||||
/// Router heartbeat
|
||||
case routerHeartbeat // = 2
|
||||
|
||||
///
|
||||
/// Router has requested the client respond. This can work as a
|
||||
/// "are you there" message.
|
||||
case routerPing // = 3
|
||||
|
||||
///
|
||||
/// The response to a "Ping"
|
||||
case routerPong // = 4
|
||||
|
||||
///
|
||||
/// Router is currently busy. Please try again later.
|
||||
case routerBusy // = 5
|
||||
|
||||
///
|
||||
/// Router is responding to a request for history.
|
||||
case routerHistory // = 6
|
||||
|
||||
///
|
||||
/// Router is responding to a request for stats.
|
||||
case routerStats // = 7
|
||||
|
||||
///
|
||||
/// Client is an in error state.
|
||||
case clientError // = 64
|
||||
|
||||
///
|
||||
/// Client has requested a replay from the router.
|
||||
case clientHistory // = 65
|
||||
|
||||
///
|
||||
/// Client has requested stats from the router.
|
||||
case clientStats // = 66
|
||||
|
||||
///
|
||||
/// Client has requested the router respond. This can work as a
|
||||
/// "are you there" message.
|
||||
case clientPing // = 67
|
||||
|
||||
///
|
||||
/// The response to a "Ping"
|
||||
case clientPong // = 68
|
||||
|
||||
///
|
||||
/// Client has requested that the router abort processing the client's request
|
||||
case clientAbort // = 106
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .unset
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .unset
|
||||
case 1: self = .routerError
|
||||
case 2: self = .routerHeartbeat
|
||||
case 3: self = .routerPing
|
||||
case 4: self = .routerPong
|
||||
case 5: self = .routerBusy
|
||||
case 6: self = .routerHistory
|
||||
case 7: self = .routerStats
|
||||
case 64: self = .clientError
|
||||
case 65: self = .clientHistory
|
||||
case 66: self = .clientStats
|
||||
case 67: self = .clientPing
|
||||
case 68: self = .clientPong
|
||||
case 106: self = .clientAbort
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .unset: return 0
|
||||
case .routerError: return 1
|
||||
case .routerHeartbeat: return 2
|
||||
case .routerPing: return 3
|
||||
case .routerPong: return 4
|
||||
case .routerBusy: return 5
|
||||
case .routerHistory: return 6
|
||||
case .routerStats: return 7
|
||||
case .clientError: return 64
|
||||
case .clientHistory: return 65
|
||||
case .clientStats: return 66
|
||||
case .clientPing: return 67
|
||||
case .clientPong: return 68
|
||||
case .clientAbort: return 106
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
struct Statistics {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Number of messages we have ever seen
|
||||
var messagesTotal: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Number of messages we have currently saved our history.
|
||||
var messagesSaved: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Maximum number of messages we will save
|
||||
var messagesMax: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Router uptime in seconds
|
||||
var upTime: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Number of times any client sent a request to the S&F.
|
||||
var requests: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Number of times the history was requested.
|
||||
var requestsHistory: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Is the heartbeat enabled on the server?
|
||||
var heartbeat: Bool = false
|
||||
|
||||
///
|
||||
/// Is the heartbeat enabled on the server?
|
||||
var returnMax: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Is the heartbeat enabled on the server?
|
||||
var returnWindow: UInt32 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
struct History {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Number of that will be sent to the client
|
||||
var historyMessages: UInt32 = 0
|
||||
|
||||
///
|
||||
/// The window of messages that was used to filter the history client requested
|
||||
var window: UInt32 = 0
|
||||
|
||||
///
|
||||
/// The window of messages that was used to filter the history client requested
|
||||
var lastRequest: UInt32 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
struct Heartbeat {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Number of that will be sent to the client
|
||||
var period: UInt32 = 0
|
||||
|
||||
///
|
||||
/// If set, this is not the primary Store & Forward router on the mesh
|
||||
var secondary: UInt32 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension StoreAndForward.RequestResponse: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [StoreAndForward.RequestResponse] = [
|
||||
.unset,
|
||||
.routerError,
|
||||
.routerHeartbeat,
|
||||
.routerPing,
|
||||
.routerPong,
|
||||
.routerBusy,
|
||||
.routerHistory,
|
||||
.routerStats,
|
||||
.clientError,
|
||||
.clientHistory,
|
||||
.clientStats,
|
||||
.clientPing,
|
||||
.clientPong,
|
||||
.clientAbort,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension StoreAndForward: @unchecked Sendable {}
|
||||
extension StoreAndForward.OneOf_Variant: @unchecked Sendable {}
|
||||
extension StoreAndForward.RequestResponse: @unchecked Sendable {}
|
||||
extension StoreAndForward.Statistics: @unchecked Sendable {}
|
||||
extension StoreAndForward.History: @unchecked Sendable {}
|
||||
extension StoreAndForward.Heartbeat: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".StoreAndForward"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "rr"),
|
||||
2: .same(proto: "stats"),
|
||||
3: .same(proto: "history"),
|
||||
4: .same(proto: "heartbeat"),
|
||||
5: .same(proto: "empty"),
|
||||
]
|
||||
|
||||
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.decodeSingularEnumField(value: &self.rr) }()
|
||||
case 2: try {
|
||||
var v: StoreAndForward.Statistics?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .stats(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .stats(v)
|
||||
}
|
||||
}()
|
||||
case 3: try {
|
||||
var v: StoreAndForward.History?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .history(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .history(v)
|
||||
}
|
||||
}()
|
||||
case 4: try {
|
||||
var v: StoreAndForward.Heartbeat?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .heartbeat(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .heartbeat(v)
|
||||
}
|
||||
}()
|
||||
case 5: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
if let v = v {
|
||||
if self.variant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .empty(v)
|
||||
}
|
||||
}()
|
||||
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
|
||||
if self.rr != .unset {
|
||||
try visitor.visitSingularEnumField(value: self.rr, fieldNumber: 1)
|
||||
}
|
||||
switch self.variant {
|
||||
case .stats?: try {
|
||||
guard case .stats(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}()
|
||||
case .history?: try {
|
||||
guard case .history(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}()
|
||||
case .heartbeat?: try {
|
||||
guard case .heartbeat(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
}()
|
||||
case .empty?: try {
|
||||
guard case .empty(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 5)
|
||||
}()
|
||||
case nil: break
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForward, rhs: StoreAndForward) -> Bool {
|
||||
if lhs.rr != rhs.rr {return false}
|
||||
if lhs.variant != rhs.variant {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension StoreAndForward.RequestResponse: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "UNSET"),
|
||||
1: .same(proto: "ROUTER_ERROR"),
|
||||
2: .same(proto: "ROUTER_HEARTBEAT"),
|
||||
3: .same(proto: "ROUTER_PING"),
|
||||
4: .same(proto: "ROUTER_PONG"),
|
||||
5: .same(proto: "ROUTER_BUSY"),
|
||||
6: .same(proto: "ROUTER_HISTORY"),
|
||||
7: .same(proto: "ROUTER_STATS"),
|
||||
64: .same(proto: "CLIENT_ERROR"),
|
||||
65: .same(proto: "CLIENT_HISTORY"),
|
||||
66: .same(proto: "CLIENT_STATS"),
|
||||
67: .same(proto: "CLIENT_PING"),
|
||||
68: .same(proto: "CLIENT_PONG"),
|
||||
106: .same(proto: "CLIENT_ABORT"),
|
||||
]
|
||||
}
|
||||
|
||||
extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForward.protoMessageName + ".Statistics"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "messages_total"),
|
||||
2: .standard(proto: "messages_saved"),
|
||||
3: .standard(proto: "messages_max"),
|
||||
4: .standard(proto: "up_time"),
|
||||
5: .same(proto: "requests"),
|
||||
6: .standard(proto: "requests_history"),
|
||||
7: .same(proto: "heartbeat"),
|
||||
8: .standard(proto: "return_max"),
|
||||
9: .standard(proto: "return_window"),
|
||||
]
|
||||
|
||||
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.messagesTotal) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.messagesSaved) }()
|
||||
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.messagesMax) }()
|
||||
case 4: try { try decoder.decodeSingularUInt32Field(value: &self.upTime) }()
|
||||
case 5: try { try decoder.decodeSingularUInt32Field(value: &self.requests) }()
|
||||
case 6: try { try decoder.decodeSingularUInt32Field(value: &self.requestsHistory) }()
|
||||
case 7: try { try decoder.decodeSingularBoolField(value: &self.heartbeat) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.returnMax) }()
|
||||
case 9: try { try decoder.decodeSingularUInt32Field(value: &self.returnWindow) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.messagesTotal != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.messagesTotal, fieldNumber: 1)
|
||||
}
|
||||
if self.messagesSaved != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.messagesSaved, fieldNumber: 2)
|
||||
}
|
||||
if self.messagesMax != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.messagesMax, fieldNumber: 3)
|
||||
}
|
||||
if self.upTime != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.upTime, fieldNumber: 4)
|
||||
}
|
||||
if self.requests != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.requests, fieldNumber: 5)
|
||||
}
|
||||
if self.requestsHistory != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.requestsHistory, fieldNumber: 6)
|
||||
}
|
||||
if self.heartbeat != false {
|
||||
try visitor.visitSingularBoolField(value: self.heartbeat, fieldNumber: 7)
|
||||
}
|
||||
if self.returnMax != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.returnMax, fieldNumber: 8)
|
||||
}
|
||||
if self.returnWindow != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.returnWindow, fieldNumber: 9)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForward.Statistics, rhs: StoreAndForward.Statistics) -> Bool {
|
||||
if lhs.messagesTotal != rhs.messagesTotal {return false}
|
||||
if lhs.messagesSaved != rhs.messagesSaved {return false}
|
||||
if lhs.messagesMax != rhs.messagesMax {return false}
|
||||
if lhs.upTime != rhs.upTime {return false}
|
||||
if lhs.requests != rhs.requests {return false}
|
||||
if lhs.requestsHistory != rhs.requestsHistory {return false}
|
||||
if lhs.heartbeat != rhs.heartbeat {return false}
|
||||
if lhs.returnMax != rhs.returnMax {return false}
|
||||
if lhs.returnWindow != rhs.returnWindow {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension StoreAndForward.History: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForward.protoMessageName + ".History"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "history_messages"),
|
||||
2: .same(proto: "window"),
|
||||
3: .standard(proto: "last_request"),
|
||||
]
|
||||
|
||||
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.historyMessages) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.window) }()
|
||||
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.lastRequest) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.historyMessages != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.historyMessages, fieldNumber: 1)
|
||||
}
|
||||
if self.window != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.window, fieldNumber: 2)
|
||||
}
|
||||
if self.lastRequest != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.lastRequest, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForward.History, rhs: StoreAndForward.History) -> Bool {
|
||||
if lhs.historyMessages != rhs.historyMessages {return false}
|
||||
if lhs.window != rhs.window {return false}
|
||||
if lhs.lastRequest != rhs.lastRequest {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension StoreAndForward.Heartbeat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = StoreAndForward.protoMessageName + ".Heartbeat"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "period"),
|
||||
2: .same(proto: "secondary"),
|
||||
]
|
||||
|
||||
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.period) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.secondary) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.period != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.period, fieldNumber: 1)
|
||||
}
|
||||
if self.secondary != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.secondary, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: StoreAndForward.Heartbeat, rhs: StoreAndForward.Heartbeat) -> Bool {
|
||||
if lhs.period != rhs.period {return false}
|
||||
if lhs.secondary != rhs.secondary {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
700
Meshtastic/Protobufs/meshtastic/telemetry.pb.swift
Normal file
700
Meshtastic/Protobufs/meshtastic/telemetry.pb.swift
Normal file
|
|
@ -0,0 +1,700 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/telemetry.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
|
||||
}
|
||||
|
||||
///
|
||||
/// Supported I2C Sensors for telemetry in Meshtastic
|
||||
enum TelemetrySensorType: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// No external telemetry sensor explicitly set
|
||||
case sensorUnset // = 0
|
||||
|
||||
///
|
||||
/// High accuracy temperature, pressure, humidity
|
||||
case bme280 // = 1
|
||||
|
||||
///
|
||||
/// High accuracy temperature, pressure, humidity, and air resistance
|
||||
case bme680 // = 2
|
||||
|
||||
///
|
||||
/// Very high accuracy temperature
|
||||
case mcp9808 // = 3
|
||||
|
||||
///
|
||||
/// Moderate accuracy current and voltage
|
||||
case ina260 // = 4
|
||||
|
||||
///
|
||||
/// Moderate accuracy current and voltage
|
||||
case ina219 // = 5
|
||||
|
||||
///
|
||||
/// High accuracy temperature and pressure
|
||||
case bmp280 // = 6
|
||||
|
||||
///
|
||||
/// High accuracy temperature and humidity
|
||||
case shtc3 // = 7
|
||||
|
||||
///
|
||||
/// High accuracy pressure
|
||||
case lps22 // = 8
|
||||
|
||||
///
|
||||
/// 3-Axis magnetic sensor
|
||||
case qmc6310 // = 9
|
||||
|
||||
///
|
||||
/// 6-Axis inertial measurement sensor
|
||||
case qmi8658 // = 10
|
||||
|
||||
///
|
||||
/// 3-Axis magnetic sensor
|
||||
case qmc5883L // = 11
|
||||
|
||||
///
|
||||
/// High accuracy temperature and humidity
|
||||
case sht31 // = 12
|
||||
|
||||
///
|
||||
/// PM2.5 air quality sensor
|
||||
case pmsa003I // = 13
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .sensorUnset
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .sensorUnset
|
||||
case 1: self = .bme280
|
||||
case 2: self = .bme680
|
||||
case 3: self = .mcp9808
|
||||
case 4: self = .ina260
|
||||
case 5: self = .ina219
|
||||
case 6: self = .bmp280
|
||||
case 7: self = .shtc3
|
||||
case 8: self = .lps22
|
||||
case 9: self = .qmc6310
|
||||
case 10: self = .qmi8658
|
||||
case 11: self = .qmc5883L
|
||||
case 12: self = .sht31
|
||||
case 13: self = .pmsa003I
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .sensorUnset: return 0
|
||||
case .bme280: return 1
|
||||
case .bme680: return 2
|
||||
case .mcp9808: return 3
|
||||
case .ina260: return 4
|
||||
case .ina219: return 5
|
||||
case .bmp280: return 6
|
||||
case .shtc3: return 7
|
||||
case .lps22: return 8
|
||||
case .qmc6310: return 9
|
||||
case .qmi8658: return 10
|
||||
case .qmc5883L: return 11
|
||||
case .sht31: return 12
|
||||
case .pmsa003I: return 13
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension TelemetrySensorType: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [TelemetrySensorType] = [
|
||||
.sensorUnset,
|
||||
.bme280,
|
||||
.bme680,
|
||||
.mcp9808,
|
||||
.ina260,
|
||||
.ina219,
|
||||
.bmp280,
|
||||
.shtc3,
|
||||
.lps22,
|
||||
.qmc6310,
|
||||
.qmi8658,
|
||||
.qmc5883L,
|
||||
.sht31,
|
||||
.pmsa003I,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
///
|
||||
/// Key native device metrics such as battery level
|
||||
struct DeviceMetrics {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// 1-100 (0 means powered)
|
||||
var batteryLevel: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Voltage measured
|
||||
var voltage: Float = 0
|
||||
|
||||
///
|
||||
/// Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise).
|
||||
var channelUtilization: Float = 0
|
||||
|
||||
///
|
||||
/// Percent of airtime for transmission used within the last hour.
|
||||
var airUtilTx: Float = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// Weather station or other environmental metrics
|
||||
struct EnvironmentMetrics {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Temperature measured
|
||||
var temperature: Float = 0
|
||||
|
||||
///
|
||||
/// Relative humidity percent measured
|
||||
var relativeHumidity: Float = 0
|
||||
|
||||
///
|
||||
/// Barometric pressure in hPA measured
|
||||
var barometricPressure: Float = 0
|
||||
|
||||
///
|
||||
/// Gas resistance in mOhm measured
|
||||
var gasResistance: Float = 0
|
||||
|
||||
///
|
||||
/// Voltage measured
|
||||
var voltage: Float = 0
|
||||
|
||||
///
|
||||
/// Current measured
|
||||
var current: Float = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// Air quality metrics
|
||||
struct AirQualityMetrics {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// Concentration Units Standard PM1.0
|
||||
var pm10Standard: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Concentration Units Standard PM2.5
|
||||
var pm25Standard: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Concentration Units Standard PM10.0
|
||||
var pm100Standard: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Concentration Units Environmental PM1.0
|
||||
var pm10Environmental: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Concentration Units Environmental PM2.5
|
||||
var pm25Environmental: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Concentration Units Environmental PM10.0
|
||||
var pm100Environmental: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 0.3um Particle Count
|
||||
var particles03Um: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 0.5um Particle Count
|
||||
var particles05Um: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 1.0um Particle Count
|
||||
var particles10Um: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 2.5um Particle Count
|
||||
var particles25Um: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 5.0um Particle Count
|
||||
var particles50Um: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 10.0um Particle Count
|
||||
var particles100Um: UInt32 = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// Types of Measurements the telemetry module is equipped to handle
|
||||
struct Telemetry {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// This is usually not sent over the mesh (to save space), but it is sent
|
||||
/// from the phone so that the local device can set its RTC If it is sent over
|
||||
/// the mesh (because there are devices on the mesh without GPS), it will only
|
||||
/// be sent by devices which has a hardware GPS clock (IE Mobile Phone).
|
||||
/// seconds since 1970
|
||||
var time: UInt32 = 0
|
||||
|
||||
var variant: Telemetry.OneOf_Variant? = nil
|
||||
|
||||
///
|
||||
/// Key native device metrics such as battery level
|
||||
var deviceMetrics: DeviceMetrics {
|
||||
get {
|
||||
if case .deviceMetrics(let v)? = variant {return v}
|
||||
return DeviceMetrics()
|
||||
}
|
||||
set {variant = .deviceMetrics(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Weather station or other environmental metrics
|
||||
var environmentMetrics: EnvironmentMetrics {
|
||||
get {
|
||||
if case .environmentMetrics(let v)? = variant {return v}
|
||||
return EnvironmentMetrics()
|
||||
}
|
||||
set {variant = .environmentMetrics(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Air quality metrics
|
||||
var airQualityMetrics: AirQualityMetrics {
|
||||
get {
|
||||
if case .airQualityMetrics(let v)? = variant {return v}
|
||||
return AirQualityMetrics()
|
||||
}
|
||||
set {variant = .airQualityMetrics(newValue)}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
enum OneOf_Variant: Equatable {
|
||||
///
|
||||
/// Key native device metrics such as battery level
|
||||
case deviceMetrics(DeviceMetrics)
|
||||
///
|
||||
/// Weather station or other environmental metrics
|
||||
case environmentMetrics(EnvironmentMetrics)
|
||||
///
|
||||
/// Air quality metrics
|
||||
case airQualityMetrics(AirQualityMetrics)
|
||||
|
||||
#if !swift(>=4.1)
|
||||
static func ==(lhs: Telemetry.OneOf_Variant, rhs: Telemetry.OneOf_Variant) -> Bool {
|
||||
// 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 (lhs, rhs) {
|
||||
case (.deviceMetrics, .deviceMetrics): return {
|
||||
guard case .deviceMetrics(let l) = lhs, case .deviceMetrics(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.environmentMetrics, .environmentMetrics): return {
|
||||
guard case .environmentMetrics(let l) = lhs, case .environmentMetrics(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.airQualityMetrics, .airQualityMetrics): return {
|
||||
guard case .airQualityMetrics(let l) = lhs, case .airQualityMetrics(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension TelemetrySensorType: @unchecked Sendable {}
|
||||
extension DeviceMetrics: @unchecked Sendable {}
|
||||
extension EnvironmentMetrics: @unchecked Sendable {}
|
||||
extension AirQualityMetrics: @unchecked Sendable {}
|
||||
extension Telemetry: @unchecked Sendable {}
|
||||
extension Telemetry.OneOf_Variant: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension TelemetrySensorType: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "SENSOR_UNSET"),
|
||||
1: .same(proto: "BME280"),
|
||||
2: .same(proto: "BME680"),
|
||||
3: .same(proto: "MCP9808"),
|
||||
4: .same(proto: "INA260"),
|
||||
5: .same(proto: "INA219"),
|
||||
6: .same(proto: "BMP280"),
|
||||
7: .same(proto: "SHTC3"),
|
||||
8: .same(proto: "LPS22"),
|
||||
9: .same(proto: "QMC6310"),
|
||||
10: .same(proto: "QMI8658"),
|
||||
11: .same(proto: "QMC5883L"),
|
||||
12: .same(proto: "SHT31"),
|
||||
13: .same(proto: "PMSA003I"),
|
||||
]
|
||||
}
|
||||
|
||||
extension DeviceMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".DeviceMetrics"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "battery_level"),
|
||||
2: .same(proto: "voltage"),
|
||||
3: .standard(proto: "channel_utilization"),
|
||||
4: .standard(proto: "air_util_tx"),
|
||||
]
|
||||
|
||||
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.batteryLevel) }()
|
||||
case 2: try { try decoder.decodeSingularFloatField(value: &self.voltage) }()
|
||||
case 3: try { try decoder.decodeSingularFloatField(value: &self.channelUtilization) }()
|
||||
case 4: try { try decoder.decodeSingularFloatField(value: &self.airUtilTx) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.batteryLevel != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.batteryLevel, fieldNumber: 1)
|
||||
}
|
||||
if self.voltage != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.voltage, fieldNumber: 2)
|
||||
}
|
||||
if self.channelUtilization != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.channelUtilization, fieldNumber: 3)
|
||||
}
|
||||
if self.airUtilTx != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.airUtilTx, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: DeviceMetrics, rhs: DeviceMetrics) -> Bool {
|
||||
if lhs.batteryLevel != rhs.batteryLevel {return false}
|
||||
if lhs.voltage != rhs.voltage {return false}
|
||||
if lhs.channelUtilization != rhs.channelUtilization {return false}
|
||||
if lhs.airUtilTx != rhs.airUtilTx {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".EnvironmentMetrics"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "temperature"),
|
||||
2: .standard(proto: "relative_humidity"),
|
||||
3: .standard(proto: "barometric_pressure"),
|
||||
4: .standard(proto: "gas_resistance"),
|
||||
5: .same(proto: "voltage"),
|
||||
6: .same(proto: "current"),
|
||||
]
|
||||
|
||||
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.decodeSingularFloatField(value: &self.temperature) }()
|
||||
case 2: try { try decoder.decodeSingularFloatField(value: &self.relativeHumidity) }()
|
||||
case 3: try { try decoder.decodeSingularFloatField(value: &self.barometricPressure) }()
|
||||
case 4: try { try decoder.decodeSingularFloatField(value: &self.gasResistance) }()
|
||||
case 5: try { try decoder.decodeSingularFloatField(value: &self.voltage) }()
|
||||
case 6: try { try decoder.decodeSingularFloatField(value: &self.current) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.temperature != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.temperature, fieldNumber: 1)
|
||||
}
|
||||
if self.relativeHumidity != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.relativeHumidity, fieldNumber: 2)
|
||||
}
|
||||
if self.barometricPressure != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.barometricPressure, fieldNumber: 3)
|
||||
}
|
||||
if self.gasResistance != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.gasResistance, fieldNumber: 4)
|
||||
}
|
||||
if self.voltage != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.voltage, fieldNumber: 5)
|
||||
}
|
||||
if self.current != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.current, fieldNumber: 6)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: EnvironmentMetrics, rhs: EnvironmentMetrics) -> Bool {
|
||||
if lhs.temperature != rhs.temperature {return false}
|
||||
if lhs.relativeHumidity != rhs.relativeHumidity {return false}
|
||||
if lhs.barometricPressure != rhs.barometricPressure {return false}
|
||||
if lhs.gasResistance != rhs.gasResistance {return false}
|
||||
if lhs.voltage != rhs.voltage {return false}
|
||||
if lhs.current != rhs.current {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension AirQualityMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".AirQualityMetrics"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "pm10_standard"),
|
||||
2: .standard(proto: "pm25_standard"),
|
||||
3: .standard(proto: "pm100_standard"),
|
||||
4: .standard(proto: "pm10_environmental"),
|
||||
5: .standard(proto: "pm25_environmental"),
|
||||
6: .standard(proto: "pm100_environmental"),
|
||||
7: .standard(proto: "particles_03um"),
|
||||
8: .standard(proto: "particles_05um"),
|
||||
9: .standard(proto: "particles_10um"),
|
||||
10: .standard(proto: "particles_25um"),
|
||||
11: .standard(proto: "particles_50um"),
|
||||
12: .standard(proto: "particles_100um"),
|
||||
]
|
||||
|
||||
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.pm10Standard) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.pm25Standard) }()
|
||||
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.pm100Standard) }()
|
||||
case 4: try { try decoder.decodeSingularUInt32Field(value: &self.pm10Environmental) }()
|
||||
case 5: try { try decoder.decodeSingularUInt32Field(value: &self.pm25Environmental) }()
|
||||
case 6: try { try decoder.decodeSingularUInt32Field(value: &self.pm100Environmental) }()
|
||||
case 7: try { try decoder.decodeSingularUInt32Field(value: &self.particles03Um) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.particles05Um) }()
|
||||
case 9: try { try decoder.decodeSingularUInt32Field(value: &self.particles10Um) }()
|
||||
case 10: try { try decoder.decodeSingularUInt32Field(value: &self.particles25Um) }()
|
||||
case 11: try { try decoder.decodeSingularUInt32Field(value: &self.particles50Um) }()
|
||||
case 12: try { try decoder.decodeSingularUInt32Field(value: &self.particles100Um) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.pm10Standard != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.pm10Standard, fieldNumber: 1)
|
||||
}
|
||||
if self.pm25Standard != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.pm25Standard, fieldNumber: 2)
|
||||
}
|
||||
if self.pm100Standard != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.pm100Standard, fieldNumber: 3)
|
||||
}
|
||||
if self.pm10Environmental != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.pm10Environmental, fieldNumber: 4)
|
||||
}
|
||||
if self.pm25Environmental != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.pm25Environmental, fieldNumber: 5)
|
||||
}
|
||||
if self.pm100Environmental != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.pm100Environmental, fieldNumber: 6)
|
||||
}
|
||||
if self.particles03Um != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.particles03Um, fieldNumber: 7)
|
||||
}
|
||||
if self.particles05Um != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.particles05Um, fieldNumber: 8)
|
||||
}
|
||||
if self.particles10Um != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.particles10Um, fieldNumber: 9)
|
||||
}
|
||||
if self.particles25Um != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.particles25Um, fieldNumber: 10)
|
||||
}
|
||||
if self.particles50Um != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.particles50Um, fieldNumber: 11)
|
||||
}
|
||||
if self.particles100Um != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.particles100Um, fieldNumber: 12)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: AirQualityMetrics, rhs: AirQualityMetrics) -> Bool {
|
||||
if lhs.pm10Standard != rhs.pm10Standard {return false}
|
||||
if lhs.pm25Standard != rhs.pm25Standard {return false}
|
||||
if lhs.pm100Standard != rhs.pm100Standard {return false}
|
||||
if lhs.pm10Environmental != rhs.pm10Environmental {return false}
|
||||
if lhs.pm25Environmental != rhs.pm25Environmental {return false}
|
||||
if lhs.pm100Environmental != rhs.pm100Environmental {return false}
|
||||
if lhs.particles03Um != rhs.particles03Um {return false}
|
||||
if lhs.particles05Um != rhs.particles05Um {return false}
|
||||
if lhs.particles10Um != rhs.particles10Um {return false}
|
||||
if lhs.particles25Um != rhs.particles25Um {return false}
|
||||
if lhs.particles50Um != rhs.particles50Um {return false}
|
||||
if lhs.particles100Um != rhs.particles100Um {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".Telemetry"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "time"),
|
||||
2: .standard(proto: "device_metrics"),
|
||||
3: .standard(proto: "environment_metrics"),
|
||||
4: .standard(proto: "air_quality_metrics"),
|
||||
]
|
||||
|
||||
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.decodeSingularFixed32Field(value: &self.time) }()
|
||||
case 2: try {
|
||||
var v: DeviceMetrics?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .deviceMetrics(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .deviceMetrics(v)
|
||||
}
|
||||
}()
|
||||
case 3: try {
|
||||
var v: EnvironmentMetrics?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .environmentMetrics(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .environmentMetrics(v)
|
||||
}
|
||||
}()
|
||||
case 4: try {
|
||||
var v: AirQualityMetrics?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .airQualityMetrics(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .airQualityMetrics(v)
|
||||
}
|
||||
}()
|
||||
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
|
||||
if self.time != 0 {
|
||||
try visitor.visitSingularFixed32Field(value: self.time, fieldNumber: 1)
|
||||
}
|
||||
switch self.variant {
|
||||
case .deviceMetrics?: try {
|
||||
guard case .deviceMetrics(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}()
|
||||
case .environmentMetrics?: try {
|
||||
guard case .environmentMetrics(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}()
|
||||
case .airQualityMetrics?: try {
|
||||
guard case .airQualityMetrics(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
}()
|
||||
case nil: break
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Telemetry, rhs: Telemetry) -> Bool {
|
||||
if lhs.time != rhs.time {return false}
|
||||
if lhs.variant != rhs.variant {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
175
Meshtastic/Protobufs/meshtastic/xmodem.pb.swift
Normal file
175
Meshtastic/Protobufs/meshtastic/xmodem.pb.swift
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: meshtastic/xmodem.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
|
||||
}
|
||||
|
||||
struct XModem {
|
||||
// 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.
|
||||
|
||||
var control: XModem.Control = .nul
|
||||
|
||||
var seq: UInt32 = 0
|
||||
|
||||
var crc16: UInt32 = 0
|
||||
|
||||
var buffer: Data = Data()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
enum Control: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
case nul // = 0
|
||||
case soh // = 1
|
||||
case stx // = 2
|
||||
case eot // = 4
|
||||
case ack // = 6
|
||||
case nak // = 21
|
||||
case can // = 24
|
||||
case ctrlz // = 26
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .nul
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .nul
|
||||
case 1: self = .soh
|
||||
case 2: self = .stx
|
||||
case 4: self = .eot
|
||||
case 6: self = .ack
|
||||
case 21: self = .nak
|
||||
case 24: self = .can
|
||||
case 26: self = .ctrlz
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .nul: return 0
|
||||
case .soh: return 1
|
||||
case .stx: return 2
|
||||
case .eot: return 4
|
||||
case .ack: return 6
|
||||
case .nak: return 21
|
||||
case .can: return 24
|
||||
case .ctrlz: return 26
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension XModem.Control: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [XModem.Control] = [
|
||||
.nul,
|
||||
.soh,
|
||||
.stx,
|
||||
.eot,
|
||||
.ack,
|
||||
.nak,
|
||||
.can,
|
||||
.ctrlz,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension XModem: @unchecked Sendable {}
|
||||
extension XModem.Control: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "meshtastic"
|
||||
|
||||
extension XModem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = _protobuf_package + ".XModem"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "control"),
|
||||
2: .same(proto: "seq"),
|
||||
3: .same(proto: "crc16"),
|
||||
4: .same(proto: "buffer"),
|
||||
]
|
||||
|
||||
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.decodeSingularEnumField(value: &self.control) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.seq) }()
|
||||
case 3: try { try decoder.decodeSingularUInt32Field(value: &self.crc16) }()
|
||||
case 4: try { try decoder.decodeSingularBytesField(value: &self.buffer) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.control != .nul {
|
||||
try visitor.visitSingularEnumField(value: self.control, fieldNumber: 1)
|
||||
}
|
||||
if self.seq != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.seq, fieldNumber: 2)
|
||||
}
|
||||
if self.crc16 != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.crc16, fieldNumber: 3)
|
||||
}
|
||||
if !self.buffer.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.buffer, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: XModem, rhs: XModem) -> Bool {
|
||||
if lhs.control != rhs.control {return false}
|
||||
if lhs.seq != rhs.seq {return false}
|
||||
if lhs.crc16 != rhs.crc16 {return false}
|
||||
if lhs.buffer != rhs.buffer {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension XModem.Control: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "NUL"),
|
||||
1: .same(proto: "SOH"),
|
||||
2: .same(proto: "STX"),
|
||||
4: .same(proto: "EOT"),
|
||||
6: .same(proto: "ACK"),
|
||||
21: .same(proto: "NAK"),
|
||||
24: .same(proto: "CAN"),
|
||||
26: .same(proto: "CTRLZ"),
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue