Skip to content

Commit

Permalink
Updated protos
Browse files Browse the repository at this point in the history
  • Loading branch information
garthvh committed Jul 7, 2024
1 parent b89a88e commit 1e9d48c
Show file tree
Hide file tree
Showing 5 changed files with 376 additions and 4 deletions.
3 changes: 0 additions & 3 deletions MeshtasticProtobufs/Sources/meshtastic/config.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ public struct Config {
/// The wifi radio and the oled screen will be put to sleep.
/// This mode may still potentially have higher power usage due to it's preference in message rebroadcasting on the mesh.
case router // = 2

///
/// Description: Combination of both ROUTER and CLIENT. Not for mobile devices.
case routerClient // = 3

///
Expand Down
127 changes: 127 additions & 0 deletions MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,23 @@ public enum HardwareModel: SwiftProtobuf.Enum {
/// Heltec Capsule Sensor V3 with ESP32-S3 CPU, Portable LoRa device that can replace GNSS modules or sensors
case heltecCapsuleSensorV3 // = 65

///
/// Heltec Vision Master T190 with ESP32-S3 CPU, and a 1.90 inch TFT display
case heltecVisionMasterT190 // = 66

///
/// Heltec Vision Master E213 with ESP32-S3 CPU, and a 2.13 inch E-Ink display
case heltecVisionMasterE213 // = 67

///
/// Heltec Vision Master E290 with ESP32-S3 CPU, and a 2.9 inch E-Ink display
case heltecVisionMasterE290 // = 68

///
/// Heltec Mesh Node T114 board with nRF52840 CPU, and a 1.14 inch TFT display, Ultimate low-power design,
/// specifically adapted for the Meshtatic project
case heltecMeshNodeT114 // = 69

///
/// ------------------------------------------------------------------------------------------------------------------------------------------
/// 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.
Expand Down Expand Up @@ -382,6 +399,10 @@ public enum HardwareModel: SwiftProtobuf.Enum {
case 63: self = .nrf52PromicroDiy
case 64: self = .radiomaster900BanditNano
case 65: self = .heltecCapsuleSensorV3
case 66: self = .heltecVisionMasterT190
case 67: self = .heltecVisionMasterE213
case 68: self = .heltecVisionMasterE290
case 69: self = .heltecMeshNodeT114
case 255: self = .privateHw
default: self = .UNRECOGNIZED(rawValue)
}
Expand Down Expand Up @@ -454,6 +475,10 @@ public enum HardwareModel: SwiftProtobuf.Enum {
case .nrf52PromicroDiy: return 63
case .radiomaster900BanditNano: return 64
case .heltecCapsuleSensorV3: return 65
case .heltecVisionMasterT190: return 66
case .heltecVisionMasterE213: return 67
case .heltecVisionMasterE290: return 68
case .heltecMeshNodeT114: return 69
case .privateHw: return 255
case .UNRECOGNIZED(let i): return i
}
Expand Down Expand Up @@ -531,6 +556,10 @@ extension HardwareModel: CaseIterable {
.nrf52PromicroDiy,
.radiomaster900BanditNano,
.heltecCapsuleSensorV3,
.heltecVisionMasterT190,
.heltecVisionMasterE213,
.heltecVisionMasterE290,
.heltecMeshNodeT114,
.privateHw,
]
}
Expand Down Expand Up @@ -2286,6 +2315,16 @@ public struct FromRadio {
set {_uniqueStorage()._payloadVariant = .mqttClientProxyMessage(newValue)}
}

///
/// File system manifest messages
public var fileInfo: FileInfo {
get {
if case .fileInfo(let v)? = _storage._payloadVariant {return v}
return FileInfo()
}
set {_uniqueStorage()._payloadVariant = .fileInfo(newValue)}
}

public var unknownFields = SwiftProtobuf.UnknownStorage()

///
Expand Down Expand Up @@ -2338,6 +2377,9 @@ public struct FromRadio {
///
/// MQTT Client Proxy Message (device sending to client / phone for publishing to MQTT)
case mqttClientProxyMessage(MqttClientProxyMessage)
///
/// File system manifest messages
case fileInfo(FileInfo)

#if !swift(>=4.1)
public static func ==(lhs: FromRadio.OneOf_PayloadVariant, rhs: FromRadio.OneOf_PayloadVariant) -> Bool {
Expand Down Expand Up @@ -2397,6 +2439,10 @@ public struct FromRadio {
guard case .mqttClientProxyMessage(let l) = lhs, case .mqttClientProxyMessage(let r) = rhs else { preconditionFailure() }
return l == r
}()
case (.fileInfo, .fileInfo): return {
guard case .fileInfo(let l) = lhs, case .fileInfo(let r) = rhs else { preconditionFailure() }
return l == r
}()
default: return false
}
}
Expand All @@ -2408,6 +2454,26 @@ public struct FromRadio {
fileprivate var _storage = _StorageClass.defaultInstance
}

///
/// Individual File info for the device
public struct FileInfo {
// 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 fully qualified path of the file
public var fileName: String = String()

///
/// The size of the file in bytes
public var sizeBytes: UInt32 = 0

public var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
}

///
/// Packets/commands to the radio will be written (reliably) to the toRadio characteristic.
/// Once the write completes the phone can assume it is handled.
Expand Down Expand Up @@ -2879,6 +2945,7 @@ extension LogRecord.Level: @unchecked Sendable {}
extension QueueStatus: @unchecked Sendable {}
extension FromRadio: @unchecked Sendable {}
extension FromRadio.OneOf_PayloadVariant: @unchecked Sendable {}
extension FileInfo: @unchecked Sendable {}
extension ToRadio: @unchecked Sendable {}
extension ToRadio.OneOf_PayloadVariant: @unchecked Sendable {}
extension Compressed: @unchecked Sendable {}
Expand Down Expand Up @@ -2964,6 +3031,10 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding {
63: .same(proto: "NRF52_PROMICRO_DIY"),
64: .same(proto: "RADIOMASTER_900_BANDIT_NANO"),
65: .same(proto: "HELTEC_CAPSULE_SENSOR_V3"),
66: .same(proto: "HELTEC_VISION_MASTER_T190"),
67: .same(proto: "HELTEC_VISION_MASTER_E213"),
68: .same(proto: "HELTEC_VISION_MASTER_E290"),
69: .same(proto: "HELTEC_MESH_NODE_T114"),
255: .same(proto: "PRIVATE_HW"),
]
}
Expand Down Expand Up @@ -4229,6 +4300,7 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
12: .same(proto: "xmodemPacket"),
13: .same(proto: "metadata"),
14: .same(proto: "mqttClientProxyMessage"),
15: .same(proto: "fileInfo"),
]

