Meshtastic-Apple/MeshtasticClient/Protobufs/environmental_measurement.pb.swift

83 lines
3.2 KiB
Swift

// 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 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"),
]
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every case branch when no optimizations are
// enabled. https://github.com/apple/swift-protobuf/issues/1034
switch fieldNumber {
case 1: try { try decoder.decodeSingularFloatField(value: &self.temperature) }()
case 2: try { try decoder.decodeSingularFloatField(value: &self.relativeHumidity) }()
case 3: try { try decoder.decodeSingularFloatField(value: &self.barometricPressure) }()
default: break
}
}
}
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.temperature != 0 {
try visitor.visitSingularFloatField(value: self.temperature, fieldNumber: 1)
}
if self.relativeHumidity != 0 {
try visitor.visitSingularFloatField(value: self.relativeHumidity, fieldNumber: 2)
}
if self.barometricPressure != 0 {
try visitor.visitSingularFloatField(value: self.barometricPressure, fieldNumber: 3)
}
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.unknownFields != rhs.unknownFields {return false}
return true
}
}