From 9524405fbf99e580180c6e2f489aeae54e52a43f Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 29 Mar 2022 18:53:33 -0700 Subject: [PATCH] Update photos to 1.03 --- Meshtastic Client.xcodeproj/project.pbxproj | 8 +- MeshtasticClient/Helpers/BLEManager.swift | 16 +- MeshtasticClient/Protobufs/admin.pb.swift | 552 +++--- MeshtasticClient/Protobufs/apponly.pb.swift | 6 + .../Protobufs/cannedmessages.pb.swift | 253 +-- MeshtasticClient/Protobufs/channel.pb.swift | 109 +- .../Protobufs/deviceonly.pb.swift | 220 +-- .../environmental_measurement.pb.swift | 107 -- MeshtasticClient/Protobufs/mesh.pb.swift | 613 ++++-- MeshtasticClient/Protobufs/mqtt.pb.swift | 12 +- MeshtasticClient/Protobufs/portnums.pb.swift | 34 +- .../Protobufs/radioconfig.pb.swift | 1709 ++++++++++------- .../Protobufs/remote_hardware.pb.swift | 9 +- .../Protobufs/storeforward.pb.swift | 40 +- MeshtasticClient/Protobufs/telemetry.pb.swift | 352 ++++ gen_protos.sh | 2 +- 16 files changed, 2283 insertions(+), 1759 deletions(-) delete mode 100644 MeshtasticClient/Protobufs/environmental_measurement.pb.swift create mode 100644 MeshtasticClient/Protobufs/telemetry.pb.swift diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index 74e34ea2..42d90624 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -43,8 +43,8 @@ DDAF8C6526ED0A490058C060 /* channel.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6426ED0A490058C060 /* channel.pb.swift */; }; DDAF8C6726ED0C8C0058C060 /* remote_hardware.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6626ED0C8C0058C060 /* remote_hardware.pb.swift */; }; DDAF8C6926ED0D070058C060 /* deviceonly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6826ED0D070058C060 /* deviceonly.pb.swift */; }; - DDAF8C6B26ED0DD80058C060 /* environmental_measurement.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6A26ED0DD80058C060 /* environmental_measurement.pb.swift */; }; DDAF8C6E26ED19040058C060 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6D26ED19040058C060 /* Extensions.swift */; }; + DDB2CC6E27F3EB47009C5FCC /* telemetry.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB2CC6D27F3EB47009C5FCC /* telemetry.pb.swift */; }; DDC2E15826CE248E0042C5E4 /* MeshtasticClientApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC2E15726CE248E0042C5E4 /* MeshtasticClientApp.swift */; }; DDC2E15C26CE248F0042C5E4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDC2E15B26CE248F0042C5E4 /* Assets.xcassets */; }; DDC2E15F26CE248F0042C5E4 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDC2E15E26CE248F0042C5E4 /* Preview Assets.xcassets */; }; @@ -110,8 +110,8 @@ DDAF8C6426ED0A490058C060 /* channel.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = channel.pb.swift; sourceTree = ""; }; DDAF8C6626ED0C8C0058C060 /* remote_hardware.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = remote_hardware.pb.swift; sourceTree = ""; }; DDAF8C6826ED0D070058C060 /* deviceonly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = deviceonly.pb.swift; sourceTree = ""; }; - DDAF8C6A26ED0DD80058C060 /* environmental_measurement.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = environmental_measurement.pb.swift; sourceTree = ""; }; DDAF8C6D26ED19040058C060 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; + DDB2CC6D27F3EB47009C5FCC /* telemetry.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = telemetry.pb.swift; sourceTree = ""; }; DDC2E15426CE248E0042C5E4 /* MeshtasticClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeshtasticClient.app; sourceTree = BUILT_PRODUCTS_DIR; }; DDC2E15726CE248E0042C5E4 /* MeshtasticClientApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshtasticClientApp.swift; sourceTree = ""; }; DDC2E15B26CE248F0042C5E4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../Assets.xcassets; sourceTree = ""; }; @@ -213,12 +213,12 @@ DDAF8C5626ED07740058C060 /* Protobufs */ = { isa = PBXGroup; children = ( + DDB2CC6D27F3EB47009C5FCC /* telemetry.pb.swift */, DD4DED8F27AD2975004BA27E /* cannedmessages.pb.swift */, DDAF8C6126ED0A230058C060 /* admin.pb.swift */, C9A88B56278B559900BD810A /* apponly.pb.swift */, DDAF8C6426ED0A490058C060 /* channel.pb.swift */, DDAF8C6826ED0D070058C060 /* deviceonly.pb.swift */, - DDAF8C6A26ED0DD80058C060 /* environmental_measurement.pb.swift */, DDAF8C5726ED07FD0058C060 /* mesh.pb.swift */, DDAF8C6026ED0A230058C060 /* mqtt.pb.swift */, DDAF8C5C26ED09490058C060 /* portnums.pb.swift */, @@ -538,7 +538,6 @@ DD90860E26F69BAE00DC5189 /* NodeMap.swift in Sources */, DD8169FF272476C700F4AB02 /* LogDocument.swift in Sources */, DDAF8C6926ED0D070058C060 /* deviceonly.pb.swift in Sources */, - DDAF8C6B26ED0DD80058C060 /* environmental_measurement.pb.swift in Sources */, DD90860C26F684AF00DC5189 /* BatteryIcon.swift in Sources */, DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */, DDAF8C6226ED0A230058C060 /* mqtt.pb.swift in Sources */, @@ -546,6 +545,7 @@ DDAF8C5D26ED09490058C060 /* portnums.pb.swift in Sources */, DD9D8F2F2764403B00080993 /* Meshtastic.xcdatamodeld in Sources */, DD1BF2F92776FE2E008C8D2F /* UserMessageList.swift in Sources */, + DDB2CC6E27F3EB47009C5FCC /* telemetry.pb.swift in Sources */, DD23A50F26FD1B4400D9B90C /* PeripheralModel.swift in Sources */, C9A7BC1027759A9600760B50 /* PositionAnnotationView.swift in Sources */, DD882F5D2772E4640005BF05 /* Contacts.swift in Sources */, diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index 1e611a16..551f9220 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -547,7 +547,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph position.longitudeI = decodedInfo.nodeInfo.position.longitudeI position.altitude = decodedInfo.nodeInfo.position.altitude - position.batteryLevel = decodedInfo.nodeInfo.position.batteryLevel if decodedInfo.nodeInfo.position.time > 0 { position.time = Date(timeIntervalSince1970: TimeInterval(Int64(decodedInfo.nodeInfo.position.time))) @@ -614,7 +613,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph position.latitudeI = decodedInfo.nodeInfo.position.latitudeI position.longitudeI = decodedInfo.nodeInfo.position.longitudeI position.altitude = decodedInfo.nodeInfo.position.altitude - position.batteryLevel = decodedInfo.nodeInfo.position.batteryLevel + if decodedInfo.nodeInfo.position.time > 0 { position.time = Date(timeIntervalSince1970: TimeInterval(Int64(decodedInfo.nodeInfo.position.time))) @@ -706,7 +705,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } newMessage.receivedACK = false newMessage.direction = "IN" - newMessage.isTapback = decodedInfo.packet.decoded.isTapback + newMessage.isTapback = decodedInfo.packet.decoded.emoji == 1 if decodedInfo.packet.decoded.replyID > 0 { @@ -843,7 +842,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph position.latitudeI = positionMessage.latitudeI position.longitudeI = positionMessage.longitudeI position.altitude = positionMessage.altitude - position.batteryLevel = positionMessage.batteryLevel if positionMessage.time == 0 { @@ -969,10 +967,10 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } } - } else if decodedInfo.packet.decoded.portnum == PortNum.environmentalMeasurementApp { + } else if decodedInfo.packet.decoded.portnum == PortNum.telemetryApp { - if meshLoggingEnabled { MeshLogger.log("ℹ️ MESH PACKET received for Environmental Measurement App UNHANDLED \(try decodedInfo.packet.jsonString())") } - print("ℹ️ MESH PACKET received for Environmental Measurement App UNHANDLED \(try decodedInfo.packet.jsonString())") + if meshLoggingEnabled { MeshLogger.log("ℹ️ MESH PACKET received for Telemetry App UNHANDLED \(try decodedInfo.packet.jsonString())") } + print("ℹ️ MESH PACKET received for Telemetry App UNHANDLED \(try decodedInfo.packet.jsonString())") } else if decodedInfo.packet.decoded.portnum == PortNum.storeForwardApp { @@ -1095,7 +1093,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph meshPacket.to = UInt32(toUserNum) meshPacket.from = UInt32(fromUserNum) meshPacket.decoded = dataMessage - meshPacket.decoded.isTapback = isTapback + meshPacket.decoded.emoji = isTapback ? 1 : 0 if replyID > 0 { meshPacket.decoded.replyID = UInt32(replyID) } @@ -1162,8 +1160,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph positionPacket.longitudeI = Int32(LocationHelper.currentLocation.longitude * 1e7) positionPacket.time = UInt32(Date().timeIntervalSince1970) positionPacket.altitude = Int32(LocationHelper.currentAltitude) - let mostRecentPosition = fetchedNode[0].positions?.lastObject as! PositionEntity - positionPacket.batteryLevel = mostRecentPosition.batteryLevel var meshPacket = MeshPacket() meshPacket.to = UInt32(destNum) diff --git a/MeshtasticClient/Protobufs/admin.pb.swift b/MeshtasticClient/Protobufs/admin.pb.swift index 62641e41..8bcd5fa1 100644 --- a/MeshtasticClient/Protobufs/admin.pb.swift +++ b/MeshtasticClient/Protobufs/admin.pb.swift @@ -21,7 +21,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } /// -/// This message is handled by the Admin plugin and is responsible for all settings/channel read/write operations. +/// This message is handled by the Admin module and is responsible for all settings/channel read/write operations. /// This message is used to do settings operations to both remote AND local nodes. /// (Prior to 1.2 these operations were done via special ToRadio operations) struct AdminMessage { @@ -29,6 +29,8 @@ struct AdminMessage { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. + /// + /// TODO: REPLACE var variant: AdminMessage.OneOf_Variant? = nil /// @@ -75,6 +77,8 @@ struct AdminMessage { set {variant = .getRadioRequest(newValue)} } + /// + /// TODO: REPLACE var getRadioResponse: RadioConfig { get { if case .getRadioResponse(let v)? = variant {return v} @@ -94,6 +98,8 @@ struct AdminMessage { set {variant = .getChannelRequest(newValue)} } + /// + /// TODO: REPLACE var getChannelResponse: Channel { get { if case .getChannelResponse(let v)? = variant {return v} @@ -112,6 +118,8 @@ struct AdminMessage { set {variant = .getOwnerRequest(newValue)} } + /// + /// TODO: REPLACE var getOwnerResponse: User { get { if case .getOwnerResponse(let v)? = variant {return v} @@ -133,6 +141,8 @@ struct AdminMessage { set {variant = .confirmSetChannel(newValue)} } + /// + /// TODO: REPLACE var confirmSetRadio: Bool { get { if case .confirmSetRadio(let v)? = variant {return v} @@ -163,143 +173,123 @@ struct AdminMessage { } /// - /// Get the Canned Message Plugin message part1 in the response to this message. - var getCannedMessagePluginPart1Request: Bool { + /// Get the Canned Message Module message part1 in the response to this message. + var getCannedMessageModulePart1Request: Bool { get { - if case .getCannedMessagePluginPart1Request(let v)? = variant {return v} + if case .getCannedMessageModulePart1Request(let v)? = variant {return v} return false } - set {variant = .getCannedMessagePluginPart1Request(newValue)} - } - - var getCannedMessagePluginPart1Response: CannedMessagePluginMessagePart1 { - get { - if case .getCannedMessagePluginPart1Response(let v)? = variant {return v} - return CannedMessagePluginMessagePart1() - } - set {variant = .getCannedMessagePluginPart1Response(newValue)} + set {variant = .getCannedMessageModulePart1Request(newValue)} } /// - /// Get the Canned Message Plugin message part2 in the response to this message. - var getCannedMessagePluginPart2Request: Bool { + /// TODO: REPLACE + var getCannedMessageModulePart1Response: String { get { - if case .getCannedMessagePluginPart2Request(let v)? = variant {return v} + if case .getCannedMessageModulePart1Response(let v)? = variant {return v} + return String() + } + set {variant = .getCannedMessageModulePart1Response(newValue)} + } + + /// + /// Get the Canned Message Module message part2 in the response to this message. + var getCannedMessageModulePart2Request: Bool { + get { + if case .getCannedMessageModulePart2Request(let v)? = variant {return v} return false } - set {variant = .getCannedMessagePluginPart2Request(newValue)} - } - - var getCannedMessagePluginPart2Response: CannedMessagePluginMessagePart2 { - get { - if case .getCannedMessagePluginPart2Response(let v)? = variant {return v} - return CannedMessagePluginMessagePart2() - } - set {variant = .getCannedMessagePluginPart2Response(newValue)} + set {variant = .getCannedMessageModulePart2Request(newValue)} } /// - /// Get the Canned Message Plugin message part3 in the response to this message. - var getCannedMessagePluginPart3Request: Bool { + /// TODO: REPLACE + var getCannedMessageModulePart2Response: String { get { - if case .getCannedMessagePluginPart3Request(let v)? = variant {return v} + if case .getCannedMessageModulePart2Response(let v)? = variant {return v} + return String() + } + set {variant = .getCannedMessageModulePart2Response(newValue)} + } + + /// + /// Get the Canned Message Module message part3 in the response to this message. + var getCannedMessageModulePart3Request: Bool { + get { + if case .getCannedMessageModulePart3Request(let v)? = variant {return v} return false } - set {variant = .getCannedMessagePluginPart3Request(newValue)} - } - - var getCannedMessagePluginPart3Response: CannedMessagePluginMessagePart3 { - get { - if case .getCannedMessagePluginPart3Response(let v)? = variant {return v} - return CannedMessagePluginMessagePart3() - } - set {variant = .getCannedMessagePluginPart3Response(newValue)} + set {variant = .getCannedMessageModulePart3Request(newValue)} } /// - /// Get the Canned Message Plugin message part4 in the response to this message. - var getCannedMessagePluginPart4Request: Bool { + /// TODO: REPLACE + var getCannedMessageModulePart3Response: String { get { - if case .getCannedMessagePluginPart4Request(let v)? = variant {return v} + if case .getCannedMessageModulePart3Response(let v)? = variant {return v} + return String() + } + set {variant = .getCannedMessageModulePart3Response(newValue)} + } + + /// + /// Get the Canned Message Module message part4 in the response to this message. + var getCannedMessageModulePart4Request: Bool { + get { + if case .getCannedMessageModulePart4Request(let v)? = variant {return v} return false } - set {variant = .getCannedMessagePluginPart4Request(newValue)} - } - - var getCannedMessagePluginPart4Response: CannedMessagePluginMessagePart4 { - get { - if case .getCannedMessagePluginPart4Response(let v)? = variant {return v} - return CannedMessagePluginMessagePart4() - } - set {variant = .getCannedMessagePluginPart4Response(newValue)} + set {variant = .getCannedMessageModulePart4Request(newValue)} } /// - /// Get the Canned Message Plugin message part5 in the response to this message. - var getCannedMessagePluginPart5Request: Bool { + /// TODO: REPLACE + var getCannedMessageModulePart4Response: String { get { - if case .getCannedMessagePluginPart5Request(let v)? = variant {return v} - return false + if case .getCannedMessageModulePart4Response(let v)? = variant {return v} + return String() } - set {variant = .getCannedMessagePluginPart5Request(newValue)} - } - - var getCannedMessagePluginPart5Response: CannedMessagePluginMessagePart5 { - get { - if case .getCannedMessagePluginPart5Response(let v)? = variant {return v} - return CannedMessagePluginMessagePart5() - } - set {variant = .getCannedMessagePluginPart5Response(newValue)} + set {variant = .getCannedMessageModulePart4Response(newValue)} } /// - /// Set the canned message plugin part 1 text. - var setCannedMessagePluginPart1: CannedMessagePluginMessagePart1 { + /// Set the canned message module part 1 text. + var setCannedMessageModulePart1: String { get { - if case .setCannedMessagePluginPart1(let v)? = variant {return v} - return CannedMessagePluginMessagePart1() + if case .setCannedMessageModulePart1(let v)? = variant {return v} + return String() } - set {variant = .setCannedMessagePluginPart1(newValue)} + set {variant = .setCannedMessageModulePart1(newValue)} } /// - /// Set the canned message plugin part 2 text. - var setCannedMessagePluginPart2: CannedMessagePluginMessagePart2 { + /// Set the canned message module part 2 text. + var setCannedMessageModulePart2: String { get { - if case .setCannedMessagePluginPart2(let v)? = variant {return v} - return CannedMessagePluginMessagePart2() + if case .setCannedMessageModulePart2(let v)? = variant {return v} + return String() } - set {variant = .setCannedMessagePluginPart2(newValue)} + set {variant = .setCannedMessageModulePart2(newValue)} } /// - /// Set the canned message plugin part 3 text. - var setCannedMessagePluginPart3: CannedMessagePluginMessagePart3 { + /// Set the canned message module part 3 text. + var setCannedMessageModulePart3: String { get { - if case .setCannedMessagePluginPart3(let v)? = variant {return v} - return CannedMessagePluginMessagePart3() + if case .setCannedMessageModulePart3(let v)? = variant {return v} + return String() } - set {variant = .setCannedMessagePluginPart3(newValue)} + set {variant = .setCannedMessageModulePart3(newValue)} } /// - /// Set the canned message plugin part 4 text. - var setCannedMessagePluginPart4: CannedMessagePluginMessagePart4 { + /// Set the canned message module part 4 text. + var setCannedMessageModulePart4: String { get { - if case .setCannedMessagePluginPart4(let v)? = variant {return v} - return CannedMessagePluginMessagePart4() + if case .setCannedMessageModulePart4(let v)? = variant {return v} + return String() } - set {variant = .setCannedMessagePluginPart4(newValue)} - } - - /// - /// Set the canned message plugin part 5 text. - var setCannedMessagePluginPart5: CannedMessagePluginMessagePart5 { - get { - if case .setCannedMessagePluginPart5(let v)? = variant {return v} - return CannedMessagePluginMessagePart5() - } - set {variant = .setCannedMessagePluginPart5(newValue)} + set {variant = .setCannedMessageModulePart4(newValue)} } /// @@ -314,6 +304,8 @@ struct AdminMessage { var unknownFields = SwiftProtobuf.UnknownStorage() + /// + /// TODO: REPLACE enum OneOf_Variant: Equatable { /// /// Set the radio provisioning for this node @@ -331,15 +323,21 @@ struct AdminMessage { /// /// 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) + /// + /// TODO: REPLACE case getChannelResponse(Channel) /// /// Send the current owner data in the response to this message. case getOwnerRequest(Bool) + /// + /// TODO: REPLACE case getOwnerResponse(User) /// /// Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again. @@ -347,6 +345,8 @@ struct AdminMessage { /// If you fail to do so, the radio will assume loss of comms and revert your changes. /// These messages are optional when changing the local node. case confirmSetChannel(Bool) + /// + /// TODO: REPLACE case confirmSetRadio(Bool) /// /// This message is only supported for the simulator porduino build. @@ -356,40 +356,41 @@ struct AdminMessage { /// Tell the node to reboot in this many seconds (or <0 to cancel reboot) case rebootSeconds(Int32) /// - /// Get the Canned Message Plugin message part1 in the response to this message. - case getCannedMessagePluginPart1Request(Bool) - case getCannedMessagePluginPart1Response(CannedMessagePluginMessagePart1) + /// Get the Canned Message Module message part1 in the response to this message. + case getCannedMessageModulePart1Request(Bool) /// - /// Get the Canned Message Plugin message part2 in the response to this message. - case getCannedMessagePluginPart2Request(Bool) - case getCannedMessagePluginPart2Response(CannedMessagePluginMessagePart2) + /// TODO: REPLACE + case getCannedMessageModulePart1Response(String) /// - /// Get the Canned Message Plugin message part3 in the response to this message. - case getCannedMessagePluginPart3Request(Bool) - case getCannedMessagePluginPart3Response(CannedMessagePluginMessagePart3) + /// Get the Canned Message Module message part2 in the response to this message. + case getCannedMessageModulePart2Request(Bool) /// - /// Get the Canned Message Plugin message part4 in the response to this message. - case getCannedMessagePluginPart4Request(Bool) - case getCannedMessagePluginPart4Response(CannedMessagePluginMessagePart4) + /// TODO: REPLACE + case getCannedMessageModulePart2Response(String) /// - /// Get the Canned Message Plugin message part5 in the response to this message. - case getCannedMessagePluginPart5Request(Bool) - case getCannedMessagePluginPart5Response(CannedMessagePluginMessagePart5) + /// Get the Canned Message Module message part3 in the response to this message. + case getCannedMessageModulePart3Request(Bool) /// - /// Set the canned message plugin part 1 text. - case setCannedMessagePluginPart1(CannedMessagePluginMessagePart1) + /// TODO: REPLACE + case getCannedMessageModulePart3Response(String) /// - /// Set the canned message plugin part 2 text. - case setCannedMessagePluginPart2(CannedMessagePluginMessagePart2) + /// Get the Canned Message Module message part4 in the response to this message. + case getCannedMessageModulePart4Request(Bool) /// - /// Set the canned message plugin part 3 text. - case setCannedMessagePluginPart3(CannedMessagePluginMessagePart3) + /// TODO: REPLACE + case getCannedMessageModulePart4Response(String) /// - /// Set the canned message plugin part 4 text. - case setCannedMessagePluginPart4(CannedMessagePluginMessagePart4) + /// Set the canned message module part 1 text. + case setCannedMessageModulePart1(String) /// - /// Set the canned message plugin part 5 text. - case setCannedMessagePluginPart5(CannedMessagePluginMessagePart5) + /// Set the canned message module part 2 text. + case setCannedMessageModulePart2(String) + /// + /// Set the canned message module part 3 text. + case setCannedMessageModulePart3(String) + /// + /// Set the canned message module part 4 text. + case setCannedMessageModulePart4(String) /// /// Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) case shutdownSeconds(Int32) @@ -452,64 +453,52 @@ struct AdminMessage { guard case .rebootSeconds(let l) = lhs, case .rebootSeconds(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart1Request, .getCannedMessagePluginPart1Request): return { - guard case .getCannedMessagePluginPart1Request(let l) = lhs, case .getCannedMessagePluginPart1Request(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart1Request, .getCannedMessageModulePart1Request): return { + guard case .getCannedMessageModulePart1Request(let l) = lhs, case .getCannedMessageModulePart1Request(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart1Response, .getCannedMessagePluginPart1Response): return { - guard case .getCannedMessagePluginPart1Response(let l) = lhs, case .getCannedMessagePluginPart1Response(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart1Response, .getCannedMessageModulePart1Response): return { + guard case .getCannedMessageModulePart1Response(let l) = lhs, case .getCannedMessageModulePart1Response(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart2Request, .getCannedMessagePluginPart2Request): return { - guard case .getCannedMessagePluginPart2Request(let l) = lhs, case .getCannedMessagePluginPart2Request(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart2Request, .getCannedMessageModulePart2Request): return { + guard case .getCannedMessageModulePart2Request(let l) = lhs, case .getCannedMessageModulePart2Request(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart2Response, .getCannedMessagePluginPart2Response): return { - guard case .getCannedMessagePluginPart2Response(let l) = lhs, case .getCannedMessagePluginPart2Response(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart2Response, .getCannedMessageModulePart2Response): return { + guard case .getCannedMessageModulePart2Response(let l) = lhs, case .getCannedMessageModulePart2Response(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart3Request, .getCannedMessagePluginPart3Request): return { - guard case .getCannedMessagePluginPart3Request(let l) = lhs, case .getCannedMessagePluginPart3Request(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart3Request, .getCannedMessageModulePart3Request): return { + guard case .getCannedMessageModulePart3Request(let l) = lhs, case .getCannedMessageModulePart3Request(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart3Response, .getCannedMessagePluginPart3Response): return { - guard case .getCannedMessagePluginPart3Response(let l) = lhs, case .getCannedMessagePluginPart3Response(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart3Response, .getCannedMessageModulePart3Response): return { + guard case .getCannedMessageModulePart3Response(let l) = lhs, case .getCannedMessageModulePart3Response(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart4Request, .getCannedMessagePluginPart4Request): return { - guard case .getCannedMessagePluginPart4Request(let l) = lhs, case .getCannedMessagePluginPart4Request(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart4Request, .getCannedMessageModulePart4Request): return { + guard case .getCannedMessageModulePart4Request(let l) = lhs, case .getCannedMessageModulePart4Request(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart4Response, .getCannedMessagePluginPart4Response): return { - guard case .getCannedMessagePluginPart4Response(let l) = lhs, case .getCannedMessagePluginPart4Response(let r) = rhs else { preconditionFailure() } + case (.getCannedMessageModulePart4Response, .getCannedMessageModulePart4Response): return { + guard case .getCannedMessageModulePart4Response(let l) = lhs, case .getCannedMessageModulePart4Response(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart5Request, .getCannedMessagePluginPart5Request): return { - guard case .getCannedMessagePluginPart5Request(let l) = lhs, case .getCannedMessagePluginPart5Request(let r) = rhs else { preconditionFailure() } + case (.setCannedMessageModulePart1, .setCannedMessageModulePart1): return { + guard case .setCannedMessageModulePart1(let l) = lhs, case .setCannedMessageModulePart1(let r) = rhs else { preconditionFailure() } return l == r }() - case (.getCannedMessagePluginPart5Response, .getCannedMessagePluginPart5Response): return { - guard case .getCannedMessagePluginPart5Response(let l) = lhs, case .getCannedMessagePluginPart5Response(let r) = rhs else { preconditionFailure() } + case (.setCannedMessageModulePart2, .setCannedMessageModulePart2): return { + guard case .setCannedMessageModulePart2(let l) = lhs, case .setCannedMessageModulePart2(let r) = rhs else { preconditionFailure() } return l == r }() - case (.setCannedMessagePluginPart1, .setCannedMessagePluginPart1): return { - guard case .setCannedMessagePluginPart1(let l) = lhs, case .setCannedMessagePluginPart1(let r) = rhs else { preconditionFailure() } + case (.setCannedMessageModulePart3, .setCannedMessageModulePart3): return { + guard case .setCannedMessageModulePart3(let l) = lhs, case .setCannedMessageModulePart3(let r) = rhs else { preconditionFailure() } return l == r }() - case (.setCannedMessagePluginPart2, .setCannedMessagePluginPart2): return { - guard case .setCannedMessagePluginPart2(let l) = lhs, case .setCannedMessagePluginPart2(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setCannedMessagePluginPart3, .setCannedMessagePluginPart3): return { - guard case .setCannedMessagePluginPart3(let l) = lhs, case .setCannedMessagePluginPart3(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setCannedMessagePluginPart4, .setCannedMessagePluginPart4): return { - guard case .setCannedMessagePluginPart4(let l) = lhs, case .setCannedMessagePluginPart4(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setCannedMessagePluginPart5, .setCannedMessagePluginPart5): return { - guard case .setCannedMessagePluginPart5(let l) = lhs, case .setCannedMessagePluginPart5(let r) = rhs else { preconditionFailure() } + case (.setCannedMessageModulePart4, .setCannedMessageModulePart4): return { + guard case .setCannedMessageModulePart4(let l) = lhs, case .setCannedMessageModulePart4(let r) = rhs else { preconditionFailure() } return l == r }() case (.shutdownSeconds, .shutdownSeconds): return { @@ -525,6 +514,11 @@ struct AdminMessage { init() {} } +#if swift(>=5.5) && canImport(_Concurrency) +extension AdminMessage: @unchecked Sendable {} +extension AdminMessage.OneOf_Variant: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + // MARK: - Code below here is support for the SwiftProtobuf runtime. extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { @@ -543,21 +537,18 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 33: .standard(proto: "confirm_set_radio"), 34: .standard(proto: "exit_simulator"), 35: .standard(proto: "reboot_seconds"), - 36: .standard(proto: "get_canned_message_plugin_part1_request"), - 37: .standard(proto: "get_canned_message_plugin_part1_response"), - 38: .standard(proto: "get_canned_message_plugin_part2_request"), - 39: .standard(proto: "get_canned_message_plugin_part2_response"), - 40: .standard(proto: "get_canned_message_plugin_part3_request"), - 41: .standard(proto: "get_canned_message_plugin_part3_response"), - 42: .standard(proto: "get_canned_message_plugin_part4_request"), - 43: .standard(proto: "get_canned_message_plugin_part4_response"), - 44: .standard(proto: "get_canned_message_plugin_part5_request"), - 45: .standard(proto: "get_canned_message_plugin_part5_response"), - 46: .standard(proto: "set_canned_message_plugin_part1"), - 47: .standard(proto: "set_canned_message_plugin_part2"), - 48: .standard(proto: "set_canned_message_plugin_part3"), - 49: .standard(proto: "set_canned_message_plugin_part4"), - 50: .standard(proto: "set_canned_message_plugin_part5"), + 36: .standard(proto: "get_canned_message_module_part1_request"), + 37: .standard(proto: "get_canned_message_module_part1_response"), + 38: .standard(proto: "get_canned_message_module_part2_request"), + 39: .standard(proto: "get_canned_message_module_part2_response"), + 40: .standard(proto: "get_canned_message_module_part3_request"), + 41: .standard(proto: "get_canned_message_module_part3_response"), + 42: .standard(proto: "get_canned_message_module_part4_request"), + 43: .standard(proto: "get_canned_message_module_part4_response"), + 44: .standard(proto: "set_canned_message_module_part1"), + 45: .standard(proto: "set_canned_message_module_part2"), + 46: .standard(proto: "set_canned_message_module_part3"), + 47: .standard(proto: "set_canned_message_module_part4"), 51: .standard(proto: "shutdown_seconds"), ] @@ -706,20 +697,15 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try decoder.decodeSingularBoolField(value: &v) if let v = v { if self.variant != nil {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart1Request(v) + self.variant = .getCannedMessageModulePart1Request(v) } }() case 37: try { - var v: CannedMessagePluginMessagePart1? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .getCannedMessagePluginPart1Response(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart1Response(v) + if self.variant != nil {try decoder.handleConflictingOneOf()} + self.variant = .getCannedMessageModulePart1Response(v) } }() case 38: try { @@ -727,20 +713,15 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try decoder.decodeSingularBoolField(value: &v) if let v = v { if self.variant != nil {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart2Request(v) + self.variant = .getCannedMessageModulePart2Request(v) } }() case 39: try { - var v: CannedMessagePluginMessagePart2? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .getCannedMessagePluginPart2Response(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart2Response(v) + if self.variant != nil {try decoder.handleConflictingOneOf()} + self.variant = .getCannedMessageModulePart2Response(v) } }() case 40: try { @@ -748,20 +729,15 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try decoder.decodeSingularBoolField(value: &v) if let v = v { if self.variant != nil {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart3Request(v) + self.variant = .getCannedMessageModulePart3Request(v) } }() case 41: try { - var v: CannedMessagePluginMessagePart3? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .getCannedMessagePluginPart3Response(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart3Response(v) + if self.variant != nil {try decoder.handleConflictingOneOf()} + self.variant = .getCannedMessageModulePart3Response(v) } }() case 42: try { @@ -769,106 +745,47 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try decoder.decodeSingularBoolField(value: &v) if let v = v { if self.variant != nil {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart4Request(v) + self.variant = .getCannedMessageModulePart4Request(v) } }() case 43: try { - var v: CannedMessagePluginMessagePart4? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .getCannedMessagePluginPart4Response(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart4Response(v) + if self.variant != nil {try decoder.handleConflictingOneOf()} + self.variant = .getCannedMessageModulePart4Response(v) } }() case 44: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { if self.variant != nil {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart5Request(v) + self.variant = .setCannedMessageModulePart1(v) } }() case 45: try { - var v: CannedMessagePluginMessagePart5? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .getCannedMessagePluginPart5Response(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .getCannedMessagePluginPart5Response(v) + if self.variant != nil {try decoder.handleConflictingOneOf()} + self.variant = .setCannedMessageModulePart2(v) } }() case 46: try { - var v: CannedMessagePluginMessagePart1? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .setCannedMessagePluginPart1(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .setCannedMessagePluginPart1(v) + if self.variant != nil {try decoder.handleConflictingOneOf()} + self.variant = .setCannedMessageModulePart3(v) } }() case 47: try { - var v: CannedMessagePluginMessagePart2? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .setCannedMessagePluginPart2(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) + var v: String? + try decoder.decodeSingularStringField(value: &v) if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .setCannedMessagePluginPart2(v) - } - }() - case 48: try { - var v: CannedMessagePluginMessagePart3? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .setCannedMessagePluginPart3(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .setCannedMessagePluginPart3(v) - } - }() - case 49: try { - var v: CannedMessagePluginMessagePart4? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .setCannedMessagePluginPart4(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .setCannedMessagePluginPart4(v) - } - }() - case 50: try { - var v: CannedMessagePluginMessagePart5? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .setCannedMessagePluginPart5(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .setCannedMessagePluginPart5(v) + if self.variant != nil {try decoder.handleConflictingOneOf()} + self.variant = .setCannedMessageModulePart4(v) } }() case 51: try { @@ -886,8 +803,9 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat func traverse(visitor: inout V) throws { // 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 + // 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 switch self.variant { case .setRadio?: try { guard case .setRadio(let v)? = self.variant else { preconditionFailure() } @@ -941,65 +859,53 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat guard case .rebootSeconds(let v)? = self.variant else { preconditionFailure() } try visitor.visitSingularInt32Field(value: v, fieldNumber: 35) }() - case .getCannedMessagePluginPart1Request?: try { - guard case .getCannedMessagePluginPart1Request(let v)? = self.variant else { preconditionFailure() } + case .getCannedMessageModulePart1Request?: try { + guard case .getCannedMessageModulePart1Request(let v)? = self.variant else { preconditionFailure() } try visitor.visitSingularBoolField(value: v, fieldNumber: 36) }() - case .getCannedMessagePluginPart1Response?: try { - guard case .getCannedMessagePluginPart1Response(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 37) + case .getCannedMessageModulePart1Response?: try { + guard case .getCannedMessageModulePart1Response(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 37) }() - case .getCannedMessagePluginPart2Request?: try { - guard case .getCannedMessagePluginPart2Request(let v)? = self.variant else { preconditionFailure() } + case .getCannedMessageModulePart2Request?: try { + guard case .getCannedMessageModulePart2Request(let v)? = self.variant else { preconditionFailure() } try visitor.visitSingularBoolField(value: v, fieldNumber: 38) }() - case .getCannedMessagePluginPart2Response?: try { - guard case .getCannedMessagePluginPart2Response(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 39) + case .getCannedMessageModulePart2Response?: try { + guard case .getCannedMessageModulePart2Response(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 39) }() - case .getCannedMessagePluginPart3Request?: try { - guard case .getCannedMessagePluginPart3Request(let v)? = self.variant else { preconditionFailure() } + case .getCannedMessageModulePart3Request?: try { + guard case .getCannedMessageModulePart3Request(let v)? = self.variant else { preconditionFailure() } try visitor.visitSingularBoolField(value: v, fieldNumber: 40) }() - case .getCannedMessagePluginPart3Response?: try { - guard case .getCannedMessagePluginPart3Response(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 41) + case .getCannedMessageModulePart3Response?: try { + guard case .getCannedMessageModulePart3Response(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 41) }() - case .getCannedMessagePluginPart4Request?: try { - guard case .getCannedMessagePluginPart4Request(let v)? = self.variant else { preconditionFailure() } + case .getCannedMessageModulePart4Request?: try { + guard case .getCannedMessageModulePart4Request(let v)? = self.variant else { preconditionFailure() } try visitor.visitSingularBoolField(value: v, fieldNumber: 42) }() - case .getCannedMessagePluginPart4Response?: try { - guard case .getCannedMessagePluginPart4Response(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 43) + case .getCannedMessageModulePart4Response?: try { + guard case .getCannedMessageModulePart4Response(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 43) }() - case .getCannedMessagePluginPart5Request?: try { - guard case .getCannedMessagePluginPart5Request(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 44) + case .setCannedMessageModulePart1?: try { + guard case .setCannedMessageModulePart1(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 44) }() - case .getCannedMessagePluginPart5Response?: try { - guard case .getCannedMessagePluginPart5Response(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 45) + case .setCannedMessageModulePart2?: try { + guard case .setCannedMessageModulePart2(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 45) }() - case .setCannedMessagePluginPart1?: try { - guard case .setCannedMessagePluginPart1(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 46) + case .setCannedMessageModulePart3?: try { + guard case .setCannedMessageModulePart3(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 46) }() - case .setCannedMessagePluginPart2?: try { - guard case .setCannedMessagePluginPart2(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 47) - }() - case .setCannedMessagePluginPart3?: try { - guard case .setCannedMessagePluginPart3(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 48) - }() - case .setCannedMessagePluginPart4?: try { - guard case .setCannedMessagePluginPart4(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 49) - }() - case .setCannedMessagePluginPart5?: try { - guard case .setCannedMessagePluginPart5(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 50) + case .setCannedMessageModulePart4?: try { + guard case .setCannedMessageModulePart4(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 47) }() case .shutdownSeconds?: try { guard case .shutdownSeconds(let v)? = self.variant else { preconditionFailure() } diff --git a/MeshtasticClient/Protobufs/apponly.pb.swift b/MeshtasticClient/Protobufs/apponly.pb.swift index 5c3b13ed..687030b7 100644 --- a/MeshtasticClient/Protobufs/apponly.pb.swift +++ b/MeshtasticClient/Protobufs/apponly.pb.swift @@ -31,6 +31,8 @@ struct ChannelSet { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. + /// + /// TODO: REPLACE var settings: [ChannelSettings] = [] var unknownFields = SwiftProtobuf.UnknownStorage() @@ -38,6 +40,10 @@ struct ChannelSet { init() {} } +#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. extension ChannelSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { diff --git a/MeshtasticClient/Protobufs/cannedmessages.pb.swift b/MeshtasticClient/Protobufs/cannedmessages.pb.swift index 9b6068b8..dc943c33 100644 --- a/MeshtasticClient/Protobufs/cannedmessages.pb.swift +++ b/MeshtasticClient/Protobufs/cannedmessages.pb.swift @@ -40,96 +40,46 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } /// -/// Canned message plugin part 1 -struct CannedMessagePluginMessagePart1 { +/// 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 plugin separated by '|' characters. - /// This is part 1. - var text: String = String() + /// Predefined messages for canned message module separated by '|' characters. + var messagesPart1: String = String() + + /// + /// TODO: REPLACE + var messagesPart2: String = String() + + /// + /// TODO: REPLACE + var messagesPart3: String = String() + + /// + /// TODO: REPLACE + var messagesPart4: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} } -/// -/// Canned message plugin part 2 -struct CannedMessagePluginMessagePart2 { - // 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 plugin separated by '|' characters. - /// This is part 2. - var text: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// Canned message plugin part 3 -struct CannedMessagePluginMessagePart3 { - // 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 plugin separated by '|' characters. - /// This is part 3. - var text: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// Canned message plugin part 4 -struct CannedMessagePluginMessagePart4 { - // 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 plugin separated by '|' characters. - /// This is part 4. - var text: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// Canned message plugin part 5 -struct CannedMessagePluginMessagePart5 { - // 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 plugin separated by '|' characters. - /// This is part 5. - var text: 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. -extension CannedMessagePluginMessagePart1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "CannedMessagePluginMessagePart1" +extension CannedMessageModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = "CannedMessageModuleConfig" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "text"), + 11: .same(proto: "messagesPart1"), + 12: .same(proto: "messagesPart2"), + 13: .same(proto: "messagesPart3"), + 14: .same(proto: "messagesPart4"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -138,149 +88,36 @@ extension CannedMessagePluginMessagePart1: SwiftProtobuf.Message, SwiftProtobuf. // 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.text) }() + case 11: try { try decoder.decodeSingularStringField(value: &self.messagesPart1) }() + case 12: try { try decoder.decodeSingularStringField(value: &self.messagesPart2) }() + case 13: try { try decoder.decodeSingularStringField(value: &self.messagesPart3) }() + case 14: try { try decoder.decodeSingularStringField(value: &self.messagesPart4) }() default: break } } } func traverse(visitor: inout V) throws { - if !self.text.isEmpty { - try visitor.visitSingularStringField(value: self.text, fieldNumber: 1) + if !self.messagesPart1.isEmpty { + try visitor.visitSingularStringField(value: self.messagesPart1, fieldNumber: 11) + } + if !self.messagesPart2.isEmpty { + try visitor.visitSingularStringField(value: self.messagesPart2, fieldNumber: 12) + } + if !self.messagesPart3.isEmpty { + try visitor.visitSingularStringField(value: self.messagesPart3, fieldNumber: 13) + } + if !self.messagesPart4.isEmpty { + try visitor.visitSingularStringField(value: self.messagesPart4, fieldNumber: 14) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: CannedMessagePluginMessagePart1, rhs: CannedMessagePluginMessagePart1) -> Bool { - if lhs.text != rhs.text {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension CannedMessagePluginMessagePart2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "CannedMessagePluginMessagePart2" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "text"), - ] - - mutating func decodeMessage(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.text) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.text.isEmpty { - try visitor.visitSingularStringField(value: self.text, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: CannedMessagePluginMessagePart2, rhs: CannedMessagePluginMessagePart2) -> Bool { - if lhs.text != rhs.text {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension CannedMessagePluginMessagePart3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "CannedMessagePluginMessagePart3" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "text"), - ] - - mutating func decodeMessage(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.text) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.text.isEmpty { - try visitor.visitSingularStringField(value: self.text, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: CannedMessagePluginMessagePart3, rhs: CannedMessagePluginMessagePart3) -> Bool { - if lhs.text != rhs.text {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension CannedMessagePluginMessagePart4: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "CannedMessagePluginMessagePart4" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "text"), - ] - - mutating func decodeMessage(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.text) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.text.isEmpty { - try visitor.visitSingularStringField(value: self.text, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: CannedMessagePluginMessagePart4, rhs: CannedMessagePluginMessagePart4) -> Bool { - if lhs.text != rhs.text {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension CannedMessagePluginMessagePart5: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "CannedMessagePluginMessagePart5" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "text"), - ] - - mutating func decodeMessage(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.text) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.text.isEmpty { - try visitor.visitSingularStringField(value: self.text, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: CannedMessagePluginMessagePart5, rhs: CannedMessagePluginMessagePart5) -> Bool { - if lhs.text != rhs.text {return false} + static func ==(lhs: CannedMessageModuleConfig, rhs: CannedMessageModuleConfig) -> Bool { + if lhs.messagesPart1 != rhs.messagesPart1 {return false} + if lhs.messagesPart2 != rhs.messagesPart2 {return false} + if lhs.messagesPart3 != rhs.messagesPart3 {return false} + if lhs.messagesPart4 != rhs.messagesPart4 {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/MeshtasticClient/Protobufs/channel.pb.swift b/MeshtasticClient/Protobufs/channel.pb.swift index 81b35faf..187de7b2 100644 --- a/MeshtasticClient/Protobufs/channel.pb.swift +++ b/MeshtasticClient/Protobufs/channel.pb.swift @@ -79,7 +79,7 @@ struct ChannelSettings { /// 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 = .bw125Cr45Sf128 + var modemConfig: ChannelSettings.ModemConfig = .vlongSlow /// /// Bandwidth in MHz @@ -173,60 +173,60 @@ struct ChannelSettings { typealias RawValue = Int /// - /// < Bw = 125 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC - /// < on. ShortSlow | Short Range / Slow (5.469 kbps) - case bw125Cr45Sf128 // = 0 + /// TODO: REPLACE + case vlongSlow // = 0 /// - /// < Bw = 500 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC - /// < on. ShortFast | Short Range / Fast (21.875 kbps) - case bw500Cr45Sf128 // = 1 + /// TODO: REPLACE + case longSlow // = 1 /// - /// < Bw = 31.25 kHz, Cr = 4/8, Sf(9) = 512chips/symbol, - /// < CRC on. LongFast | Long Range / Fast (275 bps) - case bw3125Cr48Sf512 // = 2 + /// TODO: REPLACE + case longFast // = 2 /// - /// < Bw = 125 kHz, Cr = 4/8, Sf(12) = 4096chips/symbol, CRC - /// < on. LongSlow | Long Range / Slow (183 bps) - case bw125Cr48Sf4096 // = 3 + /// TODO: REPLACE + case midSlow // = 3 /// - /// < Bw = 250 kHz, Cr = 4/6, Sf(11) = 2048chips/symbol, CRC - /// < on. MediumSlow | Medium Range / Slow (895 bps) - case bw250Cr46Sf2048 // = 4 + /// TODO: REPLACE + case midFast // = 4 /// - /// < Bw = 250 kHz, Cr = 4/7, Sf(10) = 1024chips/symbol, CRC - /// < on. MediumFast | Medium Range / Fast (1400 bps) - case bw250Cr47Sf1024 // = 5 + /// TODO: REPLACE + case shortSlow // = 5 + + /// + /// TODO: REPLACE + case shortFast // = 6 case UNRECOGNIZED(Int) init() { - self = .bw125Cr45Sf128 + self = .vlongSlow } init?(rawValue: Int) { switch rawValue { - case 0: self = .bw125Cr45Sf128 - case 1: self = .bw500Cr45Sf128 - case 2: self = .bw3125Cr48Sf512 - case 3: self = .bw125Cr48Sf4096 - case 4: self = .bw250Cr46Sf2048 - case 5: self = .bw250Cr47Sf1024 + 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 .bw125Cr45Sf128: return 0 - case .bw500Cr45Sf128: return 1 - case .bw3125Cr48Sf512: return 2 - case .bw125Cr48Sf4096: return 3 - case .bw250Cr46Sf2048: return 4 - case .bw250Cr47Sf1024: return 5 + 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 } } @@ -241,12 +241,13 @@ struct ChannelSettings { extension ChannelSettings.ModemConfig: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. static var allCases: [ChannelSettings.ModemConfig] = [ - .bw125Cr45Sf128, - .bw500Cr45Sf128, - .bw3125Cr48Sf512, - .bw125Cr48Sf4096, - .bw250Cr46Sf2048, - .bw250Cr47Sf1024, + .vlongSlow, + .longSlow, + .longFast, + .midSlow, + .midFast, + .shortSlow, + .shortFast, ] } @@ -276,6 +277,8 @@ struct Channel { /// 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() @@ -351,6 +354,13 @@ extension Channel.Role: CaseIterable { #endif // swift(>=4.2) +#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) + // MARK: - Code below here is support for the SwiftProtobuf runtime. extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { @@ -395,7 +405,7 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen if self.txPower != 0 { try visitor.visitSingularInt32Field(value: self.txPower, fieldNumber: 1) } - if self.modemConfig != .bw125Cr45Sf128 { + if self.modemConfig != .vlongSlow { try visitor.visitSingularEnumField(value: self.modemConfig, fieldNumber: 3) } if !self.psk.isEmpty { @@ -447,12 +457,13 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen extension ChannelSettings.ModemConfig: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "Bw125Cr45Sf128"), - 1: .same(proto: "Bw500Cr45Sf128"), - 2: .same(proto: "Bw31_25Cr48Sf512"), - 3: .same(proto: "Bw125Cr48Sf4096"), - 4: .same(proto: "Bw250Cr46Sf2048"), - 5: .same(proto: "Bw250Cr47Sf1024"), + 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"), ] } @@ -479,12 +490,16 @@ extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } func traverse(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) } - if let v = self._settings { + 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) } diff --git a/MeshtasticClient/Protobufs/deviceonly.pb.swift b/MeshtasticClient/Protobufs/deviceonly.pb.swift index db92de38..9311b664 100644 --- a/MeshtasticClient/Protobufs/deviceonly.pb.swift +++ b/MeshtasticClient/Protobufs/deviceonly.pb.swift @@ -20,45 +20,6 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -/// -/// This is a stub version of the old 1.1 representation of RadioConfig. -/// But only keeping the region info. -/// The device firmware uses this stub while migrating old nodes to the new preferences system. -struct LegacyRadioConfig { - // 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 preferences: LegacyRadioConfig.LegacyPreferences { - get {return _preferences ?? LegacyRadioConfig.LegacyPreferences()} - set {_preferences = newValue} - } - /// Returns true if `preferences` has been explicitly set. - var hasPreferences: Bool {return self._preferences != nil} - /// Clears the value of `preferences`. Subsequent reads from it will return its default value. - mutating func clearPreferences() {self._preferences = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - struct LegacyPreferences { - // 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 region code for my radio (US, CN, EU433, etc...) - var region: RegionCode = .unset - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - init() {} - - fileprivate var _preferences: LegacyRadioConfig.LegacyPreferences? = nil -} - /// /// This message is never sent over the wire, but it is used for serializing DB /// state to flash in the device code @@ -70,17 +31,6 @@ struct DeviceState { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - /// - /// Moved to its own file, but we keep this here so we can automatically migrate old radio.region settings - var legacyRadio: LegacyRadioConfig { - get {return _storage._legacyRadio ?? LegacyRadioConfig()} - set {_uniqueStorage()._legacyRadio = newValue} - } - /// Returns true if `legacyRadio` has been explicitly set. - var hasLegacyRadio: Bool {return _storage._legacyRadio != nil} - /// Clears the value of `legacyRadio`. Subsequent reads from it will return its default value. - mutating func clearLegacyRadio() {_uniqueStorage()._legacyRadio = nil} - /// /// Read only settings/info about this node var myNode: MyNodeInfo { @@ -103,6 +53,8 @@ struct DeviceState { /// 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} @@ -152,41 +104,6 @@ struct DeviceState { set {_uniqueStorage()._didGpsReset = newValue} } - /// - /// Canned Message Plugin message part1. - var cannedMessagePluginMessagePart1: String { - get {return _storage._cannedMessagePluginMessagePart1} - set {_uniqueStorage()._cannedMessagePluginMessagePart1 = newValue} - } - - /// - /// Canned Message Plugin message part2. - var cannedMessagePluginMessagePart2: String { - get {return _storage._cannedMessagePluginMessagePart2} - set {_uniqueStorage()._cannedMessagePluginMessagePart2 = newValue} - } - - /// - /// Canned Message Plugin message part3. - var cannedMessagePluginMessagePart3: String { - get {return _storage._cannedMessagePluginMessagePart3} - set {_uniqueStorage()._cannedMessagePluginMessagePart3 = newValue} - } - - /// - /// Canned Message Plugin message part4. - var cannedMessagePluginMessagePart4: String { - get {return _storage._cannedMessagePluginMessagePart4} - set {_uniqueStorage()._cannedMessagePluginMessagePart4 = newValue} - } - - /// - /// Canned Message Plugin message part5. - var cannedMessagePluginMessagePart5: String { - get {return _storage._cannedMessagePluginMessagePart5} - set {_uniqueStorage()._cannedMessagePluginMessagePart5 = newValue} - } - var unknownFields = SwiftProtobuf.UnknownStorage() init() {} @@ -210,76 +127,16 @@ struct ChannelFile { init() {} } +#if swift(>=5.5) && canImport(_Concurrency) +extension DeviceState: @unchecked Sendable {} +extension ChannelFile: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + // MARK: - Code below here is support for the SwiftProtobuf runtime. -extension LegacyRadioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "LegacyRadioConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "preferences"), - ] - - mutating func decodeMessage(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._preferences) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if let v = self._preferences { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: LegacyRadioConfig, rhs: LegacyRadioConfig) -> Bool { - if lhs._preferences != rhs._preferences {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension LegacyRadioConfig.LegacyPreferences: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = LegacyRadioConfig.protoMessageName + ".LegacyPreferences" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 15: .same(proto: "region"), - ] - - mutating func decodeMessage(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 15: try { try decoder.decodeSingularEnumField(value: &self.region) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.region != .unset { - try visitor.visitSingularEnumField(value: self.region, fieldNumber: 15) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: LegacyRadioConfig.LegacyPreferences, rhs: LegacyRadioConfig.LegacyPreferences) -> Bool { - if lhs.region != rhs.region {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = "DeviceState" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "legacyRadio"), 2: .standard(proto: "my_node"), 3: .same(proto: "owner"), 4: .standard(proto: "node_db"), @@ -288,15 +145,9 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati 7: .standard(proto: "rx_text_message"), 9: .standard(proto: "no_save"), 11: .standard(proto: "did_gps_reset"), - 13: .standard(proto: "canned_message_plugin_message_part1"), - 14: .standard(proto: "canned_message_plugin_message_part2"), - 15: .standard(proto: "canned_message_plugin_message_part3"), - 16: .standard(proto: "canned_message_plugin_message_part4"), - 17: .standard(proto: "canned_message_plugin_message_part5"), ] fileprivate class _StorageClass { - var _legacyRadio: LegacyRadioConfig? = nil var _myNode: MyNodeInfo? = nil var _owner: User? = nil var _nodeDb: [NodeInfo] = [] @@ -305,18 +156,12 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati var _rxTextMessage: MeshPacket? = nil var _noSave: Bool = false var _didGpsReset: Bool = false - var _cannedMessagePluginMessagePart1: String = String() - var _cannedMessagePluginMessagePart2: String = String() - var _cannedMessagePluginMessagePart3: String = String() - var _cannedMessagePluginMessagePart4: String = String() - var _cannedMessagePluginMessagePart5: String = String() static let defaultInstance = _StorageClass() private init() {} init(copying source: _StorageClass) { - _legacyRadio = source._legacyRadio _myNode = source._myNode _owner = source._owner _nodeDb = source._nodeDb @@ -325,11 +170,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati _rxTextMessage = source._rxTextMessage _noSave = source._noSave _didGpsReset = source._didGpsReset - _cannedMessagePluginMessagePart1 = source._cannedMessagePluginMessagePart1 - _cannedMessagePluginMessagePart2 = source._cannedMessagePluginMessagePart2 - _cannedMessagePluginMessagePart3 = source._cannedMessagePluginMessagePart3 - _cannedMessagePluginMessagePart4 = source._cannedMessagePluginMessagePart4 - _cannedMessagePluginMessagePart5 = source._cannedMessagePluginMessagePart5 } } @@ -348,7 +188,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati // 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._legacyRadio) }() 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) }() @@ -357,11 +196,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati 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) }() - case 13: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessagePluginMessagePart1) }() - case 14: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessagePluginMessagePart2) }() - case 15: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessagePluginMessagePart3) }() - case 16: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessagePluginMessagePart4) }() - case 17: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessagePluginMessagePart5) }() default: break } } @@ -370,24 +204,25 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati func traverse(visitor: inout V) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._legacyRadio { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if let v = _storage._myNode { + // 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) - } - if let v = _storage._owner { + } }() + 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) } - if let v = _storage._rxTextMessage { + 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) } @@ -397,21 +232,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati if _storage._didGpsReset != false { try visitor.visitSingularBoolField(value: _storage._didGpsReset, fieldNumber: 11) } - if !_storage._cannedMessagePluginMessagePart1.isEmpty { - try visitor.visitSingularStringField(value: _storage._cannedMessagePluginMessagePart1, fieldNumber: 13) - } - if !_storage._cannedMessagePluginMessagePart2.isEmpty { - try visitor.visitSingularStringField(value: _storage._cannedMessagePluginMessagePart2, fieldNumber: 14) - } - if !_storage._cannedMessagePluginMessagePart3.isEmpty { - try visitor.visitSingularStringField(value: _storage._cannedMessagePluginMessagePart3, fieldNumber: 15) - } - if !_storage._cannedMessagePluginMessagePart4.isEmpty { - try visitor.visitSingularStringField(value: _storage._cannedMessagePluginMessagePart4, fieldNumber: 16) - } - if !_storage._cannedMessagePluginMessagePart5.isEmpty { - try visitor.visitSingularStringField(value: _storage._cannedMessagePluginMessagePart5, fieldNumber: 17) - } } try unknownFields.traverse(visitor: &visitor) } @@ -421,7 +241,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 let rhs_storage = _args.1 - if _storage._legacyRadio != rhs_storage._legacyRadio {return false} if _storage._myNode != rhs_storage._myNode {return false} if _storage._owner != rhs_storage._owner {return false} if _storage._nodeDb != rhs_storage._nodeDb {return false} @@ -430,11 +249,6 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati if _storage._rxTextMessage != rhs_storage._rxTextMessage {return false} if _storage._noSave != rhs_storage._noSave {return false} if _storage._didGpsReset != rhs_storage._didGpsReset {return false} - if _storage._cannedMessagePluginMessagePart1 != rhs_storage._cannedMessagePluginMessagePart1 {return false} - if _storage._cannedMessagePluginMessagePart2 != rhs_storage._cannedMessagePluginMessagePart2 {return false} - if _storage._cannedMessagePluginMessagePart3 != rhs_storage._cannedMessagePluginMessagePart3 {return false} - if _storage._cannedMessagePluginMessagePart4 != rhs_storage._cannedMessagePluginMessagePart4 {return false} - if _storage._cannedMessagePluginMessagePart5 != rhs_storage._cannedMessagePluginMessagePart5 {return false} return true } if !storagesAreEqual {return false} diff --git a/MeshtasticClient/Protobufs/environmental_measurement.pb.swift b/MeshtasticClient/Protobufs/environmental_measurement.pb.swift deleted file mode 100644 index 76533a31..00000000 --- a/MeshtasticClient/Protobufs/environmental_measurement.pb.swift +++ /dev/null @@ -1,107 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: environmental_measurement.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 EnvironmentalMeasurement { - // 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 temperature: Float = 0 - - var relativeHumidity: Float = 0 - - var barometricPressure: Float = 0 - - var gasResistance: Float = 0 - - var voltage: Float = 0 - - var current: Float = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension EnvironmentalMeasurement: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "EnvironmentalMeasurement" - 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(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(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: EnvironmentalMeasurement, rhs: EnvironmentalMeasurement) -> 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 - } -} diff --git a/MeshtasticClient/Protobufs/mesh.pb.swift b/MeshtasticClient/Protobufs/mesh.pb.swift index 9f6370a3..bf18f8ca 100644 --- a/MeshtasticClient/Protobufs/mesh.pb.swift +++ b/MeshtasticClient/Protobufs/mesh.pb.swift @@ -46,32 +46,79 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// To match the old style filenames, _ is converted to -, p is converted to . enum HardwareModel: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// TODO: REPLACE case unset // = 0 + + /// + /// TODO: REPLACE case tloraV2 // = 1 + + /// + /// TODO: REPLACE case tloraV1 // = 2 + + /// + /// TODO: REPLACE case tloraV211P6 // = 3 + + /// + /// TODO: REPLACE case tbeam // = 4 - /// The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13 (see HELTEC_V2 for the new version). + /// + /// The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13 + /// (see HELTEC_V2 for the new version). case heltecV20 // = 5 + + /// + /// TODO: REPLACE case tbeam0P7 // = 6 + + /// + /// TODO: REPLACE case tEcho // = 7 + + /// + /// TODO: REPLACE case tloraV11P3 // = 8 + + /// + /// TODO: REPLACE case rak4631 // = 9 - /// The new version of the heltec WiFi_Lora_32_V2 board that has battery sensing hooked to GPIO 37. Sadly they did not update anything on the silkscreen to identify this board + /// + /// The new version of the heltec WiFi_Lora_32_V2 board that has battery sensing hooked to GPIO 37. + /// Sadly they did not update anything on the silkscreen to identify this board case heltecV21 // = 10 - /// Ancient heltec WiFi_Lora_32 board + /// + /// Ancient heltec WiFi_Lora_32 board case heltecV1 // = 11 /// /// Less common/prototype boards listed here (needs one more byte over the air) case loraRelayV1 // = 32 + + /// + /// TODO: REPLACE case nrf52840Dk // = 33 + + /// + /// TODO: REPLACE case ppr // = 34 + + /// + /// TODO: REPLACE case genieblocks // = 35 + + /// + /// TODO: REPLACE case nrf52Unknown // = 36 + + /// + /// TODO: REPLACE case portduino // = 37 /// @@ -191,21 +238,64 @@ extension HardwareModel: CaseIterable { enum Team: SwiftProtobuf.Enum { typealias RawValue = Int - /// the default (unset) is "achromatic" (unaffiliated) + /// + /// the default (unset) is "achromatic" (unaffiliated) case clear // = 0 + + /// + /// TODO: REPLACE case cyan // = 1 + + /// + /// TODO: REPLACE case white // = 2 + + /// + /// TODO: REPLACE case yellow // = 3 + + /// + /// TODO: REPLACE case orange // = 4 + + /// + /// TODO: REPLACE case magenta // = 5 + + /// + /// TODO: REPLACE case red // = 6 + + /// + /// TODO: REPLACE case maroon // = 7 + + /// + /// TODO: REPLACE case purple // = 8 + + /// + /// TODO: REPLACE case darkBlue // = 9 + + /// + /// TODO: REPLACE case blue // = 10 + + /// + /// TODO: REPLACE case teal // = 11 + + /// + /// TODO: REPLACE case green // = 12 + + /// + /// TODO: REPLACE case darkGreen // = 13 + + /// + /// TODO: REPLACE case brown // = 14 case UNRECOGNIZED(Int) @@ -341,6 +431,9 @@ extension Constants: CaseIterable { /// and we'll try to help. enum CriticalErrorCode: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// TODO: REPLACE case none // = 0 /// @@ -384,8 +477,9 @@ enum CriticalErrorCode: SwiftProtobuf.Enum { /// Selftest of SX1262 radio chip failed case sx1262Failure // = 10 - /// A (likely software but possibly hardware) failure was detected while trying to send packets. If this occurs on your board, please - ///post in the forum so that we can ask you to collect some information to allow fixing this bug + /// + /// A (likely software but possibly hardware) failure was detected while trying to send packets. + /// If this occurs on your board, please post in the forum so that we can ask you to collect some information to allow fixing this bug case radioSpiBug // = 11 case UNRECOGNIZED(Int) @@ -468,6 +562,8 @@ struct Position { set {_uniqueStorage()._latitudeI = newValue} } + /// + /// TODO: REPLACE var longitudeI: Int32 { get {return _storage._longitudeI} set {_uniqueStorage()._longitudeI = newValue} @@ -480,13 +576,6 @@ struct Position { set {_uniqueStorage()._altitude = newValue} } - /// - /// 1-100 (0 means not provided) - var batteryLevel: Int32 { - get {return _storage._batteryLevel} - set {_uniqueStorage()._batteryLevel = newValue} - } - /// /// 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 @@ -498,11 +587,15 @@ struct Position { set {_uniqueStorage()._time = newValue} } + /// + /// TODO: REPLACE var locationSource: Position.LocSource { get {return _storage._locationSource} set {_uniqueStorage()._locationSource = newValue} } + /// + /// TODO: REPLACE var altitudeSource: Position.AltSource { get {return _storage._altitudeSource} set {_uniqueStorage()._altitudeSource = newValue} @@ -541,16 +634,21 @@ struct Position { /// - PDOP is sufficient for most cases /// - for higher precision scenarios, HDOP and VDOP can be used instead, /// in which case PDOP becomes redundant (PDOP=sqrt(HDOP^2 + VDOP^2)) + /// TODO: REMOVE/INTEGRATE var pdop: UInt32 { get {return _storage._pdop} set {_uniqueStorage()._pdop = newValue} } + /// + /// TODO: REPLACE var hdop: UInt32 { get {return _storage._hdop} set {_uniqueStorage()._hdop = newValue} } + /// + /// TODO: REPLACE var vdop: UInt32 { get {return _storage._vdop} set {_uniqueStorage()._vdop = newValue} @@ -572,11 +670,14 @@ struct Position { /// - "track" is the direction of motion (measured in horizontal plane) /// - "heading" is where the fuselage points (measured in horizontal plane) /// - "yaw" indicates a relative rotation about the vertical axis + /// TODO: REMOVE/INTEGRATE var groundSpeed: UInt32 { get {return _storage._groundSpeed} set {_uniqueStorage()._groundSpeed = newValue} } + /// + /// TODO: REPLACE var groundTrack: UInt32 { get {return _storage._groundTrack} set {_uniqueStorage()._groundTrack = newValue} @@ -634,13 +735,21 @@ struct Position { /// How the location was acquired: manual, onboard GPS, external (EUD) GPS enum LocSource: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// TODO: REPLACE case locsrcUnspecified // = 0 + + /// + /// TODO: REPLACE case locsrcManualEntry // = 1 + + /// + /// TODO: REPLACE case locsrcGpsInternal // = 2 /// - /// More location sources can be added here when available: - /// GSM, radio beacons (BLE etc), location fingerprinting etc + /// TODO: REPLACE case locsrcGpsExternal // = 3 case UNRECOGNIZED(Int) @@ -675,10 +784,25 @@ struct Position { /// Default: same as location_source if present enum AltSource: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// TODO: REPLACE case altsrcUnspecified // = 0 + + /// + /// TODO: REPLACE case altsrcManualEntry // = 1 + + /// + /// TODO: REPLACE case altsrcGpsInternal // = 2 + + /// + /// TODO: REPLACE case altsrcGpsExternal // = 3 + + /// + /// TODO: REPLACE case altsrcBarometric // = 4 case UNRECOGNIZED(Int) @@ -851,7 +975,7 @@ struct RouteDiscovery { } /// -/// A Routing control Data packet handled by the routing plugin +/// A Routing control Data packet handled by the routing module struct Routing { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -945,6 +1069,9 @@ struct Routing { /// /// We received a nak while trying to forward on your behalf case gotNak // = 2 + + /// + /// TODO: REPLACE case timeout // = 3 /// @@ -973,8 +1100,8 @@ struct Routing { case badRequest // = 32 /// - /// The application layer service on the remote node received your request, but considered your request not authorized (i.e you did not - /// send the request on the required bound channel) + /// The application layer service on the remote node received your request, but considered your request not authorized + /// (i.e you did not send the request on the required bound channel) case notAuthorized // = 33 case UNRECOGNIZED(Int) @@ -1056,7 +1183,7 @@ struct DataMessage { var portnum: PortNum = .unknownApp /// - /// Required + /// TODO: REPLACE var payload: Data = Data() /// @@ -1091,7 +1218,52 @@ struct DataMessage { /// /// Defaults to false. If true, then what is in the payload should be treated as an emoji like giving /// a message a heart or poop emoji. - var isTapback: Bool = false + var emoji: UInt32 = 0 + + /// + /// Location structure + var location: Location { + get {return _location ?? Location()} + set {_location = newValue} + } + /// Returns true if `location` has been explicitly set. + var hasLocation: Bool {return self._location != nil} + /// Clears the value of `location`. Subsequent reads from it will return its default value. + mutating func clearLocation() {self._location = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _location: Location? = nil +} + +/// +/// Location of a waypoint to associate with a message +struct Location { + // 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. + + /// + /// Id of the location + var id: UInt32 = 0 + + /// + /// latitude_i + var latitudeI: Int32 = 0 + + /// + /// longitude_i + var longitudeI: Int32 = 0 + + /// + /// Time the location is to expire (epoch) + var expire: UInt32 = 0 + + /// + /// If true, only allow the original sender to update the location. + var locked: Bool = false var unknownFields = SwiftProtobuf.UnknownStorage() @@ -1110,7 +1282,7 @@ struct MeshPacket { /// /// The sending node number. /// Note: Our crypto implementation uses this field as well. - /// See [crypto](/developers/device/encryption.md) for details. + /// See [crypto](/docs/developers/firmware/encryption) for details. /// FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. var from: UInt32 { get {return _storage._from} @@ -1143,6 +1315,8 @@ struct MeshPacket { set {_uniqueStorage()._payloadVariant = newValue} } + /// + /// TODO: REPLACE var decoded: DataMessage { get { if case .decoded(let v)? = _storage._payloadVariant {return v} @@ -1151,6 +1325,8 @@ struct MeshPacket { set {_uniqueStorage()._payloadVariant = .decoded(newValue)} } + /// + /// TODO: REPLACE var encrypted: Data { get { if case .encrypted(let v)? = _storage._payloadVariant {return v} @@ -1167,7 +1343,7 @@ struct MeshPacket { /// needs to be unique for a few minutes (long enough to last for the length of /// any ACK or the completion of a mesh broadcast flood). /// Note: Our crypto implementation uses this id as well. - /// See [crypto](/developers/device/encryption.md) for details. + /// See [crypto](/docs/developers/firmware/encryption) for details. /// FIXME - really should be fixed32 instead, this encoding only /// hurts the ble link though. var id: UInt32 { @@ -1244,7 +1420,11 @@ struct MeshPacket { var unknownFields = SwiftProtobuf.UnknownStorage() enum OneOf_PayloadVariant: Equatable { + /// + /// TODO: REPLACE case decoded(DataMessage) + /// + /// TODO: REPLACE case encrypted(Data) #if !swift(>=4.1) @@ -1296,6 +1476,9 @@ struct MeshPacket { /// /// Treated as Priority.DEFAULT case unset // = 0 + + /// + /// TODO: REPLACE case min // = 1 /// @@ -1316,6 +1499,9 @@ struct MeshPacket { /// Ack/naks are sent with very high priority to ensure that retransmission /// stops as soon as possible case ack // = 120 + + /// + /// TODO: REPLACE case max // = 127 case UNRECOGNIZED(Int) @@ -1453,46 +1639,65 @@ struct NodeInfo { /// /// The node number - var num: UInt32 = 0 + var num: UInt32 { + get {return _storage._num} + set {_uniqueStorage()._num = newValue} + } /// /// The user info for this node var user: User { - get {return _user ?? User()} - set {_user = newValue} + get {return _storage._user ?? User()} + set {_uniqueStorage()._user = newValue} } /// Returns true if `user` has been explicitly set. - var hasUser: Bool {return self._user != nil} + var hasUser: Bool {return _storage._user != nil} /// Clears the value of `user`. Subsequent reads from it will return its default value. - mutating func clearUser() {self._user = nil} + mutating func clearUser() {_uniqueStorage()._user = nil} /// /// This position data. Note: before 1.2.14 we would also store the last time we've heard from this node in position.time, that is no longer true. /// Position.time now indicates the last time we received a POSITION from that node. var position: Position { - get {return _position ?? Position()} - set {_position = newValue} + get {return _storage._position ?? Position()} + set {_uniqueStorage()._position = newValue} } /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return self._position != nil} + var hasPosition: Bool {return _storage._position != nil} /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() {self._position = nil} + mutating func clearPosition() {_uniqueStorage()._position = nil} /// /// Returns the Signal-to-noise ratio (SNR) of the last received message, /// as measured by the receiver. Return SNR of the last received message in dB - var snr: Float = 0 + var snr: Float { + get {return _storage._snr} + set {_uniqueStorage()._snr = newValue} + } /// /// Set to indicate the last time we received a packet from this node - var lastHeard: UInt32 = 0 + var lastHeard: UInt32 { + get {return _storage._lastHeard} + set {_uniqueStorage()._lastHeard = newValue} + } + + /// + /// The latest device telemetry data for the node. + var telemetry: Telemetry { + get {return _storage._telemetry ?? Telemetry()} + 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} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _user: User? = nil - fileprivate var _position: Position? = nil + fileprivate var _storage = _StorageClass.defaultInstance } /// @@ -1520,15 +1725,6 @@ struct MyNodeInfo { set {_uniqueStorage()._hasGps_p = newValue} } - /// - /// # of frequencies that can be used (set at build time in the device flash image). - /// Note: this is different from max_channels, this field is telling the # of frequency bands this node can use. - /// (old name was num_channels) - var numBands: UInt32 { - get {return _storage._numBands} - set {_uniqueStorage()._numBands = newValue} - } - /// /// The maximum number of 'software' channels that can be set on this node. var maxChannels: UInt32 { @@ -1549,16 +1745,6 @@ struct MyNodeInfo { set {_uniqueStorage()._region = newValue} } - /// - /// TBEAM, HELTEC, etc... - /// Starting in 1.2.11 moved to hw_model enum in the NodeInfo object. - /// Apps will still need the string here for older builds - /// (so OTA update can find the right image), but if the enum is available it will be used instead. - var hwModelDeprecated: String { - get {return _storage._hwModelDeprecated} - set {_uniqueStorage()._hwModelDeprecated = newValue} - } - /// /// 0.0.5 etc... var firmwareVersion: String { @@ -1680,6 +1866,8 @@ struct LogRecord { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. + /// + /// Log levels, chosen to match python logging conventions. var message: String = String() /// @@ -1700,12 +1888,33 @@ struct LogRecord { /// Log levels, chosen to match python logging conventions. enum Level: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// Log levels, chosen to match python logging conventions. case unset // = 0 + + /// + /// Log levels, chosen to match python logging conventions. case critical // = 50 + + /// + /// Log levels, chosen to match python logging conventions. case error // = 40 + + /// + /// Log levels, chosen to match python logging conventions. case warning // = 30 + + /// + /// Log levels, chosen to match python logging conventions. case info // = 20 + + /// + /// Log levels, chosen to match python logging conventions. case debug // = 10 + + /// + /// Log levels, chosen to match python logging conventions. case trace // = 5 case UNRECOGNIZED(Int) @@ -1772,12 +1981,16 @@ struct FromRadio { // methods supported on all messages. /// - /// The packet num, used to allow the phone to request missing read packets from the FIFO, + /// The packet id, used to allow the phone to request missing read packets from the FIFO, /// see our bluetooth docs - var num: UInt32 = 0 + var id: UInt32 = 0 + /// + /// Log levels, chosen to match python logging conventions. var payloadVariant: FromRadio.OneOf_PayloadVariant? = nil + /// + /// Log levels, chosen to match python logging conventions. var packet: MeshPacket { get { if case .packet(let v)? = payloadVariant {return v} @@ -1846,7 +2059,11 @@ struct FromRadio { var unknownFields = SwiftProtobuf.UnknownStorage() + /// + /// Log levels, chosen to match python logging conventions. enum OneOf_PayloadVariant: Equatable { + /// + /// Log levels, chosen to match python logging conventions. case packet(MeshPacket) /// /// Tells the phone what our node number is, can be -1 if we've not yet joined a mesh. @@ -1919,6 +2136,8 @@ struct ToRadio { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. + /// + /// Log levels, chosen to match python logging conventions. var payloadVariant: ToRadio.OneOf_PayloadVariant? = nil /// @@ -1973,6 +2192,8 @@ struct ToRadio { var unknownFields = SwiftProtobuf.UnknownStorage() + /// + /// Log levels, chosen to match python logging conventions. enum OneOf_PayloadVariant: Equatable { /// /// Send this packet on the mesh @@ -2052,6 +2273,36 @@ struct ToRadio { init() {} } +#if swift(>=5.5) && canImport(_Concurrency) +extension HardwareModel: @unchecked Sendable {} +extension Team: @unchecked Sendable {} +extension Constants: @unchecked Sendable {} +extension CriticalErrorCode: @unchecked Sendable {} +extension Position: @unchecked Sendable {} +extension Position.LocSource: @unchecked Sendable {} +extension Position.AltSource: @unchecked Sendable {} +extension User: @unchecked Sendable {} +extension RouteDiscovery: @unchecked Sendable {} +extension Routing: @unchecked Sendable {} +extension Routing.OneOf_Variant: @unchecked Sendable {} +extension Routing.Error: @unchecked Sendable {} +extension DataMessage: @unchecked Sendable {} +extension Location: @unchecked Sendable {} +extension MeshPacket: @unchecked Sendable {} +extension MeshPacket.OneOf_PayloadVariant: @unchecked Sendable {} +extension MeshPacket.Priority: @unchecked Sendable {} +extension MeshPacket.Delayed: @unchecked Sendable {} +extension NodeInfo: @unchecked Sendable {} +extension MyNodeInfo: @unchecked Sendable {} +extension LogRecord: @unchecked Sendable {} +extension LogRecord.Level: @unchecked Sendable {} +extension FromRadio: @unchecked Sendable {} +extension FromRadio.OneOf_PayloadVariant: @unchecked Sendable {} +extension ToRadio: @unchecked Sendable {} +extension ToRadio.OneOf_PayloadVariant: @unchecked Sendable {} +extension ToRadio.PeerInfo: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + // MARK: - Code below here is support for the SwiftProtobuf runtime. extension HardwareModel: SwiftProtobuf._ProtoNameProviding { @@ -2131,7 +2382,6 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB 1: .standard(proto: "latitude_i"), 2: .standard(proto: "longitude_i"), 3: .same(proto: "altitude"), - 4: .standard(proto: "battery_level"), 9: .same(proto: "time"), 10: .standard(proto: "location_source"), 11: .standard(proto: "altitude_source"), @@ -2157,7 +2407,6 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB var _latitudeI: Int32 = 0 var _longitudeI: Int32 = 0 var _altitude: Int32 = 0 - var _batteryLevel: Int32 = 0 var _time: UInt32 = 0 var _locationSource: Position.LocSource = .locsrcUnspecified var _altitudeSource: Position.AltSource = .altsrcUnspecified @@ -2186,7 +2435,6 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB _latitudeI = source._latitudeI _longitudeI = source._longitudeI _altitude = source._altitude - _batteryLevel = source._batteryLevel _time = source._time _locationSource = source._locationSource _altitudeSource = source._altitudeSource @@ -2227,7 +2475,6 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB case 1: try { try decoder.decodeSingularSFixed32Field(value: &_storage._latitudeI) }() case 2: try { try decoder.decodeSingularSFixed32Field(value: &_storage._longitudeI) }() case 3: try { try decoder.decodeSingularInt32Field(value: &_storage._altitude) }() - case 4: try { try decoder.decodeSingularInt32Field(value: &_storage._batteryLevel) }() case 9: try { try decoder.decodeSingularFixed32Field(value: &_storage._time) }() case 10: try { try decoder.decodeSingularEnumField(value: &_storage._locationSource) }() case 11: try { try decoder.decodeSingularEnumField(value: &_storage._altitudeSource) }() @@ -2264,9 +2511,6 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB if _storage._altitude != 0 { try visitor.visitSingularInt32Field(value: _storage._altitude, fieldNumber: 3) } - if _storage._batteryLevel != 0 { - try visitor.visitSingularInt32Field(value: _storage._batteryLevel, fieldNumber: 4) - } if _storage._time != 0 { try visitor.visitSingularFixed32Field(value: _storage._time, fieldNumber: 9) } @@ -2336,7 +2580,6 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB if _storage._latitudeI != rhs_storage._latitudeI {return false} if _storage._longitudeI != rhs_storage._longitudeI {return false} if _storage._altitude != rhs_storage._altitude {return false} - if _storage._batteryLevel != rhs_storage._batteryLevel {return false} if _storage._time != rhs_storage._time {return false} if _storage._locationSource != rhs_storage._locationSource {return false} if _storage._altitudeSource != rhs_storage._altitudeSource {return false} @@ -2557,8 +2800,9 @@ extension Routing: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa func traverse(visitor: inout V) throws { // 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 + // 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 switch self.variant { case .routeRequest?: try { guard case .routeRequest(let v)? = self.variant else { preconditionFailure() } @@ -2610,7 +2854,8 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati 5: .same(proto: "source"), 6: .standard(proto: "request_id"), 7: .standard(proto: "reply_id"), - 8: .standard(proto: "is_tapback"), + 8: .same(proto: "emoji"), + 9: .same(proto: "location"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -2626,13 +2871,18 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati case 5: try { try decoder.decodeSingularFixed32Field(value: &self.source) }() case 6: try { try decoder.decodeSingularFixed32Field(value: &self.requestID) }() case 7: try { try decoder.decodeSingularFixed32Field(value: &self.replyID) }() - case 8: try { try decoder.decodeSingularBoolField(value: &self.isTapback) }() + case 8: try { try decoder.decodeSingularFixed32Field(value: &self.emoji) }() + case 9: try { try decoder.decodeSingularMessageField(value: &self._location) }() default: break } } } func traverse(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.portnum != .unknownApp { try visitor.visitSingularEnumField(value: self.portnum, fieldNumber: 1) } @@ -2654,9 +2904,12 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati if self.replyID != 0 { try visitor.visitSingularFixed32Field(value: self.replyID, fieldNumber: 7) } - if self.isTapback != false { - try visitor.visitSingularBoolField(value: self.isTapback, fieldNumber: 8) + if self.emoji != 0 { + try visitor.visitSingularFixed32Field(value: self.emoji, fieldNumber: 8) } + try { if let v = self._location { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() try unknownFields.traverse(visitor: &visitor) } @@ -2668,7 +2921,64 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati if lhs.source != rhs.source {return false} if lhs.requestID != rhs.requestID {return false} if lhs.replyID != rhs.replyID {return false} - if lhs.isTapback != rhs.isTapback {return false} + if lhs.emoji != rhs.emoji {return false} + if lhs._location != rhs._location {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Location: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = "Location" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .standard(proto: "latitude_i"), + 3: .standard(proto: "longitude_i"), + 4: .same(proto: "expire"), + 5: .same(proto: "locked"), + ] + + mutating func decodeMessage(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 2: try { try decoder.decodeSingularSFixed32Field(value: &self.latitudeI) }() + case 3: try { try decoder.decodeSingularSFixed32Field(value: &self.longitudeI) }() + case 4: try { try decoder.decodeSingularUInt32Field(value: &self.expire) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self.locked) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.id != 0 { + try visitor.visitSingularUInt32Field(value: self.id, fieldNumber: 1) + } + if self.latitudeI != 0 { + try visitor.visitSingularSFixed32Field(value: self.latitudeI, fieldNumber: 2) + } + if self.longitudeI != 0 { + try visitor.visitSingularSFixed32Field(value: self.longitudeI, fieldNumber: 3) + } + if self.expire != 0 { + try visitor.visitSingularUInt32Field(value: self.expire, fieldNumber: 4) + } + if self.locked != false { + try visitor.visitSingularBoolField(value: self.locked, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Location, rhs: Location) -> Bool { + if lhs.id != rhs.id {return false} + if lhs.latitudeI != rhs.latitudeI {return false} + if lhs.longitudeI != rhs.longitudeI {return false} + if lhs.expire != rhs.expire {return false} + if lhs.locked != rhs.locked {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } @@ -2781,6 +3091,10 @@ extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio func traverse(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 if _storage._from != 0 { try visitor.visitSingularFixed32Field(value: _storage._from, fieldNumber: 1) } @@ -2790,9 +3104,6 @@ extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio if _storage._channel != 0 { try visitor.visitSingularUInt32Field(value: _storage._channel, fieldNumber: 3) } - // 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 _storage._payloadVariant { case .decoded?: try { guard case .decoded(let v)? = _storage._payloadVariant else { preconditionFailure() } @@ -2884,51 +3195,103 @@ extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB 1: .same(proto: "num"), 2: .same(proto: "user"), 3: .same(proto: "position"), - 7: .same(proto: "snr"), - 4: .standard(proto: "last_heard"), + 4: .same(proto: "snr"), + 5: .standard(proto: "last_heard"), + 6: .same(proto: "telemetry"), ] + fileprivate class _StorageClass { + var _num: UInt32 = 0 + var _user: User? = nil + var _position: Position? = nil + var _snr: Float = 0 + var _lastHeard: UInt32 = 0 + var _telemetry: Telemetry? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _num = source._num + _user = source._user + _position = source._position + _snr = source._snr + _lastHeard = source._lastHeard + _telemetry = source._telemetry + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + mutating func decodeMessage(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.num) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._user) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._position) }() - case 4: try { try decoder.decodeSingularFixed32Field(value: &self.lastHeard) }() - case 7: try { try decoder.decodeSingularFloatField(value: &self.snr) }() - 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 1: try { try decoder.decodeSingularUInt32Field(value: &_storage._num) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._user) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._position) }() + case 4: try { try decoder.decodeSingularFloatField(value: &_storage._snr) }() + case 5: try { try decoder.decodeSingularFixed32Field(value: &_storage._lastHeard) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._telemetry) }() + default: break + } } } } func traverse(visitor: inout V) throws { - if self.num != 0 { - try visitor.visitSingularUInt32Field(value: self.num, fieldNumber: 1) - } - if let v = self._user { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } - if let v = self._position { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } - if self.lastHeard != 0 { - try visitor.visitSingularFixed32Field(value: self.lastHeard, fieldNumber: 4) - } - if self.snr != 0 { - try visitor.visitSingularFloatField(value: self.snr, fieldNumber: 7) + 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._num != 0 { + try visitor.visitSingularUInt32Field(value: _storage._num, fieldNumber: 1) + } + try { if let v = _storage._user { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._position { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + if _storage._snr != 0 { + try visitor.visitSingularFloatField(value: _storage._snr, fieldNumber: 4) + } + if _storage._lastHeard != 0 { + try visitor.visitSingularFixed32Field(value: _storage._lastHeard, fieldNumber: 5) + } + try { if let v = _storage._telemetry { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: NodeInfo, rhs: NodeInfo) -> Bool { - if lhs.num != rhs.num {return false} - if lhs._user != rhs._user {return false} - if lhs._position != rhs._position {return false} - if lhs.snr != rhs.snr {return false} - if lhs.lastHeard != rhs.lastHeard {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._num != rhs_storage._num {return false} + if _storage._user != rhs_storage._user {return false} + if _storage._position != rhs_storage._position {return false} + if _storage._snr != rhs_storage._snr {return false} + if _storage._lastHeard != rhs_storage._lastHeard {return false} + if _storage._telemetry != rhs_storage._telemetry {return false} + return true + } + if !storagesAreEqual {return false} + } if lhs.unknownFields != rhs.unknownFields {return false} return true } @@ -2939,10 +3302,8 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "my_node_num"), 2: .standard(proto: "has_gps"), - 3: .standard(proto: "num_bands"), 15: .standard(proto: "max_channels"), 4: .same(proto: "region"), - 5: .standard(proto: "hw_model_deprecated"), 6: .standard(proto: "firmware_version"), 7: .standard(proto: "error_code"), 8: .standard(proto: "error_address"), @@ -2961,10 +3322,8 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio fileprivate class _StorageClass { var _myNodeNum: UInt32 = 0 var _hasGps_p: Bool = false - var _numBands: UInt32 = 0 var _maxChannels: UInt32 = 0 var _region: String = String() - var _hwModelDeprecated: String = String() var _firmwareVersion: String = String() var _errorCode: CriticalErrorCode = .none var _errorAddress: UInt32 = 0 @@ -2986,10 +3345,8 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio init(copying source: _StorageClass) { _myNodeNum = source._myNodeNum _hasGps_p = source._hasGps_p - _numBands = source._numBands _maxChannels = source._maxChannels _region = source._region - _hwModelDeprecated = source._hwModelDeprecated _firmwareVersion = source._firmwareVersion _errorCode = source._errorCode _errorAddress = source._errorAddress @@ -3023,9 +3380,7 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio switch fieldNumber { case 1: try { try decoder.decodeSingularUInt32Field(value: &_storage._myNodeNum) }() case 2: try { try decoder.decodeSingularBoolField(value: &_storage._hasGps_p) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &_storage._numBands) }() case 4: try { try decoder.decodeSingularStringField(value: &_storage._region) }() - case 5: try { try decoder.decodeSingularStringField(value: &_storage._hwModelDeprecated) }() 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) }() @@ -3054,15 +3409,9 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio if _storage._hasGps_p != false { try visitor.visitSingularBoolField(value: _storage._hasGps_p, fieldNumber: 2) } - if _storage._numBands != 0 { - try visitor.visitSingularUInt32Field(value: _storage._numBands, fieldNumber: 3) - } if !_storage._region.isEmpty { try visitor.visitSingularStringField(value: _storage._region, fieldNumber: 4) } - if !_storage._hwModelDeprecated.isEmpty { - try visitor.visitSingularStringField(value: _storage._hwModelDeprecated, fieldNumber: 5) - } if !_storage._firmwareVersion.isEmpty { try visitor.visitSingularStringField(value: _storage._firmwareVersion, fieldNumber: 6) } @@ -3116,10 +3465,8 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio 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._numBands != rhs_storage._numBands {return false} if _storage._maxChannels != rhs_storage._maxChannels {return false} if _storage._region != rhs_storage._region {return false} - if _storage._hwModelDeprecated != rhs_storage._hwModelDeprecated {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} @@ -3207,7 +3554,7 @@ extension LogRecord.Level: SwiftProtobuf._ProtoNameProviding { extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = "FromRadio" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "num"), + 1: .same(proto: "id"), 11: .same(proto: "packet"), 3: .standard(proto: "my_info"), 4: .standard(proto: "node_info"), @@ -3222,7 +3569,7 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation // 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.num) }() + case 1: try { try decoder.decodeSingularUInt32Field(value: &self.id) }() case 3: try { var v: MyNodeInfo? var hadOneofValue = false @@ -3297,12 +3644,13 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } func traverse(visitor: inout V) throws { - if self.num != 0 { - try visitor.visitSingularUInt32Field(value: self.num, fieldNumber: 1) - } // 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 + // 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() } @@ -3334,7 +3682,7 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } static func ==(lhs: FromRadio, rhs: FromRadio) -> Bool { - if lhs.num != rhs.num {return false} + if lhs.id != rhs.id {return false} if lhs.payloadVariant != rhs.payloadVariant {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -3405,8 +3753,9 @@ extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa func traverse(visitor: inout V) throws { // 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 + // 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 switch self.payloadVariant { case .packet?: try { guard case .packet(let v)? = self.payloadVariant else { preconditionFailure() } diff --git a/MeshtasticClient/Protobufs/mqtt.pb.swift b/MeshtasticClient/Protobufs/mqtt.pb.swift index 988140a4..0f347c87 100644 --- a/MeshtasticClient/Protobufs/mqtt.pb.swift +++ b/MeshtasticClient/Protobufs/mqtt.pb.swift @@ -55,6 +55,10 @@ struct ServiceEnvelope { 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. extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { @@ -80,9 +84,13 @@ extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } func traverse(visitor: inout V) throws { - if let v = self._packet { + // 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) } diff --git a/MeshtasticClient/Protobufs/portnums.pb.swift b/MeshtasticClient/Protobufs/portnums.pb.swift index 9d204a69..175c4f66 100644 --- a/MeshtasticClient/Protobufs/portnums.pb.swift +++ b/MeshtasticClient/Protobufs/portnums.pb.swift @@ -61,27 +61,27 @@ enum PortNum: SwiftProtobuf.Enum { /// /// The built-in position messaging app. - /// Payload is a [Position](/developers/protobufs/api.md#position) message + /// Payload is a [Position](/docs/developers/protobufs/api#position) message case positionApp // = 3 /// /// The built-in user info app. - /// Payload is a [User](/developers/protobufs/api.md#user) message + /// Payload is a [User](/docs/developers/protobufs/api#user) message case nodeinfoApp // = 4 /// /// Protocol control packets for mesh protocol use. - /// Payload is a [Routing](/developers/protobufs/api.md#routing) message + /// Payload is a [Routing](/docs/developers/protobufs/api#routing) message case routingApp // = 5 /// /// Admin control packets. - /// Payload is a [AdminMessage](/developers/protobufs/api.md#adminmessage) message + /// Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message case adminApp // = 6 /// /// Provides a 'ping' service that replies to any packet it receives. - /// Also serves as a small example plugin. + /// Also serves as a small example module. case replyApp // = 32 /// @@ -93,8 +93,7 @@ enum PortNum: SwiftProtobuf.Enum { /// 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. - /// Plugin is disabled by default can be turned on by setting SERIALPLUGIN_ENABLED = 1 in SerialPlugh.cpp. - /// Maintained by Jm Casler (MC Hamster) : jm@casler.org + /// Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp. case serialApp // = 64 /// @@ -103,14 +102,13 @@ enum PortNum: SwiftProtobuf.Enum { case storeForwardApp // = 65 /// - /// STORE_FORWARD_APP (Work in Progress) - /// Maintained by Jm Casler (MC Hamster) : jm@casler.org + /// Optional port for messages for the range test module. case rangeTestApp // = 66 /// - /// Provides a format to send and receive environmental data from the Meshtastic network. + /// Provides a format to send and receive telemetry data from the Meshtastic network. /// Maintained by Charles Crossan (crossan007) : crossan007@gmail.com - case environmentalMeasurementApp // = 67 + case telemetryApp // = 67 /// /// Experimental tools for estimating node position without a GPS @@ -125,7 +123,7 @@ enum PortNum: SwiftProtobuf.Enum { case privateApp // = 256 /// - /// ATAK Forwarder Plugin https://github.com/paulmandal/atak-forwarder + /// ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder case atakForwarder // = 257 /// @@ -151,7 +149,7 @@ enum PortNum: SwiftProtobuf.Enum { case 64: self = .serialApp case 65: self = .storeForwardApp case 66: self = .rangeTestApp - case 67: self = .environmentalMeasurementApp + case 67: self = .telemetryApp case 68: self = .zpsApp case 256: self = .privateApp case 257: self = .atakForwarder @@ -174,7 +172,7 @@ enum PortNum: SwiftProtobuf.Enum { case .serialApp: return 64 case .storeForwardApp: return 65 case .rangeTestApp: return 66 - case .environmentalMeasurementApp: return 67 + case .telemetryApp: return 67 case .zpsApp: return 68 case .privateApp: return 256 case .atakForwarder: return 257 @@ -202,7 +200,7 @@ extension PortNum: CaseIterable { .serialApp, .storeForwardApp, .rangeTestApp, - .environmentalMeasurementApp, + .telemetryApp, .zpsApp, .privateApp, .atakForwarder, @@ -212,6 +210,10 @@ extension PortNum: CaseIterable { #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 { @@ -228,7 +230,7 @@ extension PortNum: SwiftProtobuf._ProtoNameProviding { 64: .same(proto: "SERIAL_APP"), 65: .same(proto: "STORE_FORWARD_APP"), 66: .same(proto: "RANGE_TEST_APP"), - 67: .same(proto: "ENVIRONMENTAL_MEASUREMENT_APP"), + 67: .same(proto: "TELEMETRY_APP"), 68: .same(proto: "ZPS_APP"), 256: .same(proto: "PRIVATE_APP"), 257: .same(proto: "ATAK_FORWARDER"), diff --git a/MeshtasticClient/Protobufs/radioconfig.pb.swift b/MeshtasticClient/Protobufs/radioconfig.pb.swift index 5ea36075..2d77364f 100644 --- a/MeshtasticClient/Protobufs/radioconfig.pb.swift +++ b/MeshtasticClient/Protobufs/radioconfig.pb.swift @@ -50,16 +50,58 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// old value will be no longer set. enum RegionCode: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// TODO: REPLACE case unset // = 0 + + /// + /// TODO: REPLACE case us // = 1 + + /// + /// TODO: REPLACE case eu433 // = 2 - case eu865 // = 3 + + /// + /// TODO: REPLACE + case eu868 // = 3 + + /// + /// TODO: REPLACE case cn // = 4 + + /// + /// TODO: REPLACE case jp // = 5 + + /// + /// TODO: REPLACE case anz // = 6 + + /// + /// TODO: REPLACE case kr // = 7 + + /// + /// TODO: REPLACE case tw // = 8 + + /// + /// TODO: REPLACE case ru // = 9 + + /// + /// TODO: REPLACE + case `in` // = 10 + + /// + /// TODO: REPLACE + case nz865 // = 11 + + /// + /// TODO: REPLACE + case th // = 12 case UNRECOGNIZED(Int) init() { @@ -71,13 +113,16 @@ enum RegionCode: SwiftProtobuf.Enum { case 0: self = .unset case 1: self = .us case 2: self = .eu433 - case 3: self = .eu865 + case 3: self = .eu868 case 4: self = .cn case 5: self = .jp case 6: self = .anz case 7: self = .kr case 8: self = .tw case 9: self = .ru + case 10: self = .in + case 11: self = .nz865 + case 12: self = .th default: self = .UNRECOGNIZED(rawValue) } } @@ -87,13 +132,16 @@ enum RegionCode: SwiftProtobuf.Enum { case .unset: return 0 case .us: return 1 case .eu433: return 2 - case .eu865: return 3 + case .eu868: return 3 case .cn: return 4 case .jp: return 5 case .anz: return 6 case .kr: return 7 case .tw: return 8 case .ru: return 9 + case .in: return 10 + case .nz865: return 11 + case .th: return 12 case .UNRECOGNIZED(let i): return i } } @@ -108,13 +156,69 @@ extension RegionCode: CaseIterable { .unset, .us, .eu433, - .eu865, + .eu868, .cn, .jp, .anz, .kr, .tw, .ru, + .in, + .nz865, + .th, + ] +} + +#endif // swift(>=4.2) + +/// +/// Defines the device's role on the Mesh network +/// unset +/// Behave normally. +/// +/// Router +/// Functions as a router +enum Role: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + /// Default device role + case `default` // = 0 + + /// + /// Router device role + case router // = 1 + case UNRECOGNIZED(Int) + + init() { + self = .default + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .default + case 1: self = .router + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .default: return 0 + case .router: return 1 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Role: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Role] = [ + .default, + .router, ] } @@ -125,22 +229,73 @@ extension RegionCode: CaseIterable { /// configured. This is passed into the axp power management chip like on the tbeam. enum ChargeCurrent: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// TODO: REPLACE case maunset // = 0 + + /// + /// TODO: REPLACE case ma100 // = 1 + + /// + /// TODO: REPLACE case ma190 // = 2 + + /// + /// TODO: REPLACE case ma280 // = 3 + + /// + /// TODO: REPLACE case ma360 // = 4 + + /// + /// TODO: REPLACE case ma450 // = 5 + + /// + /// TODO: REPLACE case ma550 // = 6 + + /// + /// TODO: REPLACE case ma630 // = 7 + + /// + /// TODO: REPLACE case ma700 // = 8 + + /// + /// TODO: REPLACE case ma780 // = 9 + + /// + /// TODO: REPLACE case ma880 // = 10 + + /// + /// TODO: REPLACE case ma960 // = 11 + + /// + /// TODO: REPLACE case ma1000 // = 12 + + /// + /// TODO: REPLACE case ma1080 // = 13 + + /// + /// TODO: REPLACE case ma1160 // = 14 + + /// + /// TODO: REPLACE case ma1240 // = 15 + + /// + /// TODO: REPLACE case ma1320 // = 16 case UNRECOGNIZED(Int) @@ -223,81 +378,6 @@ extension ChargeCurrent: CaseIterable { #endif // swift(>=4.2) -/// -/// How the GPS hardware in this unit is operated. -/// Note: This is independent of how our location is shared with other devices. -/// For that see LocationSharing -enum GpsOperation: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// This is treated as GpsOpMobile - it is the default setting - case gpsOpUnset // = 0 - - /// - /// Note: This mode was removed, because it is identical go GpsOpMobile with a gps_update_rate of once per day - /// This node is mostly stationary, we should try to get location only once per day, - /// Once we have that position we should turn the GPS to sleep mode - /// This is the recommended configuration for stationary 'router' nodes - case gpsOpStationary // = 1 - - /// - /// This node is mobile and we should get GPS position at a rate governed by gps_update_rate - case gpsOpMobile // = 2 - - /// - /// We should only use the GPS to get time (no location data should be acquired/stored) - /// Once we have the time we treat gps_update_interval as MAXINT (i.e. sleep forever) - case gpsOpTimeOnly // = 3 - - /// - /// GPS is always turned off - this mode is not recommended - use GpsOpTimeOnly instead - case gpsOpDisabled // = 4 - case UNRECOGNIZED(Int) - - init() { - self = .gpsOpUnset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .gpsOpUnset - case 1: self = .gpsOpStationary - case 2: self = .gpsOpMobile - case 3: self = .gpsOpTimeOnly - case 4: self = .gpsOpDisabled - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .gpsOpUnset: return 0 - case .gpsOpStationary: return 1 - case .gpsOpMobile: return 2 - case .gpsOpTimeOnly: return 3 - case .gpsOpDisabled: return 4 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension GpsOperation: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [GpsOperation] = [ - .gpsOpUnset, - .gpsOpStationary, - .gpsOpMobile, - .gpsOpTimeOnly, - .gpsOpDisabled, - ] -} - -#endif // swift(>=4.2) - /// /// How the GPS coordinates are displayed on the OLED screen. enum GpsCoordinateFormat: SwiftProtobuf.Enum { @@ -381,61 +461,6 @@ extension GpsCoordinateFormat: CaseIterable { #endif // swift(>=4.2) -/// -/// How our location is shared with other nodes (or the local phone) -enum LocationSharing: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// This is the default and treated as LocEnabled. - case locUnset // = 0 - - /// - /// We are sharing our location - case locEnabled // = 1 - - /// - /// We are not sharing our location (if the unit has a GPS it will default to only get time - i.e. GpsOpTimeOnly) - case locDisabled // = 2 - case UNRECOGNIZED(Int) - - init() { - self = .locUnset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .locUnset - case 1: self = .locEnabled - case 2: self = .locDisabled - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .locUnset: return 0 - case .locEnabled: return 1 - case .locDisabled: return 2 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension LocationSharing: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [LocationSharing] = [ - .locUnset, - .locEnabled, - .locDisabled, - ] -} - -#endif // swift(>=4.2) - /// /// Bit field of boolean configuration options, indicating which optional /// fields to include when assembling POSITION messages @@ -446,34 +471,44 @@ extension LocationSharing: CaseIterable { enum PositionFlags: SwiftProtobuf.Enum { typealias RawValue = Int - /// Required for compilation + /// + /// Required for compilation case posUndefined // = 0 - /// Include an altitude value (if available) + /// + /// Include an altitude value (if available) case posAltitude // = 1 - /// Altitude value is MSL + /// + /// Altitude value is MSL case posAltMsl // = 2 - /// Include geoidal separation + /// + /// Include geoidal separation case posGeoSep // = 4 - /// Include the DOP value ; PDOP used by default, see below + /// + /// Include the DOP value ; PDOP used by default, see below case posDop // = 8 - /// If POS_DOP set, send separate HDOP / VDOP values instead of PDOP + /// + /// If POS_DOP set, send separate HDOP / VDOP values instead of PDOP case posHvdop // = 16 - /// Include battery level + /// + /// Include battery level case posBattery // = 32 - /// Include number of "satellites in view" + /// + /// Include number of "satellites in view" case posSatinview // = 64 - /// Include a sequence number incremented per packet + /// + /// Include a sequence number incremented per packet case posSeqNos // = 128 - /// Include positional timestamp (from GPS solution) + /// + /// Include positional timestamp (from GPS solution) case posTimestamp // = 256 case UNRECOGNIZED(Int) @@ -535,17 +570,41 @@ extension PositionFlags: CaseIterable { #endif // swift(>=4.2) +/// +/// TODO: REPLACE enum InputEventChar: SwiftProtobuf.Enum { typealias RawValue = Int + + /// + /// TODO: REPLACE case keyNone // = 0 + + /// + /// TODO: REPLACE case keyUp // = 17 + + /// + /// TODO: REPLACE case keyDown // = 18 + + /// + /// TODO: REPLACE case keyLeft // = 19 + + /// + /// TODO: REPLACE case keyRight // = 20 - /// '\n' + /// + /// '\n' case keySelect // = 10 + + /// + /// TODO: REPLACE case keyBack // = 27 + + /// + /// TODO: REPLACE case keyCancel // = 24 case UNRECOGNIZED(Int) @@ -610,6 +669,8 @@ struct RadioConfig { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. + /// + /// TODO: REPLACE var preferences: RadioConfig.UserPreferences { get {return _preferences ?? RadioConfig.UserPreferences()} set {_preferences = newValue} @@ -622,7 +683,7 @@ struct RadioConfig { var unknownFields = SwiftProtobuf.UnknownStorage() /// - /// See [software design](/software/other/sw-design.md) for more information on these preferences + /// See [software design](/docs/software/other/sw-design) for more information on these preferences struct UserPreferences { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -638,10 +699,9 @@ struct RadioConfig { /// /// We should send our position this often (but only if it has changed significantly) - /// Defaults to 15 minutes - var positionBroadcastSmart: Bool { - get {return _storage._positionBroadcastSmart} - set {_uniqueStorage()._positionBroadcastSmart = newValue} + var positionBroadcastSmartDisabled: Bool { + get {return _storage._positionBroadcastSmartDisabled} + set {_uniqueStorage()._positionBroadcastSmartDisabled = newValue} } /// @@ -653,7 +713,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of 1 minute var waitBluetoothSecs: UInt32 { get {return _storage._waitBluetoothSecs} @@ -662,7 +722,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of one minute var screenOnSecs: UInt32 { get {return _storage._screenOnSecs} @@ -671,7 +731,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of 15 minutes /// IMPORTANT NOTE FOR DEVICE CLIENTS: YOU MUST SEND SOME SORT OF PACKET TO THE PHONE AT LEAST THIS OFTEN OR THE DEVICE WILL DECIDE YOU ARE GONE! var phoneTimeoutSecs: UInt32 { @@ -681,7 +741,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of two hours, MAXUINT for disabled var phoneSdsTimeoutSec: UInt32 { get {return _storage._phoneSdsTimeoutSec} @@ -690,7 +750,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of two hours, MAXUINT for disabled var meshSdsTimeoutSecs: UInt32 { get {return _storage._meshSdsTimeoutSecs} @@ -699,7 +759,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of one year var sdsSecs: UInt32 { get {return _storage._sdsSecs} @@ -708,7 +768,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of 3600 var lsSecs: UInt32 { get {return _storage._lsSecs} @@ -717,7 +777,7 @@ struct RadioConfig { /// /// Power management state machine option. - /// See [power management](/software/other/power.md) for details. + /// See [power management](/docs/software/other/power) for details. /// 0 for default of 10 seconds var minWakeSecs: UInt32 { get {return _storage._minWakeSecs} @@ -762,14 +822,10 @@ struct RadioConfig { } /// - /// Are we operating as a router. - /// Changes behavior in the following ways: - /// The device will only sleep for critically low battery level (i.e. always tries to stay alive for the mesh) - /// In the future routing decisions will preferentially route packets through nodes with this attribute (because assumed - /// good line of sight) - var isRouter: Bool { - get {return _storage._isRouter} - set {_uniqueStorage()._isRouter = newValue} + /// Sets the role of node + var role: Role { + get {return _storage._role} + set {_uniqueStorage()._role = newValue} } /// @@ -798,23 +854,21 @@ struct RadioConfig { } /// - /// How our location is shared with other nodes (or the local phone) - var locationShare: LocationSharing { - get {return _storage._locationShare} - set {_uniqueStorage()._locationShare = newValue} + /// Should we disbale location sharing with other nodes (or the local phone) + var locationShareDisabled: Bool { + get {return _storage._locationShareDisabled} + set {_uniqueStorage()._locationShareDisabled = newValue} } /// - /// How the GPS hardware in this unit is operated. - /// Note: This is independent of how our location is shared with other devices. - /// For that see LocationSharing - var gpsOperation: GpsOperation { - get {return _storage._gpsOperation} - set {_uniqueStorage()._gpsOperation = newValue} + /// Should the GPS be disabled for this node? + var gpsDisabled: Bool { + get {return _storage._gpsDisabled} + set {_uniqueStorage()._gpsDisabled = newValue} } /// - /// How often should we try to get GPS position (in seconds) when we are in GpsOpMobile mode? + /// How often should we try to get GPS position (in seconds) /// or zero for the default of once every 30 seconds /// or a very large value (maxint) to update only once at boot. var gpsUpdateInterval: UInt32 { @@ -916,179 +970,218 @@ struct RadioConfig { } /// - /// Preferences for the SerialPlugin - /// FIXME - Move this out of UserPreferences and into a section for plugin configuration. - var serialpluginEnabled: Bool { - get {return _storage._serialpluginEnabled} - set {_uniqueStorage()._serialpluginEnabled = newValue} - } - - var serialpluginEcho: Bool { - get {return _storage._serialpluginEcho} - set {_uniqueStorage()._serialpluginEcho = newValue} - } - - var serialpluginRxd: UInt32 { - get {return _storage._serialpluginRxd} - set {_uniqueStorage()._serialpluginRxd = newValue} - } - - var serialpluginTxd: UInt32 { - get {return _storage._serialpluginTxd} - set {_uniqueStorage()._serialpluginTxd = newValue} - } - - var serialpluginTimeout: UInt32 { - get {return _storage._serialpluginTimeout} - set {_uniqueStorage()._serialpluginTimeout = newValue} - } - - var serialpluginMode: UInt32 { - get {return _storage._serialpluginMode} - set {_uniqueStorage()._serialpluginMode = newValue} + /// Preferences for the SerialModule + /// FIXME - Move this out of UserPreferences and into a section for module configuration. + var serialModuleEnabled: Bool { + get {return _storage._serialModuleEnabled} + set {_uniqueStorage()._serialModuleEnabled = newValue} } /// - /// Preferences for the ExternalNotificationPlugin - /// FIXME - Move this out of UserPreferences and into a section for plugin configuration. - var extNotificationPluginEnabled: Bool { - get {return _storage._extNotificationPluginEnabled} - set {_uniqueStorage()._extNotificationPluginEnabled = newValue} - } - - var extNotificationPluginOutputMs: UInt32 { - get {return _storage._extNotificationPluginOutputMs} - set {_uniqueStorage()._extNotificationPluginOutputMs = newValue} - } - - var extNotificationPluginOutput: UInt32 { - get {return _storage._extNotificationPluginOutput} - set {_uniqueStorage()._extNotificationPluginOutput = newValue} - } - - var extNotificationPluginActive: Bool { - get {return _storage._extNotificationPluginActive} - set {_uniqueStorage()._extNotificationPluginActive = newValue} - } - - var extNotificationPluginAlertMessage: Bool { - get {return _storage._extNotificationPluginAlertMessage} - set {_uniqueStorage()._extNotificationPluginAlertMessage = newValue} - } - - var extNotificationPluginAlertBell: Bool { - get {return _storage._extNotificationPluginAlertBell} - set {_uniqueStorage()._extNotificationPluginAlertBell = newValue} + /// TODO: REPLACE + var serialModuleEcho: Bool { + get {return _storage._serialModuleEcho} + set {_uniqueStorage()._serialModuleEcho = newValue} } /// - /// Preferences for the RangeTestPlugin - /// FIXME - Move this out of UserPreferences and into a section for plugin configuration. - var rangeTestPluginEnabled: Bool { - get {return _storage._rangeTestPluginEnabled} - set {_uniqueStorage()._rangeTestPluginEnabled = newValue} - } - - var rangeTestPluginSender: UInt32 { - get {return _storage._rangeTestPluginSender} - set {_uniqueStorage()._rangeTestPluginSender = newValue} - } - - var rangeTestPluginSave: Bool { - get {return _storage._rangeTestPluginSave} - set {_uniqueStorage()._rangeTestPluginSave = newValue} + /// TODO: REPLACE + var serialModuleRxd: UInt32 { + get {return _storage._serialModuleRxd} + set {_uniqueStorage()._serialModuleRxd = newValue} } /// - /// Preferences for the StoreForwardPlugin - ///FIXME - Move this out of UserPreferences and into a section for plugin configuration. (was 136) - var storeForwardPluginEnabled: Bool { - get {return _storage._storeForwardPluginEnabled} - set {_uniqueStorage()._storeForwardPluginEnabled = newValue} - } - - var storeForwardPluginHeartbeat: Bool { - get {return _storage._storeForwardPluginHeartbeat} - set {_uniqueStorage()._storeForwardPluginHeartbeat = newValue} - } - - var storeForwardPluginRecords: UInt32 { - get {return _storage._storeForwardPluginRecords} - set {_uniqueStorage()._storeForwardPluginRecords = newValue} - } - - var storeForwardPluginHistoryReturnMax: UInt32 { - get {return _storage._storeForwardPluginHistoryReturnMax} - set {_uniqueStorage()._storeForwardPluginHistoryReturnMax = newValue} - } - - var storeForwardPluginHistoryReturnWindow: UInt32 { - get {return _storage._storeForwardPluginHistoryReturnWindow} - set {_uniqueStorage()._storeForwardPluginHistoryReturnWindow = newValue} + /// TODO: REPLACE + var serialModuleTxd: UInt32 { + get {return _storage._serialModuleTxd} + set {_uniqueStorage()._serialModuleTxd = newValue} } /// - /// Preferences for the EnvironmentalMeasurement Plugin - /// FIXME - Move this out of UserPreferences and into a section for plugin configuration. - /// Enable/Disable the environmental measurement plugin measurement collection - var environmentalMeasurementPluginMeasurementEnabled: Bool { - get {return _storage._environmentalMeasurementPluginMeasurementEnabled} - set {_uniqueStorage()._environmentalMeasurementPluginMeasurementEnabled = newValue} + /// TODO: REPLACE + var serialModuleBaud: RadioConfig.UserPreferences.Serial_Baud { + get {return _storage._serialModuleBaud} + set {_uniqueStorage()._serialModuleBaud = newValue} } /// - /// Enable/Disable the environmental measurement plugin on-device display - var environmentalMeasurementPluginScreenEnabled: Bool { - get {return _storage._environmentalMeasurementPluginScreenEnabled} - set {_uniqueStorage()._environmentalMeasurementPluginScreenEnabled = newValue} + /// TODO: REPLACE + var serialModuleTimeout: UInt32 { + get {return _storage._serialModuleTimeout} + set {_uniqueStorage()._serialModuleTimeout = newValue} + } + + /// + /// TODO: REPLACE + var serialModuleMode: RadioConfig.UserPreferences.Serial_Mode { + get {return _storage._serialModuleMode} + set {_uniqueStorage()._serialModuleMode = newValue} + } + + /// + /// Preferences for the ExternalNotificationModule + /// FIXME - Move this out of UserPreferences and into a section for module configuration. + var extNotificationModuleEnabled: Bool { + get {return _storage._extNotificationModuleEnabled} + set {_uniqueStorage()._extNotificationModuleEnabled = newValue} + } + + /// + /// TODO: REPLACE + var extNotificationModuleOutputMs: UInt32 { + get {return _storage._extNotificationModuleOutputMs} + set {_uniqueStorage()._extNotificationModuleOutputMs = newValue} + } + + /// + /// TODO: REPLACE + var extNotificationModuleOutput: UInt32 { + get {return _storage._extNotificationModuleOutput} + set {_uniqueStorage()._extNotificationModuleOutput = newValue} + } + + /// + /// TODO: REPLACE + var extNotificationModuleActive: Bool { + get {return _storage._extNotificationModuleActive} + set {_uniqueStorage()._extNotificationModuleActive = newValue} + } + + /// + /// TODO: REPLACE + var extNotificationModuleAlertMessage: Bool { + get {return _storage._extNotificationModuleAlertMessage} + set {_uniqueStorage()._extNotificationModuleAlertMessage = newValue} + } + + /// + /// TODO: REPLACE + var extNotificationModuleAlertBell: Bool { + get {return _storage._extNotificationModuleAlertBell} + set {_uniqueStorage()._extNotificationModuleAlertBell = newValue} + } + + /// + /// Preferences for the RangeTestModule + /// FIXME - Move this out of UserPreferences and into a section for module configuration. + var rangeTestModuleEnabled: Bool { + get {return _storage._rangeTestModuleEnabled} + set {_uniqueStorage()._rangeTestModuleEnabled = newValue} + } + + /// + /// TODO: REPLACE + var rangeTestModuleSender: UInt32 { + get {return _storage._rangeTestModuleSender} + set {_uniqueStorage()._rangeTestModuleSender = newValue} + } + + /// + /// TODO: REPLACE + var rangeTestModuleSave: Bool { + get {return _storage._rangeTestModuleSave} + set {_uniqueStorage()._rangeTestModuleSave = newValue} + } + + /// + /// Preferences for the StoreForwardModule + ///FIXME - Move this out of UserPreferences and into a section for module configuration. (was 136) + var storeForwardModuleEnabled: Bool { + get {return _storage._storeForwardModuleEnabled} + set {_uniqueStorage()._storeForwardModuleEnabled = newValue} + } + + /// + /// TODO: REPLACE + var storeForwardModuleHeartbeat: Bool { + get {return _storage._storeForwardModuleHeartbeat} + set {_uniqueStorage()._storeForwardModuleHeartbeat = newValue} + } + + /// + /// TODO: REPLACE + var storeForwardModuleRecords: UInt32 { + get {return _storage._storeForwardModuleRecords} + set {_uniqueStorage()._storeForwardModuleRecords = newValue} + } + + /// + /// TODO: REPLACE + var storeForwardModuleHistoryReturnMax: UInt32 { + get {return _storage._storeForwardModuleHistoryReturnMax} + set {_uniqueStorage()._storeForwardModuleHistoryReturnMax = newValue} + } + + /// + /// TODO: REPLACE + var storeForwardModuleHistoryReturnWindow: UInt32 { + get {return _storage._storeForwardModuleHistoryReturnWindow} + set {_uniqueStorage()._storeForwardModuleHistoryReturnWindow = newValue} + } + + /// + /// Preferences for the Telemetry Module (Environment) + /// FIXME - Move this out of UserPreferences and into a section for module configuration. + /// Enable/Disable the telemetry measurement module measurement collection + var telemetryModuleEnvironmentMeasurementEnabled: Bool { + get {return _storage._telemetryModuleEnvironmentMeasurementEnabled} + set {_uniqueStorage()._telemetryModuleEnvironmentMeasurementEnabled = newValue} + } + + /// + /// Enable/Disable the telemetry measurement module on-device display + var telemetryModuleEnvironmentScreenEnabled: Bool { + get {return _storage._telemetryModuleEnvironmentScreenEnabled} + set {_uniqueStorage()._telemetryModuleEnvironmentScreenEnabled = newValue} } /// /// Sometimes sensor reads can fail. /// If this happens, we will retry a configurable number of attempts, /// each attempt will be delayed by the minimum required refresh rate for that sensor - var environmentalMeasurementPluginReadErrorCountThreshold: UInt32 { - get {return _storage._environmentalMeasurementPluginReadErrorCountThreshold} - set {_uniqueStorage()._environmentalMeasurementPluginReadErrorCountThreshold = newValue} + var telemetryModuleEnvironmentReadErrorCountThreshold: UInt32 { + get {return _storage._telemetryModuleEnvironmentReadErrorCountThreshold} + set {_uniqueStorage()._telemetryModuleEnvironmentReadErrorCountThreshold = newValue} } /// /// Interval in seconds of how often we should try to send our /// measurements to the mesh - var environmentalMeasurementPluginUpdateInterval: UInt32 { - get {return _storage._environmentalMeasurementPluginUpdateInterval} - set {_uniqueStorage()._environmentalMeasurementPluginUpdateInterval = newValue} + var telemetryModuleDeviceUpdateInterval: UInt32 { + get {return _storage._telemetryModuleDeviceUpdateInterval} + set {_uniqueStorage()._telemetryModuleDeviceUpdateInterval = newValue} } /// /// Sometimes we can end up with more than read_error_count_threshold failures. /// In this case, we will stop trying to read from the sensor for a while. /// Wait this long until trying to read from the sensor again - var environmentalMeasurementPluginRecoveryInterval: UInt32 { - get {return _storage._environmentalMeasurementPluginRecoveryInterval} - set {_uniqueStorage()._environmentalMeasurementPluginRecoveryInterval = newValue} + var telemetryModuleEnvironmentRecoveryInterval: UInt32 { + get {return _storage._telemetryModuleEnvironmentRecoveryInterval} + set {_uniqueStorage()._telemetryModuleEnvironmentRecoveryInterval = newValue} } /// /// We'll always read the sensor in Celsius, but sometimes we might want to - /// display the results in Farenheit as a "user preference". - var environmentalMeasurementPluginDisplayFarenheit: Bool { - get {return _storage._environmentalMeasurementPluginDisplayFarenheit} - set {_uniqueStorage()._environmentalMeasurementPluginDisplayFarenheit = newValue} + /// display the results in Fahrenheit as a "user preference". + var telemetryModuleEnvironmentDisplayFahrenheit: Bool { + get {return _storage._telemetryModuleEnvironmentDisplayFahrenheit} + set {_uniqueStorage()._telemetryModuleEnvironmentDisplayFahrenheit = newValue} } /// /// Specify the sensor type - var environmentalMeasurementPluginSensorType: RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType { - get {return _storage._environmentalMeasurementPluginSensorType} - set {_uniqueStorage()._environmentalMeasurementPluginSensorType = newValue} + var telemetryModuleEnvironmentSensorType: RadioConfig.UserPreferences.TelemetrySensorType { + get {return _storage._telemetryModuleEnvironmentSensorType} + set {_uniqueStorage()._telemetryModuleEnvironmentSensorType = newValue} } /// /// Specify the peferred GPIO Pin for sensor readings - var environmentalMeasurementPluginSensorPin: UInt32 { - get {return _storage._environmentalMeasurementPluginSensorPin} - set {_uniqueStorage()._environmentalMeasurementPluginSensorPin = newValue} + var telemetryModuleEnvironmentSensorPin: UInt32 { + get {return _storage._telemetryModuleEnvironmentSensorPin} + set {_uniqueStorage()._telemetryModuleEnvironmentSensorPin = newValue} } /// @@ -1163,7 +1256,7 @@ struct RadioConfig { } /// - /// Enable the rotary encoder #1 + /// Enable the rotary encoder #1. This is a 'dumb' encoder sending pulses on both A and B pins while rotating. var rotary1Enabled: Bool { get {return _storage._rotary1Enabled} set {_uniqueStorage()._rotary1Enabled = newValue} @@ -1171,77 +1264,74 @@ struct RadioConfig { /// /// GPIO pin for rotary encoder A port. - var rotary1PinA: UInt32 { - get {return _storage._rotary1PinA} - set {_uniqueStorage()._rotary1PinA = newValue} + var inputbrokerPinA: UInt32 { + get {return _storage._inputbrokerPinA} + set {_uniqueStorage()._inputbrokerPinA = newValue} } /// /// GPIO pin for rotary encoder B port. - var rotary1PinB: UInt32 { - get {return _storage._rotary1PinB} - set {_uniqueStorage()._rotary1PinB = newValue} + var inputbrokerPinB: UInt32 { + get {return _storage._inputbrokerPinB} + set {_uniqueStorage()._inputbrokerPinB = newValue} } /// /// GPIO pin for rotary encoder Press port. - var rotary1PinPress: UInt32 { - get {return _storage._rotary1PinPress} - set {_uniqueStorage()._rotary1PinPress = newValue} + var inputbrokerPinPress: UInt32 { + get {return _storage._inputbrokerPinPress} + set {_uniqueStorage()._inputbrokerPinPress = newValue} } /// /// Generate input event on CW of this kind. - var rotary1EventCw: InputEventChar { - get {return _storage._rotary1EventCw} - set {_uniqueStorage()._rotary1EventCw = newValue} + var inputbrokerEventCw: InputEventChar { + get {return _storage._inputbrokerEventCw} + set {_uniqueStorage()._inputbrokerEventCw = newValue} } /// /// Generate input event on CCW of this kind. - var rotary1EventCcw: InputEventChar { - get {return _storage._rotary1EventCcw} - set {_uniqueStorage()._rotary1EventCcw = newValue} + var inputbrokerEventCcw: InputEventChar { + get {return _storage._inputbrokerEventCcw} + set {_uniqueStorage()._inputbrokerEventCcw = newValue} } /// /// Generate input event on Press of this kind. - var rotary1EventPress: InputEventChar { - get {return _storage._rotary1EventPress} - set {_uniqueStorage()._rotary1EventPress = newValue} + var inputbrokerEventPress: InputEventChar { + get {return _storage._inputbrokerEventPress} + set {_uniqueStorage()._inputbrokerEventPress = newValue} } /// - /// Enable/disable CannedMessagePlugin. - var cannedMessagePluginEnabled: Bool { - get {return _storage._cannedMessagePluginEnabled} - set {_uniqueStorage()._cannedMessagePluginEnabled = newValue} + /// Enable the Up/Down/Select input device. Can be RAK rotary encoder or 3 buttons. Uses the a/b/press definitions from inputbroker. + var updown1Enabled: Bool { + get {return _storage._updown1Enabled} + set {_uniqueStorage()._updown1Enabled = newValue} } /// - /// Input event origin accepted by the canned message plugin. - /// Can be e.g. "rotEnc1" or keyword "_any" - var cannedMessagePluginAllowInputSource: String { - get {return _storage._cannedMessagePluginAllowInputSource} - set {_uniqueStorage()._cannedMessagePluginAllowInputSource = newValue} + /// Enable/disable CannedMessageModule. + var cannedMessageModuleEnabled: Bool { + get {return _storage._cannedMessageModuleEnabled} + set {_uniqueStorage()._cannedMessageModuleEnabled = newValue} } /// - /// Predefined messages for CannedMessagePlugin separated by '|' characters. - /// Note: Split out the messages out to their own messages because we want to store 1,000 characters. - /// and the entire message must fit within 256 bytes. - /// Not sure if we should deprecate this or just remove it since we're in dev phase. - var cannedMessagePluginMessages: String { - get {return _storage._cannedMessagePluginMessages} - set {_uniqueStorage()._cannedMessagePluginMessages = newValue} + /// Input event origin accepted by the canned message module. + /// Can be e.g. "rotEnc1", "upDownEnc1" or keyword "_any" + var cannedMessageModuleAllowInputSource: String { + get {return _storage._cannedMessageModuleAllowInputSource} + set {_uniqueStorage()._cannedMessageModuleAllowInputSource = newValue} } /// - /// CannedMessagePlugin also sends a bell character with the messages. - /// ExternalNotificationPlugin can benefit from this feature. - var cannedMessagePluginSendBell: Bool { - get {return _storage._cannedMessagePluginSendBell} - set {_uniqueStorage()._cannedMessagePluginSendBell = newValue} + /// CannedMessageModule also sends a bell character with the messages. + /// ExternalNotificationModule can benefit from this feature. + var cannedMessageModuleSendBell: Bool { + get {return _storage._cannedMessageModuleSendBell} + set {_uniqueStorage()._cannedMessageModuleSendBell = newValue} } /// @@ -1263,48 +1353,187 @@ struct RadioConfig { set {_uniqueStorage()._adcMultiplierOverride = newValue} } + /// + /// Interval in seconds of how often we should try to send our + /// environent measurements to the mesh + var telemetryModuleEnvironmentUpdateInterval: UInt32 { + get {return _storage._telemetryModuleEnvironmentUpdateInterval} + set {_uniqueStorage()._telemetryModuleEnvironmentUpdateInterval = newValue} + } + var unknownFields = SwiftProtobuf.UnknownStorage() - enum EnvironmentalMeasurementSensorType: SwiftProtobuf.Enum { + /// + /// TODO: REPLACE + enum Serial_Baud: SwiftProtobuf.Enum { typealias RawValue = Int - case dht11 // = 0 - case ds18B20 // = 1 - case dht12 // = 2 - case dht21 // = 3 - case dht22 // = 4 - case bme280 // = 5 - case bme680 // = 6 - case mcp9808 // = 7 + case baudDefault // = 0 + case baud2400 // = 1 + case baud4800 // = 2 + case baud9600 // = 3 + case baud19200 // = 4 + case baud38400 // = 5 + case baud57600 // = 6 + case baud115200 // = 7 + case baud230400 // = 8 + case baud460800 // = 9 + case baud576000 // = 10 + case baud921600 // = 11 case UNRECOGNIZED(Int) init() { - self = .dht11 + self = .baudDefault } init?(rawValue: Int) { switch rawValue { - case 0: self = .dht11 - case 1: self = .ds18B20 - case 2: self = .dht12 - case 3: self = .dht21 - case 4: self = .dht22 - case 5: self = .bme280 - case 6: self = .bme680 - case 7: self = .mcp9808 + case 0: self = .baudDefault + case 1: self = .baud2400 + case 2: self = .baud4800 + case 3: self = .baud9600 + case 4: self = .baud19200 + case 5: self = .baud38400 + case 6: self = .baud57600 + case 7: self = .baud115200 + case 8: self = .baud230400 + case 9: self = .baud460800 + case 10: self = .baud576000 + case 11: self = .baud921600 default: self = .UNRECOGNIZED(rawValue) } } var rawValue: Int { switch self { - case .dht11: return 0 - case .ds18B20: return 1 - case .dht12: return 2 - case .dht21: return 3 - case .dht22: return 4 - case .bme280: return 5 - case .bme680: return 6 - case .mcp9808: return 7 + case .baudDefault: return 0 + case .baud2400: return 1 + case .baud4800: return 2 + case .baud9600: return 3 + case .baud19200: return 4 + case .baud38400: return 5 + case .baud57600: return 6 + case .baud115200: return 7 + case .baud230400: return 8 + case .baud460800: return 9 + case .baud576000: return 10 + case .baud921600: return 11 + case .UNRECOGNIZED(let i): return i + } + } + + } + + /// + /// TODO: REPLACE + enum Serial_Mode: SwiftProtobuf.Enum { + typealias RawValue = Int + case modeDefault // = 0 + case modeSimple // = 1 + case modeProto // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .modeDefault + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .modeDefault + case 1: self = .modeSimple + case 2: self = .modeProto + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .modeDefault: return 0 + case .modeSimple: return 1 + case .modeProto: return 2 + case .UNRECOGNIZED(let i): return i + } + } + + } + + /// + /// TODO: REPLACE + enum TelemetrySensorType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + /// No external telemetry sensor + case none // = 0 + + /// + /// TODO: REPLACE + case dht11 // = 1 + + /// + /// TODO: REPLACE + case ds18B20 // = 2 + + /// + /// TODO: REPLACE + case dht12 // = 3 + + /// + /// TODO: REPLACE + case dht21 // = 4 + + /// + /// TODO: REPLACE + case dht22 // = 5 + + /// + /// TODO: REPLACE + case bme280 // = 6 + + /// + /// TODO: REPLACE + case bme680 // = 7 + + /// + /// TODO: REPLACE + case mcp9808 // = 8 + + /// + /// TODO: REPLACE + case shtc3 // = 9 + case UNRECOGNIZED(Int) + + init() { + self = .none + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .none + case 1: self = .dht11 + case 2: self = .ds18B20 + case 3: self = .dht12 + case 4: self = .dht21 + case 5: self = .dht22 + case 6: self = .bme280 + case 7: self = .bme680 + case 8: self = .mcp9808 + case 9: self = .shtc3 + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .none: return 0 + case .dht11: return 1 + case .ds18B20: return 2 + case .dht12: return 3 + case .dht21: return 4 + case .dht22: return 5 + case .bme280: return 6 + case .bme680: return 7 + case .mcp9808: return 8 + case .shtc3: return 9 case .UNRECOGNIZED(let i): return i } } @@ -1323,9 +1552,37 @@ struct RadioConfig { #if swift(>=4.2) -extension RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType: CaseIterable { +extension RadioConfig.UserPreferences.Serial_Baud: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType] = [ + static var allCases: [RadioConfig.UserPreferences.Serial_Baud] = [ + .baudDefault, + .baud2400, + .baud4800, + .baud9600, + .baud19200, + .baud38400, + .baud57600, + .baud115200, + .baud230400, + .baud460800, + .baud576000, + .baud921600, + ] +} + +extension RadioConfig.UserPreferences.Serial_Mode: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [RadioConfig.UserPreferences.Serial_Mode] = [ + .modeDefault, + .modeSimple, + .modeProto, + ] +} + +extension RadioConfig.UserPreferences.TelemetrySensorType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [RadioConfig.UserPreferences.TelemetrySensorType] = [ + .none, .dht11, .ds18B20, .dht12, @@ -1334,11 +1591,26 @@ extension RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType: CaseIt .bme280, .bme680, .mcp9808, + .shtc3, ] } #endif // swift(>=4.2) +#if swift(>=5.5) && canImport(_Concurrency) +extension RegionCode: @unchecked Sendable {} +extension Role: @unchecked Sendable {} +extension ChargeCurrent: @unchecked Sendable {} +extension GpsCoordinateFormat: @unchecked Sendable {} +extension PositionFlags: @unchecked Sendable {} +extension InputEventChar: @unchecked Sendable {} +extension RadioConfig: @unchecked Sendable {} +extension RadioConfig.UserPreferences: @unchecked Sendable {} +extension RadioConfig.UserPreferences.Serial_Baud: @unchecked Sendable {} +extension RadioConfig.UserPreferences.Serial_Mode: @unchecked Sendable {} +extension RadioConfig.UserPreferences.TelemetrySensorType: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + // MARK: - Code below here is support for the SwiftProtobuf runtime. extension RegionCode: SwiftProtobuf._ProtoNameProviding { @@ -1346,13 +1618,23 @@ extension RegionCode: SwiftProtobuf._ProtoNameProviding { 0: .same(proto: "Unset"), 1: .same(proto: "US"), 2: .same(proto: "EU433"), - 3: .same(proto: "EU865"), + 3: .same(proto: "EU868"), 4: .same(proto: "CN"), 5: .same(proto: "JP"), 6: .same(proto: "ANZ"), 7: .same(proto: "KR"), 8: .same(proto: "TW"), 9: .same(proto: "RU"), + 10: .same(proto: "IN"), + 11: .same(proto: "NZ865"), + 12: .same(proto: "TH"), + ] +} + +extension Role: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "Default"), + 1: .same(proto: "Router"), ] } @@ -1378,16 +1660,6 @@ extension ChargeCurrent: SwiftProtobuf._ProtoNameProviding { ] } -extension GpsOperation: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "GpsOpUnset"), - 1: .same(proto: "GpsOpStationary"), - 2: .same(proto: "GpsOpMobile"), - 3: .same(proto: "GpsOpTimeOnly"), - 4: .same(proto: "GpsOpDisabled"), - ] -} - extension GpsCoordinateFormat: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "GpsFormatDec"), @@ -1399,14 +1671,6 @@ extension GpsCoordinateFormat: SwiftProtobuf._ProtoNameProviding { ] } -extension LocationSharing: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "LocUnset"), - 1: .same(proto: "LocEnabled"), - 2: .same(proto: "LocDisabled"), - ] -} - extension PositionFlags: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "POS_UNDEFINED"), @@ -1454,9 +1718,13 @@ extension RadioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } func traverse(visitor: inout V) throws { - if let v = self._preferences { + // 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._preferences { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } + } }() try unknownFields.traverse(visitor: &visitor) } @@ -1471,7 +1739,7 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes static let protoMessageName: String = RadioConfig.protoMessageName + ".UserPreferences" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "position_broadcast_secs"), - 17: .standard(proto: "position_broadcast_smart"), + 17: .standard(proto: "position_broadcast_smart_disabled"), 2: .standard(proto: "send_owner_interval"), 4: .standard(proto: "wait_bluetooth_secs"), 5: .standard(proto: "screen_on_secs"), @@ -1486,12 +1754,12 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes 14: .standard(proto: "wifi_ap_mode"), 15: .same(proto: "region"), 16: .standard(proto: "charge_current"), - 37: .standard(proto: "is_router"), + 18: .same(proto: "role"), 38: .standard(proto: "is_low_power"), 39: .standard(proto: "fixed_position"), 40: .standard(proto: "serial_disabled"), - 32: .standard(proto: "location_share"), - 33: .standard(proto: "gps_operation"), + 32: .standard(proto: "location_share_disabled"), + 33: .standard(proto: "gps_disabled"), 34: .standard(proto: "gps_update_interval"), 36: .standard(proto: "gps_attempt_time"), 45: .standard(proto: "gps_accept_2d"), @@ -1503,34 +1771,35 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes 100: .standard(proto: "factory_reset"), 101: .standard(proto: "debug_log_enabled"), 103: .standard(proto: "ignore_incoming"), - 120: .standard(proto: "serialplugin_enabled"), - 121: .standard(proto: "serialplugin_echo"), - 122: .standard(proto: "serialplugin_rxd"), - 123: .standard(proto: "serialplugin_txd"), - 124: .standard(proto: "serialplugin_timeout"), - 125: .standard(proto: "serialplugin_mode"), - 126: .standard(proto: "ext_notification_plugin_enabled"), - 127: .standard(proto: "ext_notification_plugin_output_ms"), - 128: .standard(proto: "ext_notification_plugin_output"), - 129: .standard(proto: "ext_notification_plugin_active"), - 130: .standard(proto: "ext_notification_plugin_alert_message"), - 131: .standard(proto: "ext_notification_plugin_alert_bell"), - 132: .standard(proto: "range_test_plugin_enabled"), - 133: .standard(proto: "range_test_plugin_sender"), - 134: .standard(proto: "range_test_plugin_save"), - 148: .standard(proto: "store_forward_plugin_enabled"), - 149: .standard(proto: "store_forward_plugin_heartbeat"), - 137: .standard(proto: "store_forward_plugin_records"), - 138: .standard(proto: "store_forward_plugin_history_return_max"), - 139: .standard(proto: "store_forward_plugin_history_return_window"), - 140: .standard(proto: "environmental_measurement_plugin_measurement_enabled"), - 141: .standard(proto: "environmental_measurement_plugin_screen_enabled"), - 142: .standard(proto: "environmental_measurement_plugin_read_error_count_threshold"), - 143: .standard(proto: "environmental_measurement_plugin_update_interval"), - 144: .standard(proto: "environmental_measurement_plugin_recovery_interval"), - 145: .standard(proto: "environmental_measurement_plugin_display_farenheit"), - 146: .standard(proto: "environmental_measurement_plugin_sensor_type"), - 147: .standard(proto: "environmental_measurement_plugin_sensor_pin"), + 120: .standard(proto: "serial_module_enabled"), + 121: .standard(proto: "serial_module_echo"), + 122: .standard(proto: "serial_module_rxd"), + 123: .standard(proto: "serial_module_txd"), + 176: .standard(proto: "serial_module_baud"), + 124: .standard(proto: "serial_module_timeout"), + 125: .standard(proto: "serial_module_mode"), + 126: .standard(proto: "ext_notification_module_enabled"), + 127: .standard(proto: "ext_notification_module_output_ms"), + 128: .standard(proto: "ext_notification_module_output"), + 129: .standard(proto: "ext_notification_module_active"), + 130: .standard(proto: "ext_notification_module_alert_message"), + 131: .standard(proto: "ext_notification_module_alert_bell"), + 132: .standard(proto: "range_test_module_enabled"), + 133: .standard(proto: "range_test_module_sender"), + 134: .standard(proto: "range_test_module_save"), + 148: .standard(proto: "store_forward_module_enabled"), + 149: .standard(proto: "store_forward_module_heartbeat"), + 137: .standard(proto: "store_forward_module_records"), + 138: .standard(proto: "store_forward_module_history_return_max"), + 139: .standard(proto: "store_forward_module_history_return_window"), + 140: .standard(proto: "telemetry_module_environment_measurement_enabled"), + 141: .standard(proto: "telemetry_module_environment_screen_enabled"), + 142: .standard(proto: "telemetry_module_environment_read_error_count_threshold"), + 143: .standard(proto: "telemetry_module_device_update_interval"), + 144: .standard(proto: "telemetry_module_environment_recovery_interval"), + 145: .standard(proto: "telemetry_module_environment_display_fahrenheit"), + 146: .standard(proto: "telemetry_module_environment_sensor_type"), + 147: .standard(proto: "telemetry_module_environment_sensor_pin"), 150: .standard(proto: "position_flags"), 151: .standard(proto: "is_always_powered"), 152: .standard(proto: "auto_screen_carousel_secs"), @@ -1541,23 +1810,24 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes 157: .standard(proto: "is_lora_tx_disabled"), 158: .standard(proto: "is_power_saving"), 160: .standard(proto: "rotary1_enabled"), - 161: .standard(proto: "rotary1_pin_a"), - 162: .standard(proto: "rotary1_pin_b"), - 163: .standard(proto: "rotary1_pin_press"), - 164: .standard(proto: "rotary1_event_cw"), - 165: .standard(proto: "rotary1_event_ccw"), - 166: .standard(proto: "rotary1_event_press"), - 170: .standard(proto: "canned_message_plugin_enabled"), - 171: .standard(proto: "canned_message_plugin_allow_input_source"), - 172: .standard(proto: "canned_message_plugin_messages"), - 173: .standard(proto: "canned_message_plugin_send_bell"), + 161: .standard(proto: "inputbroker_pin_a"), + 162: .standard(proto: "inputbroker_pin_b"), + 163: .standard(proto: "inputbroker_pin_press"), + 164: .standard(proto: "inputbroker_event_cw"), + 165: .standard(proto: "inputbroker_event_ccw"), + 166: .standard(proto: "inputbroker_event_press"), + 167: .standard(proto: "updown1_enabled"), + 170: .standard(proto: "canned_message_module_enabled"), + 171: .standard(proto: "canned_message_module_allow_input_source"), + 173: .standard(proto: "canned_message_module_send_bell"), 174: .standard(proto: "mqtt_encryption_enabled"), 175: .standard(proto: "adc_multiplier_override"), + 177: .standard(proto: "telemetry_module_environment_update_interval"), ] fileprivate class _StorageClass { var _positionBroadcastSecs: UInt32 = 0 - var _positionBroadcastSmart: Bool = false + var _positionBroadcastSmartDisabled: Bool = false var _sendOwnerInterval: UInt32 = 0 var _waitBluetoothSecs: UInt32 = 0 var _screenOnSecs: UInt32 = 0 @@ -1572,12 +1842,12 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes var _wifiApMode: Bool = false var _region: RegionCode = .unset var _chargeCurrent: ChargeCurrent = .maunset - var _isRouter: Bool = false + var _role: Role = .default var _isLowPower: Bool = false var _fixedPosition: Bool = false var _serialDisabled: Bool = false - var _locationShare: LocationSharing = .locUnset - var _gpsOperation: GpsOperation = .gpsOpUnset + var _locationShareDisabled: Bool = false + var _gpsDisabled: Bool = false var _gpsUpdateInterval: UInt32 = 0 var _gpsAttemptTime: UInt32 = 0 var _gpsAccept2D: Bool = false @@ -1589,34 +1859,35 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes var _factoryReset: Bool = false var _debugLogEnabled: Bool = false var _ignoreIncoming: [UInt32] = [] - var _serialpluginEnabled: Bool = false - var _serialpluginEcho: Bool = false - var _serialpluginRxd: UInt32 = 0 - var _serialpluginTxd: UInt32 = 0 - var _serialpluginTimeout: UInt32 = 0 - var _serialpluginMode: UInt32 = 0 - var _extNotificationPluginEnabled: Bool = false - var _extNotificationPluginOutputMs: UInt32 = 0 - var _extNotificationPluginOutput: UInt32 = 0 - var _extNotificationPluginActive: Bool = false - var _extNotificationPluginAlertMessage: Bool = false - var _extNotificationPluginAlertBell: Bool = false - var _rangeTestPluginEnabled: Bool = false - var _rangeTestPluginSender: UInt32 = 0 - var _rangeTestPluginSave: Bool = false - var _storeForwardPluginEnabled: Bool = false - var _storeForwardPluginHeartbeat: Bool = false - var _storeForwardPluginRecords: UInt32 = 0 - var _storeForwardPluginHistoryReturnMax: UInt32 = 0 - var _storeForwardPluginHistoryReturnWindow: UInt32 = 0 - var _environmentalMeasurementPluginMeasurementEnabled: Bool = false - var _environmentalMeasurementPluginScreenEnabled: Bool = false - var _environmentalMeasurementPluginReadErrorCountThreshold: UInt32 = 0 - var _environmentalMeasurementPluginUpdateInterval: UInt32 = 0 - var _environmentalMeasurementPluginRecoveryInterval: UInt32 = 0 - var _environmentalMeasurementPluginDisplayFarenheit: Bool = false - var _environmentalMeasurementPluginSensorType: RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType = .dht11 - var _environmentalMeasurementPluginSensorPin: UInt32 = 0 + var _serialModuleEnabled: Bool = false + var _serialModuleEcho: Bool = false + var _serialModuleRxd: UInt32 = 0 + var _serialModuleTxd: UInt32 = 0 + var _serialModuleBaud: RadioConfig.UserPreferences.Serial_Baud = .baudDefault + var _serialModuleTimeout: UInt32 = 0 + var _serialModuleMode: RadioConfig.UserPreferences.Serial_Mode = .modeDefault + var _extNotificationModuleEnabled: Bool = false + var _extNotificationModuleOutputMs: UInt32 = 0 + var _extNotificationModuleOutput: UInt32 = 0 + var _extNotificationModuleActive: Bool = false + var _extNotificationModuleAlertMessage: Bool = false + var _extNotificationModuleAlertBell: Bool = false + var _rangeTestModuleEnabled: Bool = false + var _rangeTestModuleSender: UInt32 = 0 + var _rangeTestModuleSave: Bool = false + var _storeForwardModuleEnabled: Bool = false + var _storeForwardModuleHeartbeat: Bool = false + var _storeForwardModuleRecords: UInt32 = 0 + var _storeForwardModuleHistoryReturnMax: UInt32 = 0 + var _storeForwardModuleHistoryReturnWindow: UInt32 = 0 + var _telemetryModuleEnvironmentMeasurementEnabled: Bool = false + var _telemetryModuleEnvironmentScreenEnabled: Bool = false + var _telemetryModuleEnvironmentReadErrorCountThreshold: UInt32 = 0 + var _telemetryModuleDeviceUpdateInterval: UInt32 = 0 + var _telemetryModuleEnvironmentRecoveryInterval: UInt32 = 0 + var _telemetryModuleEnvironmentDisplayFahrenheit: Bool = false + var _telemetryModuleEnvironmentSensorType: RadioConfig.UserPreferences.TelemetrySensorType = .none + var _telemetryModuleEnvironmentSensorPin: UInt32 = 0 var _positionFlags: UInt32 = 0 var _isAlwaysPowered: Bool = false var _autoScreenCarouselSecs: UInt32 = 0 @@ -1627,18 +1898,19 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes var _isLoraTxDisabled: Bool = false var _isPowerSaving: Bool = false var _rotary1Enabled: Bool = false - var _rotary1PinA: UInt32 = 0 - var _rotary1PinB: UInt32 = 0 - var _rotary1PinPress: UInt32 = 0 - var _rotary1EventCw: InputEventChar = .keyNone - var _rotary1EventCcw: InputEventChar = .keyNone - var _rotary1EventPress: InputEventChar = .keyNone - var _cannedMessagePluginEnabled: Bool = false - var _cannedMessagePluginAllowInputSource: String = String() - var _cannedMessagePluginMessages: String = String() - var _cannedMessagePluginSendBell: Bool = false + var _inputbrokerPinA: UInt32 = 0 + var _inputbrokerPinB: UInt32 = 0 + var _inputbrokerPinPress: UInt32 = 0 + var _inputbrokerEventCw: InputEventChar = .keyNone + var _inputbrokerEventCcw: InputEventChar = .keyNone + var _inputbrokerEventPress: InputEventChar = .keyNone + var _updown1Enabled: Bool = false + var _cannedMessageModuleEnabled: Bool = false + var _cannedMessageModuleAllowInputSource: String = String() + var _cannedMessageModuleSendBell: Bool = false var _mqttEncryptionEnabled: Bool = false var _adcMultiplierOverride: Float = 0 + var _telemetryModuleEnvironmentUpdateInterval: UInt32 = 0 static let defaultInstance = _StorageClass() @@ -1646,7 +1918,7 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes init(copying source: _StorageClass) { _positionBroadcastSecs = source._positionBroadcastSecs - _positionBroadcastSmart = source._positionBroadcastSmart + _positionBroadcastSmartDisabled = source._positionBroadcastSmartDisabled _sendOwnerInterval = source._sendOwnerInterval _waitBluetoothSecs = source._waitBluetoothSecs _screenOnSecs = source._screenOnSecs @@ -1661,12 +1933,12 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes _wifiApMode = source._wifiApMode _region = source._region _chargeCurrent = source._chargeCurrent - _isRouter = source._isRouter + _role = source._role _isLowPower = source._isLowPower _fixedPosition = source._fixedPosition _serialDisabled = source._serialDisabled - _locationShare = source._locationShare - _gpsOperation = source._gpsOperation + _locationShareDisabled = source._locationShareDisabled + _gpsDisabled = source._gpsDisabled _gpsUpdateInterval = source._gpsUpdateInterval _gpsAttemptTime = source._gpsAttemptTime _gpsAccept2D = source._gpsAccept2D @@ -1678,34 +1950,35 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes _factoryReset = source._factoryReset _debugLogEnabled = source._debugLogEnabled _ignoreIncoming = source._ignoreIncoming - _serialpluginEnabled = source._serialpluginEnabled - _serialpluginEcho = source._serialpluginEcho - _serialpluginRxd = source._serialpluginRxd - _serialpluginTxd = source._serialpluginTxd - _serialpluginTimeout = source._serialpluginTimeout - _serialpluginMode = source._serialpluginMode - _extNotificationPluginEnabled = source._extNotificationPluginEnabled - _extNotificationPluginOutputMs = source._extNotificationPluginOutputMs - _extNotificationPluginOutput = source._extNotificationPluginOutput - _extNotificationPluginActive = source._extNotificationPluginActive - _extNotificationPluginAlertMessage = source._extNotificationPluginAlertMessage - _extNotificationPluginAlertBell = source._extNotificationPluginAlertBell - _rangeTestPluginEnabled = source._rangeTestPluginEnabled - _rangeTestPluginSender = source._rangeTestPluginSender - _rangeTestPluginSave = source._rangeTestPluginSave - _storeForwardPluginEnabled = source._storeForwardPluginEnabled - _storeForwardPluginHeartbeat = source._storeForwardPluginHeartbeat - _storeForwardPluginRecords = source._storeForwardPluginRecords - _storeForwardPluginHistoryReturnMax = source._storeForwardPluginHistoryReturnMax - _storeForwardPluginHistoryReturnWindow = source._storeForwardPluginHistoryReturnWindow - _environmentalMeasurementPluginMeasurementEnabled = source._environmentalMeasurementPluginMeasurementEnabled - _environmentalMeasurementPluginScreenEnabled = source._environmentalMeasurementPluginScreenEnabled - _environmentalMeasurementPluginReadErrorCountThreshold = source._environmentalMeasurementPluginReadErrorCountThreshold - _environmentalMeasurementPluginUpdateInterval = source._environmentalMeasurementPluginUpdateInterval - _environmentalMeasurementPluginRecoveryInterval = source._environmentalMeasurementPluginRecoveryInterval - _environmentalMeasurementPluginDisplayFarenheit = source._environmentalMeasurementPluginDisplayFarenheit - _environmentalMeasurementPluginSensorType = source._environmentalMeasurementPluginSensorType - _environmentalMeasurementPluginSensorPin = source._environmentalMeasurementPluginSensorPin + _serialModuleEnabled = source._serialModuleEnabled + _serialModuleEcho = source._serialModuleEcho + _serialModuleRxd = source._serialModuleRxd + _serialModuleTxd = source._serialModuleTxd + _serialModuleBaud = source._serialModuleBaud + _serialModuleTimeout = source._serialModuleTimeout + _serialModuleMode = source._serialModuleMode + _extNotificationModuleEnabled = source._extNotificationModuleEnabled + _extNotificationModuleOutputMs = source._extNotificationModuleOutputMs + _extNotificationModuleOutput = source._extNotificationModuleOutput + _extNotificationModuleActive = source._extNotificationModuleActive + _extNotificationModuleAlertMessage = source._extNotificationModuleAlertMessage + _extNotificationModuleAlertBell = source._extNotificationModuleAlertBell + _rangeTestModuleEnabled = source._rangeTestModuleEnabled + _rangeTestModuleSender = source._rangeTestModuleSender + _rangeTestModuleSave = source._rangeTestModuleSave + _storeForwardModuleEnabled = source._storeForwardModuleEnabled + _storeForwardModuleHeartbeat = source._storeForwardModuleHeartbeat + _storeForwardModuleRecords = source._storeForwardModuleRecords + _storeForwardModuleHistoryReturnMax = source._storeForwardModuleHistoryReturnMax + _storeForwardModuleHistoryReturnWindow = source._storeForwardModuleHistoryReturnWindow + _telemetryModuleEnvironmentMeasurementEnabled = source._telemetryModuleEnvironmentMeasurementEnabled + _telemetryModuleEnvironmentScreenEnabled = source._telemetryModuleEnvironmentScreenEnabled + _telemetryModuleEnvironmentReadErrorCountThreshold = source._telemetryModuleEnvironmentReadErrorCountThreshold + _telemetryModuleDeviceUpdateInterval = source._telemetryModuleDeviceUpdateInterval + _telemetryModuleEnvironmentRecoveryInterval = source._telemetryModuleEnvironmentRecoveryInterval + _telemetryModuleEnvironmentDisplayFahrenheit = source._telemetryModuleEnvironmentDisplayFahrenheit + _telemetryModuleEnvironmentSensorType = source._telemetryModuleEnvironmentSensorType + _telemetryModuleEnvironmentSensorPin = source._telemetryModuleEnvironmentSensorPin _positionFlags = source._positionFlags _isAlwaysPowered = source._isAlwaysPowered _autoScreenCarouselSecs = source._autoScreenCarouselSecs @@ -1716,18 +1989,19 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes _isLoraTxDisabled = source._isLoraTxDisabled _isPowerSaving = source._isPowerSaving _rotary1Enabled = source._rotary1Enabled - _rotary1PinA = source._rotary1PinA - _rotary1PinB = source._rotary1PinB - _rotary1PinPress = source._rotary1PinPress - _rotary1EventCw = source._rotary1EventCw - _rotary1EventCcw = source._rotary1EventCcw - _rotary1EventPress = source._rotary1EventPress - _cannedMessagePluginEnabled = source._cannedMessagePluginEnabled - _cannedMessagePluginAllowInputSource = source._cannedMessagePluginAllowInputSource - _cannedMessagePluginMessages = source._cannedMessagePluginMessages - _cannedMessagePluginSendBell = source._cannedMessagePluginSendBell + _inputbrokerPinA = source._inputbrokerPinA + _inputbrokerPinB = source._inputbrokerPinB + _inputbrokerPinPress = source._inputbrokerPinPress + _inputbrokerEventCw = source._inputbrokerEventCw + _inputbrokerEventCcw = source._inputbrokerEventCcw + _inputbrokerEventPress = source._inputbrokerEventPress + _updown1Enabled = source._updown1Enabled + _cannedMessageModuleEnabled = source._cannedMessageModuleEnabled + _cannedMessageModuleAllowInputSource = source._cannedMessageModuleAllowInputSource + _cannedMessageModuleSendBell = source._cannedMessageModuleSendBell _mqttEncryptionEnabled = source._mqttEncryptionEnabled _adcMultiplierOverride = source._adcMultiplierOverride + _telemetryModuleEnvironmentUpdateInterval = source._telemetryModuleEnvironmentUpdateInterval } } @@ -1761,12 +2035,12 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes case 14: try { try decoder.decodeSingularBoolField(value: &_storage._wifiApMode) }() case 15: try { try decoder.decodeSingularEnumField(value: &_storage._region) }() case 16: try { try decoder.decodeSingularEnumField(value: &_storage._chargeCurrent) }() - case 17: try { try decoder.decodeSingularBoolField(value: &_storage._positionBroadcastSmart) }() - case 32: try { try decoder.decodeSingularEnumField(value: &_storage._locationShare) }() - case 33: try { try decoder.decodeSingularEnumField(value: &_storage._gpsOperation) }() + case 17: try { try decoder.decodeSingularBoolField(value: &_storage._positionBroadcastSmartDisabled) }() + case 18: try { try decoder.decodeSingularEnumField(value: &_storage._role) }() + case 32: try { try decoder.decodeSingularBoolField(value: &_storage._locationShareDisabled) }() + case 33: try { try decoder.decodeSingularBoolField(value: &_storage._gpsDisabled) }() case 34: try { try decoder.decodeSingularUInt32Field(value: &_storage._gpsUpdateInterval) }() case 36: try { try decoder.decodeSingularUInt32Field(value: &_storage._gpsAttemptTime) }() - case 37: try { try decoder.decodeSingularBoolField(value: &_storage._isRouter) }() case 38: try { try decoder.decodeSingularBoolField(value: &_storage._isLowPower) }() case 39: try { try decoder.decodeSingularBoolField(value: &_storage._fixedPosition) }() case 40: try { try decoder.decodeSingularBoolField(value: &_storage._serialDisabled) }() @@ -1779,34 +2053,34 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes case 100: try { try decoder.decodeSingularBoolField(value: &_storage._factoryReset) }() case 101: try { try decoder.decodeSingularBoolField(value: &_storage._debugLogEnabled) }() case 103: try { try decoder.decodeRepeatedUInt32Field(value: &_storage._ignoreIncoming) }() - case 120: try { try decoder.decodeSingularBoolField(value: &_storage._serialpluginEnabled) }() - case 121: try { try decoder.decodeSingularBoolField(value: &_storage._serialpluginEcho) }() - case 122: try { try decoder.decodeSingularUInt32Field(value: &_storage._serialpluginRxd) }() - case 123: try { try decoder.decodeSingularUInt32Field(value: &_storage._serialpluginTxd) }() - case 124: try { try decoder.decodeSingularUInt32Field(value: &_storage._serialpluginTimeout) }() - case 125: try { try decoder.decodeSingularUInt32Field(value: &_storage._serialpluginMode) }() - case 126: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationPluginEnabled) }() - case 127: try { try decoder.decodeSingularUInt32Field(value: &_storage._extNotificationPluginOutputMs) }() - case 128: try { try decoder.decodeSingularUInt32Field(value: &_storage._extNotificationPluginOutput) }() - case 129: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationPluginActive) }() - case 130: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationPluginAlertMessage) }() - case 131: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationPluginAlertBell) }() - case 132: try { try decoder.decodeSingularBoolField(value: &_storage._rangeTestPluginEnabled) }() - case 133: try { try decoder.decodeSingularUInt32Field(value: &_storage._rangeTestPluginSender) }() - case 134: try { try decoder.decodeSingularBoolField(value: &_storage._rangeTestPluginSave) }() - case 137: try { try decoder.decodeSingularUInt32Field(value: &_storage._storeForwardPluginRecords) }() - case 138: try { try decoder.decodeSingularUInt32Field(value: &_storage._storeForwardPluginHistoryReturnMax) }() - case 139: try { try decoder.decodeSingularUInt32Field(value: &_storage._storeForwardPluginHistoryReturnWindow) }() - case 140: try { try decoder.decodeSingularBoolField(value: &_storage._environmentalMeasurementPluginMeasurementEnabled) }() - case 141: try { try decoder.decodeSingularBoolField(value: &_storage._environmentalMeasurementPluginScreenEnabled) }() - case 142: try { try decoder.decodeSingularUInt32Field(value: &_storage._environmentalMeasurementPluginReadErrorCountThreshold) }() - case 143: try { try decoder.decodeSingularUInt32Field(value: &_storage._environmentalMeasurementPluginUpdateInterval) }() - case 144: try { try decoder.decodeSingularUInt32Field(value: &_storage._environmentalMeasurementPluginRecoveryInterval) }() - case 145: try { try decoder.decodeSingularBoolField(value: &_storage._environmentalMeasurementPluginDisplayFarenheit) }() - case 146: try { try decoder.decodeSingularEnumField(value: &_storage._environmentalMeasurementPluginSensorType) }() - case 147: try { try decoder.decodeSingularUInt32Field(value: &_storage._environmentalMeasurementPluginSensorPin) }() - case 148: try { try decoder.decodeSingularBoolField(value: &_storage._storeForwardPluginEnabled) }() - case 149: try { try decoder.decodeSingularBoolField(value: &_storage._storeForwardPluginHeartbeat) }() + case 120: try { try decoder.decodeSingularBoolField(value: &_storage._serialModuleEnabled) }() + case 121: try { try decoder.decodeSingularBoolField(value: &_storage._serialModuleEcho) }() + case 122: try { try decoder.decodeSingularUInt32Field(value: &_storage._serialModuleRxd) }() + case 123: try { try decoder.decodeSingularUInt32Field(value: &_storage._serialModuleTxd) }() + case 124: try { try decoder.decodeSingularUInt32Field(value: &_storage._serialModuleTimeout) }() + case 125: try { try decoder.decodeSingularEnumField(value: &_storage._serialModuleMode) }() + case 126: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationModuleEnabled) }() + case 127: try { try decoder.decodeSingularUInt32Field(value: &_storage._extNotificationModuleOutputMs) }() + case 128: try { try decoder.decodeSingularUInt32Field(value: &_storage._extNotificationModuleOutput) }() + case 129: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationModuleActive) }() + case 130: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationModuleAlertMessage) }() + case 131: try { try decoder.decodeSingularBoolField(value: &_storage._extNotificationModuleAlertBell) }() + case 132: try { try decoder.decodeSingularBoolField(value: &_storage._rangeTestModuleEnabled) }() + case 133: try { try decoder.decodeSingularUInt32Field(value: &_storage._rangeTestModuleSender) }() + case 134: try { try decoder.decodeSingularBoolField(value: &_storage._rangeTestModuleSave) }() + case 137: try { try decoder.decodeSingularUInt32Field(value: &_storage._storeForwardModuleRecords) }() + case 138: try { try decoder.decodeSingularUInt32Field(value: &_storage._storeForwardModuleHistoryReturnMax) }() + case 139: try { try decoder.decodeSingularUInt32Field(value: &_storage._storeForwardModuleHistoryReturnWindow) }() + case 140: try { try decoder.decodeSingularBoolField(value: &_storage._telemetryModuleEnvironmentMeasurementEnabled) }() + case 141: try { try decoder.decodeSingularBoolField(value: &_storage._telemetryModuleEnvironmentScreenEnabled) }() + case 142: try { try decoder.decodeSingularUInt32Field(value: &_storage._telemetryModuleEnvironmentReadErrorCountThreshold) }() + case 143: try { try decoder.decodeSingularUInt32Field(value: &_storage._telemetryModuleDeviceUpdateInterval) }() + case 144: try { try decoder.decodeSingularUInt32Field(value: &_storage._telemetryModuleEnvironmentRecoveryInterval) }() + case 145: try { try decoder.decodeSingularBoolField(value: &_storage._telemetryModuleEnvironmentDisplayFahrenheit) }() + case 146: try { try decoder.decodeSingularEnumField(value: &_storage._telemetryModuleEnvironmentSensorType) }() + case 147: try { try decoder.decodeSingularUInt32Field(value: &_storage._telemetryModuleEnvironmentSensorPin) }() + case 148: try { try decoder.decodeSingularBoolField(value: &_storage._storeForwardModuleEnabled) }() + case 149: try { try decoder.decodeSingularBoolField(value: &_storage._storeForwardModuleHeartbeat) }() case 150: try { try decoder.decodeSingularUInt32Field(value: &_storage._positionFlags) }() case 151: try { try decoder.decodeSingularBoolField(value: &_storage._isAlwaysPowered) }() case 152: try { try decoder.decodeSingularUInt32Field(value: &_storage._autoScreenCarouselSecs) }() @@ -1817,18 +2091,20 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes case 157: try { try decoder.decodeSingularBoolField(value: &_storage._isLoraTxDisabled) }() case 158: try { try decoder.decodeSingularBoolField(value: &_storage._isPowerSaving) }() case 160: try { try decoder.decodeSingularBoolField(value: &_storage._rotary1Enabled) }() - case 161: try { try decoder.decodeSingularUInt32Field(value: &_storage._rotary1PinA) }() - case 162: try { try decoder.decodeSingularUInt32Field(value: &_storage._rotary1PinB) }() - case 163: try { try decoder.decodeSingularUInt32Field(value: &_storage._rotary1PinPress) }() - case 164: try { try decoder.decodeSingularEnumField(value: &_storage._rotary1EventCw) }() - case 165: try { try decoder.decodeSingularEnumField(value: &_storage._rotary1EventCcw) }() - case 166: try { try decoder.decodeSingularEnumField(value: &_storage._rotary1EventPress) }() - case 170: try { try decoder.decodeSingularBoolField(value: &_storage._cannedMessagePluginEnabled) }() - case 171: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessagePluginAllowInputSource) }() - case 172: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessagePluginMessages) }() - case 173: try { try decoder.decodeSingularBoolField(value: &_storage._cannedMessagePluginSendBell) }() + case 161: try { try decoder.decodeSingularUInt32Field(value: &_storage._inputbrokerPinA) }() + case 162: try { try decoder.decodeSingularUInt32Field(value: &_storage._inputbrokerPinB) }() + case 163: try { try decoder.decodeSingularUInt32Field(value: &_storage._inputbrokerPinPress) }() + case 164: try { try decoder.decodeSingularEnumField(value: &_storage._inputbrokerEventCw) }() + case 165: try { try decoder.decodeSingularEnumField(value: &_storage._inputbrokerEventCcw) }() + case 166: try { try decoder.decodeSingularEnumField(value: &_storage._inputbrokerEventPress) }() + case 167: try { try decoder.decodeSingularBoolField(value: &_storage._updown1Enabled) }() + case 170: try { try decoder.decodeSingularBoolField(value: &_storage._cannedMessageModuleEnabled) }() + case 171: try { try decoder.decodeSingularStringField(value: &_storage._cannedMessageModuleAllowInputSource) }() + case 173: try { try decoder.decodeSingularBoolField(value: &_storage._cannedMessageModuleSendBell) }() case 174: try { try decoder.decodeSingularBoolField(value: &_storage._mqttEncryptionEnabled) }() case 175: try { try decoder.decodeSingularFloatField(value: &_storage._adcMultiplierOverride) }() + case 176: try { try decoder.decodeSingularEnumField(value: &_storage._serialModuleBaud) }() + case 177: try { try decoder.decodeSingularUInt32Field(value: &_storage._telemetryModuleEnvironmentUpdateInterval) }() default: break } } @@ -1882,14 +2158,17 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if _storage._chargeCurrent != .maunset { try visitor.visitSingularEnumField(value: _storage._chargeCurrent, fieldNumber: 16) } - if _storage._positionBroadcastSmart != false { - try visitor.visitSingularBoolField(value: _storage._positionBroadcastSmart, fieldNumber: 17) + if _storage._positionBroadcastSmartDisabled != false { + try visitor.visitSingularBoolField(value: _storage._positionBroadcastSmartDisabled, fieldNumber: 17) } - if _storage._locationShare != .locUnset { - try visitor.visitSingularEnumField(value: _storage._locationShare, fieldNumber: 32) + if _storage._role != .default { + try visitor.visitSingularEnumField(value: _storage._role, fieldNumber: 18) } - if _storage._gpsOperation != .gpsOpUnset { - try visitor.visitSingularEnumField(value: _storage._gpsOperation, fieldNumber: 33) + if _storage._locationShareDisabled != false { + try visitor.visitSingularBoolField(value: _storage._locationShareDisabled, fieldNumber: 32) + } + if _storage._gpsDisabled != false { + try visitor.visitSingularBoolField(value: _storage._gpsDisabled, fieldNumber: 33) } if _storage._gpsUpdateInterval != 0 { try visitor.visitSingularUInt32Field(value: _storage._gpsUpdateInterval, fieldNumber: 34) @@ -1897,9 +2176,6 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if _storage._gpsAttemptTime != 0 { try visitor.visitSingularUInt32Field(value: _storage._gpsAttemptTime, fieldNumber: 36) } - if _storage._isRouter != false { - try visitor.visitSingularBoolField(value: _storage._isRouter, fieldNumber: 37) - } if _storage._isLowPower != false { try visitor.visitSingularBoolField(value: _storage._isLowPower, fieldNumber: 38) } @@ -1936,89 +2212,89 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if !_storage._ignoreIncoming.isEmpty { try visitor.visitPackedUInt32Field(value: _storage._ignoreIncoming, fieldNumber: 103) } - if _storage._serialpluginEnabled != false { - try visitor.visitSingularBoolField(value: _storage._serialpluginEnabled, fieldNumber: 120) + if _storage._serialModuleEnabled != false { + try visitor.visitSingularBoolField(value: _storage._serialModuleEnabled, fieldNumber: 120) } - if _storage._serialpluginEcho != false { - try visitor.visitSingularBoolField(value: _storage._serialpluginEcho, fieldNumber: 121) + if _storage._serialModuleEcho != false { + try visitor.visitSingularBoolField(value: _storage._serialModuleEcho, fieldNumber: 121) } - if _storage._serialpluginRxd != 0 { - try visitor.visitSingularUInt32Field(value: _storage._serialpluginRxd, fieldNumber: 122) + if _storage._serialModuleRxd != 0 { + try visitor.visitSingularUInt32Field(value: _storage._serialModuleRxd, fieldNumber: 122) } - if _storage._serialpluginTxd != 0 { - try visitor.visitSingularUInt32Field(value: _storage._serialpluginTxd, fieldNumber: 123) + if _storage._serialModuleTxd != 0 { + try visitor.visitSingularUInt32Field(value: _storage._serialModuleTxd, fieldNumber: 123) } - if _storage._serialpluginTimeout != 0 { - try visitor.visitSingularUInt32Field(value: _storage._serialpluginTimeout, fieldNumber: 124) + if _storage._serialModuleTimeout != 0 { + try visitor.visitSingularUInt32Field(value: _storage._serialModuleTimeout, fieldNumber: 124) } - if _storage._serialpluginMode != 0 { - try visitor.visitSingularUInt32Field(value: _storage._serialpluginMode, fieldNumber: 125) + if _storage._serialModuleMode != .modeDefault { + try visitor.visitSingularEnumField(value: _storage._serialModuleMode, fieldNumber: 125) } - if _storage._extNotificationPluginEnabled != false { - try visitor.visitSingularBoolField(value: _storage._extNotificationPluginEnabled, fieldNumber: 126) + if _storage._extNotificationModuleEnabled != false { + try visitor.visitSingularBoolField(value: _storage._extNotificationModuleEnabled, fieldNumber: 126) } - if _storage._extNotificationPluginOutputMs != 0 { - try visitor.visitSingularUInt32Field(value: _storage._extNotificationPluginOutputMs, fieldNumber: 127) + if _storage._extNotificationModuleOutputMs != 0 { + try visitor.visitSingularUInt32Field(value: _storage._extNotificationModuleOutputMs, fieldNumber: 127) } - if _storage._extNotificationPluginOutput != 0 { - try visitor.visitSingularUInt32Field(value: _storage._extNotificationPluginOutput, fieldNumber: 128) + if _storage._extNotificationModuleOutput != 0 { + try visitor.visitSingularUInt32Field(value: _storage._extNotificationModuleOutput, fieldNumber: 128) } - if _storage._extNotificationPluginActive != false { - try visitor.visitSingularBoolField(value: _storage._extNotificationPluginActive, fieldNumber: 129) + if _storage._extNotificationModuleActive != false { + try visitor.visitSingularBoolField(value: _storage._extNotificationModuleActive, fieldNumber: 129) } - if _storage._extNotificationPluginAlertMessage != false { - try visitor.visitSingularBoolField(value: _storage._extNotificationPluginAlertMessage, fieldNumber: 130) + if _storage._extNotificationModuleAlertMessage != false { + try visitor.visitSingularBoolField(value: _storage._extNotificationModuleAlertMessage, fieldNumber: 130) } - if _storage._extNotificationPluginAlertBell != false { - try visitor.visitSingularBoolField(value: _storage._extNotificationPluginAlertBell, fieldNumber: 131) + if _storage._extNotificationModuleAlertBell != false { + try visitor.visitSingularBoolField(value: _storage._extNotificationModuleAlertBell, fieldNumber: 131) } - if _storage._rangeTestPluginEnabled != false { - try visitor.visitSingularBoolField(value: _storage._rangeTestPluginEnabled, fieldNumber: 132) + if _storage._rangeTestModuleEnabled != false { + try visitor.visitSingularBoolField(value: _storage._rangeTestModuleEnabled, fieldNumber: 132) } - if _storage._rangeTestPluginSender != 0 { - try visitor.visitSingularUInt32Field(value: _storage._rangeTestPluginSender, fieldNumber: 133) + if _storage._rangeTestModuleSender != 0 { + try visitor.visitSingularUInt32Field(value: _storage._rangeTestModuleSender, fieldNumber: 133) } - if _storage._rangeTestPluginSave != false { - try visitor.visitSingularBoolField(value: _storage._rangeTestPluginSave, fieldNumber: 134) + if _storage._rangeTestModuleSave != false { + try visitor.visitSingularBoolField(value: _storage._rangeTestModuleSave, fieldNumber: 134) } - if _storage._storeForwardPluginRecords != 0 { - try visitor.visitSingularUInt32Field(value: _storage._storeForwardPluginRecords, fieldNumber: 137) + if _storage._storeForwardModuleRecords != 0 { + try visitor.visitSingularUInt32Field(value: _storage._storeForwardModuleRecords, fieldNumber: 137) } - if _storage._storeForwardPluginHistoryReturnMax != 0 { - try visitor.visitSingularUInt32Field(value: _storage._storeForwardPluginHistoryReturnMax, fieldNumber: 138) + if _storage._storeForwardModuleHistoryReturnMax != 0 { + try visitor.visitSingularUInt32Field(value: _storage._storeForwardModuleHistoryReturnMax, fieldNumber: 138) } - if _storage._storeForwardPluginHistoryReturnWindow != 0 { - try visitor.visitSingularUInt32Field(value: _storage._storeForwardPluginHistoryReturnWindow, fieldNumber: 139) + if _storage._storeForwardModuleHistoryReturnWindow != 0 { + try visitor.visitSingularUInt32Field(value: _storage._storeForwardModuleHistoryReturnWindow, fieldNumber: 139) } - if _storage._environmentalMeasurementPluginMeasurementEnabled != false { - try visitor.visitSingularBoolField(value: _storage._environmentalMeasurementPluginMeasurementEnabled, fieldNumber: 140) + if _storage._telemetryModuleEnvironmentMeasurementEnabled != false { + try visitor.visitSingularBoolField(value: _storage._telemetryModuleEnvironmentMeasurementEnabled, fieldNumber: 140) } - if _storage._environmentalMeasurementPluginScreenEnabled != false { - try visitor.visitSingularBoolField(value: _storage._environmentalMeasurementPluginScreenEnabled, fieldNumber: 141) + if _storage._telemetryModuleEnvironmentScreenEnabled != false { + try visitor.visitSingularBoolField(value: _storage._telemetryModuleEnvironmentScreenEnabled, fieldNumber: 141) } - if _storage._environmentalMeasurementPluginReadErrorCountThreshold != 0 { - try visitor.visitSingularUInt32Field(value: _storage._environmentalMeasurementPluginReadErrorCountThreshold, fieldNumber: 142) + if _storage._telemetryModuleEnvironmentReadErrorCountThreshold != 0 { + try visitor.visitSingularUInt32Field(value: _storage._telemetryModuleEnvironmentReadErrorCountThreshold, fieldNumber: 142) } - if _storage._environmentalMeasurementPluginUpdateInterval != 0 { - try visitor.visitSingularUInt32Field(value: _storage._environmentalMeasurementPluginUpdateInterval, fieldNumber: 143) + if _storage._telemetryModuleDeviceUpdateInterval != 0 { + try visitor.visitSingularUInt32Field(value: _storage._telemetryModuleDeviceUpdateInterval, fieldNumber: 143) } - if _storage._environmentalMeasurementPluginRecoveryInterval != 0 { - try visitor.visitSingularUInt32Field(value: _storage._environmentalMeasurementPluginRecoveryInterval, fieldNumber: 144) + if _storage._telemetryModuleEnvironmentRecoveryInterval != 0 { + try visitor.visitSingularUInt32Field(value: _storage._telemetryModuleEnvironmentRecoveryInterval, fieldNumber: 144) } - if _storage._environmentalMeasurementPluginDisplayFarenheit != false { - try visitor.visitSingularBoolField(value: _storage._environmentalMeasurementPluginDisplayFarenheit, fieldNumber: 145) + if _storage._telemetryModuleEnvironmentDisplayFahrenheit != false { + try visitor.visitSingularBoolField(value: _storage._telemetryModuleEnvironmentDisplayFahrenheit, fieldNumber: 145) } - if _storage._environmentalMeasurementPluginSensorType != .dht11 { - try visitor.visitSingularEnumField(value: _storage._environmentalMeasurementPluginSensorType, fieldNumber: 146) + if _storage._telemetryModuleEnvironmentSensorType != .none { + try visitor.visitSingularEnumField(value: _storage._telemetryModuleEnvironmentSensorType, fieldNumber: 146) } - if _storage._environmentalMeasurementPluginSensorPin != 0 { - try visitor.visitSingularUInt32Field(value: _storage._environmentalMeasurementPluginSensorPin, fieldNumber: 147) + if _storage._telemetryModuleEnvironmentSensorPin != 0 { + try visitor.visitSingularUInt32Field(value: _storage._telemetryModuleEnvironmentSensorPin, fieldNumber: 147) } - if _storage._storeForwardPluginEnabled != false { - try visitor.visitSingularBoolField(value: _storage._storeForwardPluginEnabled, fieldNumber: 148) + if _storage._storeForwardModuleEnabled != false { + try visitor.visitSingularBoolField(value: _storage._storeForwardModuleEnabled, fieldNumber: 148) } - if _storage._storeForwardPluginHeartbeat != false { - try visitor.visitSingularBoolField(value: _storage._storeForwardPluginHeartbeat, fieldNumber: 149) + if _storage._storeForwardModuleHeartbeat != false { + try visitor.visitSingularBoolField(value: _storage._storeForwardModuleHeartbeat, fieldNumber: 149) } if _storage._positionFlags != 0 { try visitor.visitSingularUInt32Field(value: _storage._positionFlags, fieldNumber: 150) @@ -2050,35 +2326,35 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if _storage._rotary1Enabled != false { try visitor.visitSingularBoolField(value: _storage._rotary1Enabled, fieldNumber: 160) } - if _storage._rotary1PinA != 0 { - try visitor.visitSingularUInt32Field(value: _storage._rotary1PinA, fieldNumber: 161) + if _storage._inputbrokerPinA != 0 { + try visitor.visitSingularUInt32Field(value: _storage._inputbrokerPinA, fieldNumber: 161) } - if _storage._rotary1PinB != 0 { - try visitor.visitSingularUInt32Field(value: _storage._rotary1PinB, fieldNumber: 162) + if _storage._inputbrokerPinB != 0 { + try visitor.visitSingularUInt32Field(value: _storage._inputbrokerPinB, fieldNumber: 162) } - if _storage._rotary1PinPress != 0 { - try visitor.visitSingularUInt32Field(value: _storage._rotary1PinPress, fieldNumber: 163) + if _storage._inputbrokerPinPress != 0 { + try visitor.visitSingularUInt32Field(value: _storage._inputbrokerPinPress, fieldNumber: 163) } - if _storage._rotary1EventCw != .keyNone { - try visitor.visitSingularEnumField(value: _storage._rotary1EventCw, fieldNumber: 164) + if _storage._inputbrokerEventCw != .keyNone { + try visitor.visitSingularEnumField(value: _storage._inputbrokerEventCw, fieldNumber: 164) } - if _storage._rotary1EventCcw != .keyNone { - try visitor.visitSingularEnumField(value: _storage._rotary1EventCcw, fieldNumber: 165) + if _storage._inputbrokerEventCcw != .keyNone { + try visitor.visitSingularEnumField(value: _storage._inputbrokerEventCcw, fieldNumber: 165) } - if _storage._rotary1EventPress != .keyNone { - try visitor.visitSingularEnumField(value: _storage._rotary1EventPress, fieldNumber: 166) + if _storage._inputbrokerEventPress != .keyNone { + try visitor.visitSingularEnumField(value: _storage._inputbrokerEventPress, fieldNumber: 166) } - if _storage._cannedMessagePluginEnabled != false { - try visitor.visitSingularBoolField(value: _storage._cannedMessagePluginEnabled, fieldNumber: 170) + if _storage._updown1Enabled != false { + try visitor.visitSingularBoolField(value: _storage._updown1Enabled, fieldNumber: 167) } - if !_storage._cannedMessagePluginAllowInputSource.isEmpty { - try visitor.visitSingularStringField(value: _storage._cannedMessagePluginAllowInputSource, fieldNumber: 171) + if _storage._cannedMessageModuleEnabled != false { + try visitor.visitSingularBoolField(value: _storage._cannedMessageModuleEnabled, fieldNumber: 170) } - if !_storage._cannedMessagePluginMessages.isEmpty { - try visitor.visitSingularStringField(value: _storage._cannedMessagePluginMessages, fieldNumber: 172) + if !_storage._cannedMessageModuleAllowInputSource.isEmpty { + try visitor.visitSingularStringField(value: _storage._cannedMessageModuleAllowInputSource, fieldNumber: 171) } - if _storage._cannedMessagePluginSendBell != false { - try visitor.visitSingularBoolField(value: _storage._cannedMessagePluginSendBell, fieldNumber: 173) + if _storage._cannedMessageModuleSendBell != false { + try visitor.visitSingularBoolField(value: _storage._cannedMessageModuleSendBell, fieldNumber: 173) } if _storage._mqttEncryptionEnabled != false { try visitor.visitSingularBoolField(value: _storage._mqttEncryptionEnabled, fieldNumber: 174) @@ -2086,6 +2362,12 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if _storage._adcMultiplierOverride != 0 { try visitor.visitSingularFloatField(value: _storage._adcMultiplierOverride, fieldNumber: 175) } + if _storage._serialModuleBaud != .baudDefault { + try visitor.visitSingularEnumField(value: _storage._serialModuleBaud, fieldNumber: 176) + } + if _storage._telemetryModuleEnvironmentUpdateInterval != 0 { + try visitor.visitSingularUInt32Field(value: _storage._telemetryModuleEnvironmentUpdateInterval, fieldNumber: 177) + } } try unknownFields.traverse(visitor: &visitor) } @@ -2096,7 +2378,7 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes let _storage = _args.0 let rhs_storage = _args.1 if _storage._positionBroadcastSecs != rhs_storage._positionBroadcastSecs {return false} - if _storage._positionBroadcastSmart != rhs_storage._positionBroadcastSmart {return false} + if _storage._positionBroadcastSmartDisabled != rhs_storage._positionBroadcastSmartDisabled {return false} if _storage._sendOwnerInterval != rhs_storage._sendOwnerInterval {return false} if _storage._waitBluetoothSecs != rhs_storage._waitBluetoothSecs {return false} if _storage._screenOnSecs != rhs_storage._screenOnSecs {return false} @@ -2111,12 +2393,12 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if _storage._wifiApMode != rhs_storage._wifiApMode {return false} if _storage._region != rhs_storage._region {return false} if _storage._chargeCurrent != rhs_storage._chargeCurrent {return false} - if _storage._isRouter != rhs_storage._isRouter {return false} + if _storage._role != rhs_storage._role {return false} if _storage._isLowPower != rhs_storage._isLowPower {return false} if _storage._fixedPosition != rhs_storage._fixedPosition {return false} if _storage._serialDisabled != rhs_storage._serialDisabled {return false} - if _storage._locationShare != rhs_storage._locationShare {return false} - if _storage._gpsOperation != rhs_storage._gpsOperation {return false} + if _storage._locationShareDisabled != rhs_storage._locationShareDisabled {return false} + if _storage._gpsDisabled != rhs_storage._gpsDisabled {return false} if _storage._gpsUpdateInterval != rhs_storage._gpsUpdateInterval {return false} if _storage._gpsAttemptTime != rhs_storage._gpsAttemptTime {return false} if _storage._gpsAccept2D != rhs_storage._gpsAccept2D {return false} @@ -2128,34 +2410,35 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if _storage._factoryReset != rhs_storage._factoryReset {return false} if _storage._debugLogEnabled != rhs_storage._debugLogEnabled {return false} if _storage._ignoreIncoming != rhs_storage._ignoreIncoming {return false} - if _storage._serialpluginEnabled != rhs_storage._serialpluginEnabled {return false} - if _storage._serialpluginEcho != rhs_storage._serialpluginEcho {return false} - if _storage._serialpluginRxd != rhs_storage._serialpluginRxd {return false} - if _storage._serialpluginTxd != rhs_storage._serialpluginTxd {return false} - if _storage._serialpluginTimeout != rhs_storage._serialpluginTimeout {return false} - if _storage._serialpluginMode != rhs_storage._serialpluginMode {return false} - if _storage._extNotificationPluginEnabled != rhs_storage._extNotificationPluginEnabled {return false} - if _storage._extNotificationPluginOutputMs != rhs_storage._extNotificationPluginOutputMs {return false} - if _storage._extNotificationPluginOutput != rhs_storage._extNotificationPluginOutput {return false} - if _storage._extNotificationPluginActive != rhs_storage._extNotificationPluginActive {return false} - if _storage._extNotificationPluginAlertMessage != rhs_storage._extNotificationPluginAlertMessage {return false} - if _storage._extNotificationPluginAlertBell != rhs_storage._extNotificationPluginAlertBell {return false} - if _storage._rangeTestPluginEnabled != rhs_storage._rangeTestPluginEnabled {return false} - if _storage._rangeTestPluginSender != rhs_storage._rangeTestPluginSender {return false} - if _storage._rangeTestPluginSave != rhs_storage._rangeTestPluginSave {return false} - if _storage._storeForwardPluginEnabled != rhs_storage._storeForwardPluginEnabled {return false} - if _storage._storeForwardPluginHeartbeat != rhs_storage._storeForwardPluginHeartbeat {return false} - if _storage._storeForwardPluginRecords != rhs_storage._storeForwardPluginRecords {return false} - if _storage._storeForwardPluginHistoryReturnMax != rhs_storage._storeForwardPluginHistoryReturnMax {return false} - if _storage._storeForwardPluginHistoryReturnWindow != rhs_storage._storeForwardPluginHistoryReturnWindow {return false} - if _storage._environmentalMeasurementPluginMeasurementEnabled != rhs_storage._environmentalMeasurementPluginMeasurementEnabled {return false} - if _storage._environmentalMeasurementPluginScreenEnabled != rhs_storage._environmentalMeasurementPluginScreenEnabled {return false} - if _storage._environmentalMeasurementPluginReadErrorCountThreshold != rhs_storage._environmentalMeasurementPluginReadErrorCountThreshold {return false} - if _storage._environmentalMeasurementPluginUpdateInterval != rhs_storage._environmentalMeasurementPluginUpdateInterval {return false} - if _storage._environmentalMeasurementPluginRecoveryInterval != rhs_storage._environmentalMeasurementPluginRecoveryInterval {return false} - if _storage._environmentalMeasurementPluginDisplayFarenheit != rhs_storage._environmentalMeasurementPluginDisplayFarenheit {return false} - if _storage._environmentalMeasurementPluginSensorType != rhs_storage._environmentalMeasurementPluginSensorType {return false} - if _storage._environmentalMeasurementPluginSensorPin != rhs_storage._environmentalMeasurementPluginSensorPin {return false} + if _storage._serialModuleEnabled != rhs_storage._serialModuleEnabled {return false} + if _storage._serialModuleEcho != rhs_storage._serialModuleEcho {return false} + if _storage._serialModuleRxd != rhs_storage._serialModuleRxd {return false} + if _storage._serialModuleTxd != rhs_storage._serialModuleTxd {return false} + if _storage._serialModuleBaud != rhs_storage._serialModuleBaud {return false} + if _storage._serialModuleTimeout != rhs_storage._serialModuleTimeout {return false} + if _storage._serialModuleMode != rhs_storage._serialModuleMode {return false} + if _storage._extNotificationModuleEnabled != rhs_storage._extNotificationModuleEnabled {return false} + if _storage._extNotificationModuleOutputMs != rhs_storage._extNotificationModuleOutputMs {return false} + if _storage._extNotificationModuleOutput != rhs_storage._extNotificationModuleOutput {return false} + if _storage._extNotificationModuleActive != rhs_storage._extNotificationModuleActive {return false} + if _storage._extNotificationModuleAlertMessage != rhs_storage._extNotificationModuleAlertMessage {return false} + if _storage._extNotificationModuleAlertBell != rhs_storage._extNotificationModuleAlertBell {return false} + if _storage._rangeTestModuleEnabled != rhs_storage._rangeTestModuleEnabled {return false} + if _storage._rangeTestModuleSender != rhs_storage._rangeTestModuleSender {return false} + if _storage._rangeTestModuleSave != rhs_storage._rangeTestModuleSave {return false} + if _storage._storeForwardModuleEnabled != rhs_storage._storeForwardModuleEnabled {return false} + if _storage._storeForwardModuleHeartbeat != rhs_storage._storeForwardModuleHeartbeat {return false} + if _storage._storeForwardModuleRecords != rhs_storage._storeForwardModuleRecords {return false} + if _storage._storeForwardModuleHistoryReturnMax != rhs_storage._storeForwardModuleHistoryReturnMax {return false} + if _storage._storeForwardModuleHistoryReturnWindow != rhs_storage._storeForwardModuleHistoryReturnWindow {return false} + if _storage._telemetryModuleEnvironmentMeasurementEnabled != rhs_storage._telemetryModuleEnvironmentMeasurementEnabled {return false} + if _storage._telemetryModuleEnvironmentScreenEnabled != rhs_storage._telemetryModuleEnvironmentScreenEnabled {return false} + if _storage._telemetryModuleEnvironmentReadErrorCountThreshold != rhs_storage._telemetryModuleEnvironmentReadErrorCountThreshold {return false} + if _storage._telemetryModuleDeviceUpdateInterval != rhs_storage._telemetryModuleDeviceUpdateInterval {return false} + if _storage._telemetryModuleEnvironmentRecoveryInterval != rhs_storage._telemetryModuleEnvironmentRecoveryInterval {return false} + if _storage._telemetryModuleEnvironmentDisplayFahrenheit != rhs_storage._telemetryModuleEnvironmentDisplayFahrenheit {return false} + if _storage._telemetryModuleEnvironmentSensorType != rhs_storage._telemetryModuleEnvironmentSensorType {return false} + if _storage._telemetryModuleEnvironmentSensorPin != rhs_storage._telemetryModuleEnvironmentSensorPin {return false} if _storage._positionFlags != rhs_storage._positionFlags {return false} if _storage._isAlwaysPowered != rhs_storage._isAlwaysPowered {return false} if _storage._autoScreenCarouselSecs != rhs_storage._autoScreenCarouselSecs {return false} @@ -2166,18 +2449,19 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes if _storage._isLoraTxDisabled != rhs_storage._isLoraTxDisabled {return false} if _storage._isPowerSaving != rhs_storage._isPowerSaving {return false} if _storage._rotary1Enabled != rhs_storage._rotary1Enabled {return false} - if _storage._rotary1PinA != rhs_storage._rotary1PinA {return false} - if _storage._rotary1PinB != rhs_storage._rotary1PinB {return false} - if _storage._rotary1PinPress != rhs_storage._rotary1PinPress {return false} - if _storage._rotary1EventCw != rhs_storage._rotary1EventCw {return false} - if _storage._rotary1EventCcw != rhs_storage._rotary1EventCcw {return false} - if _storage._rotary1EventPress != rhs_storage._rotary1EventPress {return false} - if _storage._cannedMessagePluginEnabled != rhs_storage._cannedMessagePluginEnabled {return false} - if _storage._cannedMessagePluginAllowInputSource != rhs_storage._cannedMessagePluginAllowInputSource {return false} - if _storage._cannedMessagePluginMessages != rhs_storage._cannedMessagePluginMessages {return false} - if _storage._cannedMessagePluginSendBell != rhs_storage._cannedMessagePluginSendBell {return false} + if _storage._inputbrokerPinA != rhs_storage._inputbrokerPinA {return false} + if _storage._inputbrokerPinB != rhs_storage._inputbrokerPinB {return false} + if _storage._inputbrokerPinPress != rhs_storage._inputbrokerPinPress {return false} + if _storage._inputbrokerEventCw != rhs_storage._inputbrokerEventCw {return false} + if _storage._inputbrokerEventCcw != rhs_storage._inputbrokerEventCcw {return false} + if _storage._inputbrokerEventPress != rhs_storage._inputbrokerEventPress {return false} + if _storage._updown1Enabled != rhs_storage._updown1Enabled {return false} + if _storage._cannedMessageModuleEnabled != rhs_storage._cannedMessageModuleEnabled {return false} + if _storage._cannedMessageModuleAllowInputSource != rhs_storage._cannedMessageModuleAllowInputSource {return false} + if _storage._cannedMessageModuleSendBell != rhs_storage._cannedMessageModuleSendBell {return false} if _storage._mqttEncryptionEnabled != rhs_storage._mqttEncryptionEnabled {return false} if _storage._adcMultiplierOverride != rhs_storage._adcMultiplierOverride {return false} + if _storage._telemetryModuleEnvironmentUpdateInterval != rhs_storage._telemetryModuleEnvironmentUpdateInterval {return false} return true } if !storagesAreEqual {return false} @@ -2187,15 +2471,42 @@ extension RadioConfig.UserPreferences: SwiftProtobuf.Message, SwiftProtobuf._Mes } } -extension RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType: SwiftProtobuf._ProtoNameProviding { +extension RadioConfig.UserPreferences.Serial_Baud: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "DHT11"), - 1: .same(proto: "DS18B20"), - 2: .same(proto: "DHT12"), - 3: .same(proto: "DHT21"), - 4: .same(proto: "DHT22"), - 5: .same(proto: "BME280"), - 6: .same(proto: "BME680"), - 7: .same(proto: "MCP9808"), + 0: .same(proto: "BAUD_Default"), + 1: .same(proto: "BAUD_2400"), + 2: .same(proto: "BAUD_4800"), + 3: .same(proto: "BAUD_9600"), + 4: .same(proto: "BAUD_19200"), + 5: .same(proto: "BAUD_38400"), + 6: .same(proto: "BAUD_57600"), + 7: .same(proto: "BAUD_115200"), + 8: .same(proto: "BAUD_230400"), + 9: .same(proto: "BAUD_460800"), + 10: .same(proto: "BAUD_576000"), + 11: .same(proto: "BAUD_921600"), + ] +} + +extension RadioConfig.UserPreferences.Serial_Mode: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "MODE_Default"), + 1: .same(proto: "MODE_SIMPLE"), + 2: .same(proto: "MODE_PROTO"), + ] +} + +extension RadioConfig.UserPreferences.TelemetrySensorType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "None"), + 1: .same(proto: "DHT11"), + 2: .same(proto: "DS18B20"), + 3: .same(proto: "DHT12"), + 4: .same(proto: "DHT21"), + 5: .same(proto: "DHT22"), + 6: .same(proto: "BME280"), + 7: .same(proto: "BME680"), + 8: .same(proto: "MCP9808"), + 9: .same(proto: "SHTC3"), ] } diff --git a/MeshtasticClient/Protobufs/remote_hardware.pb.swift b/MeshtasticClient/Protobufs/remote_hardware.pb.swift index 5a21328d..701fafc2 100644 --- a/MeshtasticClient/Protobufs/remote_hardware.pb.swift +++ b/MeshtasticClient/Protobufs/remote_hardware.pb.swift @@ -21,7 +21,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } /// -/// An example app to show off the plugin system. This message is used for +/// 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. @@ -53,6 +53,8 @@ struct HardwareMessage { var unknownFields = SwiftProtobuf.UnknownStorage() + /// + /// TODO: REPLACE enum TypeEnum: SwiftProtobuf.Enum { typealias RawValue = Int @@ -132,6 +134,11 @@ extension HardwareMessage.TypeEnum: CaseIterable { #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. extension HardwareMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { diff --git a/MeshtasticClient/Protobufs/storeforward.pb.swift b/MeshtasticClient/Protobufs/storeforward.pb.swift index ceb9d9f8..b6df6719 100644 --- a/MeshtasticClient/Protobufs/storeforward.pb.swift +++ b/MeshtasticClient/Protobufs/storeforward.pb.swift @@ -20,13 +20,19 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP 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 stats: StoreAndForward.Statistics { get {return _stats ?? StoreAndForward.Statistics()} set {_stats = newValue} @@ -36,6 +42,8 @@ struct StoreAndForward { /// Clears the value of `stats`. Subsequent reads from it will return its default value. mutating func clearStats() {self._stats = nil} + /// + /// TODO: REPLACE var history: StoreAndForward.History { get {return _history ?? StoreAndForward.History()} set {_history = newValue} @@ -45,6 +53,8 @@ struct StoreAndForward { /// Clears the value of `history`. Subsequent reads from it will return its default value. mutating func clearHistory() {self._history = nil} + /// + /// TODO: REPLACE var heartbeat: StoreAndForward.Heartbeat { get {return _heartbeat ?? StoreAndForward.Heartbeat()} set {_heartbeat = newValue} @@ -161,6 +171,8 @@ struct StoreAndForward { } + /// + /// 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 @@ -207,6 +219,8 @@ struct StoreAndForward { 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 @@ -229,6 +243,8 @@ struct StoreAndForward { 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 @@ -277,6 +293,14 @@ extension StoreAndForward.RequestResponse: CaseIterable { #endif // swift(>=4.2) +#if swift(>=5.5) && canImport(_Concurrency) +extension StoreAndForward: @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. extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { @@ -304,18 +328,22 @@ extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } func traverse(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) } - if let v = self._stats { + try { if let v = self._stats { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } - if let v = self._history { + } }() + try { if let v = self._history { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } - if let v = self._heartbeat { + } }() + try { if let v = self._heartbeat { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - } + } }() try unknownFields.traverse(visitor: &visitor) } diff --git a/MeshtasticClient/Protobufs/telemetry.pb.swift b/MeshtasticClient/Protobufs/telemetry.pb.swift new file mode 100644 index 00000000..9f22221c --- /dev/null +++ b/MeshtasticClient/Protobufs/telemetry.pb.swift @@ -0,0 +1,352 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: 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 +} + +/// +/// 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() {} +} + +/// +/// 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)} + } + + 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) + + #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 + }() + default: return false + } + } + #endif + } + + init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension DeviceMetrics: @unchecked Sendable {} +extension EnvironmentMetrics: @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. + +extension DeviceMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = "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(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(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 = "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(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(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 Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = "Telemetry" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "time"), + 2: .standard(proto: "device_metrics"), + 3: .standard(proto: "environment_metrics"), + ] + + mutating func decodeMessage(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) + } + }() + default: break + } + } + } + + func traverse(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 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 + } +} diff --git a/gen_protos.sh b/gen_protos.sh index 0f34f5e6..ec9f89be 100755 --- a/gen_protos.sh +++ b/gen_protos.sh @@ -15,7 +15,7 @@ fi pdir=$(realpath "../Meshtastic-protobufs") sdir=$(realpath "./MeshtasticClient/Protobufs") echo "pdir:$pdir sdir:$sdir" -pfiles="admin.proto apponly.proto cannedmessages.proto channel.proto deviceonly.proto environmental_measurement.proto mesh.proto mqtt.proto portnums.proto radioconfig.proto remote_hardware.proto storeforward.proto" +pfiles="admin.proto apponly.proto cannedmessages.proto channel.proto deviceonly.proto mesh.proto mqtt.proto portnums.proto radioconfig.proto remote_hardware.proto storeforward.proto telemetry.proto" for pf in $pfiles do echo "Generating $pf..."