mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Update Protobufs
Add GPS Timestamp to LocationHelper Use GPS Timestamp for position updates
This commit is contained in:
parent
590f1fd783
commit
7e163c863c
9 changed files with 1783 additions and 1471 deletions
|
|
@ -6,8 +6,8 @@
|
|||
"repositoryURL": "https://github.com/stephencelis/SQLite.swift.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "4d543d811ee644fa4cc4bfa0be996b4dd6ba0f54",
|
||||
"version": "0.13.3"
|
||||
"revision": "60a65015f6402b7c34b9a924f755ca0a73afeeaa",
|
||||
"version": "0.13.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1057,7 +1057,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
|
||||
var decodedInfo = FromRadio()
|
||||
|
||||
decodedInfo = try! FromRadio(serializedData: characteristic.value!)
|
||||
//decodedInfo = try! FromRadio(serializedData: characteristic.value!)
|
||||
|
||||
default:
|
||||
print("🚨 Unhandled Characteristic UUID: \(characteristic.uuid)")
|
||||
|
|
@ -1216,7 +1216,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
var positionPacket = Position()
|
||||
positionPacket.latitudeI = Int32(LocationHelper.currentLocation.latitude * 1e7)
|
||||
positionPacket.longitudeI = Int32(LocationHelper.currentLocation.longitude * 1e7)
|
||||
positionPacket.time = UInt32(Date().timeIntervalSince1970)
|
||||
positionPacket.time = UInt32(LocationHelper.currentTimestamp.timeIntervalSince1970)
|
||||
positionPacket.altitude = Int32(LocationHelper.currentAltitude)
|
||||
|
||||
var meshPacket = MeshPacket()
|
||||
|
|
@ -1274,7 +1274,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
public func getSettings() -> Bool {
|
||||
|
||||
var adminPacket = AdminMessage()
|
||||
adminPacket.getRadioRequest = true
|
||||
//adminPacket.getRadioRequest = true
|
||||
|
||||
var meshPacket: MeshPacket = MeshPacket()
|
||||
meshPacket.to = UInt32(connectedPeripheral.num)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,16 @@ class LocationHelper: NSObject, ObservableObject {
|
|||
}
|
||||
return altitude
|
||||
}
|
||||
|
||||
static var currentTimestamp: Date {
|
||||
|
||||
guard let timestamp = shared.locationManager.location?.timestamp else {
|
||||
return Date.now
|
||||
}
|
||||
return timestamp
|
||||
}
|
||||
|
||||
|
||||
|
||||
private let locationManager = CLLocationManager()
|
||||
|
||||
|
|
|
|||
|
|
@ -33,16 +33,6 @@ struct AdminMessage {
|
|||
/// TODO: REPLACE
|
||||
var variant: AdminMessage.OneOf_Variant? = nil
|
||||
|
||||
///
|
||||
/// Set the radio provisioning for this node
|
||||
var setRadio: RadioConfig {
|
||||
get {
|
||||
if case .setRadio(let v)? = variant {return v}
|
||||
return RadioConfig()
|
||||
}
|
||||
set {variant = .setRadio(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Set the owner for this node
|
||||
var setOwner: User {
|
||||
|
|
@ -67,26 +57,6 @@ struct AdminMessage {
|
|||
set {variant = .setChannel(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Send the current RadioConfig in the response to this message.
|
||||
var getRadioRequest: Bool {
|
||||
get {
|
||||
if case .getRadioRequest(let v)? = variant {return v}
|
||||
return false
|
||||
}
|
||||
set {variant = .getRadioRequest(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var getRadioResponse: RadioConfig {
|
||||
get {
|
||||
if case .getRadioResponse(let v)? = variant {return v}
|
||||
return RadioConfig()
|
||||
}
|
||||
set {variant = .getRadioResponse(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Send the specified channel in the response to this message
|
||||
/// NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present)
|
||||
|
|
@ -387,9 +357,6 @@ struct AdminMessage {
|
|||
///
|
||||
/// TODO: REPLACE
|
||||
enum OneOf_Variant: Equatable {
|
||||
///
|
||||
/// Set the radio provisioning for this node
|
||||
case setRadio(RadioConfig)
|
||||
///
|
||||
/// Set the owner for this node
|
||||
case setOwner(User)
|
||||
|
|
@ -401,12 +368,6 @@ struct AdminMessage {
|
|||
/// If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically.
|
||||
case setChannel(Channel)
|
||||
///
|
||||
/// Send the current RadioConfig in the response to this message.
|
||||
case getRadioRequest(Bool)
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case getRadioResponse(RadioConfig)
|
||||
///
|
||||
/// Send the specified channel in the response to this message
|
||||
/// NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present)
|
||||
case getChannelRequest(UInt32)
|
||||
|
|
@ -505,10 +466,6 @@ struct AdminMessage {
|
|||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch (lhs, rhs) {
|
||||
case (.setRadio, .setRadio): return {
|
||||
guard case .setRadio(let l) = lhs, case .setRadio(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.setOwner, .setOwner): return {
|
||||
guard case .setOwner(let l) = lhs, case .setOwner(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
|
|
@ -517,14 +474,6 @@ struct AdminMessage {
|
|||
guard case .setChannel(let l) = lhs, case .setChannel(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.getRadioRequest, .getRadioRequest): return {
|
||||
guard case .getRadioRequest(let l) = lhs, case .getRadioRequest(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.getRadioResponse, .getRadioResponse): return {
|
||||
guard case .getRadioResponse(let l) = lhs, case .getRadioResponse(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.getChannelRequest, .getChannelRequest): return {
|
||||
guard case .getChannelRequest(let l) = lhs, case .getChannelRequest(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
|
|
@ -658,7 +607,7 @@ struct AdminMessage {
|
|||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case gpsConfig // = 1
|
||||
case positionConfig // = 1
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
|
|
@ -684,7 +633,7 @@ struct AdminMessage {
|
|||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .deviceConfig
|
||||
case 1: self = .gpsConfig
|
||||
case 1: self = .positionConfig
|
||||
case 2: self = .powerConfig
|
||||
case 3: self = .wifiConfig
|
||||
case 4: self = .displayConfig
|
||||
|
|
@ -696,7 +645,7 @@ struct AdminMessage {
|
|||
var rawValue: Int {
|
||||
switch self {
|
||||
case .deviceConfig: return 0
|
||||
case .gpsConfig: return 1
|
||||
case .positionConfig: return 1
|
||||
case .powerConfig: return 2
|
||||
case .wifiConfig: return 3
|
||||
case .displayConfig: return 4
|
||||
|
|
@ -782,7 +731,7 @@ extension AdminMessage.ConfigType: CaseIterable {
|
|||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [AdminMessage.ConfigType] = [
|
||||
.deviceConfig,
|
||||
.gpsConfig,
|
||||
.positionConfig,
|
||||
.powerConfig,
|
||||
.wifiConfig,
|
||||
.displayConfig,
|
||||
|
|
@ -817,11 +766,8 @@ extension AdminMessage.ModuleConfigType: @unchecked Sendable {}
|
|||
extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "AdminMessage"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "set_radio"),
|
||||
2: .standard(proto: "set_owner"),
|
||||
3: .standard(proto: "set_channel"),
|
||||
4: .standard(proto: "get_radio_request"),
|
||||
5: .standard(proto: "get_radio_response"),
|
||||
6: .standard(proto: "get_channel_request"),
|
||||
7: .standard(proto: "get_channel_response"),
|
||||
8: .standard(proto: "get_owner_request"),
|
||||
|
|
@ -859,19 +805,6 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
// 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 {
|
||||
var v: RadioConfig?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .setRadio(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .setRadio(v)
|
||||
}
|
||||
}()
|
||||
case 2: try {
|
||||
var v: User?
|
||||
var hadOneofValue = false
|
||||
|
|
@ -898,27 +831,6 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
self.variant = .setChannel(v)
|
||||
}
|
||||
}()
|
||||
case 4: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
if let v = v {
|
||||
if self.variant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .getRadioRequest(v)
|
||||
}
|
||||
}()
|
||||
case 5: try {
|
||||
var v: RadioConfig?
|
||||
var hadOneofValue = false
|
||||
if let current = self.variant {
|
||||
hadOneofValue = true
|
||||
if case .getRadioResponse(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.variant = .getRadioResponse(v)
|
||||
}
|
||||
}()
|
||||
case 6: try {
|
||||
var v: UInt32?
|
||||
try decoder.decodeSingularUInt32Field(value: &v)
|
||||
|
|
@ -1192,10 +1104,6 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
switch self.variant {
|
||||
case .setRadio?: try {
|
||||
guard case .setRadio(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}()
|
||||
case .setOwner?: try {
|
||||
guard case .setOwner(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
|
|
@ -1204,14 +1112,6 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
guard case .setChannel(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}()
|
||||
case .getRadioRequest?: try {
|
||||
guard case .getRadioRequest(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 4)
|
||||
}()
|
||||
case .getRadioResponse?: try {
|
||||
guard case .getRadioResponse(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
|
||||
}()
|
||||
case .getChannelRequest?: try {
|
||||
guard case .getChannelRequest(let v)? = self.variant else { preconditionFailure() }
|
||||
try visitor.visitSingularUInt32Field(value: v, fieldNumber: 6)
|
||||
|
|
@ -1343,7 +1243,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
extension AdminMessage.ConfigType: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "DEVICE_CONFIG"),
|
||||
1: .same(proto: "GPS_CONFIG"),
|
||||
1: .same(proto: "POSITION_CONFIG"),
|
||||
2: .same(proto: "POWER_CONFIG"),
|
||||
3: .same(proto: "WIFI_CONFIG"),
|
||||
4: .same(proto: "DISPLAY_CONFIG"),
|
||||
|
|
|
|||
|
|
@ -45,38 +45,6 @@ struct ChannelSettings {
|
|||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
///
|
||||
/// If zero then, use default max legal continuous power (ie. something that won't
|
||||
/// burn out the radio hardware)
|
||||
/// In most cases you should use zero here.
|
||||
/// Units are in dBm.
|
||||
var txPower: Int32 = 0
|
||||
|
||||
///
|
||||
/// Note: This is the 'old' mechanism for specifying channel parameters.
|
||||
/// Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH.
|
||||
/// As a heuristic: If bandwidth is specified, do not use modem_config.
|
||||
/// Because protobufs take ZERO space when the value is zero this works out nicely.
|
||||
/// This value is replaced by bandwidth/spread_factor/coding_rate.
|
||||
/// If you'd like to experiment with other options add them to MeshRadio.cpp in the device code.
|
||||
var modemConfig: ChannelSettings.ModemConfig = .vlongSlow
|
||||
|
||||
///
|
||||
/// Bandwidth in MHz
|
||||
/// Certain bandwidth numbers are 'special' and will be converted to the
|
||||
/// appropriate floating point value: 31 -> 31.25MHz
|
||||
var bandwidth: UInt32 = 0
|
||||
|
||||
///
|
||||
/// A number from 7 to 12.
|
||||
/// Indicates number of chirps per symbol as 1<<spread_factor.
|
||||
var spreadFactor: UInt32 = 0
|
||||
|
||||
///
|
||||
/// The denominator of the coding rate.
|
||||
/// ie for 4/8, the value is 8. 5/8 the value is 5.
|
||||
var codingRate: UInt32 = 0
|
||||
|
||||
///
|
||||
/// NOTE: this field is _independent_ and unrelated to the concepts in channel.proto.
|
||||
/// this is controlling the actual hardware frequency the radio is transmitting on.
|
||||
|
|
@ -119,7 +87,7 @@ struct ChannelSettings {
|
|||
/// 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 ModemConfig
|
||||
/// Where "X" is selected based on the English words listed above for ModemPreset
|
||||
var name: String = String()
|
||||
|
||||
///
|
||||
|
|
@ -146,93 +114,9 @@ struct ChannelSettings {
|
|||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
///
|
||||
/// Standard predefined channel settings
|
||||
/// Note: these mappings must match ModemConfigChoice in the device code.
|
||||
enum ModemConfig: SwiftProtobuf.Enum {
|
||||
typealias RawValue = Int
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case vlongSlow // = 0
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case longSlow // = 1
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case longFast // = 2
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case midSlow // = 3
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case midFast // = 4
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case shortSlow // = 5
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case shortFast // = 6
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
self = .vlongSlow
|
||||
}
|
||||
|
||||
init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .vlongSlow
|
||||
case 1: self = .longSlow
|
||||
case 2: self = .longFast
|
||||
case 3: self = .midSlow
|
||||
case 4: self = .midFast
|
||||
case 5: self = .shortSlow
|
||||
case 6: self = .shortFast
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
var rawValue: Int {
|
||||
switch self {
|
||||
case .vlongSlow: return 0
|
||||
case .longSlow: return 1
|
||||
case .longFast: return 2
|
||||
case .midSlow: return 3
|
||||
case .midFast: return 4
|
||||
case .shortSlow: return 5
|
||||
case .shortFast: return 6
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension ChannelSettings.ModemConfig: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
static var allCases: [ChannelSettings.ModemConfig] = [
|
||||
.vlongSlow,
|
||||
.longSlow,
|
||||
.longFast,
|
||||
.midSlow,
|
||||
.midFast,
|
||||
.shortSlow,
|
||||
.shortFast,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
///
|
||||
/// A pair of a channel number, mode and the (sharable) settings for that channel
|
||||
struct Channel {
|
||||
|
|
@ -334,7 +218,6 @@ extension Channel.Role: CaseIterable {
|
|||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension ChannelSettings: @unchecked Sendable {}
|
||||
extension ChannelSettings.ModemConfig: @unchecked Sendable {}
|
||||
extension Channel: @unchecked Sendable {}
|
||||
extension Channel.Role: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
|
@ -344,11 +227,6 @@ extension Channel.Role: @unchecked Sendable {}
|
|||
extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "ChannelSettings"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "tx_power"),
|
||||
3: .standard(proto: "modem_config"),
|
||||
6: .same(proto: "bandwidth"),
|
||||
7: .standard(proto: "spread_factor"),
|
||||
8: .standard(proto: "coding_rate"),
|
||||
9: .standard(proto: "channel_num"),
|
||||
4: .same(proto: "psk"),
|
||||
5: .same(proto: "name"),
|
||||
|
|
@ -363,13 +241,8 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
|
|||
// 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.txPower) }()
|
||||
case 3: try { try decoder.decodeSingularEnumField(value: &self.modemConfig) }()
|
||||
case 4: try { try decoder.decodeSingularBytesField(value: &self.psk) }()
|
||||
case 5: try { try decoder.decodeSingularStringField(value: &self.name) }()
|
||||
case 6: try { try decoder.decodeSingularUInt32Field(value: &self.bandwidth) }()
|
||||
case 7: try { try decoder.decodeSingularUInt32Field(value: &self.spreadFactor) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.codingRate) }()
|
||||
case 9: try { try decoder.decodeSingularUInt32Field(value: &self.channelNum) }()
|
||||
case 10: try { try decoder.decodeSingularFixed32Field(value: &self.id) }()
|
||||
case 16: try { try decoder.decodeSingularBoolField(value: &self.uplinkEnabled) }()
|
||||
|
|
@ -380,27 +253,12 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
|
|||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.txPower != 0 {
|
||||
try visitor.visitSingularInt32Field(value: self.txPower, fieldNumber: 1)
|
||||
}
|
||||
if self.modemConfig != .vlongSlow {
|
||||
try visitor.visitSingularEnumField(value: self.modemConfig, fieldNumber: 3)
|
||||
}
|
||||
if !self.psk.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.psk, fieldNumber: 4)
|
||||
}
|
||||
if !self.name.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.name, fieldNumber: 5)
|
||||
}
|
||||
if self.bandwidth != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.bandwidth, fieldNumber: 6)
|
||||
}
|
||||
if self.spreadFactor != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.spreadFactor, fieldNumber: 7)
|
||||
}
|
||||
if self.codingRate != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.codingRate, fieldNumber: 8)
|
||||
}
|
||||
if self.channelNum != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.channelNum, fieldNumber: 9)
|
||||
}
|
||||
|
|
@ -417,11 +275,6 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
|
|||
}
|
||||
|
||||
static func ==(lhs: ChannelSettings, rhs: ChannelSettings) -> Bool {
|
||||
if lhs.txPower != rhs.txPower {return false}
|
||||
if lhs.modemConfig != rhs.modemConfig {return false}
|
||||
if lhs.bandwidth != rhs.bandwidth {return false}
|
||||
if lhs.spreadFactor != rhs.spreadFactor {return false}
|
||||
if lhs.codingRate != rhs.codingRate {return false}
|
||||
if lhs.channelNum != rhs.channelNum {return false}
|
||||
if lhs.psk != rhs.psk {return false}
|
||||
if lhs.name != rhs.name {return false}
|
||||
|
|
@ -433,18 +286,6 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
|
|||
}
|
||||
}
|
||||
|
||||
extension ChannelSettings.ModemConfig: SwiftProtobuf._ProtoNameProviding {
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "VLongSlow"),
|
||||
1: .same(proto: "LongSlow"),
|
||||
2: .same(proto: "LongFast"),
|
||||
3: .same(proto: "MidSlow"),
|
||||
4: .same(proto: "MidFast"),
|
||||
5: .same(proto: "ShortSlow"),
|
||||
6: .same(proto: "ShortFast"),
|
||||
]
|
||||
}
|
||||
|
||||
extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "Channel"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -89,68 +89,81 @@ struct DeviceState {
|
|||
///
|
||||
/// Read only settings/info about this node
|
||||
var myNode: MyNodeInfo {
|
||||
get {return _myNode ?? MyNodeInfo()}
|
||||
set {_myNode = newValue}
|
||||
get {return _storage._myNode ?? MyNodeInfo()}
|
||||
set {_uniqueStorage()._myNode = newValue}
|
||||
}
|
||||
/// Returns true if `myNode` has been explicitly set.
|
||||
var hasMyNode: Bool {return self._myNode != nil}
|
||||
var hasMyNode: Bool {return _storage._myNode != nil}
|
||||
/// Clears the value of `myNode`. Subsequent reads from it will return its default value.
|
||||
mutating func clearMyNode() {self._myNode = nil}
|
||||
mutating func clearMyNode() {_uniqueStorage()._myNode = nil}
|
||||
|
||||
///
|
||||
/// My owner info
|
||||
var owner: User {
|
||||
get {return _owner ?? User()}
|
||||
set {_owner = newValue}
|
||||
get {return _storage._owner ?? User()}
|
||||
set {_uniqueStorage()._owner = newValue}
|
||||
}
|
||||
/// Returns true if `owner` has been explicitly set.
|
||||
var hasOwner: Bool {return self._owner != nil}
|
||||
var hasOwner: Bool {return _storage._owner != nil}
|
||||
/// Clears the value of `owner`. Subsequent reads from it will return its default value.
|
||||
mutating func clearOwner() {self._owner = nil}
|
||||
mutating func clearOwner() {_uniqueStorage()._owner = nil}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var nodeDb: [NodeInfo] = []
|
||||
var nodeDb: [NodeInfo] {
|
||||
get {return _storage._nodeDb}
|
||||
set {_uniqueStorage()._nodeDb = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// Received packets saved for delivery to the phone
|
||||
var receiveQueue: [MeshPacket] = []
|
||||
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 = 0
|
||||
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 _rxTextMessage ?? MeshPacket()}
|
||||
set {_rxTextMessage = newValue}
|
||||
get {return _storage._rxTextMessage ?? MeshPacket()}
|
||||
set {_uniqueStorage()._rxTextMessage = newValue}
|
||||
}
|
||||
/// Returns true if `rxTextMessage` has been explicitly set.
|
||||
var hasRxTextMessage: Bool {return self._rxTextMessage != nil}
|
||||
var hasRxTextMessage: Bool {return _storage._rxTextMessage != nil}
|
||||
/// Clears the value of `rxTextMessage`. Subsequent reads from it will return its default value.
|
||||
mutating func clearRxTextMessage() {self._rxTextMessage = nil}
|
||||
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 = false
|
||||
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 = false
|
||||
var didGpsReset: Bool {
|
||||
get {return _storage._didGpsReset}
|
||||
set {_uniqueStorage()._didGpsReset = newValue}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _myNode: MyNodeInfo? = nil
|
||||
fileprivate var _owner: User? = nil
|
||||
fileprivate var _rxTextMessage: MeshPacket? = nil
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -232,66 +245,112 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati
|
|||
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 {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._myNode) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &self._owner) }()
|
||||
case 4: try { try decoder.decodeRepeatedMessageField(value: &self.nodeDb) }()
|
||||
case 5: try { try decoder.decodeRepeatedMessageField(value: &self.receiveQueue) }()
|
||||
case 7: try { try decoder.decodeSingularMessageField(value: &self._rxTextMessage) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.version) }()
|
||||
case 9: try { try decoder.decodeSingularBoolField(value: &self.noSave) }()
|
||||
case 11: try { try decoder.decodeSingularBoolField(value: &self.didGpsReset) }()
|
||||
default: break
|
||||
_ = _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 {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
try { if let v = self._myNode {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
} }()
|
||||
try { if let v = self._owner {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
} }()
|
||||
if !self.nodeDb.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.nodeDb, fieldNumber: 4)
|
||||
}
|
||||
if !self.receiveQueue.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.receiveQueue, fieldNumber: 5)
|
||||
}
|
||||
try { if let v = self._rxTextMessage {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
} }()
|
||||
if self.version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 8)
|
||||
}
|
||||
if self.noSave != false {
|
||||
try visitor.visitSingularBoolField(value: self.noSave, fieldNumber: 9)
|
||||
}
|
||||
if self.didGpsReset != false {
|
||||
try visitor.visitSingularBoolField(value: self.didGpsReset, fieldNumber: 11)
|
||||
try 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._myNode != rhs._myNode {return false}
|
||||
if lhs._owner != rhs._owner {return false}
|
||||
if lhs.nodeDb != rhs.nodeDb {return false}
|
||||
if lhs.receiveQueue != rhs.receiveQueue {return false}
|
||||
if lhs.version != rhs.version {return false}
|
||||
if lhs._rxTextMessage != rhs._rxTextMessage {return false}
|
||||
if lhs.noSave != rhs.noSave {return false}
|
||||
if lhs.didGpsReset != rhs.didGpsReset {return false}
|
||||
if lhs._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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,14 @@ enum HardwareModel: SwiftProtobuf.Enum {
|
|||
/// nRF52840 Dongle : https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle/
|
||||
case nrf52840Pca10059 // = 42
|
||||
|
||||
///
|
||||
/// Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio/tree/master/hardware/board_esp32_v3
|
||||
case drDev // = 43
|
||||
|
||||
///
|
||||
/// M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/
|
||||
case m5Stack // = 44
|
||||
|
||||
///
|
||||
/// Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits.
|
||||
case privateHw // = 255
|
||||
|
|
@ -156,6 +164,8 @@ enum HardwareModel: SwiftProtobuf.Enum {
|
|||
case 40: self = .rak11200
|
||||
case 41: self = .nanoG1
|
||||
case 42: self = .nrf52840Pca10059
|
||||
case 43: self = .drDev
|
||||
case 44: self = .m5Stack
|
||||
case 255: self = .privateHw
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
|
|
@ -186,6 +196,8 @@ enum HardwareModel: SwiftProtobuf.Enum {
|
|||
case .rak11200: return 40
|
||||
case .nanoG1: return 41
|
||||
case .nrf52840Pca10059: return 42
|
||||
case .drDev: return 43
|
||||
case .m5Stack: return 44
|
||||
case .privateHw: return 255
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
|
|
@ -221,6 +233,8 @@ extension HardwareModel: CaseIterable {
|
|||
.rak11200,
|
||||
.nanoG1,
|
||||
.nrf52840Pca10059,
|
||||
.drDev,
|
||||
.m5Stack,
|
||||
.privateHw,
|
||||
]
|
||||
}
|
||||
|
|
@ -1590,45 +1604,20 @@ struct MyNodeInfo {
|
|||
///
|
||||
/// Tells the phone what our node number is, default starting value is
|
||||
/// lowbyte of macaddr, but it will be fixed if that is already in use
|
||||
var myNodeNum: UInt32 {
|
||||
get {return _storage._myNodeNum}
|
||||
set {_uniqueStorage()._myNodeNum = newValue}
|
||||
}
|
||||
var myNodeNum: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Note: This flag merely means we detected a hardware GPS in our node.
|
||||
/// Not the same as UserPreferences.location_sharing
|
||||
var hasGps_p: Bool {
|
||||
get {return _storage._hasGps_p}
|
||||
set {_uniqueStorage()._hasGps_p = newValue}
|
||||
}
|
||||
var hasGps_p: Bool = false
|
||||
|
||||
///
|
||||
/// The maximum number of 'software' channels that can be set on this node.
|
||||
var maxChannels: UInt32 {
|
||||
get {return _storage._maxChannels}
|
||||
set {_uniqueStorage()._maxChannels = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// Deprecated! ONLY USED IN DEVICE CODE (for upgrading old 1.0 firmwares) DO NOT READ ELSEWHERE.
|
||||
/// The region code for my radio (US, CN, etc...)
|
||||
/// Note: This string is deprecated.
|
||||
/// The 1.0 builds populate it based on the flashed firmware name.
|
||||
/// But for newer builds this string will be unpopulated (missing/null).
|
||||
/// For those builds you should instead look at the new read/write region enum in UserSettings
|
||||
/// The format of this string was 1.0-US or 1.0-CN etc.. Or empty string if unset.
|
||||
var region: String {
|
||||
get {return _storage._region}
|
||||
set {_uniqueStorage()._region = newValue}
|
||||
}
|
||||
var maxChannels: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 0.0.5 etc...
|
||||
var firmwareVersion: String {
|
||||
get {return _storage._firmwareVersion}
|
||||
set {_uniqueStorage()._firmwareVersion = newValue}
|
||||
}
|
||||
var firmwareVersion: String = String()
|
||||
|
||||
///
|
||||
/// An error message we'd like to report back to the mothership through analytics.
|
||||
|
|
@ -1637,99 +1626,61 @@ struct MyNodeInfo {
|
|||
/// This field will be cleared after the phone reads MyNodeInfo
|
||||
/// (i.e. it will only be reported once)
|
||||
/// a numeric error code to go with error message, zero means no error
|
||||
var errorCode: CriticalErrorCode {
|
||||
get {return _storage._errorCode}
|
||||
set {_uniqueStorage()._errorCode = newValue}
|
||||
}
|
||||
var errorCode: CriticalErrorCode = .none
|
||||
|
||||
///
|
||||
/// A numeric error address (nonzero if available)
|
||||
var errorAddress: UInt32 {
|
||||
get {return _storage._errorAddress}
|
||||
set {_uniqueStorage()._errorAddress = newValue}
|
||||
}
|
||||
var errorAddress: UInt32 = 0
|
||||
|
||||
///
|
||||
/// The total number of errors this node has ever encountered
|
||||
/// (well - since the last time we discarded preferences)
|
||||
var errorCount: UInt32 {
|
||||
get {return _storage._errorCount}
|
||||
set {_uniqueStorage()._errorCount = newValue}
|
||||
}
|
||||
var errorCount: UInt32 = 0
|
||||
|
||||
///
|
||||
/// The total number of reboots this node has ever encountered
|
||||
/// (well - since the last time we discarded preferences)
|
||||
var rebootCount: UInt32 {
|
||||
get {return _storage._rebootCount}
|
||||
set {_uniqueStorage()._rebootCount = newValue}
|
||||
}
|
||||
var rebootCount: UInt32 = 0
|
||||
|
||||
///
|
||||
/// Calculated bitrate of the current channel (in Bytes Per Second)
|
||||
var bitrate: Float {
|
||||
get {return _storage._bitrate}
|
||||
set {_uniqueStorage()._bitrate = newValue}
|
||||
}
|
||||
var bitrate: Float = 0
|
||||
|
||||
///
|
||||
/// How long before we consider a message abandoned and we can clear our
|
||||
/// caches of any messages in flight Normally quite large to handle the worst case
|
||||
/// message delivery time, 5 minutes.
|
||||
/// Formerly called FLOOD_EXPIRE_TIME in the device code
|
||||
var messageTimeoutMsec: UInt32 {
|
||||
get {return _storage._messageTimeoutMsec}
|
||||
set {_uniqueStorage()._messageTimeoutMsec = newValue}
|
||||
}
|
||||
var messageTimeoutMsec: UInt32 = 0
|
||||
|
||||
///
|
||||
/// The minimum app version that can talk to this device.
|
||||
/// Phone/PC apps should compare this to their build number and if too low tell the user they must update their app
|
||||
var minAppVersion: UInt32 {
|
||||
get {return _storage._minAppVersion}
|
||||
set {_uniqueStorage()._minAppVersion = newValue}
|
||||
}
|
||||
var minAppVersion: UInt32 = 0
|
||||
|
||||
///
|
||||
/// 24 time windows of 1hr each with the airtime transmitted out of the device per hour.
|
||||
var airPeriodTx: [UInt32] {
|
||||
get {return _storage._airPeriodTx}
|
||||
set {_uniqueStorage()._airPeriodTx = newValue}
|
||||
}
|
||||
var airPeriodTx: [UInt32] = []
|
||||
|
||||
///
|
||||
/// 24 time windows of 1hr each with the airtime of valid packets for your mesh.
|
||||
var airPeriodRx: [UInt32] {
|
||||
get {return _storage._airPeriodRx}
|
||||
set {_uniqueStorage()._airPeriodRx = newValue}
|
||||
}
|
||||
var airPeriodRx: [UInt32] = []
|
||||
|
||||
///
|
||||
/// Is the device wifi capable?
|
||||
var hasWifi_p: Bool {
|
||||
get {return _storage._hasWifi_p}
|
||||
set {_uniqueStorage()._hasWifi_p = newValue}
|
||||
}
|
||||
var hasWifi_p: Bool = false
|
||||
|
||||
///
|
||||
/// Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise).
|
||||
var channelUtilization: Float {
|
||||
get {return _storage._channelUtilization}
|
||||
set {_uniqueStorage()._channelUtilization = newValue}
|
||||
}
|
||||
var channelUtilization: Float = 0
|
||||
|
||||
///
|
||||
/// Percent of airtime for transmission used within the last hour.
|
||||
var airUtilTx: Float {
|
||||
get {return _storage._airUtilTx}
|
||||
set {_uniqueStorage()._airUtilTx = newValue}
|
||||
}
|
||||
var airUtilTx: Float = 0
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -1860,20 +1811,26 @@ struct FromRadio {
|
|||
///
|
||||
/// The packet id, used to allow the phone to request missing read packets from the FIFO,
|
||||
/// see our bluetooth docs
|
||||
var id: UInt32 = 0
|
||||
var id: UInt32 {
|
||||
get {return _storage._id}
|
||||
set {_uniqueStorage()._id = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// Log levels, chosen to match python logging conventions.
|
||||
var payloadVariant: FromRadio.OneOf_PayloadVariant? = nil
|
||||
var payloadVariant: OneOf_PayloadVariant? {
|
||||
get {return _storage._payloadVariant}
|
||||
set {_uniqueStorage()._payloadVariant = newValue}
|
||||
}
|
||||
|
||||
///
|
||||
/// Log levels, chosen to match python logging conventions.
|
||||
var packet: MeshPacket {
|
||||
get {
|
||||
if case .packet(let v)? = payloadVariant {return v}
|
||||
if case .packet(let v)? = _storage._payloadVariant {return v}
|
||||
return MeshPacket()
|
||||
}
|
||||
set {payloadVariant = .packet(newValue)}
|
||||
set {_uniqueStorage()._payloadVariant = .packet(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -1881,10 +1838,10 @@ struct FromRadio {
|
|||
/// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps.
|
||||
var myInfo: MyNodeInfo {
|
||||
get {
|
||||
if case .myInfo(let v)? = payloadVariant {return v}
|
||||
if case .myInfo(let v)? = _storage._payloadVariant {return v}
|
||||
return MyNodeInfo()
|
||||
}
|
||||
set {payloadVariant = .myInfo(newValue)}
|
||||
set {_uniqueStorage()._payloadVariant = .myInfo(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -1892,20 +1849,20 @@ struct FromRadio {
|
|||
/// starts over with the first node in our DB
|
||||
var nodeInfo: NodeInfo {
|
||||
get {
|
||||
if case .nodeInfo(let v)? = payloadVariant {return v}
|
||||
if case .nodeInfo(let v)? = _storage._payloadVariant {return v}
|
||||
return NodeInfo()
|
||||
}
|
||||
set {payloadVariant = .nodeInfo(newValue)}
|
||||
set {_uniqueStorage()._payloadVariant = .nodeInfo(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Set to send debug console output over our protobuf stream
|
||||
var logRecord: LogRecord {
|
||||
get {
|
||||
if case .logRecord(let v)? = payloadVariant {return v}
|
||||
if case .logRecord(let v)? = _storage._payloadVariant {return v}
|
||||
return LogRecord()
|
||||
}
|
||||
set {payloadVariant = .logRecord(newValue)}
|
||||
set {_uniqueStorage()._payloadVariant = .logRecord(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -1915,10 +1872,10 @@ struct FromRadio {
|
|||
/// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps.
|
||||
var configCompleteID: UInt32 {
|
||||
get {
|
||||
if case .configCompleteID(let v)? = payloadVariant {return v}
|
||||
if case .configCompleteID(let v)? = _storage._payloadVariant {return v}
|
||||
return 0
|
||||
}
|
||||
set {payloadVariant = .configCompleteID(newValue)}
|
||||
set {_uniqueStorage()._payloadVariant = .configCompleteID(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -1928,10 +1885,10 @@ struct FromRadio {
|
|||
/// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps.
|
||||
var rebooted: Bool {
|
||||
get {
|
||||
if case .rebooted(let v)? = payloadVariant {return v}
|
||||
if case .rebooted(let v)? = _storage._payloadVariant {return v}
|
||||
return false
|
||||
}
|
||||
set {payloadVariant = .rebooted(newValue)}
|
||||
set {_uniqueStorage()._payloadVariant = .rebooted(newValue)}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
|
@ -2003,6 +1960,8 @@ struct FromRadio {
|
|||
}
|
||||
|
||||
init() {}
|
||||
|
||||
fileprivate var _storage = _StorageClass.defaultInstance
|
||||
}
|
||||
|
||||
///
|
||||
|
|
@ -2150,6 +2109,26 @@ struct ToRadio {
|
|||
init() {}
|
||||
}
|
||||
|
||||
///
|
||||
/// Compressed message payload
|
||||
struct Compressed {
|
||||
// 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.
|
||||
|
||||
///
|
||||
/// PortNum to determine the how to handle the compressed payload.
|
||||
var portnum: PortNum = .unknownApp
|
||||
|
||||
///
|
||||
/// Compressed data.
|
||||
var data: Data = Data()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
#if swift(>=5.5) && canImport(_Concurrency)
|
||||
extension HardwareModel: @unchecked Sendable {}
|
||||
extension Constants: @unchecked Sendable {}
|
||||
|
|
@ -2178,6 +2157,7 @@ extension FromRadio.OneOf_PayloadVariant: @unchecked Sendable {}
|
|||
extension ToRadio: @unchecked Sendable {}
|
||||
extension ToRadio.OneOf_PayloadVariant: @unchecked Sendable {}
|
||||
extension ToRadio.PeerInfo: @unchecked Sendable {}
|
||||
extension Compressed: @unchecked Sendable {}
|
||||
#endif // swift(>=5.5) && canImport(_Concurrency)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
|
@ -2207,6 +2187,8 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding {
|
|||
40: .same(proto: "RAK11200"),
|
||||
41: .same(proto: "NANO_G1"),
|
||||
42: .same(proto: "NRF52840_PCA10059"),
|
||||
43: .same(proto: "DR_DEV"),
|
||||
44: .same(proto: "M5STACK"),
|
||||
255: .same(proto: "PRIVATE_HW"),
|
||||
]
|
||||
}
|
||||
|
|
@ -3175,7 +3157,6 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio
|
|||
1: .standard(proto: "my_node_num"),
|
||||
2: .standard(proto: "has_gps"),
|
||||
15: .standard(proto: "max_channels"),
|
||||
4: .same(proto: "region"),
|
||||
6: .standard(proto: "firmware_version"),
|
||||
7: .standard(proto: "error_code"),
|
||||
8: .standard(proto: "error_address"),
|
||||
|
|
@ -3191,171 +3172,102 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio
|
|||
20: .standard(proto: "air_util_tx"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _myNodeNum: UInt32 = 0
|
||||
var _hasGps_p: Bool = false
|
||||
var _maxChannels: UInt32 = 0
|
||||
var _region: String = String()
|
||||
var _firmwareVersion: String = String()
|
||||
var _errorCode: CriticalErrorCode = .none
|
||||
var _errorAddress: UInt32 = 0
|
||||
var _errorCount: UInt32 = 0
|
||||
var _rebootCount: UInt32 = 0
|
||||
var _bitrate: Float = 0
|
||||
var _messageTimeoutMsec: UInt32 = 0
|
||||
var _minAppVersion: UInt32 = 0
|
||||
var _airPeriodTx: [UInt32] = []
|
||||
var _airPeriodRx: [UInt32] = []
|
||||
var _hasWifi_p: Bool = false
|
||||
var _channelUtilization: Float = 0
|
||||
var _airUtilTx: Float = 0
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_myNodeNum = source._myNodeNum
|
||||
_hasGps_p = source._hasGps_p
|
||||
_maxChannels = source._maxChannels
|
||||
_region = source._region
|
||||
_firmwareVersion = source._firmwareVersion
|
||||
_errorCode = source._errorCode
|
||||
_errorAddress = source._errorAddress
|
||||
_errorCount = source._errorCount
|
||||
_rebootCount = source._rebootCount
|
||||
_bitrate = source._bitrate
|
||||
_messageTimeoutMsec = source._messageTimeoutMsec
|
||||
_minAppVersion = source._minAppVersion
|
||||
_airPeriodTx = source._airPeriodTx
|
||||
_airPeriodRx = source._airPeriodRx
|
||||
_hasWifi_p = source._hasWifi_p
|
||||
_channelUtilization = source._channelUtilization
|
||||
_airUtilTx = source._airUtilTx
|
||||
}
|
||||
}
|
||||
|
||||
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.decodeSingularUInt32Field(value: &_storage._myNodeNum) }()
|
||||
case 2: try { try decoder.decodeSingularBoolField(value: &_storage._hasGps_p) }()
|
||||
case 4: try { try decoder.decodeSingularStringField(value: &_storage._region) }()
|
||||
case 6: try { try decoder.decodeSingularStringField(value: &_storage._firmwareVersion) }()
|
||||
case 7: try { try decoder.decodeSingularEnumField(value: &_storage._errorCode) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._errorAddress) }()
|
||||
case 9: try { try decoder.decodeSingularUInt32Field(value: &_storage._errorCount) }()
|
||||
case 10: try { try decoder.decodeSingularUInt32Field(value: &_storage._rebootCount) }()
|
||||
case 11: try { try decoder.decodeSingularFloatField(value: &_storage._bitrate) }()
|
||||
case 13: try { try decoder.decodeSingularUInt32Field(value: &_storage._messageTimeoutMsec) }()
|
||||
case 14: try { try decoder.decodeSingularUInt32Field(value: &_storage._minAppVersion) }()
|
||||
case 15: try { try decoder.decodeSingularUInt32Field(value: &_storage._maxChannels) }()
|
||||
case 16: try { try decoder.decodeRepeatedUInt32Field(value: &_storage._airPeriodTx) }()
|
||||
case 17: try { try decoder.decodeRepeatedUInt32Field(value: &_storage._airPeriodRx) }()
|
||||
case 18: try { try decoder.decodeSingularBoolField(value: &_storage._hasWifi_p) }()
|
||||
case 19: try { try decoder.decodeSingularFloatField(value: &_storage._channelUtilization) }()
|
||||
case 20: try { try decoder.decodeSingularFloatField(value: &_storage._airUtilTx) }()
|
||||
default: break
|
||||
}
|
||||
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.myNodeNum) }()
|
||||
case 2: try { try decoder.decodeSingularBoolField(value: &self.hasGps_p) }()
|
||||
case 6: try { try decoder.decodeSingularStringField(value: &self.firmwareVersion) }()
|
||||
case 7: try { try decoder.decodeSingularEnumField(value: &self.errorCode) }()
|
||||
case 8: try { try decoder.decodeSingularUInt32Field(value: &self.errorAddress) }()
|
||||
case 9: try { try decoder.decodeSingularUInt32Field(value: &self.errorCount) }()
|
||||
case 10: try { try decoder.decodeSingularUInt32Field(value: &self.rebootCount) }()
|
||||
case 11: try { try decoder.decodeSingularFloatField(value: &self.bitrate) }()
|
||||
case 13: try { try decoder.decodeSingularUInt32Field(value: &self.messageTimeoutMsec) }()
|
||||
case 14: try { try decoder.decodeSingularUInt32Field(value: &self.minAppVersion) }()
|
||||
case 15: try { try decoder.decodeSingularUInt32Field(value: &self.maxChannels) }()
|
||||
case 16: try { try decoder.decodeRepeatedUInt32Field(value: &self.airPeriodTx) }()
|
||||
case 17: try { try decoder.decodeRepeatedUInt32Field(value: &self.airPeriodRx) }()
|
||||
case 18: try { try decoder.decodeSingularBoolField(value: &self.hasWifi_p) }()
|
||||
case 19: try { try decoder.decodeSingularFloatField(value: &self.channelUtilization) }()
|
||||
case 20: try { try decoder.decodeSingularFloatField(value: &self.airUtilTx) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
||||
if _storage._myNodeNum != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._myNodeNum, fieldNumber: 1)
|
||||
}
|
||||
if _storage._hasGps_p != false {
|
||||
try visitor.visitSingularBoolField(value: _storage._hasGps_p, fieldNumber: 2)
|
||||
}
|
||||
if !_storage._region.isEmpty {
|
||||
try visitor.visitSingularStringField(value: _storage._region, fieldNumber: 4)
|
||||
}
|
||||
if !_storage._firmwareVersion.isEmpty {
|
||||
try visitor.visitSingularStringField(value: _storage._firmwareVersion, fieldNumber: 6)
|
||||
}
|
||||
if _storage._errorCode != .none {
|
||||
try visitor.visitSingularEnumField(value: _storage._errorCode, fieldNumber: 7)
|
||||
}
|
||||
if _storage._errorAddress != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._errorAddress, fieldNumber: 8)
|
||||
}
|
||||
if _storage._errorCount != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._errorCount, fieldNumber: 9)
|
||||
}
|
||||
if _storage._rebootCount != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._rebootCount, fieldNumber: 10)
|
||||
}
|
||||
if _storage._bitrate != 0 {
|
||||
try visitor.visitSingularFloatField(value: _storage._bitrate, fieldNumber: 11)
|
||||
}
|
||||
if _storage._messageTimeoutMsec != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._messageTimeoutMsec, fieldNumber: 13)
|
||||
}
|
||||
if _storage._minAppVersion != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._minAppVersion, fieldNumber: 14)
|
||||
}
|
||||
if _storage._maxChannels != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._maxChannels, fieldNumber: 15)
|
||||
}
|
||||
if !_storage._airPeriodTx.isEmpty {
|
||||
try visitor.visitPackedUInt32Field(value: _storage._airPeriodTx, fieldNumber: 16)
|
||||
}
|
||||
if !_storage._airPeriodRx.isEmpty {
|
||||
try visitor.visitPackedUInt32Field(value: _storage._airPeriodRx, fieldNumber: 17)
|
||||
}
|
||||
if _storage._hasWifi_p != false {
|
||||
try visitor.visitSingularBoolField(value: _storage._hasWifi_p, fieldNumber: 18)
|
||||
}
|
||||
if _storage._channelUtilization != 0 {
|
||||
try visitor.visitSingularFloatField(value: _storage._channelUtilization, fieldNumber: 19)
|
||||
}
|
||||
if _storage._airUtilTx != 0 {
|
||||
try visitor.visitSingularFloatField(value: _storage._airUtilTx, fieldNumber: 20)
|
||||
}
|
||||
if self.myNodeNum != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.myNodeNum, fieldNumber: 1)
|
||||
}
|
||||
if self.hasGps_p != false {
|
||||
try visitor.visitSingularBoolField(value: self.hasGps_p, fieldNumber: 2)
|
||||
}
|
||||
if !self.firmwareVersion.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.firmwareVersion, fieldNumber: 6)
|
||||
}
|
||||
if self.errorCode != .none {
|
||||
try visitor.visitSingularEnumField(value: self.errorCode, fieldNumber: 7)
|
||||
}
|
||||
if self.errorAddress != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.errorAddress, fieldNumber: 8)
|
||||
}
|
||||
if self.errorCount != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.errorCount, fieldNumber: 9)
|
||||
}
|
||||
if self.rebootCount != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.rebootCount, fieldNumber: 10)
|
||||
}
|
||||
if self.bitrate != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.bitrate, fieldNumber: 11)
|
||||
}
|
||||
if self.messageTimeoutMsec != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.messageTimeoutMsec, fieldNumber: 13)
|
||||
}
|
||||
if self.minAppVersion != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.minAppVersion, fieldNumber: 14)
|
||||
}
|
||||
if self.maxChannels != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.maxChannels, fieldNumber: 15)
|
||||
}
|
||||
if !self.airPeriodTx.isEmpty {
|
||||
try visitor.visitPackedUInt32Field(value: self.airPeriodTx, fieldNumber: 16)
|
||||
}
|
||||
if !self.airPeriodRx.isEmpty {
|
||||
try visitor.visitPackedUInt32Field(value: self.airPeriodRx, fieldNumber: 17)
|
||||
}
|
||||
if self.hasWifi_p != false {
|
||||
try visitor.visitSingularBoolField(value: self.hasWifi_p, fieldNumber: 18)
|
||||
}
|
||||
if self.channelUtilization != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.channelUtilization, fieldNumber: 19)
|
||||
}
|
||||
if self.airUtilTx != 0 {
|
||||
try visitor.visitSingularFloatField(value: self.airUtilTx, fieldNumber: 20)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: MyNodeInfo, rhs: MyNodeInfo) -> 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._myNodeNum != rhs_storage._myNodeNum {return false}
|
||||
if _storage._hasGps_p != rhs_storage._hasGps_p {return false}
|
||||
if _storage._maxChannels != rhs_storage._maxChannels {return false}
|
||||
if _storage._region != rhs_storage._region {return false}
|
||||
if _storage._firmwareVersion != rhs_storage._firmwareVersion {return false}
|
||||
if _storage._errorCode != rhs_storage._errorCode {return false}
|
||||
if _storage._errorAddress != rhs_storage._errorAddress {return false}
|
||||
if _storage._errorCount != rhs_storage._errorCount {return false}
|
||||
if _storage._rebootCount != rhs_storage._rebootCount {return false}
|
||||
if _storage._bitrate != rhs_storage._bitrate {return false}
|
||||
if _storage._messageTimeoutMsec != rhs_storage._messageTimeoutMsec {return false}
|
||||
if _storage._minAppVersion != rhs_storage._minAppVersion {return false}
|
||||
if _storage._airPeriodTx != rhs_storage._airPeriodTx {return false}
|
||||
if _storage._airPeriodRx != rhs_storage._airPeriodRx {return false}
|
||||
if _storage._hasWifi_p != rhs_storage._hasWifi_p {return false}
|
||||
if _storage._channelUtilization != rhs_storage._channelUtilization {return false}
|
||||
if _storage._airUtilTx != rhs_storage._airUtilTx {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs.myNodeNum != rhs.myNodeNum {return false}
|
||||
if lhs.hasGps_p != rhs.hasGps_p {return false}
|
||||
if lhs.maxChannels != rhs.maxChannels {return false}
|
||||
if lhs.firmwareVersion != rhs.firmwareVersion {return false}
|
||||
if lhs.errorCode != rhs.errorCode {return false}
|
||||
if lhs.errorAddress != rhs.errorAddress {return false}
|
||||
if lhs.errorCount != rhs.errorCount {return false}
|
||||
if lhs.rebootCount != rhs.rebootCount {return false}
|
||||
if lhs.bitrate != rhs.bitrate {return false}
|
||||
if lhs.messageTimeoutMsec != rhs.messageTimeoutMsec {return false}
|
||||
if lhs.minAppVersion != rhs.minAppVersion {return false}
|
||||
if lhs.airPeriodTx != rhs.airPeriodTx {return false}
|
||||
if lhs.airPeriodRx != rhs.airPeriodRx {return false}
|
||||
if lhs.hasWifi_p != rhs.hasWifi_p {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
|
||||
}
|
||||
|
|
@ -3435,127 +3347,161 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
|
|||
9: .same(proto: "rebooted"),
|
||||
]
|
||||
|
||||
fileprivate class _StorageClass {
|
||||
var _id: UInt32 = 0
|
||||
var _payloadVariant: FromRadio.OneOf_PayloadVariant?
|
||||
|
||||
static let defaultInstance = _StorageClass()
|
||||
|
||||
private init() {}
|
||||
|
||||
init(copying source: _StorageClass) {
|
||||
_id = source._id
|
||||
_payloadVariant = source._payloadVariant
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
||||
if !isKnownUniquelyReferenced(&_storage) {
|
||||
_storage = _StorageClass(copying: _storage)
|
||||
}
|
||||
return _storage
|
||||
}
|
||||
|
||||
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.id) }()
|
||||
case 3: try {
|
||||
var v: MyNodeInfo?
|
||||
var hadOneofValue = false
|
||||
if let current = self.payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .myInfo(let m) = current {v = m}
|
||||
_ = _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.decodeSingularUInt32Field(value: &_storage._id) }()
|
||||
case 3: try {
|
||||
var v: MyNodeInfo?
|
||||
var hadOneofValue = false
|
||||
if let current = _storage._payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .myInfo(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
_storage._payloadVariant = .myInfo(v)
|
||||
}
|
||||
}()
|
||||
case 4: try {
|
||||
var v: NodeInfo?
|
||||
var hadOneofValue = false
|
||||
if let current = _storage._payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .nodeInfo(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
_storage._payloadVariant = .nodeInfo(v)
|
||||
}
|
||||
}()
|
||||
case 7: try {
|
||||
var v: LogRecord?
|
||||
var hadOneofValue = false
|
||||
if let current = _storage._payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .logRecord(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
_storage._payloadVariant = .logRecord(v)
|
||||
}
|
||||
}()
|
||||
case 8: try {
|
||||
var v: UInt32?
|
||||
try decoder.decodeSingularUInt32Field(value: &v)
|
||||
if let v = v {
|
||||
if _storage._payloadVariant != nil {try decoder.handleConflictingOneOf()}
|
||||
_storage._payloadVariant = .configCompleteID(v)
|
||||
}
|
||||
}()
|
||||
case 9: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
if let v = v {
|
||||
if _storage._payloadVariant != nil {try decoder.handleConflictingOneOf()}
|
||||
_storage._payloadVariant = .rebooted(v)
|
||||
}
|
||||
}()
|
||||
case 11: try {
|
||||
var v: MeshPacket?
|
||||
var hadOneofValue = false
|
||||
if let current = _storage._payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .packet(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
_storage._payloadVariant = .packet(v)
|
||||
}
|
||||
}()
|
||||
default: break
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .myInfo(v)
|
||||
}
|
||||
}()
|
||||
case 4: try {
|
||||
var v: NodeInfo?
|
||||
var hadOneofValue = false
|
||||
if let current = self.payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .nodeInfo(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .nodeInfo(v)
|
||||
}
|
||||
}()
|
||||
case 7: try {
|
||||
var v: LogRecord?
|
||||
var hadOneofValue = false
|
||||
if let current = self.payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .logRecord(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .logRecord(v)
|
||||
}
|
||||
}()
|
||||
case 8: try {
|
||||
var v: UInt32?
|
||||
try decoder.decodeSingularUInt32Field(value: &v)
|
||||
if let v = v {
|
||||
if self.payloadVariant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .configCompleteID(v)
|
||||
}
|
||||
}()
|
||||
case 9: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
if let v = v {
|
||||
if self.payloadVariant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .rebooted(v)
|
||||
}
|
||||
}()
|
||||
case 11: try {
|
||||
var v: MeshPacket?
|
||||
var hadOneofValue = false
|
||||
if let current = self.payloadVariant {
|
||||
hadOneofValue = true
|
||||
if case .packet(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .packet(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.id != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.id, fieldNumber: 1)
|
||||
}
|
||||
switch self.payloadVariant {
|
||||
case .myInfo?: try {
|
||||
guard case .myInfo(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}()
|
||||
case .nodeInfo?: try {
|
||||
guard case .nodeInfo(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
}()
|
||||
case .logRecord?: try {
|
||||
guard case .logRecord(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
}()
|
||||
case .configCompleteID?: try {
|
||||
guard case .configCompleteID(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularUInt32Field(value: v, fieldNumber: 8)
|
||||
}()
|
||||
case .rebooted?: try {
|
||||
guard case .rebooted(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 9)
|
||||
}()
|
||||
case .packet?: try {
|
||||
guard case .packet(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 11)
|
||||
}()
|
||||
case nil: break
|
||||
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
|
||||
if _storage._id != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: _storage._id, fieldNumber: 1)
|
||||
}
|
||||
switch _storage._payloadVariant {
|
||||
case .myInfo?: try {
|
||||
guard case .myInfo(let v)? = _storage._payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}()
|
||||
case .nodeInfo?: try {
|
||||
guard case .nodeInfo(let v)? = _storage._payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
}()
|
||||
case .logRecord?: try {
|
||||
guard case .logRecord(let v)? = _storage._payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
}()
|
||||
case .configCompleteID?: try {
|
||||
guard case .configCompleteID(let v)? = _storage._payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularUInt32Field(value: v, fieldNumber: 8)
|
||||
}()
|
||||
case .rebooted?: try {
|
||||
guard case .rebooted(let v)? = _storage._payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 9)
|
||||
}()
|
||||
case .packet?: try {
|
||||
guard case .packet(let v)? = _storage._payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 11)
|
||||
}()
|
||||
case nil: break
|
||||
}
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: FromRadio, rhs: FromRadio) -> Bool {
|
||||
if lhs.id != rhs.id {return false}
|
||||
if lhs.payloadVariant != rhs.payloadVariant {return false}
|
||||
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._id != rhs_storage._id {return false}
|
||||
if _storage._payloadVariant != rhs_storage._payloadVariant {return false}
|
||||
return true
|
||||
}
|
||||
if !storagesAreEqual {return false}
|
||||
}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
|
|
@ -3694,3 +3640,41 @@ extension ToRadio.PeerInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImpleme
|
|||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Compressed: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "Compressed"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "portnum"),
|
||||
2: .same(proto: "data"),
|
||||
]
|
||||
|
||||
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.portnum) }()
|
||||
case 2: try { try decoder.decodeSingularBytesField(value: &self.data) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.portnum != .unknownApp {
|
||||
try visitor.visitSingularEnumField(value: self.portnum, fieldNumber: 1)
|
||||
}
|
||||
if !self.data.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: Compressed, rhs: Compressed) -> Bool {
|
||||
if lhs.portnum != rhs.portnum {return false}
|
||||
if lhs.data != rhs.data {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ enum PortNum: SwiftProtobuf.Enum {
|
|||
/// 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)
|
||||
/// Formerly called CLEAR_TEXT
|
||||
case textMessageApp // = 1
|
||||
|
||||
///
|
||||
|
|
@ -111,6 +110,10 @@ enum PortNum: SwiftProtobuf.Enum {
|
|||
/// Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS
|
||||
case zpsApp // = 68
|
||||
|
||||
///
|
||||
/// Compressed payloads.
|
||||
case compressionApp // = 69
|
||||
|
||||
///
|
||||
/// Private applications should use portnums >= 256.
|
||||
/// To simplify initial development and testing you can use "PRIVATE_APP"
|
||||
|
|
@ -146,6 +149,7 @@ enum PortNum: SwiftProtobuf.Enum {
|
|||
case 66: self = .rangeTestApp
|
||||
case 67: self = .telemetryApp
|
||||
case 68: self = .zpsApp
|
||||
case 69: self = .compressionApp
|
||||
case 256: self = .privateApp
|
||||
case 257: self = .atakForwarder
|
||||
case 511: self = .max
|
||||
|
|
@ -169,6 +173,7 @@ enum PortNum: SwiftProtobuf.Enum {
|
|||
case .rangeTestApp: return 66
|
||||
case .telemetryApp: return 67
|
||||
case .zpsApp: return 68
|
||||
case .compressionApp: return 69
|
||||
case .privateApp: return 256
|
||||
case .atakForwarder: return 257
|
||||
case .max: return 511
|
||||
|
|
@ -197,6 +202,7 @@ extension PortNum: CaseIterable {
|
|||
.rangeTestApp,
|
||||
.telemetryApp,
|
||||
.zpsApp,
|
||||
.compressionApp,
|
||||
.privateApp,
|
||||
.atakForwarder,
|
||||
.max,
|
||||
|
|
@ -227,6 +233,7 @@ extension PortNum: SwiftProtobuf._ProtoNameProviding {
|
|||
66: .same(proto: "RANGE_TEST_APP"),
|
||||
67: .same(proto: "TELEMETRY_APP"),
|
||||
68: .same(proto: "ZPS_APP"),
|
||||
69: .same(proto: "COMPRESSION_APP"),
|
||||
256: .same(proto: "PRIVATE_APP"),
|
||||
257: .same(proto: "ATAK_FORWARDER"),
|
||||
511: .same(proto: "MAX"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue