From 4b44224fb2f489ffbf106d318305c00c1142cb91 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 9 Oct 2024 19:32:32 -0700 Subject: [PATCH] Bump protos and device hardware --- Meshtastic/Resources/DeviceHardware.json | 16 ++ .../Sources/meshtastic/atak.pb.swift | 4 +- .../Sources/meshtastic/config.pb.swift | 24 +++ .../Sources/meshtastic/mesh.pb.swift | 49 ++++- .../Sources/meshtastic/module_config.pb.swift | 143 ++++++++++++-- .../Sources/meshtastic/telemetry.pb.swift | 183 +++++++++++++++++- protobufs | 2 +- 7 files changed, 398 insertions(+), 23 deletions(-) diff --git a/Meshtastic/Resources/DeviceHardware.json b/Meshtastic/Resources/DeviceHardware.json index eaf5db0b..0b88202d 100644 --- a/Meshtastic/Resources/DeviceHardware.json +++ b/Meshtastic/Resources/DeviceHardware.json @@ -127,6 +127,14 @@ "activelySupported": true, "displayName": "LILYGO T-LoRa T3-S3" }, + { + "hwModel": 16, + "hwModelSlug": "TLORA_T3_S3", + "platformioTarget": "tlora-t3s3-epaper", + "architecture": "esp32-s3", + "activelySupported": true, + "displayName": "LILYGO T-LoRa T3-S3 E-Paper" + }, { "hwModel": 17, "hwModelSlug": "NANO_G1_EXPLORER", @@ -414,5 +422,13 @@ "architecture": "nrf52840", "activelySupported": true, "displayName": "Seeed Card Tracker T1000-E" + }, + { + "hwModel": 72, + "hwModelSlug": "Seeed_XIAO_S3", + "platformioTarget": "seeed-xiao-s3", + "architecture": "esp32-s3", + "activelySupported": true, + "displayName": "Seeed XIAO S3" } ] diff --git a/MeshtasticProtobufs/Sources/meshtastic/atak.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/atak.pb.swift index c756d94d..867648a9 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/atak.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/atak.pb.swift @@ -324,7 +324,7 @@ public struct TAKPacket { /// /// Generic CoT detail XML - /// May be compressed / truncated by the sender + /// May be compressed / truncated by the sender (EUD) public var detail: Data { get { if case .detail(let v)? = payloadVariant {return v} @@ -346,7 +346,7 @@ public struct TAKPacket { case chat(GeoChat) /// /// Generic CoT detail XML - /// May be compressed / truncated by the sender + /// May be compressed / truncated by the sender (EUD) case detail(Data) #if !swift(>=4.1) diff --git a/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift index 37832baa..38df8ea0 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift @@ -1344,6 +1344,18 @@ public struct Config { /// /// Singapore 923mhz case sg923 // = 18 + + /// + /// Philippines 433mhz + case ph433 // = 19 + + /// + /// Philippines 868mhz + case ph868 // = 20 + + /// + /// Philippines 915mhz + case ph915 // = 21 case UNRECOGNIZED(Int) public init() { @@ -1371,6 +1383,9 @@ public struct Config { case 16: self = .my433 case 17: self = .my919 case 18: self = .sg923 + case 19: self = .ph433 + case 20: self = .ph868 + case 21: self = .ph915 default: self = .UNRECOGNIZED(rawValue) } } @@ -1396,6 +1411,9 @@ public struct Config { case .my433: return 16 case .my919: return 17 case .sg923: return 18 + case .ph433: return 19 + case .ph868: return 20 + case .ph915: return 21 case .UNRECOGNIZED(let i): return i } } @@ -1747,6 +1765,9 @@ extension Config.LoRaConfig.RegionCode: CaseIterable { .my433, .my919, .sg923, + .ph433, + .ph868, + .ph915, ] } @@ -2834,6 +2855,9 @@ extension Config.LoRaConfig.RegionCode: SwiftProtobuf._ProtoNameProviding { 16: .same(proto: "MY_433"), 17: .same(proto: "MY_919"), 18: .same(proto: "SG_923"), + 19: .same(proto: "PH_433"), + 20: .same(proto: "PH_868"), + 21: .same(proto: "PH_915"), ] } diff --git a/MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift index 6bddec60..f604d4a7 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift @@ -126,6 +126,10 @@ public enum HardwareModel: SwiftProtobuf.Enum { /// Heltec HRU-3601: https://heltec.org/project/hru-3601/ case heltecHru3601 // = 23 + /// + /// Heltec Wireless Bridge + case heltecWirelessBridge // = 24 + /// /// B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station case stationG1 // = 25 @@ -197,7 +201,7 @@ public enum HardwareModel: SwiftProtobuf.Enum { case drDev // = 41 /// - /// M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ + /// M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/ case m5Stack // = 42 /// @@ -355,10 +359,27 @@ public enum HardwareModel: SwiftProtobuf.Enum { /// ^^^ short A0 to switch to I2C address 0x3C case rp2040FeatherRfm95 // = 76 - /// M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ + /// M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/ case m5StackCorebasic // = 77 case m5StackCore2 // = 78 + /// Pico2 with Waveshare Hat, same as Pico + case rpiPico2 // = 79 + + /// M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/ + case m5StackCores3 // = 80 + + /// Seeed XIAO S3 DK + case seeedXiaoS3 // = 81 + + /// + /// Nordic nRF52840+Semtech SX1262 LoRa BLE Combo Module. nRF52840+SX1262 MS24SF1 + case ms24Sf1 // = 82 + + /// + /// Lilygo TLora-C6 with the new ESP32-C6 MCU + case tloraC6 // = 83 + /// /// ------------------------------------------------------------------------------------------------------------------------------------------ /// Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. @@ -396,6 +417,7 @@ public enum HardwareModel: SwiftProtobuf.Enum { case 21: self = .wioWm1110 case 22: self = .rak2560 case 23: self = .heltecHru3601 + case 24: self = .heltecWirelessBridge case 25: self = .stationG1 case 26: self = .rak11310 case 27: self = .senseloraRp2040 @@ -450,6 +472,11 @@ public enum HardwareModel: SwiftProtobuf.Enum { case 76: self = .rp2040FeatherRfm95 case 77: self = .m5StackCorebasic case 78: self = .m5StackCore2 + case 79: self = .rpiPico2 + case 80: self = .m5StackCores3 + case 81: self = .seeedXiaoS3 + case 82: self = .ms24Sf1 + case 83: self = .tloraC6 case 255: self = .privateHw default: self = .UNRECOGNIZED(rawValue) } @@ -481,6 +508,7 @@ public enum HardwareModel: SwiftProtobuf.Enum { case .wioWm1110: return 21 case .rak2560: return 22 case .heltecHru3601: return 23 + case .heltecWirelessBridge: return 24 case .stationG1: return 25 case .rak11310: return 26 case .senseloraRp2040: return 27 @@ -535,6 +563,11 @@ public enum HardwareModel: SwiftProtobuf.Enum { case .rp2040FeatherRfm95: return 76 case .m5StackCorebasic: return 77 case .m5StackCore2: return 78 + case .rpiPico2: return 79 + case .m5StackCores3: return 80 + case .seeedXiaoS3: return 81 + case .ms24Sf1: return 82 + case .tloraC6: return 83 case .privateHw: return 255 case .UNRECOGNIZED(let i): return i } @@ -571,6 +604,7 @@ extension HardwareModel: CaseIterable { .wioWm1110, .rak2560, .heltecHru3601, + .heltecWirelessBridge, .stationG1, .rak11310, .senseloraRp2040, @@ -625,6 +659,11 @@ extension HardwareModel: CaseIterable { .rp2040FeatherRfm95, .m5StackCorebasic, .m5StackCore2, + .rpiPico2, + .m5StackCores3, + .seeedXiaoS3, + .ms24Sf1, + .tloraC6, .privateHw, ] } @@ -3262,6 +3301,7 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding { 21: .same(proto: "WIO_WM1110"), 22: .same(proto: "RAK2560"), 23: .same(proto: "HELTEC_HRU_3601"), + 24: .same(proto: "HELTEC_WIRELESS_BRIDGE"), 25: .same(proto: "STATION_G1"), 26: .same(proto: "RAK11310"), 27: .same(proto: "SENSELORA_RP2040"), @@ -3316,6 +3356,11 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding { 76: .same(proto: "RP2040_FEATHER_RFM95"), 77: .same(proto: "M5STACK_COREBASIC"), 78: .same(proto: "M5STACK_CORE2"), + 79: .same(proto: "RPI_PICO2"), + 80: .same(proto: "M5STACK_CORES3"), + 81: .same(proto: "SEEED_XIAO_S3"), + 82: .same(proto: "MS24SF1"), + 83: .same(proto: "TLORA_C6"), 255: .same(proto: "PRIVATE_HW"), ] } diff --git a/MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift index 3186c349..30a8e0a4 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift @@ -475,13 +475,15 @@ public struct ModuleConfig { public var enabled: Bool = false /// - /// Interval in seconds of how often we can send a message to the mesh when a state change is detected + /// Interval in seconds of how often we can send a message to the mesh when a + /// trigger event is detected public var minimumBroadcastSecs: UInt32 = 0 /// - /// Interval in seconds of how often we should send a message to the mesh with the current state regardless of changes - /// When set to 0, only state changes will be broadcasted - /// Works as a sort of status heartbeat for peace of mind + /// Interval in seconds of how often we should send a message to the mesh + /// with the current state regardless of trigger events When set to 0, only + /// trigger events will be broadcasted Works as a sort of status heartbeat + /// for peace of mind public var stateBroadcastSecs: UInt32 = 0 /// @@ -500,9 +502,8 @@ public struct ModuleConfig { public var monitorPin: UInt32 = 0 /// - /// Whether or not the GPIO pin state detection is triggered on HIGH (1) - /// Otherwise LOW (0) - public var detectionTriggeredHigh: Bool = false + /// The type of trigger event to be used + public var detectionTriggerType: ModuleConfig.DetectionSensorConfig.TriggerType = .logicLow /// /// Whether or not use INPUT_PULLUP mode for GPIO pin @@ -511,6 +512,60 @@ public struct ModuleConfig { public var unknownFields = SwiftProtobuf.UnknownStorage() + public enum TriggerType: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// Event is triggered if pin is low + case logicLow // = 0 + + /// Event is triggered if pin is high + case logicHigh // = 1 + + /// Event is triggered when pin goes high to low + case fallingEdge // = 2 + + /// Event is triggered when pin goes low to high + case risingEdge // = 3 + + /// Event is triggered on every pin state change, low is considered to be + /// "active" + case eitherEdgeActiveLow // = 4 + + /// Event is triggered on every pin state change, high is considered to be + /// "active" + case eitherEdgeActiveHigh // = 5 + case UNRECOGNIZED(Int) + + public init() { + self = .logicLow + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .logicLow + case 1: self = .logicHigh + case 2: self = .fallingEdge + case 3: self = .risingEdge + case 4: self = .eitherEdgeActiveLow + case 5: self = .eitherEdgeActiveHigh + default: self = .UNRECOGNIZED(rawValue) + } + } + + public var rawValue: Int { + switch self { + case .logicLow: return 0 + case .logicHigh: return 1 + case .fallingEdge: return 2 + case .risingEdge: return 3 + case .eitherEdgeActiveLow: return 4 + case .eitherEdgeActiveHigh: return 5 + case .UNRECOGNIZED(let i): return i + } + } + + } + public init() {} } @@ -980,20 +1035,32 @@ public struct ModuleConfig { public var airQualityInterval: UInt32 = 0 /// - /// Interval in seconds of how often we should try to send our - /// air quality metrics to the mesh + /// Enable/disable Power metrics public var powerMeasurementEnabled: Bool = false /// /// Interval in seconds of how often we should try to send our - /// air quality metrics to the mesh + /// power metrics to the mesh public var powerUpdateInterval: UInt32 = 0 /// - /// Interval in seconds of how often we should try to send our - /// air quality metrics to the mesh + /// Enable/Disable the power measurement module on-device display public var powerScreenEnabled: Bool = false + /// + /// Preferences for the (Health) Telemetry Module + /// Enable/Disable the telemetry measurement module measurement collection + public var healthMeasurementEnabled: Bool = false + + /// + /// Interval in seconds of how often we should try to send our + /// health metrics to the mesh + public var healthUpdateInterval: UInt32 = 0 + + /// + /// Enable/Disable the health telemetry module on-device display + public var healthScreenEnabled: Bool = false + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -1167,6 +1234,18 @@ public struct ModuleConfig { #if swift(>=4.2) +extension ModuleConfig.DetectionSensorConfig.TriggerType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + public static let allCases: [ModuleConfig.DetectionSensorConfig.TriggerType] = [ + .logicLow, + .logicHigh, + .fallingEdge, + .risingEdge, + .eitherEdgeActiveLow, + .eitherEdgeActiveHigh, + ] +} + extension ModuleConfig.AudioConfig.Audio_Baud: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [ModuleConfig.AudioConfig.Audio_Baud] = [ @@ -1266,6 +1345,7 @@ extension ModuleConfig.MapReportSettings: @unchecked Sendable {} extension ModuleConfig.RemoteHardwareConfig: @unchecked Sendable {} extension ModuleConfig.NeighborInfoConfig: @unchecked Sendable {} extension ModuleConfig.DetectionSensorConfig: @unchecked Sendable {} +extension ModuleConfig.DetectionSensorConfig.TriggerType: @unchecked Sendable {} extension ModuleConfig.AudioConfig: @unchecked Sendable {} extension ModuleConfig.AudioConfig.Audio_Baud: @unchecked Sendable {} extension ModuleConfig.PaxcounterConfig: @unchecked Sendable {} @@ -1787,7 +1867,7 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob 4: .standard(proto: "send_bell"), 5: .same(proto: "name"), 6: .standard(proto: "monitor_pin"), - 7: .standard(proto: "detection_triggered_high"), + 7: .standard(proto: "detection_trigger_type"), 8: .standard(proto: "use_pullup"), ] @@ -1803,7 +1883,7 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob case 4: try { try decoder.decodeSingularBoolField(value: &self.sendBell) }() case 5: try { try decoder.decodeSingularStringField(value: &self.name) }() case 6: try { try decoder.decodeSingularUInt32Field(value: &self.monitorPin) }() - case 7: try { try decoder.decodeSingularBoolField(value: &self.detectionTriggeredHigh) }() + case 7: try { try decoder.decodeSingularEnumField(value: &self.detectionTriggerType) }() case 8: try { try decoder.decodeSingularBoolField(value: &self.usePullup) }() default: break } @@ -1829,8 +1909,8 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob if self.monitorPin != 0 { try visitor.visitSingularUInt32Field(value: self.monitorPin, fieldNumber: 6) } - if self.detectionTriggeredHigh != false { - try visitor.visitSingularBoolField(value: self.detectionTriggeredHigh, fieldNumber: 7) + if self.detectionTriggerType != .logicLow { + try visitor.visitSingularEnumField(value: self.detectionTriggerType, fieldNumber: 7) } if self.usePullup != false { try visitor.visitSingularBoolField(value: self.usePullup, fieldNumber: 8) @@ -1845,13 +1925,24 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob if lhs.sendBell != rhs.sendBell {return false} if lhs.name != rhs.name {return false} if lhs.monitorPin != rhs.monitorPin {return false} - if lhs.detectionTriggeredHigh != rhs.detectionTriggeredHigh {return false} + if lhs.detectionTriggerType != rhs.detectionTriggerType {return false} if lhs.usePullup != rhs.usePullup {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } +extension ModuleConfig.DetectionSensorConfig.TriggerType: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "LOGIC_LOW"), + 1: .same(proto: "LOGIC_HIGH"), + 2: .same(proto: "FALLING_EDGE"), + 3: .same(proto: "RISING_EDGE"), + 4: .same(proto: "EITHER_EDGE_ACTIVE_LOW"), + 5: .same(proto: "EITHER_EDGE_ACTIVE_HIGH"), + ] +} + extension ModuleConfig.AudioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = ModuleConfig.protoMessageName + ".AudioConfig" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ @@ -2326,6 +2417,9 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me 8: .standard(proto: "power_measurement_enabled"), 9: .standard(proto: "power_update_interval"), 10: .standard(proto: "power_screen_enabled"), + 11: .standard(proto: "health_measurement_enabled"), + 12: .standard(proto: "health_update_interval"), + 13: .standard(proto: "health_screen_enabled"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -2344,6 +2438,9 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me case 8: try { try decoder.decodeSingularBoolField(value: &self.powerMeasurementEnabled) }() case 9: try { try decoder.decodeSingularUInt32Field(value: &self.powerUpdateInterval) }() case 10: try { try decoder.decodeSingularBoolField(value: &self.powerScreenEnabled) }() + case 11: try { try decoder.decodeSingularBoolField(value: &self.healthMeasurementEnabled) }() + case 12: try { try decoder.decodeSingularUInt32Field(value: &self.healthUpdateInterval) }() + case 13: try { try decoder.decodeSingularBoolField(value: &self.healthScreenEnabled) }() default: break } } @@ -2380,6 +2477,15 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me if self.powerScreenEnabled != false { try visitor.visitSingularBoolField(value: self.powerScreenEnabled, fieldNumber: 10) } + if self.healthMeasurementEnabled != false { + try visitor.visitSingularBoolField(value: self.healthMeasurementEnabled, fieldNumber: 11) + } + if self.healthUpdateInterval != 0 { + try visitor.visitSingularUInt32Field(value: self.healthUpdateInterval, fieldNumber: 12) + } + if self.healthScreenEnabled != false { + try visitor.visitSingularBoolField(value: self.healthScreenEnabled, fieldNumber: 13) + } try unknownFields.traverse(visitor: &visitor) } @@ -2394,6 +2500,9 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me if lhs.powerMeasurementEnabled != rhs.powerMeasurementEnabled {return false} if lhs.powerUpdateInterval != rhs.powerUpdateInterval {return false} if lhs.powerScreenEnabled != rhs.powerScreenEnabled {return false} + if lhs.healthMeasurementEnabled != rhs.healthMeasurementEnabled {return false} + if lhs.healthUpdateInterval != rhs.healthUpdateInterval {return false} + if lhs.healthScreenEnabled != rhs.healthScreenEnabled {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift index dc1d6cce..ec5faaa4 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift @@ -144,6 +144,14 @@ public enum TelemetrySensorType: SwiftProtobuf.Enum { /// /// Custom I2C sensor implementation based on https://github.com/meshtastic/i2c-sensor case customSensor // = 29 + + /// + /// MAX30102 Pulse Oximeter and Heart-Rate Sensor + case max30102 // = 30 + + /// + /// MLX90614 non-contact IR temperature sensor. + case mlx90614 // = 31 case UNRECOGNIZED(Int) public init() { @@ -182,6 +190,8 @@ public enum TelemetrySensorType: SwiftProtobuf.Enum { case 27: self = .icm20948 case 28: self = .max17048 case 29: self = .customSensor + case 30: self = .max30102 + case 31: self = .mlx90614 default: self = .UNRECOGNIZED(rawValue) } } @@ -218,6 +228,8 @@ public enum TelemetrySensorType: SwiftProtobuf.Enum { case .icm20948: return 27 case .max17048: return 28 case .customSensor: return 29 + case .max30102: return 30 + case .mlx90614: return 31 case .UNRECOGNIZED(let i): return i } } @@ -259,6 +271,8 @@ extension TelemetrySensorType: CaseIterable { .icm20948, .max17048, .customSensor, + .max30102, + .mlx90614, ] } @@ -806,7 +820,7 @@ public struct LocalStats { public var numPacketsTx: UInt32 = 0 /// - /// Number of packets received good + /// Number of packets received (both good and bad) public var numPacketsRx: UInt32 = 0 /// @@ -821,11 +835,74 @@ public struct LocalStats { /// Number of nodes total public var numTotalNodes: UInt32 = 0 + /// + /// Number of received packets that were duplicates (due to multiple nodes relaying). + /// If this number is high, there are nodes in the mesh relaying packets when it's unnecessary, for example due to the ROUTER/REPEATER role. + public var numRxDupe: UInt32 = 0 + + /// + /// Number of packets we transmitted that were a relay for others (not originating from ourselves). + public var numTxRelay: UInt32 = 0 + + /// + /// Number of times we canceled a packet to be relayed, because someone else did it before us. + /// This will always be zero for ROUTERs/REPEATERs. If this number is high, some other node(s) is/are relaying faster than you. + public var numTxRelayCanceled: UInt32 = 0 + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} } +/// +/// Health telemetry metrics +public struct HealthMetrics { + // 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. + + /// + /// Heart rate (beats per minute) + public var heartBpm: UInt32 { + get {return _heartBpm ?? 0} + set {_heartBpm = newValue} + } + /// Returns true if `heartBpm` has been explicitly set. + public var hasHeartBpm: Bool {return self._heartBpm != nil} + /// Clears the value of `heartBpm`. Subsequent reads from it will return its default value. + public mutating func clearHeartBpm() {self._heartBpm = nil} + + /// + /// SpO2 (blood oxygen saturation) level + public var spO2: UInt32 { + get {return _spO2 ?? 0} + set {_spO2 = newValue} + } + /// Returns true if `spO2` has been explicitly set. + public var hasSpO2: Bool {return self._spO2 != nil} + /// Clears the value of `spO2`. Subsequent reads from it will return its default value. + public mutating func clearSpO2() {self._spO2 = nil} + + /// + /// Body temperature in degrees Celsius + public var temperature: Float { + get {return _temperature ?? 0} + set {_temperature = newValue} + } + /// Returns true if `temperature` has been explicitly set. + public var hasTemperature: Bool {return self._temperature != nil} + /// Clears the value of `temperature`. Subsequent reads from it will return its default value. + public mutating func clearTemperature() {self._temperature = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _heartBpm: UInt32? = nil + fileprivate var _spO2: UInt32? = nil + fileprivate var _temperature: Float? = nil +} + /// /// Types of Measurements the telemetry module is equipped to handle public struct Telemetry { @@ -889,6 +966,16 @@ public struct Telemetry { set {variant = .localStats(newValue)} } + /// + /// Health telemetry metrics + public var healthMetrics: HealthMetrics { + get { + if case .healthMetrics(let v)? = variant {return v} + return HealthMetrics() + } + set {variant = .healthMetrics(newValue)} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() public enum OneOf_Variant: Equatable { @@ -907,6 +994,9 @@ public struct Telemetry { /// /// Local device mesh statistics case localStats(LocalStats) + /// + /// Health telemetry metrics + case healthMetrics(HealthMetrics) #if !swift(>=4.1) public static func ==(lhs: Telemetry.OneOf_Variant, rhs: Telemetry.OneOf_Variant) -> Bool { @@ -934,6 +1024,10 @@ public struct Telemetry { guard case .localStats(let l) = lhs, case .localStats(let r) = rhs else { preconditionFailure() } return l == r }() + case (.healthMetrics, .healthMetrics): return { + guard case .healthMetrics(let l) = lhs, case .healthMetrics(let r) = rhs else { preconditionFailure() } + return l == r + }() default: return false } } @@ -970,6 +1064,7 @@ extension EnvironmentMetrics: @unchecked Sendable {} extension PowerMetrics: @unchecked Sendable {} extension AirQualityMetrics: @unchecked Sendable {} extension LocalStats: @unchecked Sendable {} +extension HealthMetrics: @unchecked Sendable {} extension Telemetry: @unchecked Sendable {} extension Telemetry.OneOf_Variant: @unchecked Sendable {} extension Nau7802Config: @unchecked Sendable {} @@ -1011,6 +1106,8 @@ extension TelemetrySensorType: SwiftProtobuf._ProtoNameProviding { 27: .same(proto: "ICM20948"), 28: .same(proto: "MAX17048"), 29: .same(proto: "CUSTOM_SENSOR"), + 30: .same(proto: "MAX30102"), + 31: .same(proto: "MLX90614"), ] } @@ -1457,6 +1554,9 @@ extension LocalStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio 6: .standard(proto: "num_packets_rx_bad"), 7: .standard(proto: "num_online_nodes"), 8: .standard(proto: "num_total_nodes"), + 9: .standard(proto: "num_rx_dupe"), + 10: .standard(proto: "num_tx_relay"), + 11: .standard(proto: "num_tx_relay_canceled"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -1473,6 +1573,9 @@ extension LocalStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio case 6: try { try decoder.decodeSingularUInt32Field(value: &self.numPacketsRxBad) }() case 7: try { try decoder.decodeSingularUInt32Field(value: &self.numOnlineNodes) }() case 8: try { try decoder.decodeSingularUInt32Field(value: &self.numTotalNodes) }() + case 9: try { try decoder.decodeSingularUInt32Field(value: &self.numRxDupe) }() + case 10: try { try decoder.decodeSingularUInt32Field(value: &self.numTxRelay) }() + case 11: try { try decoder.decodeSingularUInt32Field(value: &self.numTxRelayCanceled) }() default: break } } @@ -1503,6 +1606,15 @@ extension LocalStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio if self.numTotalNodes != 0 { try visitor.visitSingularUInt32Field(value: self.numTotalNodes, fieldNumber: 8) } + if self.numRxDupe != 0 { + try visitor.visitSingularUInt32Field(value: self.numRxDupe, fieldNumber: 9) + } + if self.numTxRelay != 0 { + try visitor.visitSingularUInt32Field(value: self.numTxRelay, fieldNumber: 10) + } + if self.numTxRelayCanceled != 0 { + try visitor.visitSingularUInt32Field(value: self.numTxRelayCanceled, fieldNumber: 11) + } try unknownFields.traverse(visitor: &visitor) } @@ -1515,6 +1627,57 @@ extension LocalStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio if lhs.numPacketsRxBad != rhs.numPacketsRxBad {return false} if lhs.numOnlineNodes != rhs.numOnlineNodes {return false} if lhs.numTotalNodes != rhs.numTotalNodes {return false} + if lhs.numRxDupe != rhs.numRxDupe {return false} + if lhs.numTxRelay != rhs.numTxRelay {return false} + if lhs.numTxRelayCanceled != rhs.numTxRelayCanceled {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension HealthMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".HealthMetrics" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "heart_bpm"), + 2: .same(proto: "spO2"), + 3: .same(proto: "temperature"), + ] + + public 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._heartBpm) }() + case 2: try { try decoder.decodeSingularUInt32Field(value: &self._spO2) }() + case 3: try { try decoder.decodeSingularFloatField(value: &self._temperature) }() + default: break + } + } + } + + public 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 + try { if let v = self._heartBpm { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 1) + } }() + try { if let v = self._spO2 { + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2) + } }() + try { if let v = self._temperature { + try visitor.visitSingularFloatField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: HealthMetrics, rhs: HealthMetrics) -> Bool { + if lhs._heartBpm != rhs._heartBpm {return false} + if lhs._spO2 != rhs._spO2 {return false} + if lhs._temperature != rhs._temperature {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } @@ -1529,6 +1692,7 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation 4: .standard(proto: "air_quality_metrics"), 5: .standard(proto: "power_metrics"), 6: .standard(proto: "local_stats"), + 7: .standard(proto: "health_metrics"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -1603,6 +1767,19 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation self.variant = .localStats(v) } }() + case 7: try { + var v: HealthMetrics? + var hadOneofValue = false + if let current = self.variant { + hadOneofValue = true + if case .healthMetrics(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.variant = .healthMetrics(v) + } + }() default: break } } @@ -1637,6 +1814,10 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation guard case .localStats(let v)? = self.variant else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 6) }() + case .healthMetrics?: try { + guard case .healthMetrics(let v)? = self.variant else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + }() case nil: break } try unknownFields.traverse(visitor: &visitor) diff --git a/protobufs b/protobufs index 5709c0a0..c9ae7fd4 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 5709c0a05eaefccbc9cb8ed3917adbf5fd134197 +Subproject commit c9ae7fd478bffe5f954b30de6cb140821fe9ff52