From 7792daa140628e58e6087cce79da78acd14f3f10 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 11 Nov 2022 08:20:18 -0800 Subject: [PATCH] Proto updates for voice on 2.4 --- Meshtastic/Protobufs/admin.pb.swift | 8 + Meshtastic/Protobufs/config.pb.swift | 128 ++++++------ Meshtastic/Protobufs/localonly.pb.swift | 19 ++ Meshtastic/Protobufs/mesh.pb.swift | 12 +- Meshtastic/Protobufs/module_config.pb.swift | 205 ++++++++++++++++++++ Meshtastic/Protobufs/portnums.pb.swift | 10 +- 6 files changed, 321 insertions(+), 61 deletions(-) diff --git a/Meshtastic/Protobufs/admin.pb.swift b/Meshtastic/Protobufs/admin.pb.swift index 83169e01..a8dbfaae 100644 --- a/Meshtastic/Protobufs/admin.pb.swift +++ b/Meshtastic/Protobufs/admin.pb.swift @@ -628,6 +628,10 @@ struct AdminMessage { /// /// TODO: REPLACE case cannedmsgConfig // = 6 + + /// + /// TODO: REPLACE + case audioConfig // = 7 case UNRECOGNIZED(Int) init() { @@ -643,6 +647,7 @@ struct AdminMessage { case 4: self = .rangetestConfig case 5: self = .telemetryConfig case 6: self = .cannedmsgConfig + case 7: self = .audioConfig default: self = .UNRECOGNIZED(rawValue) } } @@ -656,6 +661,7 @@ struct AdminMessage { case .rangetestConfig: return 4 case .telemetryConfig: return 5 case .cannedmsgConfig: return 6 + case .audioConfig: return 7 case .UNRECOGNIZED(let i): return i } } @@ -690,6 +696,7 @@ extension AdminMessage.ModuleConfigType: CaseIterable { .rangetestConfig, .telemetryConfig, .cannedmsgConfig, + .audioConfig, ] } @@ -1155,5 +1162,6 @@ extension AdminMessage.ModuleConfigType: SwiftProtobuf._ProtoNameProviding { 4: .same(proto: "RANGETEST_CONFIG"), 5: .same(proto: "TELEMETRY_CONFIG"), 6: .same(proto: "CANNEDMSG_CONFIG"), + 7: .same(proto: "AUDIO_CONFIG"), ] } diff --git a/Meshtastic/Protobufs/config.pb.swift b/Meshtastic/Protobufs/config.pb.swift index a70a48aa..1bdbd1eb 100644 --- a/Meshtastic/Protobufs/config.pb.swift +++ b/Meshtastic/Protobufs/config.pb.swift @@ -471,46 +471,6 @@ struct Config { var unknownFields = SwiftProtobuf.UnknownStorage() - enum WiFiMode: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// This mode is used to connect to an external WiFi network - case client // = 0 - - /// - /// In this mode the node will operate as an AP (and DHCP server) - case accessPoint // = 1 - - /// - /// If set, the node AP will broadcast as a hidden SSID - case accessPointHidden // = 2 - case UNRECOGNIZED(Int) - - init() { - self = .client - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .client - case 1: self = .accessPoint - case 2: self = .accessPointHidden - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .client: return 0 - case .accessPoint: return 1 - case .accessPointHidden: return 2 - case .UNRECOGNIZED(let i): return i - } - } - - } - enum EthMode: SwiftProtobuf.Enum { typealias RawValue = Int @@ -610,6 +570,10 @@ struct Config { /// Perferred display units var units: Config.DisplayConfig.DisplayUnits = .metric + /// + /// Override auto-detect in screen + var oled: Config.DisplayConfig.OledType = .oledAuto + var unknownFields = SwiftProtobuf.UnknownStorage() /// @@ -715,6 +679,48 @@ struct Config { } + /// + /// Override OLED outo detect with this if it fails. + enum OledType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + /// Default / Auto + case oledAuto // = 0 + + /// + /// Default / Auto + case oledSsd1306 // = 1 + + /// + /// Default / Auto + case oledSh1106 // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .oledAuto + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .oledAuto + case 1: self = .oledSsd1306 + case 2: self = .oledSh1106 + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .oledAuto: return 0 + case .oledSsd1306: return 1 + case .oledSh1106: return 2 + case .UNRECOGNIZED(let i): return i + } + } + + } + init() {} } @@ -1069,15 +1075,6 @@ extension Config.PositionConfig.PositionFlags: CaseIterable { ] } -extension Config.NetworkConfig.WiFiMode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.NetworkConfig.WiFiMode] = [ - .client, - .accessPoint, - .accessPointHidden, - ] -} - extension Config.NetworkConfig.EthMode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. static var allCases: [Config.NetworkConfig.EthMode] = [ @@ -1106,6 +1103,15 @@ extension Config.DisplayConfig.DisplayUnits: CaseIterable { ] } +extension Config.DisplayConfig.OledType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Config.DisplayConfig.OledType] = [ + .oledAuto, + .oledSsd1306, + .oledSh1106, + ] +} + extension Config.LoRaConfig.RegionCode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. static var allCases: [Config.LoRaConfig.RegionCode] = [ @@ -1159,12 +1165,12 @@ extension Config.PositionConfig: @unchecked Sendable {} extension Config.PositionConfig.PositionFlags: @unchecked Sendable {} extension Config.PowerConfig: @unchecked Sendable {} extension Config.NetworkConfig: @unchecked Sendable {} -extension Config.NetworkConfig.WiFiMode: @unchecked Sendable {} extension Config.NetworkConfig.EthMode: @unchecked Sendable {} extension Config.NetworkConfig.IpV4Config: @unchecked Sendable {} extension Config.DisplayConfig: @unchecked Sendable {} extension Config.DisplayConfig.GpsCoordinateFormat: @unchecked Sendable {} extension Config.DisplayConfig.DisplayUnits: @unchecked Sendable {} +extension Config.DisplayConfig.OledType: @unchecked Sendable {} extension Config.LoRaConfig: @unchecked Sendable {} extension Config.LoRaConfig.RegionCode: @unchecked Sendable {} extension Config.LoRaConfig.ModemPreset: @unchecked Sendable {} @@ -1617,14 +1623,6 @@ extension Config.NetworkConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } } -extension Config.NetworkConfig.WiFiMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "CLIENT"), - 1: .same(proto: "ACCESS_POINT"), - 2: .same(proto: "ACCESS_POINT_HIDDEN"), - ] -} - extension Config.NetworkConfig.EthMode: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DHCP"), @@ -1691,6 +1689,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 4: .standard(proto: "compass_north_top"), 5: .standard(proto: "flip_screen"), 6: .same(proto: "units"), + 7: .same(proto: "oled"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -1705,6 +1704,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp case 4: try { try decoder.decodeSingularBoolField(value: &self.compassNorthTop) }() case 5: try { try decoder.decodeSingularBoolField(value: &self.flipScreen) }() case 6: try { try decoder.decodeSingularEnumField(value: &self.units) }() + case 7: try { try decoder.decodeSingularEnumField(value: &self.oled) }() default: break } } @@ -1729,6 +1729,9 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp if self.units != .metric { try visitor.visitSingularEnumField(value: self.units, fieldNumber: 6) } + if self.oled != .oledAuto { + try visitor.visitSingularEnumField(value: self.oled, fieldNumber: 7) + } try unknownFields.traverse(visitor: &visitor) } @@ -1739,6 +1742,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp if lhs.compassNorthTop != rhs.compassNorthTop {return false} if lhs.flipScreen != rhs.flipScreen {return false} if lhs.units != rhs.units {return false} + if lhs.oled != rhs.oled {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } @@ -1762,6 +1766,14 @@ extension Config.DisplayConfig.DisplayUnits: SwiftProtobuf._ProtoNameProviding { ] } +extension Config.DisplayConfig.OledType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "OLED_AUTO"), + 1: .same(proto: "OLED_SSD1306"), + 2: .same(proto: "OLED_SH1106"), + ] +} + extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = Config.protoMessageName + ".LoRaConfig" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ diff --git a/Meshtastic/Protobufs/localonly.pb.swift b/Meshtastic/Protobufs/localonly.pb.swift index 8ad6ccf6..2c89a577 100644 --- a/Meshtastic/Protobufs/localonly.pb.swift +++ b/Meshtastic/Protobufs/localonly.pb.swift @@ -200,6 +200,17 @@ struct LocalModuleConfig { /// Clears the value of `cannedMessage`. Subsequent reads from it will return its default value. mutating func clearCannedMessage() {_uniqueStorage()._cannedMessage = nil} + /// + /// The part of the config that is specific to the Audio module + var audio: ModuleConfig.AudioConfig { + get {return _storage._audio ?? ModuleConfig.AudioConfig()} + set {_uniqueStorage()._audio = newValue} + } + /// Returns true if `audio` has been explicitly set. + var hasAudio: Bool {return _storage._audio != nil} + /// Clears the value of `audio`. Subsequent reads from it will return its default value. + mutating func clearAudio() {_uniqueStorage()._audio = nil} + /// /// A version integer used to invalidate old save files when we make /// incompatible changes This integer is set at build time and is private to @@ -357,6 +368,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem 5: .standard(proto: "range_test"), 6: .same(proto: "telemetry"), 7: .standard(proto: "canned_message"), + 9: .same(proto: "audio"), 8: .same(proto: "version"), ] @@ -368,6 +380,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem var _rangeTest: ModuleConfig.RangeTestConfig? = nil var _telemetry: ModuleConfig.TelemetryConfig? = nil var _cannedMessage: ModuleConfig.CannedMessageConfig? = nil + var _audio: ModuleConfig.AudioConfig? = nil var _version: UInt32 = 0 static let defaultInstance = _StorageClass() @@ -382,6 +395,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem _rangeTest = source._rangeTest _telemetry = source._telemetry _cannedMessage = source._cannedMessage + _audio = source._audio _version = source._version } } @@ -409,6 +423,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem case 6: try { try decoder.decodeSingularMessageField(value: &_storage._telemetry) }() case 7: try { try decoder.decodeSingularMessageField(value: &_storage._cannedMessage) }() case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }() + case 9: try { try decoder.decodeSingularMessageField(value: &_storage._audio) }() default: break } } @@ -445,6 +460,9 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem if _storage._version != 0 { try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 8) } + try { if let v = _storage._audio { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() } try unknownFields.traverse(visitor: &visitor) } @@ -461,6 +479,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem if _storage._rangeTest != rhs_storage._rangeTest {return false} if _storage._telemetry != rhs_storage._telemetry {return false} if _storage._cannedMessage != rhs_storage._cannedMessage {return false} + if _storage._audio != rhs_storage._audio {return false} if _storage._version != rhs_storage._version {return false} return true } diff --git a/Meshtastic/Protobufs/mesh.pb.swift b/Meshtastic/Protobufs/mesh.pb.swift index 8735aca7..6d64e08e 100644 --- a/Meshtastic/Protobufs/mesh.pb.swift +++ b/Meshtastic/Protobufs/mesh.pb.swift @@ -90,6 +90,10 @@ enum HardwareModel: SwiftProtobuf.Enum { /// B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano case nanoG1 // = 14 + /// + /// TODO: REPLACE + case tloraV211P8 // = 15 + /// /// B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station case stationG1 // = 25 @@ -164,6 +168,7 @@ enum HardwareModel: SwiftProtobuf.Enum { case 12: self = .lilygoTbeamS3Core case 13: self = .rak11200 case 14: self = .nanoG1 + case 15: self = .tloraV211P8 case 25: self = .stationG1 case 32: self = .loraRelayV1 case 33: self = .nrf52840Dk @@ -198,6 +203,7 @@ enum HardwareModel: SwiftProtobuf.Enum { case .lilygoTbeamS3Core: return 12 case .rak11200: return 13 case .nanoG1: return 14 + case .tloraV211P8: return 15 case .stationG1: return 25 case .loraRelayV1: return 32 case .nrf52840Dk: return 33 @@ -237,6 +243,7 @@ extension HardwareModel: CaseIterable { .lilygoTbeamS3Core, .rak11200, .nanoG1, + .tloraV211P8, .stationG1, .loraRelayV1, .nrf52840Dk, @@ -1129,7 +1136,7 @@ struct MeshPacket { /// /// The sending node number. /// Note: Our crypto implementation uses this field as well. - /// See [crypto](/docs/developers/firmware/encryption) for details. + /// See [crypto](/docs/overview/encryption) for details. /// FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. var from: UInt32 { get {return _storage._from} @@ -1190,7 +1197,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](/docs/developers/firmware/encryption) for details. + /// See [crypto](/docs/overview/encryption) for details. /// FIXME - really should be fixed32 instead, this encoding only /// hurts the ble link though. var id: UInt32 { @@ -2124,6 +2131,7 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding { 12: .same(proto: "LILYGO_TBEAM_S3_CORE"), 13: .same(proto: "RAK11200"), 14: .same(proto: "NANO_G1"), + 15: .same(proto: "TLORA_V2_1_1P8"), 25: .same(proto: "STATION_G1"), 32: .same(proto: "LORA_RELAY_V1"), 33: .same(proto: "NRF52840DK"), diff --git a/Meshtastic/Protobufs/module_config.pb.swift b/Meshtastic/Protobufs/module_config.pb.swift index ca381640..4911431e 100644 --- a/Meshtastic/Protobufs/module_config.pb.swift +++ b/Meshtastic/Protobufs/module_config.pb.swift @@ -101,6 +101,16 @@ struct ModuleConfig { set {payloadVariant = .cannedMessage(newValue)} } + /// + /// TODO: REPLACE + var audio: ModuleConfig.AudioConfig { + get { + if case .audio(let v)? = payloadVariant {return v} + return ModuleConfig.AudioConfig() + } + set {payloadVariant = .audio(newValue)} + } + var unknownFields = SwiftProtobuf.UnknownStorage() /// @@ -127,6 +137,9 @@ struct ModuleConfig { /// /// TODO: REPLACE case cannedMessage(ModuleConfig.CannedMessageConfig) + /// + /// TODO: REPLACE + case audio(ModuleConfig.AudioConfig) #if !swift(>=4.1) static func ==(lhs: ModuleConfig.OneOf_PayloadVariant, rhs: ModuleConfig.OneOf_PayloadVariant) -> Bool { @@ -162,6 +175,10 @@ struct ModuleConfig { guard case .cannedMessage(let l) = lhs, case .cannedMessage(let r) = rhs else { preconditionFailure() } return l == r }() + case (.audio, .audio): return { + guard case .audio(let l) = lhs, case .audio(let r) = rhs else { preconditionFailure() } + return l == r + }() default: return false } } @@ -213,6 +230,89 @@ struct ModuleConfig { init() {} } + /// + /// Audio Config for codec2 voice + struct AudioConfig { + // 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. + + /// + /// Whether Audio is enabled + var codec2Enabled: Bool = false + + /// + /// ADC where Microphone is connected + var micChan: UInt32 = 0 + + /// + /// DAC where Speaker is connected + var ampPin: UInt32 = 0 + + /// + /// PTT Pin + var pttPin: UInt32 = 0 + + /// + /// The audio sample rate to use for codec2 + var bitrate: ModuleConfig.AudioConfig.Audio_Baud = .codec2Default + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// + /// Baudrate for codec2 voice + enum Audio_Baud: SwiftProtobuf.Enum { + typealias RawValue = Int + case codec2Default // = 0 + case codec23200 // = 1 + case codec22400 // = 2 + case codec21600 // = 3 + case codec21400 // = 4 + case codec21300 // = 5 + case codec21200 // = 6 + case codec2700 // = 7 + case codec2700B // = 8 + case UNRECOGNIZED(Int) + + init() { + self = .codec2Default + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .codec2Default + case 1: self = .codec23200 + case 2: self = .codec22400 + case 3: self = .codec21600 + case 4: self = .codec21400 + case 5: self = .codec21300 + case 6: self = .codec21200 + case 7: self = .codec2700 + case 8: self = .codec2700B + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .codec2Default: return 0 + case .codec23200: return 1 + case .codec22400: return 2 + case .codec21600: return 3 + case .codec21400: return 4 + case .codec21300: return 5 + case .codec21200: return 6 + case .codec2700: return 7 + case .codec2700B: return 8 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} + } + /// /// Serial Config struct SerialConfig { @@ -627,6 +727,21 @@ struct ModuleConfig { #if swift(>=4.2) +extension ModuleConfig.AudioConfig.Audio_Baud: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [ModuleConfig.AudioConfig.Audio_Baud] = [ + .codec2Default, + .codec23200, + .codec22400, + .codec21600, + .codec21400, + .codec21300, + .codec21200, + .codec2700, + .codec2700B, + ] +} + extension ModuleConfig.SerialConfig.Serial_Baud: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. static var allCases: [ModuleConfig.SerialConfig.Serial_Baud] = [ @@ -680,6 +795,8 @@ extension ModuleConfig.CannedMessageConfig.InputEventChar: CaseIterable { extension ModuleConfig: @unchecked Sendable {} extension ModuleConfig.OneOf_PayloadVariant: @unchecked Sendable {} extension ModuleConfig.MQTTConfig: @unchecked Sendable {} +extension ModuleConfig.AudioConfig: @unchecked Sendable {} +extension ModuleConfig.AudioConfig.Audio_Baud: @unchecked Sendable {} extension ModuleConfig.SerialConfig: @unchecked Sendable {} extension ModuleConfig.SerialConfig.Serial_Baud: @unchecked Sendable {} extension ModuleConfig.SerialConfig.Serial_Mode: @unchecked Sendable {} @@ -703,6 +820,7 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 5: .standard(proto: "range_test"), 6: .same(proto: "telemetry"), 7: .standard(proto: "canned_message"), + 8: .same(proto: "audio"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -802,6 +920,19 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat self.payloadVariant = .cannedMessage(v) } }() + case 8: try { + var v: ModuleConfig.AudioConfig? + var hadOneofValue = false + if let current = self.payloadVariant { + hadOneofValue = true + if case .audio(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.payloadVariant = .audio(v) + } + }() default: break } } @@ -841,6 +972,10 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat guard case .cannedMessage(let v)? = self.payloadVariant else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 7) }() + case .audio?: try { + guard case .audio(let v)? = self.payloadVariant else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + }() case nil: break } try unknownFields.traverse(visitor: &visitor) @@ -915,6 +1050,76 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message } } +extension ModuleConfig.AudioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = ModuleConfig.protoMessageName + ".AudioConfig" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "codec2_enabled"), + 2: .standard(proto: "mic_chan"), + 3: .standard(proto: "amp_pin"), + 4: .standard(proto: "ptt_pin"), + 5: .same(proto: "bitrate"), + ] + + 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.decodeSingularBoolField(value: &self.codec2Enabled) }() + case 2: try { try decoder.decodeSingularUInt32Field(value: &self.micChan) }() + case 3: try { try decoder.decodeSingularUInt32Field(value: &self.ampPin) }() + case 4: try { try decoder.decodeSingularUInt32Field(value: &self.pttPin) }() + case 5: try { try decoder.decodeSingularEnumField(value: &self.bitrate) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.codec2Enabled != false { + try visitor.visitSingularBoolField(value: self.codec2Enabled, fieldNumber: 1) + } + if self.micChan != 0 { + try visitor.visitSingularUInt32Field(value: self.micChan, fieldNumber: 2) + } + if self.ampPin != 0 { + try visitor.visitSingularUInt32Field(value: self.ampPin, fieldNumber: 3) + } + if self.pttPin != 0 { + try visitor.visitSingularUInt32Field(value: self.pttPin, fieldNumber: 4) + } + if self.bitrate != .codec2Default { + try visitor.visitSingularEnumField(value: self.bitrate, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ModuleConfig.AudioConfig, rhs: ModuleConfig.AudioConfig) -> Bool { + if lhs.codec2Enabled != rhs.codec2Enabled {return false} + if lhs.micChan != rhs.micChan {return false} + if lhs.ampPin != rhs.ampPin {return false} + if lhs.pttPin != rhs.pttPin {return false} + if lhs.bitrate != rhs.bitrate {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension ModuleConfig.AudioConfig.Audio_Baud: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CODEC2_DEFAULT"), + 1: .same(proto: "CODEC2_3200"), + 2: .same(proto: "CODEC2_2400"), + 3: .same(proto: "CODEC2_1600"), + 4: .same(proto: "CODEC2_1400"), + 5: .same(proto: "CODEC2_1300"), + 6: .same(proto: "CODEC2_1200"), + 7: .same(proto: "CODEC2_700"), + 8: .same(proto: "CODEC2_700B"), + ] +} + extension ModuleConfig.SerialConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = ModuleConfig.protoMessageName + ".SerialConfig" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ diff --git a/Meshtastic/Protobufs/portnums.pb.swift b/Meshtastic/Protobufs/portnums.pb.swift index efeea5d4..7f58fd3e 100644 --- a/Meshtastic/Protobufs/portnums.pb.swift +++ b/Meshtastic/Protobufs/portnums.pb.swift @@ -82,6 +82,10 @@ enum PortNum: SwiftProtobuf.Enum { /// Payload is a [Waypoint](/docs/developers/protobufs/api#waypoint) message case waypointApp // = 8 + /// Audio Payloads. + /// Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now + case audioApp // = 9 + /// /// Provides a 'ping' service that replies to any packet it receives. /// Also serves as a small example module. @@ -129,7 +133,7 @@ enum PortNum: SwiftProtobuf.Enum { /// /// Private applications should use portnums >= 256. /// To simplify initial development and testing you can use "PRIVATE_APP" - /// in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/Meshtastic-device/blob/master/bin/regen-protos.sh)) + /// in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh)) case privateApp // = 256 /// @@ -156,6 +160,7 @@ enum PortNum: SwiftProtobuf.Enum { case 6: self = .adminApp case 7: self = .textMessageCompressedApp case 8: self = .waypointApp + case 9: self = .audioApp case 32: self = .replyApp case 33: self = .ipTunnelApp case 64: self = .serialApp @@ -182,6 +187,7 @@ enum PortNum: SwiftProtobuf.Enum { case .adminApp: return 6 case .textMessageCompressedApp: return 7 case .waypointApp: return 8 + case .audioApp: return 9 case .replyApp: return 32 case .ipTunnelApp: return 33 case .serialApp: return 64 @@ -213,6 +219,7 @@ extension PortNum: CaseIterable { .adminApp, .textMessageCompressedApp, .waypointApp, + .audioApp, .replyApp, .ipTunnelApp, .serialApp, @@ -246,6 +253,7 @@ extension PortNum: SwiftProtobuf._ProtoNameProviding { 6: .same(proto: "ADMIN_APP"), 7: .same(proto: "TEXT_MESSAGE_COMPRESSED_APP"), 8: .same(proto: "WAYPOINT_APP"), + 9: .same(proto: "AUDIO_APP"), 32: .same(proto: "REPLY_APP"), 33: .same(proto: "IP_TUNNEL_APP"), 64: .same(proto: "SERIAL_APP"),