fileprivate class _StorageClass {
Expand Down Expand Up @@ -4428,6 +4500,19 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
_storage._payloadVariant = .mqttClientProxyMessage(v)
}
}()
case 15: try {
var v: FileInfo?
var hadOneofValue = false
if let current = _storage._payloadVariant {
hadOneofValue = true
if case .fileInfo(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {
if hadOneofValue {try decoder.handleConflictingOneOf()}
_storage._payloadVariant = .fileInfo(v)
}
}()
default: break
}
}
Expand Down Expand Up @@ -4496,6 +4581,10 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
guard case .mqttClientProxyMessage(let v)? = _storage._payloadVariant else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 14)
}()
case .fileInfo?: try {
guard case .fileInfo(let v)? = _storage._payloadVariant else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 15)
}()
case nil: break
}
}
Expand All @@ -4518,6 +4607,44 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
}
}

extension FileInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".FileInfo"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "file_name"),
2: .standard(proto: "size_bytes"),
]

public 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.decodeSingularStringField(value: &self.fileName) }()
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.sizeBytes) }()
default: break
}
}
}

public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if !self.fileName.isEmpty {
try visitor.visitSingularStringField(value: self.fileName, fieldNumber: 1)
}
if self.sizeBytes != 0 {
try visitor.visitSingularUInt32Field(value: self.sizeBytes, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}

public static func ==(lhs: FileInfo, rhs: FileInfo) -> Bool {
if lhs.fileName != rhs.fileName {return false}
if lhs.sizeBytes != rhs.sizeBytes {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".ToRadio"
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
Expand Down
8 changes: 8 additions & 0 deletions MeshtasticProtobufs/Sources/meshtastic/portnums.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ public enum PortNum: SwiftProtobuf.Enum {
/// Provides unencrypted information about a node for consumption by a map via MQTT
case mapReportApp // = 73

///
/// PowerStress based monitoring support (for automated power consumption testing)
case powerstressApp // = 74

///
/// Private applications should use portnums >= 256.
/// To simplify initial development and testing you can use "PRIVATE_APP"
Expand Down Expand Up @@ -231,6 +235,7 @@ public enum PortNum: SwiftProtobuf.Enum {
case 71: self = .neighborinfoApp
case 72: self = .atakPlugin
case 73: self = .mapReportApp
case 74: self = .powerstressApp
case 256: self = .privateApp
case 257: self = .atakForwarder
case 511: self = .max
Expand Down Expand Up @@ -264,6 +269,7 @@ public enum PortNum: SwiftProtobuf.Enum {
case .neighborinfoApp: return 71
case .atakPlugin: return 72
case .mapReportApp: return 73
case .powerstressApp: return 74
case .privateApp: return 256
case .atakForwarder: return 257
case .max: return 511
Expand Down Expand Up @@ -302,6 +308,7 @@ extension PortNum: CaseIterable {
.neighborinfoApp,
.atakPlugin,
.mapReportApp,
.powerstressApp,
.privateApp,
.atakForwarder,
.max,
Expand Down Expand Up @@ -342,6 +349,7 @@ extension PortNum: SwiftProtobuf._ProtoNameProviding {
71: .same(proto: "NEIGHBORINFO_APP"),
72: .same(proto: "ATAK_PLUGIN"),
73: .same(proto: "MAP_REPORT_APP"),
74: .same(proto: "POWERSTRESS_APP"),
256: .same(proto: "PRIVATE_APP"),
257: .same(proto: "ATAK_FORWARDER"),
511: .same(proto: "MAX"),
Expand Down
Loading

0 comments on commit 1e9d48c

Please sign in to comment.