From b12067e7ef0f87e33167104218bc8567f279f4e2 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sat, 4 Feb 2023 11:02:43 -0800 Subject: [PATCH] Proto Submodule --- .gitmodules | 3 + Meshtastic.xcodeproj/project.pbxproj | 148 +- Meshtastic/Protobufs/admin.pb.swift | 1201 ------ Meshtastic/Protobufs/apponly.pb.swift | 102 - Meshtastic/Protobufs/cannedmessages.pb.swift | 75 - Meshtastic/Protobufs/channel.pb.swift | 326 -- Meshtastic/Protobufs/config.pb.swift | 2255 ---------- Meshtastic/Protobufs/device_metadata.pb.swift | 145 - Meshtastic/Protobufs/deviceonly.pb.swift | 508 --- Meshtastic/Protobufs/localonly.pb.swift | 510 --- Meshtastic/Protobufs/mesh.pb.swift | 3781 ----------------- Meshtastic/Protobufs/module_config.pb.swift | 1736 -------- Meshtastic/Protobufs/mqtt.pb.swift | 110 - Meshtastic/Protobufs/portnums.pb.swift | 278 -- Meshtastic/Protobufs/remote_hardware.pb.swift | 194 - Meshtastic/Protobufs/rtttl.pb.swift | 75 - Meshtastic/Protobufs/storeforward.pb.swift | 651 --- Meshtastic/Protobufs/telemetry.pb.swift | 496 --- Meshtastic/Protobufs/xmodem.pb.swift | 173 - gen_protos.sh | 26 +- 20 files changed, 87 insertions(+), 12706 deletions(-) create mode 100644 .gitmodules delete mode 100644 Meshtastic/Protobufs/admin.pb.swift delete mode 100644 Meshtastic/Protobufs/apponly.pb.swift delete mode 100644 Meshtastic/Protobufs/cannedmessages.pb.swift delete mode 100644 Meshtastic/Protobufs/channel.pb.swift delete mode 100644 Meshtastic/Protobufs/config.pb.swift delete mode 100644 Meshtastic/Protobufs/device_metadata.pb.swift delete mode 100644 Meshtastic/Protobufs/deviceonly.pb.swift delete mode 100644 Meshtastic/Protobufs/localonly.pb.swift delete mode 100644 Meshtastic/Protobufs/mesh.pb.swift delete mode 100644 Meshtastic/Protobufs/module_config.pb.swift delete mode 100644 Meshtastic/Protobufs/mqtt.pb.swift delete mode 100644 Meshtastic/Protobufs/portnums.pb.swift delete mode 100644 Meshtastic/Protobufs/remote_hardware.pb.swift delete mode 100644 Meshtastic/Protobufs/rtttl.pb.swift delete mode 100644 Meshtastic/Protobufs/storeforward.pb.swift delete mode 100644 Meshtastic/Protobufs/telemetry.pb.swift delete mode 100644 Meshtastic/Protobufs/xmodem.pb.swift diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..d155a849 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "protobufs"] + path = protobufs + url = http://github.com/meshtastic/protobufs diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index 60e70e47..8bcca6f1 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -11,9 +11,7 @@ C9697FA527933B8C00250207 /* SQLite in Frameworks */ = {isa = PBXBuildFile; productRef = C9697FA427933B8C00250207 /* SQLite */; }; C9A7BC1027759A9600760B50 /* PositionAnnotationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A7BC0F27759A9600760B50 /* PositionAnnotationView.swift */; }; C9A88B55278B503C00BD810A /* MapViewModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A88B54278B503C00BD810A /* MapViewModule.swift */; }; - C9A88B57278B559900BD810A /* apponly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A88B56278B559900BD810A /* apponly.pb.swift */; }; DD0F791B28713C8A00A6FDAD /* AdminMessageList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */; }; - DD17E5DE277D49D400010EC2 /* storeforward.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD17E5DC277D49D400010EC2 /* storeforward.pb.swift */; }; DD1925B728CDA5A400720036 /* CannedMessagesConfigEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD1925B628CDA5A400720036 /* CannedMessagesConfigEnums.swift */; }; DD1925B928CDA93900720036 /* SerialConfigEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD1925B828CDA93900720036 /* SerialConfigEnums.swift */; }; DD1BF2F92776FE2E008C8D2F /* UserMessageList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD1BF2F82776FE2E008C8D2F /* UserMessageList.swift */; }; @@ -23,8 +21,6 @@ DD2553592855B52700E55709 /* PositionConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2553582855B52700E55709 /* PositionConfig.swift */; }; DD2AD8A8296D2DF9001FF0E7 /* MapViewSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2AD8A7296D2DF9001FF0E7 /* MapViewSwiftUI.swift */; }; DD2E65262767A01F00E45FC5 /* NodeDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2E65252767A01F00E45FC5 /* NodeDetail.swift */; }; - DD2F145129787595009E4638 /* xmodem.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2F144F29787595009E4638 /* xmodem.pb.swift */; }; - DD2F145229787595009E4638 /* rtttl.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2F145029787595009E4638 /* rtttl.pb.swift */; }; DD3501892852FC3B000FC853 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3501882852FC3B000FC853 /* Settings.swift */; }; DD35018B2852FC79000FC853 /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD35018A2852FC79000FC853 /* UserSettings.swift */; }; DD3CC6B528E33FD100FA9159 /* ShareChannels.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3CC6B428E33FD100FA9159 /* ShareChannels.swift */; }; @@ -39,15 +35,30 @@ DD47E3CE26F103C600029299 /* NodeList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3CD26F103C600029299 /* NodeList.swift */; }; DD47E3D626F17ED900029299 /* CircleText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3D526F17ED900029299 /* CircleText.swift */; }; DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4A911D2708C65400501B7E /* AppSettings.swift */; }; - DD4C158C2824A91E0032668E /* module_config.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4C158B2824A91E0032668E /* module_config.pb.swift */; }; - DD4C158E2824AA7E0032668E /* config.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4C158D2824AA7E0032668E /* config.pb.swift */; }; - DD4DED9027AD2975004BA27E /* cannedmessages.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4DED8F27AD2975004BA27E /* cannedmessages.pb.swift */; }; DD4F23CD28779A3C001D37CB /* EnvironmentMetricsLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4F23CC28779A3C001D37CB /* EnvironmentMetricsLog.swift */; }; DD5394FC276993AD00AD86B1 /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = DD5394FB276993AD00AD86B1 /* SwiftProtobuf */; }; DD5394FE276BA0EF00AD86B1 /* PositionEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5394FD276BA0EF00AD86B1 /* PositionEntityExtension.swift */; }; DD539502276DAA6A00AD86B1 /* MapLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD539501276DAA6A00AD86B1 /* MapLocation.swift */; }; DD58C5F22919AD3C00D5BEFB /* ChannelEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD58C5F12919AD3C00D5BEFB /* ChannelEntityExtension.swift */; }; DD5D0A9C2931B9F200F7EA61 /* EthernetModes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5D0A9B2931B9F200F7EA61 /* EthernetModes.swift */; }; + DD5E5202298EE33B00D21B61 /* admin.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F0298EE33B00D21B61 /* admin.pb.swift */; }; + DD5E5203298EE33B00D21B61 /* config.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F1298EE33B00D21B61 /* config.pb.swift */; }; + DD5E5204298EE33B00D21B61 /* xmodem.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F2298EE33B00D21B61 /* xmodem.pb.swift */; }; + DD5E5205298EE33B00D21B61 /* mesh.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F3298EE33B00D21B61 /* mesh.pb.swift */; }; + DD5E5206298EE33B00D21B61 /* localonly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F4298EE33B00D21B61 /* localonly.pb.swift */; }; + DD5E5207298EE33B00D21B61 /* connection_status.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F5298EE33B00D21B61 /* connection_status.pb.swift */; }; + DD5E5208298EE33B00D21B61 /* rtttl.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F6298EE33B00D21B61 /* rtttl.pb.swift */; }; + DD5E5209298EE33B00D21B61 /* module_config.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F7298EE33B00D21B61 /* module_config.pb.swift */; }; + DD5E520A298EE33B00D21B61 /* channel.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F8298EE33B00D21B61 /* channel.pb.swift */; }; + DD5E520B298EE33B00D21B61 /* device_metadata.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51F9298EE33B00D21B61 /* device_metadata.pb.swift */; }; + DD5E520C298EE33B00D21B61 /* portnums.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51FA298EE33B00D21B61 /* portnums.pb.swift */; }; + DD5E520D298EE33B00D21B61 /* storeforward.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51FB298EE33B00D21B61 /* storeforward.pb.swift */; }; + DD5E520E298EE33B00D21B61 /* mqtt.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51FC298EE33B00D21B61 /* mqtt.pb.swift */; }; + DD5E520F298EE33B00D21B61 /* cannedmessages.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51FD298EE33B00D21B61 /* cannedmessages.pb.swift */; }; + DD5E5210298EE33B00D21B61 /* telemetry.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51FE298EE33B00D21B61 /* telemetry.pb.swift */; }; + DD5E5211298EE33B00D21B61 /* remote_hardware.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E51FF298EE33B00D21B61 /* remote_hardware.pb.swift */; }; + DD5E5212298EE33B00D21B61 /* apponly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E5200298EE33B00D21B61 /* apponly.pb.swift */; }; + DD5E5213298EE33B00D21B61 /* deviceonly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E5201298EE33B00D21B61 /* deviceonly.pb.swift */; }; DD6193752862F6E600E59241 /* ExternalNotificationConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193742862F6E600E59241 /* ExternalNotificationConfig.swift */; }; DD6193772862F90F00E59241 /* CannedMessagesConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193762862F90F00E59241 /* CannedMessagesConfig.swift */; }; DD6193792863875F00E59241 /* SerialConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193782863875F00E59241 /* SerialConfig.swift */; }; @@ -81,16 +92,7 @@ DDA6B2E928419CF2003E8C16 /* MeshPackets.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDA6B2E828419CF2003E8C16 /* MeshPackets.swift */; }; DDA6B2EB28420A7B003E8C16 /* NodeAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDA6B2EA28420A7B003E8C16 /* NodeAnnotation.swift */; }; DDAF8C5326EB1DF10058C060 /* BLEManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C5226EB1DF10058C060 /* BLEManager.swift */; }; - DDAF8C5826ED07FD0058C060 /* mesh.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C5726ED07FD0058C060 /* mesh.pb.swift */; }; - DDAF8C5D26ED09490058C060 /* portnums.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C5C26ED09490058C060 /* portnums.pb.swift */; }; - DDAF8C6226ED0A230058C060 /* mqtt.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6026ED0A230058C060 /* mqtt.pb.swift */; }; - DDAF8C6326ED0A230058C060 /* admin.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6126ED0A230058C060 /* admin.pb.swift */; }; - 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 */; }; DDAF8C6E26ED19040058C060 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C6D26ED19040058C060 /* Extensions.swift */; }; - DDB2CC6E27F3EB47009C5FCC /* telemetry.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB2CC6D27F3EB47009C5FCC /* telemetry.pb.swift */; }; - DDB3107228A6224100F1DE3D /* device_metadata.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB3107128A6224100F1DE3D /* device_metadata.pb.swift */; }; DDB6ABD628AE742000384BA1 /* BluetoothConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB6ABD528AE742000384BA1 /* BluetoothConfig.swift */; }; DDB6ABD928B0A4BA00384BA1 /* BluetoothModes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB6ABD828B0A4BA00384BA1 /* BluetoothModes.swift */; }; DDB6ABDB28B0AC6000384BA1 /* DistanceText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDB6ABDA28B0AC6000384BA1 /* DistanceText.swift */; }; @@ -108,7 +110,6 @@ DDC4D568275499A500A4208E /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC4D567275499A500A4208E /* Persistence.swift */; }; DDCDC6CB29481FCC004C1DDA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DDCDC6CD29481FCC004C1DDA /* Localizable.strings */; }; DDCE4E2C2869F92900BE9F8F /* UserConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE4E2B2869F92900BE9F8F /* UserConfig.swift */; }; - DDCFF601285453A7005FA625 /* localonly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCFF600285453A7005FA625 /* localonly.pb.swift */; }; DDD3BBD5292D763200D609B3 /* MeshtasticTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD3BBD4292D763200D609B3 /* MeshtasticTests.swift */; }; DDD94A502845C8F5004A87A0 /* DateTimeText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */; }; DDD9E4E4284B208E003777C5 /* UserEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD9E4E3284B208E003777C5 /* UserEntityExtension.swift */; }; @@ -138,9 +139,7 @@ C9697F9C279336B700250207 /* LocalMBTileOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalMBTileOverlay.swift; sourceTree = ""; }; C9A7BC0F27759A9600760B50 /* PositionAnnotationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionAnnotationView.swift; sourceTree = ""; }; C9A88B54278B503C00BD810A /* MapViewModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapViewModule.swift; sourceTree = ""; }; - C9A88B56278B559900BD810A /* apponly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = apponly.pb.swift; sourceTree = ""; }; DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminMessageList.swift; sourceTree = ""; }; - DD17E5DC277D49D400010EC2 /* storeforward.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = storeforward.pb.swift; sourceTree = ""; }; DD1925B628CDA5A400720036 /* CannedMessagesConfigEnums.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CannedMessagesConfigEnums.swift; sourceTree = ""; }; DD1925B828CDA93900720036 /* SerialConfigEnums.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SerialConfigEnums.swift; sourceTree = ""; }; DD1BF2F82776FE2E008C8D2F /* UserMessageList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserMessageList.swift; sourceTree = ""; }; @@ -150,8 +149,6 @@ DD2553582855B52700E55709 /* PositionConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionConfig.swift; sourceTree = ""; }; DD2AD8A7296D2DF9001FF0E7 /* MapViewSwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapViewSwiftUI.swift; sourceTree = ""; }; DD2E65252767A01F00E45FC5 /* NodeDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeDetail.swift; sourceTree = ""; }; - DD2F144F29787595009E4638 /* xmodem.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = xmodem.pb.swift; sourceTree = ""; }; - DD2F145029787595009E4638 /* rtttl.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = rtttl.pb.swift; sourceTree = ""; }; DD3501882852FC3B000FC853 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; DD35018A2852FC79000FC853 /* UserSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = ""; }; DD3CC6B428E33FD100FA9159 /* ShareChannels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareChannels.swift; sourceTree = ""; }; @@ -167,9 +164,6 @@ DD47E3CD26F103C600029299 /* NodeList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeList.swift; sourceTree = ""; }; DD47E3D526F17ED900029299 /* CircleText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleText.swift; sourceTree = ""; }; DD4A911D2708C65400501B7E /* AppSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSettings.swift; sourceTree = ""; }; - DD4C158B2824A91E0032668E /* module_config.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = module_config.pb.swift; sourceTree = ""; }; - DD4C158D2824AA7E0032668E /* config.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = config.pb.swift; sourceTree = ""; }; - DD4DED8F27AD2975004BA27E /* cannedmessages.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = cannedmessages.pb.swift; sourceTree = ""; }; DD4F23CC28779A3C001D37CB /* EnvironmentMetricsLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentMetricsLog.swift; sourceTree = ""; }; DD5394FD276BA0EF00AD86B1 /* PositionEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionEntityExtension.swift; sourceTree = ""; }; DD539501276DAA6A00AD86B1 /* MapLocation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapLocation.swift; sourceTree = ""; }; @@ -177,6 +171,24 @@ DD5D0A9A2931AD6B00F7EA61 /* MeshtasticDataModelV2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV2.xcdatamodel; sourceTree = ""; }; DD5D0A9B2931B9F200F7EA61 /* EthernetModes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthernetModes.swift; sourceTree = ""; }; DD5E51CC2986643400D21B61 /* MeshtasticDataModelV7.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV7.xcdatamodel; sourceTree = ""; }; + DD5E51F0298EE33B00D21B61 /* admin.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = admin.pb.swift; sourceTree = ""; }; + DD5E51F1298EE33B00D21B61 /* config.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = config.pb.swift; sourceTree = ""; }; + DD5E51F2298EE33B00D21B61 /* xmodem.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = xmodem.pb.swift; sourceTree = ""; }; + DD5E51F3298EE33B00D21B61 /* mesh.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mesh.pb.swift; sourceTree = ""; }; + DD5E51F4298EE33B00D21B61 /* localonly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = localonly.pb.swift; sourceTree = ""; }; + DD5E51F5298EE33B00D21B61 /* connection_status.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = connection_status.pb.swift; sourceTree = ""; }; + DD5E51F6298EE33B00D21B61 /* rtttl.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = rtttl.pb.swift; sourceTree = ""; }; + DD5E51F7298EE33B00D21B61 /* module_config.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = module_config.pb.swift; sourceTree = ""; }; + DD5E51F8298EE33B00D21B61 /* channel.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = channel.pb.swift; sourceTree = ""; }; + DD5E51F9298EE33B00D21B61 /* device_metadata.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = device_metadata.pb.swift; sourceTree = ""; }; + DD5E51FA298EE33B00D21B61 /* portnums.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = portnums.pb.swift; sourceTree = ""; }; + DD5E51FB298EE33B00D21B61 /* storeforward.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = storeforward.pb.swift; sourceTree = ""; }; + DD5E51FC298EE33B00D21B61 /* mqtt.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mqtt.pb.swift; sourceTree = ""; }; + DD5E51FD298EE33B00D21B61 /* cannedmessages.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = cannedmessages.pb.swift; sourceTree = ""; }; + DD5E51FE298EE33B00D21B61 /* telemetry.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = telemetry.pb.swift; sourceTree = ""; }; + DD5E51FF298EE33B00D21B61 /* remote_hardware.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = remote_hardware.pb.swift; sourceTree = ""; }; + DD5E5200298EE33B00D21B61 /* apponly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = apponly.pb.swift; sourceTree = ""; }; + DD5E5201298EE33B00D21B61 /* deviceonly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = deviceonly.pb.swift; sourceTree = ""; }; DD6193742862F6E600E59241 /* ExternalNotificationConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalNotificationConfig.swift; sourceTree = ""; }; DD6193762862F90F00E59241 /* CannedMessagesConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CannedMessagesConfig.swift; sourceTree = ""; }; DD6193782863875F00E59241 /* SerialConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SerialConfig.swift; sourceTree = ""; }; @@ -212,16 +224,7 @@ DDA6B2E828419CF2003E8C16 /* MeshPackets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshPackets.swift; sourceTree = ""; }; DDA6B2EA28420A7B003E8C16 /* NodeAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeAnnotation.swift; sourceTree = ""; }; DDAF8C5226EB1DF10058C060 /* BLEManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLEManager.swift; sourceTree = ""; }; - DDAF8C5726ED07FD0058C060 /* mesh.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mesh.pb.swift; sourceTree = ""; }; - DDAF8C5C26ED09490058C060 /* portnums.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = portnums.pb.swift; sourceTree = ""; }; - DDAF8C6026ED0A230058C060 /* mqtt.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mqtt.pb.swift; sourceTree = ""; }; - DDAF8C6126ED0A230058C060 /* admin.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = admin.pb.swift; sourceTree = ""; }; - 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 = ""; }; 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 = ""; }; - DDB3107128A6224100F1DE3D /* device_metadata.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = device_metadata.pb.swift; sourceTree = ""; }; DDB6ABD528AE742000384BA1 /* BluetoothConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BluetoothConfig.swift; sourceTree = ""; }; DDB6ABD828B0A4BA00384BA1 /* BluetoothModes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BluetoothModes.swift; sourceTree = ""; }; DDB6ABDA28B0AC6000384BA1 /* DistanceText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DistanceText.swift; sourceTree = ""; }; @@ -247,7 +250,6 @@ DDCDC6CC29481FCC004C1DDA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; DDCDC6CE294821AD004C1DDA /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; DDCE4E2B2869F92900BE9F8F /* UserConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserConfig.swift; sourceTree = ""; }; - DDCFF600285453A7005FA625 /* localonly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = localonly.pb.swift; sourceTree = ""; }; DDD3BBD4292D763200D609B3 /* MeshtasticTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeshtasticTests.swift; sourceTree = ""; }; DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTimeText.swift; sourceTree = ""; }; DDD9E4E3284B208E003777C5 /* UserEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserEntityExtension.swift; sourceTree = ""; }; @@ -343,6 +345,31 @@ path = Settings; sourceTree = ""; }; + DD5E51EF298EE33B00D21B61 /* meshtastic */ = { + isa = PBXGroup; + children = ( + DD5E51F0298EE33B00D21B61 /* admin.pb.swift */, + DD5E51F1298EE33B00D21B61 /* config.pb.swift */, + DD5E51F2298EE33B00D21B61 /* xmodem.pb.swift */, + DD5E51F3298EE33B00D21B61 /* mesh.pb.swift */, + DD5E51F4298EE33B00D21B61 /* localonly.pb.swift */, + DD5E51F5298EE33B00D21B61 /* connection_status.pb.swift */, + DD5E51F6298EE33B00D21B61 /* rtttl.pb.swift */, + DD5E51F7298EE33B00D21B61 /* module_config.pb.swift */, + DD5E51F8298EE33B00D21B61 /* channel.pb.swift */, + DD5E51F9298EE33B00D21B61 /* device_metadata.pb.swift */, + DD5E51FA298EE33B00D21B61 /* portnums.pb.swift */, + DD5E51FB298EE33B00D21B61 /* storeforward.pb.swift */, + DD5E51FC298EE33B00D21B61 /* mqtt.pb.swift */, + DD5E51FD298EE33B00D21B61 /* cannedmessages.pb.swift */, + DD5E51FE298EE33B00D21B61 /* telemetry.pb.swift */, + DD5E51FF298EE33B00D21B61 /* remote_hardware.pb.swift */, + DD5E5200298EE33B00D21B61 /* apponly.pb.swift */, + DD5E5201298EE33B00D21B61 /* deviceonly.pb.swift */, + ); + path = meshtastic; + sourceTree = ""; + }; DD61937A2863876A00E59241 /* Config */ = { isa = PBXGroup; children = ( @@ -410,23 +437,7 @@ DDAF8C5626ED07740058C060 /* Protobufs */ = { isa = PBXGroup; children = ( - DDAF8C6126ED0A230058C060 /* admin.pb.swift */, - C9A88B56278B559900BD810A /* apponly.pb.swift */, - DD4DED8F27AD2975004BA27E /* cannedmessages.pb.swift */, - DDAF8C6426ED0A490058C060 /* channel.pb.swift */, - DD4C158D2824AA7E0032668E /* config.pb.swift */, - DDAF8C6826ED0D070058C060 /* deviceonly.pb.swift */, - DDB3107128A6224100F1DE3D /* device_metadata.pb.swift */, - DDCFF600285453A7005FA625 /* localonly.pb.swift */, - DDAF8C5726ED07FD0058C060 /* mesh.pb.swift */, - DD4C158B2824A91E0032668E /* module_config.pb.swift */, - DDAF8C6026ED0A230058C060 /* mqtt.pb.swift */, - DDAF8C5C26ED09490058C060 /* portnums.pb.swift */, - DDAF8C6626ED0C8C0058C060 /* remote_hardware.pb.swift */, - DD2F145029787595009E4638 /* rtttl.pb.swift */, - DD17E5DC277D49D400010EC2 /* storeforward.pb.swift */, - DDB2CC6D27F3EB47009C5FCC /* telemetry.pb.swift */, - DD2F144F29787595009E4638 /* xmodem.pb.swift */, + DD5E51EF298EE33B00D21B61 /* meshtastic */, ); path = Protobufs; sourceTree = ""; @@ -749,21 +760,19 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - DD4DED9027AD2975004BA27E /* cannedmessages.pb.swift in Sources */, + DD5E520C298EE33B00D21B61 /* portnums.pb.swift in Sources */, DD457188293C7E63000C49FB /* SignalStrengthIndicator.swift in Sources */, - DDCFF601285453A7005FA625 /* localonly.pb.swift in Sources */, DD836AE726F6B38600ABCC23 /* Connect.swift in Sources */, DDAF8C6E26ED19040058C060 /* Extensions.swift in Sources */, DD964FBF296E76EF007C176F /* WaypointFormView.swift in Sources */, DD3501892852FC3B000FC853 /* Settings.swift in Sources */, DD5D0A9C2931B9F200F7EA61 /* EthernetModes.swift in Sources */, + DD5E5203298EE33B00D21B61 /* config.pb.swift in Sources */, DD798B072915928D005217CD /* ChannelMessageList.swift in Sources */, DDA6B2EB28420A7B003E8C16 /* NodeAnnotation.swift in Sources */, DDC2E1A726CEB3400042C5E4 /* LocationHelper.swift in Sources */, DD5394FE276BA0EF00AD86B1 /* PositionEntityExtension.swift in Sources */, DD913639270DFF4C00D7ACF3 /* LocalNotificationManager.swift in Sources */, - DD2F145129787595009E4638 /* xmodem.pb.swift in Sources */, - DD4C158C2824A91E0032668E /* module_config.pb.swift in Sources */, DD4F23CD28779A3C001D37CB /* EnvironmentMetricsLog.swift in Sources */, DDB6ABD628AE742000384BA1 /* BluetoothConfig.swift in Sources */, DD769E0328D18BF1001A3F05 /* DeviceMetricsLog.swift in Sources */, @@ -773,52 +782,53 @@ DD964FBD296E6B01007C176F /* EmojiOnlyTextField.swift in Sources */, DD8169FF272476C700F4AB02 /* LogDocument.swift in Sources */, DD2AD8A8296D2DF9001FF0E7 /* MapViewSwiftUI.swift in Sources */, + DD5E5213298EE33B00D21B61 /* deviceonly.pb.swift in Sources */, + DD5E5208298EE33B00D21B61 /* rtttl.pb.swift in Sources */, DD6193792863875F00E59241 /* SerialConfig.swift in Sources */, DDA0B6B2294CDC55001356EC /* Channels.swift in Sources */, - DDAF8C6926ED0D070058C060 /* deviceonly.pb.swift in Sources */, DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */, + DD5E5209298EE33B00D21B61 /* module_config.pb.swift in Sources */, DD35018B2852FC79000FC853 /* UserSettings.swift in Sources */, DD2160AF28C5552500C17253 /* MQTTConfig.swift in Sources */, - DDAF8C6226ED0A230058C060 /* mqtt.pb.swift in Sources */, + DD5E520F298EE33B00D21B61 /* cannedmessages.pb.swift in Sources */, DDF924CA26FBB953009FE055 /* ConnectedDevice.swift in Sources */, - DDAF8C5D26ED09490058C060 /* portnums.pb.swift in Sources */, DD3CC6BE28E4CD9800FA9159 /* BatteryGauge.swift in Sources */, DD6193772862F90F00E59241 /* CannedMessagesConfig.swift in Sources */, DD41582628582E9B009B0E59 /* DeviceConfig.swift in Sources */, DD3CC6B528E33FD100FA9159 /* ShareChannels.swift in Sources */, DD1BF2F92776FE2E008C8D2F /* UserMessageList.swift in Sources */, + DD5E5207298EE33B00D21B61 /* connection_status.pb.swift in Sources */, DD3CC6C228EB9D4900FA9159 /* UpdateCoreData.swift in Sources */, DDE0F7C5295F77B700B8AAB3 /* AppSettingsEnums.swift in Sources */, DDB6ABE628B1406100384BA1 /* LoraConfigEnums.swift in Sources */, - DDB2CC6E27F3EB47009C5FCC /* telemetry.pb.swift in Sources */, DD23A50F26FD1B4400D9B90C /* PeripheralModel.swift in Sources */, DDB6ABDB28B0AC6000384BA1 /* DistanceText.swift in Sources */, + DD5E520D298EE33B00D21B61 /* storeforward.pb.swift in Sources */, C9A7BC1027759A9600760B50 /* PositionAnnotationView.swift in Sources */, DD882F5D2772E4640005BF05 /* Contacts.swift in Sources */, DD964FC2297272AE007C176F /* WaypointEntityExtension.swift in Sources */, DD47E3CE26F103C600029299 /* NodeList.swift in Sources */, + DD5E520A298EE33B00D21B61 /* channel.pb.swift in Sources */, DD8EBF43285058FA00426DCA /* DisplayConfig.swift in Sources */, DD964FC42974767D007C176F /* MapViewFitExtension.swift in Sources */, DD47E3D626F17ED900029299 /* CircleText.swift in Sources */, DDC2E18F26CE25FE0042C5E4 /* ContentView.swift in Sources */, - DD17E5DE277D49D400010EC2 /* storeforward.pb.swift in Sources */, DD2553572855B02500E55709 /* LoRaConfig.swift in Sources */, DDB6ABD928B0A4BA00384BA1 /* BluetoothModes.swift in Sources */, DDD9E4E4284B208E003777C5 /* UserEntityExtension.swift in Sources */, C9A88B55278B503C00BD810A /* MapViewModule.swift in Sources */, DD2553592855B52700E55709 /* PositionConfig.swift in Sources */, - DDB3107228A6224100F1DE3D /* device_metadata.pb.swift in Sources */, - DDAF8C6326ED0A230058C060 /* admin.pb.swift in Sources */, DD97E96828EFE9A00056DDA4 /* About.swift in Sources */, DDB6ABE028B13AC700384BA1 /* DeviceRoles.swift in Sources */, DD86D40C287F401000BAEB7A /* SaveChannelQRCode.swift in Sources */, DDA1C48E28DB49D3009933EC /* ChannelRoles.swift in Sources */, DD8ED9C8289CE4B900B3B0AB /* RoutingError.swift in Sources */, - DDAF8C5826ED07FD0058C060 /* mesh.pb.swift in Sources */, + DD5E5202298EE33B00D21B61 /* admin.pb.swift in Sources */, DD964FC62975DBFD007C176F /* QueryCoreData.swift in Sources */, DD8169FB271F1F3A00F4AB02 /* MeshLog.swift in Sources */, DD8ED9C52898D51F00B3B0AB /* NetworkConfig.swift in Sources */, DDC3B274283F411B00AC321C /* LastHeardText.swift in Sources */, + DD5E520B298EE33B00D21B61 /* device_metadata.pb.swift in Sources */, DD2E65262767A01F00E45FC5 /* NodeDetail.swift in Sources */, DD1925B928CDA93900720036 /* SerialConfigEnums.swift in Sources */, DD86D4112881D16900BAEB7A /* WriteCsvFile.swift in Sources */, @@ -829,25 +839,27 @@ DDB6ABE428B13FFF00384BA1 /* DisplayEnums.swift in Sources */, DD86D40A287F04F100BAEB7A /* InvalidVersion.swift in Sources */, DDD94A502845C8F5004A87A0 /* DateTimeText.swift in Sources */, - C9A88B57278B559900BD810A /* apponly.pb.swift in Sources */, - DD4C158E2824AA7E0032668E /* config.pb.swift in Sources */, + DD5E5212298EE33B00D21B61 /* apponly.pb.swift in Sources */, DDB6ABE228B13FB500384BA1 /* PositionConfigEnums.swift in Sources */, + DD5E520E298EE33B00D21B61 /* mqtt.pb.swift in Sources */, DD994B69295F88B60013760A /* IntervalEnums.swift in Sources */, DD415828285859C4009B0E59 /* TelemetryConfig.swift in Sources */, DD73FD1128750779000852D6 /* PositionLog.swift in Sources */, + DD5E5206298EE33B00D21B61 /* localonly.pb.swift in Sources */, DD3CC6C028E7A60700FA9159 /* MessagingEnums.swift in Sources */, DD97E96628EFD9820056DDA4 /* MeshtasticLogo.swift in Sources */, C9697F9D279336B700250207 /* LocalMBTileOverlay.swift in Sources */, DD58C5F22919AD3C00D5BEFB /* ChannelEntityExtension.swift in Sources */, DD0F791B28713C8A00A6FDAD /* AdminMessageList.swift in Sources */, - DD2F145229787595009E4638 /* rtttl.pb.swift in Sources */, DD3CC6BC28E366DF00FA9159 /* Meshtastic.xcdatamodeld in Sources */, + DD5E5210298EE33B00D21B61 /* telemetry.pb.swift in Sources */, + DD5E5205298EE33B00D21B61 /* mesh.pb.swift in Sources */, DD8169F9271F1A6100F4AB02 /* MeshLogger.swift in Sources */, DD539502276DAA6A00AD86B1 /* MapLocation.swift in Sources */, DD41582A28585C32009B0E59 /* RangeTestConfig.swift in Sources */, - DDAF8C6726ED0C8C0058C060 /* remote_hardware.pb.swift in Sources */, DD1925B728CDA5A400720036 /* CannedMessagesConfigEnums.swift in Sources */, - DDAF8C6526ED0A490058C060 /* channel.pb.swift in Sources */, + DD5E5211298EE33B00D21B61 /* remote_hardware.pb.swift in Sources */, + DD5E5204298EE33B00D21B61 /* xmodem.pb.swift in Sources */, DDC2E15826CE248E0042C5E4 /* MeshtasticApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Meshtastic/Protobufs/admin.pb.swift b/Meshtastic/Protobufs/admin.pb.swift deleted file mode 100644 index 9d108cd5..00000000 --- a/Meshtastic/Protobufs/admin.pb.swift +++ /dev/null @@ -1,1201 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: admin.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 -} - -/// -/// 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 { - // 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 payloadVariant: AdminMessage.OneOf_PayloadVariant? = nil - - /// - /// 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) - var getChannelRequest: UInt32 { - get { - if case .getChannelRequest(let v)? = payloadVariant {return v} - return 0 - } - set {payloadVariant = .getChannelRequest(newValue)} - } - - /// - /// TODO: REPLACE - var getChannelResponse: Channel { - get { - if case .getChannelResponse(let v)? = payloadVariant {return v} - return Channel() - } - set {payloadVariant = .getChannelResponse(newValue)} - } - - /// - /// Send the current owner data in the response to this message. - var getOwnerRequest: Bool { - get { - if case .getOwnerRequest(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .getOwnerRequest(newValue)} - } - - /// - /// TODO: REPLACE - var getOwnerResponse: User { - get { - if case .getOwnerResponse(let v)? = payloadVariant {return v} - return User() - } - set {payloadVariant = .getOwnerResponse(newValue)} - } - - /// - /// Ask for the following config data to be sent - var getConfigRequest: AdminMessage.ConfigType { - get { - if case .getConfigRequest(let v)? = payloadVariant {return v} - return .deviceConfig - } - set {payloadVariant = .getConfigRequest(newValue)} - } - - /// - /// Send the current Config in the response to this message. - var getConfigResponse: Config { - get { - if case .getConfigResponse(let v)? = payloadVariant {return v} - return Config() - } - set {payloadVariant = .getConfigResponse(newValue)} - } - - /// - /// Ask for the following config data to be sent - var getModuleConfigRequest: AdminMessage.ModuleConfigType { - get { - if case .getModuleConfigRequest(let v)? = payloadVariant {return v} - return .mqttConfig - } - set {payloadVariant = .getModuleConfigRequest(newValue)} - } - - /// - /// Send the current Config in the response to this message. - var getModuleConfigResponse: ModuleConfig { - get { - if case .getModuleConfigResponse(let v)? = payloadVariant {return v} - return ModuleConfig() - } - set {payloadVariant = .getModuleConfigResponse(newValue)} - } - - /// - /// Get the Canned Message Module messages in the response to this message. - var getCannedMessageModuleMessagesRequest: Bool { - get { - if case .getCannedMessageModuleMessagesRequest(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .getCannedMessageModuleMessagesRequest(newValue)} - } - - /// - /// Get the Canned Message Module messages in the response to this message. - var getCannedMessageModuleMessagesResponse: String { - get { - if case .getCannedMessageModuleMessagesResponse(let v)? = payloadVariant {return v} - return String() - } - set {payloadVariant = .getCannedMessageModuleMessagesResponse(newValue)} - } - - /// - /// Request the node to send device metadata (firmware, protobuf version, etc) - var getDeviceMetadataRequest: Bool { - get { - if case .getDeviceMetadataRequest(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .getDeviceMetadataRequest(newValue)} - } - - /// - /// Device metadata response - var getDeviceMetadataResponse: DeviceMetadata { - get { - if case .getDeviceMetadataResponse(let v)? = payloadVariant {return v} - return DeviceMetadata() - } - set {payloadVariant = .getDeviceMetadataResponse(newValue)} - } - - /// - /// Get the Ringtone in the response to this message. - var getRingtoneRequest: Bool { - get { - if case .getRingtoneRequest(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .getRingtoneRequest(newValue)} - } - - /// - /// Get the Ringtone in the response to this message. - var getRingtoneResponse: String { - get { - if case .getRingtoneResponse(let v)? = payloadVariant {return v} - return String() - } - set {payloadVariant = .getRingtoneResponse(newValue)} - } - - /// - /// Set the owner for this node - var setOwner: User { - get { - if case .setOwner(let v)? = payloadVariant {return v} - return User() - } - set {payloadVariant = .setOwner(newValue)} - } - - /// - /// Set channels (using the new API). - /// A special channel is the "primary channel". - /// The other records are secondary channels. - /// Note: only one channel can be marked as primary. - /// If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. - var setChannel: Channel { - get { - if case .setChannel(let v)? = payloadVariant {return v} - return Channel() - } - set {payloadVariant = .setChannel(newValue)} - } - - /// - /// Set the current Config - var setConfig: Config { - get { - if case .setConfig(let v)? = payloadVariant {return v} - return Config() - } - set {payloadVariant = .setConfig(newValue)} - } - - /// - /// Set the current Config - var setModuleConfig: ModuleConfig { - get { - if case .setModuleConfig(let v)? = payloadVariant {return v} - return ModuleConfig() - } - set {payloadVariant = .setModuleConfig(newValue)} - } - - /// - /// Set the Canned Message Module messages text. - var setCannedMessageModuleMessages: String { - get { - if case .setCannedMessageModuleMessages(let v)? = payloadVariant {return v} - return String() - } - set {payloadVariant = .setCannedMessageModuleMessages(newValue)} - } - - /// - /// Set the ringtone for ExternalNotification. - var setRingtoneMessage: String { - get { - if case .setRingtoneMessage(let v)? = payloadVariant {return v} - return String() - } - set {payloadVariant = .setRingtoneMessage(newValue)} - } - - /// - /// Begins an edit transaction for config, module config, owner, and channel settings changes - /// This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings) - var beginEditSettings: Bool { - get { - if case .beginEditSettings(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .beginEditSettings(newValue)} - } - - /// - /// Commits an open transaction for any edits made to config, module config, owner, and channel settings - var commitEditSettings: Bool { - get { - if case .commitEditSettings(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .commitEditSettings(newValue)} - } - - /// - /// Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot) - /// Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth. - var rebootOtaSeconds: Int32 { - get { - if case .rebootOtaSeconds(let v)? = payloadVariant {return v} - return 0 - } - set {payloadVariant = .rebootOtaSeconds(newValue)} - } - - /// - /// This message is only supported for the simulator porduino build. - /// If received the simulator will exit successfully. - var exitSimulator: Bool { - get { - if case .exitSimulator(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .exitSimulator(newValue)} - } - - /// - /// Tell the node to reboot in this many seconds (or <0 to cancel reboot) - var rebootSeconds: Int32 { - get { - if case .rebootSeconds(let v)? = payloadVariant {return v} - return 0 - } - set {payloadVariant = .rebootSeconds(newValue)} - } - - /// - /// Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) - var shutdownSeconds: Int32 { - get { - if case .shutdownSeconds(let v)? = payloadVariant {return v} - return 0 - } - set {payloadVariant = .shutdownSeconds(newValue)} - } - - /// - /// Tell the node to factory reset, all device settings will be returned to factory defaults. - var factoryReset: Int32 { - get { - if case .factoryReset(let v)? = payloadVariant {return v} - return 0 - } - set {payloadVariant = .factoryReset(newValue)} - } - - /// - /// Tell the node to reset the nodedb. - var nodedbReset: Int32 { - get { - if case .nodedbReset(let v)? = payloadVariant {return v} - return 0 - } - set {payloadVariant = .nodedbReset(newValue)} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// TODO: REPLACE - enum OneOf_PayloadVariant: Equatable { - /// - /// 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) - /// - /// Ask for the following config data to be sent - case getConfigRequest(AdminMessage.ConfigType) - /// - /// Send the current Config in the response to this message. - case getConfigResponse(Config) - /// - /// Ask for the following config data to be sent - case getModuleConfigRequest(AdminMessage.ModuleConfigType) - /// - /// Send the current Config in the response to this message. - case getModuleConfigResponse(ModuleConfig) - /// - /// Get the Canned Message Module messages in the response to this message. - case getCannedMessageModuleMessagesRequest(Bool) - /// - /// Get the Canned Message Module messages in the response to this message. - case getCannedMessageModuleMessagesResponse(String) - /// - /// Request the node to send device metadata (firmware, protobuf version, etc) - case getDeviceMetadataRequest(Bool) - /// - /// Device metadata response - case getDeviceMetadataResponse(DeviceMetadata) - /// - /// Get the Ringtone in the response to this message. - case getRingtoneRequest(Bool) - /// - /// Get the Ringtone in the response to this message. - case getRingtoneResponse(String) - /// - /// Set the owner for this node - case setOwner(User) - /// - /// Set channels (using the new API). - /// A special channel is the "primary channel". - /// The other records are secondary channels. - /// Note: only one channel can be marked as primary. - /// If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. - case setChannel(Channel) - /// - /// Set the current Config - case setConfig(Config) - /// - /// Set the current Config - case setModuleConfig(ModuleConfig) - /// - /// Set the Canned Message Module messages text. - case setCannedMessageModuleMessages(String) - /// - /// Set the ringtone for ExternalNotification. - case setRingtoneMessage(String) - /// - /// Begins an edit transaction for config, module config, owner, and channel settings changes - /// This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings) - case beginEditSettings(Bool) - /// - /// Commits an open transaction for any edits made to config, module config, owner, and channel settings - case commitEditSettings(Bool) - /// - /// Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot) - /// Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth. - case rebootOtaSeconds(Int32) - /// - /// This message is only supported for the simulator porduino build. - /// If received the simulator will exit successfully. - case exitSimulator(Bool) - /// - /// Tell the node to reboot in this many seconds (or <0 to cancel reboot) - case rebootSeconds(Int32) - /// - /// Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) - case shutdownSeconds(Int32) - /// - /// Tell the node to factory reset, all device settings will be returned to factory defaults. - case factoryReset(Int32) - /// - /// Tell the node to reset the nodedb. - case nodedbReset(Int32) - - #if !swift(>=4.1) - static func ==(lhs: AdminMessage.OneOf_PayloadVariant, rhs: AdminMessage.OneOf_PayloadVariant) -> 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 (.getChannelRequest, .getChannelRequest): return { - guard case .getChannelRequest(let l) = lhs, case .getChannelRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getChannelResponse, .getChannelResponse): return { - guard case .getChannelResponse(let l) = lhs, case .getChannelResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getOwnerRequest, .getOwnerRequest): return { - guard case .getOwnerRequest(let l) = lhs, case .getOwnerRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getOwnerResponse, .getOwnerResponse): return { - guard case .getOwnerResponse(let l) = lhs, case .getOwnerResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getConfigRequest, .getConfigRequest): return { - guard case .getConfigRequest(let l) = lhs, case .getConfigRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getConfigResponse, .getConfigResponse): return { - guard case .getConfigResponse(let l) = lhs, case .getConfigResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getModuleConfigRequest, .getModuleConfigRequest): return { - guard case .getModuleConfigRequest(let l) = lhs, case .getModuleConfigRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getModuleConfigResponse, .getModuleConfigResponse): return { - guard case .getModuleConfigResponse(let l) = lhs, case .getModuleConfigResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getCannedMessageModuleMessagesRequest, .getCannedMessageModuleMessagesRequest): return { - guard case .getCannedMessageModuleMessagesRequest(let l) = lhs, case .getCannedMessageModuleMessagesRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getCannedMessageModuleMessagesResponse, .getCannedMessageModuleMessagesResponse): return { - guard case .getCannedMessageModuleMessagesResponse(let l) = lhs, case .getCannedMessageModuleMessagesResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getDeviceMetadataRequest, .getDeviceMetadataRequest): return { - guard case .getDeviceMetadataRequest(let l) = lhs, case .getDeviceMetadataRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getDeviceMetadataResponse, .getDeviceMetadataResponse): return { - guard case .getDeviceMetadataResponse(let l) = lhs, case .getDeviceMetadataResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getRingtoneRequest, .getRingtoneRequest): return { - guard case .getRingtoneRequest(let l) = lhs, case .getRingtoneRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getRingtoneResponse, .getRingtoneResponse): return { - guard case .getRingtoneResponse(let l) = lhs, case .getRingtoneResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setOwner, .setOwner): return { - guard case .setOwner(let l) = lhs, case .setOwner(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setChannel, .setChannel): return { - guard case .setChannel(let l) = lhs, case .setChannel(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setConfig, .setConfig): return { - guard case .setConfig(let l) = lhs, case .setConfig(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setModuleConfig, .setModuleConfig): return { - guard case .setModuleConfig(let l) = lhs, case .setModuleConfig(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setCannedMessageModuleMessages, .setCannedMessageModuleMessages): return { - guard case .setCannedMessageModuleMessages(let l) = lhs, case .setCannedMessageModuleMessages(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.setRingtoneMessage, .setRingtoneMessage): return { - guard case .setRingtoneMessage(let l) = lhs, case .setRingtoneMessage(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.beginEditSettings, .beginEditSettings): return { - guard case .beginEditSettings(let l) = lhs, case .beginEditSettings(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.commitEditSettings, .commitEditSettings): return { - guard case .commitEditSettings(let l) = lhs, case .commitEditSettings(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.rebootOtaSeconds, .rebootOtaSeconds): return { - guard case .rebootOtaSeconds(let l) = lhs, case .rebootOtaSeconds(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.exitSimulator, .exitSimulator): return { - guard case .exitSimulator(let l) = lhs, case .exitSimulator(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.rebootSeconds, .rebootSeconds): return { - guard case .rebootSeconds(let l) = lhs, case .rebootSeconds(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.shutdownSeconds, .shutdownSeconds): return { - guard case .shutdownSeconds(let l) = lhs, case .shutdownSeconds(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.factoryReset, .factoryReset): return { - guard case .factoryReset(let l) = lhs, case .factoryReset(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nodedbReset, .nodedbReset): return { - guard case .nodedbReset(let l) = lhs, case .nodedbReset(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// - /// TODO: REPLACE - enum ConfigType: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// TODO: REPLACE - case deviceConfig // = 0 - - /// - /// TODO: REPLACE - case positionConfig // = 1 - - /// - /// TODO: REPLACE - case powerConfig // = 2 - - /// - /// TODO: REPLACE - case networkConfig // = 3 - - /// - /// TODO: REPLACE - case displayConfig // = 4 - - /// - /// TODO: REPLACE - case loraConfig // = 5 - - /// - /// TODO: REPLACE - case bluetoothConfig // = 6 - case UNRECOGNIZED(Int) - - init() { - self = .deviceConfig - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .deviceConfig - case 1: self = .positionConfig - case 2: self = .powerConfig - case 3: self = .networkConfig - case 4: self = .displayConfig - case 5: self = .loraConfig - case 6: self = .bluetoothConfig - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .deviceConfig: return 0 - case .positionConfig: return 1 - case .powerConfig: return 2 - case .networkConfig: return 3 - case .displayConfig: return 4 - case .loraConfig: return 5 - case .bluetoothConfig: return 6 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// TODO: REPLACE - enum ModuleConfigType: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// TODO: REPLACE - case mqttConfig // = 0 - - /// - /// TODO: REPLACE - case serialConfig // = 1 - - /// - /// TODO: REPLACE - case extnotifConfig // = 2 - - /// - /// TODO: REPLACE - case storeforwardConfig // = 3 - - /// - /// TODO: REPLACE - case rangetestConfig // = 4 - - /// - /// TODO: REPLACE - case telemetryConfig // = 5 - - /// - /// TODO: REPLACE - case cannedmsgConfig // = 6 - - /// - /// TODO: REPLACE - case audioConfig // = 7 - - /// - /// TODO: REPLACE - case remotehardwareConfig // = 8 - case UNRECOGNIZED(Int) - - init() { - self = .mqttConfig - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .mqttConfig - case 1: self = .serialConfig - case 2: self = .extnotifConfig - case 3: self = .storeforwardConfig - case 4: self = .rangetestConfig - case 5: self = .telemetryConfig - case 6: self = .cannedmsgConfig - case 7: self = .audioConfig - case 8: self = .remotehardwareConfig - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .mqttConfig: return 0 - case .serialConfig: return 1 - case .extnotifConfig: return 2 - case .storeforwardConfig: return 3 - case .rangetestConfig: return 4 - case .telemetryConfig: return 5 - case .cannedmsgConfig: return 6 - case .audioConfig: return 7 - case .remotehardwareConfig: return 8 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} -} - -#if swift(>=4.2) - -extension AdminMessage.ConfigType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [AdminMessage.ConfigType] = [ - .deviceConfig, - .positionConfig, - .powerConfig, - .networkConfig, - .displayConfig, - .loraConfig, - .bluetoothConfig, - ] -} - -extension AdminMessage.ModuleConfigType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [AdminMessage.ModuleConfigType] = [ - .mqttConfig, - .serialConfig, - .extnotifConfig, - .storeforwardConfig, - .rangetestConfig, - .telemetryConfig, - .cannedmsgConfig, - .audioConfig, - .remotehardwareConfig, - ] -} - -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension AdminMessage: @unchecked Sendable {} -extension AdminMessage.OneOf_PayloadVariant: @unchecked Sendable {} -extension AdminMessage.ConfigType: @unchecked Sendable {} -extension AdminMessage.ModuleConfigType: @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 { - static let protoMessageName: String = "AdminMessage" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "get_channel_request"), - 2: .standard(proto: "get_channel_response"), - 3: .standard(proto: "get_owner_request"), - 4: .standard(proto: "get_owner_response"), - 5: .standard(proto: "get_config_request"), - 6: .standard(proto: "get_config_response"), - 7: .standard(proto: "get_module_config_request"), - 8: .standard(proto: "get_module_config_response"), - 10: .standard(proto: "get_canned_message_module_messages_request"), - 11: .standard(proto: "get_canned_message_module_messages_response"), - 12: .standard(proto: "get_device_metadata_request"), - 13: .standard(proto: "get_device_metadata_response"), - 14: .standard(proto: "get_ringtone_request"), - 15: .standard(proto: "get_ringtone_response"), - 32: .standard(proto: "set_owner"), - 33: .standard(proto: "set_channel"), - 34: .standard(proto: "set_config"), - 35: .standard(proto: "set_module_config"), - 36: .standard(proto: "set_canned_message_module_messages"), - 37: .standard(proto: "set_ringtone_message"), - 64: .standard(proto: "begin_edit_settings"), - 65: .standard(proto: "commit_edit_settings"), - 95: .standard(proto: "reboot_ota_seconds"), - 96: .standard(proto: "exit_simulator"), - 97: .standard(proto: "reboot_seconds"), - 98: .standard(proto: "shutdown_seconds"), - 99: .standard(proto: "factory_reset"), - 100: .standard(proto: "nodedb_reset"), - ] - - 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 { - var v: UInt32? - try decoder.decodeSingularUInt32Field(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getChannelRequest(v) - } - }() - case 2: try { - var v: Channel? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .getChannelResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getChannelResponse(v) - } - }() - case 3: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getOwnerRequest(v) - } - }() - case 4: try { - var v: User? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .getOwnerResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getOwnerResponse(v) - } - }() - case 5: try { - var v: AdminMessage.ConfigType? - try decoder.decodeSingularEnumField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getConfigRequest(v) - } - }() - case 6: try { - var v: Config? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .getConfigResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getConfigResponse(v) - } - }() - case 7: try { - var v: AdminMessage.ModuleConfigType? - try decoder.decodeSingularEnumField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getModuleConfigRequest(v) - } - }() - case 8: try { - var v: ModuleConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .getModuleConfigResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getModuleConfigResponse(v) - } - }() - case 10: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getCannedMessageModuleMessagesRequest(v) - } - }() - case 11: try { - var v: String? - try decoder.decodeSingularStringField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getCannedMessageModuleMessagesResponse(v) - } - }() - case 12: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getDeviceMetadataRequest(v) - } - }() - case 13: try { - var v: DeviceMetadata? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .getDeviceMetadataResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getDeviceMetadataResponse(v) - } - }() - case 14: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getRingtoneRequest(v) - } - }() - case 15: try { - var v: String? - try decoder.decodeSingularStringField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .getRingtoneResponse(v) - } - }() - case 32: try { - var v: User? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .setOwner(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .setOwner(v) - } - }() - case 33: try { - var v: Channel? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .setChannel(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .setChannel(v) - } - }() - case 34: try { - var v: Config? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .setConfig(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .setConfig(v) - } - }() - case 35: try { - var v: ModuleConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .setModuleConfig(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .setModuleConfig(v) - } - }() - case 36: try { - var v: String? - try decoder.decodeSingularStringField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .setCannedMessageModuleMessages(v) - } - }() - case 37: try { - var v: String? - try decoder.decodeSingularStringField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .setRingtoneMessage(v) - } - }() - case 64: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .beginEditSettings(v) - } - }() - case 65: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .commitEditSettings(v) - } - }() - case 95: try { - var v: Int32? - try decoder.decodeSingularInt32Field(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .rebootOtaSeconds(v) - } - }() - case 96: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .exitSimulator(v) - } - }() - case 97: try { - var v: Int32? - try decoder.decodeSingularInt32Field(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .rebootSeconds(v) - } - }() - case 98: try { - var v: Int32? - try decoder.decodeSingularInt32Field(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .shutdownSeconds(v) - } - }() - case 99: try { - var v: Int32? - try decoder.decodeSingularInt32Field(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .factoryReset(v) - } - }() - case 100: try { - var v: Int32? - try decoder.decodeSingularInt32Field(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .nodedbReset(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 - switch self.payloadVariant { - case .getChannelRequest?: try { - guard case .getChannelRequest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularUInt32Field(value: v, fieldNumber: 1) - }() - case .getChannelResponse?: try { - guard case .getChannelResponse(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case .getOwnerRequest?: try { - guard case .getOwnerRequest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 3) - }() - case .getOwnerResponse?: try { - guard case .getOwnerResponse(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - }() - case .getConfigRequest?: try { - guard case .getConfigRequest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularEnumField(value: v, fieldNumber: 5) - }() - case .getConfigResponse?: try { - guard case .getConfigResponse(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - }() - case .getModuleConfigRequest?: try { - guard case .getModuleConfigRequest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularEnumField(value: v, fieldNumber: 7) - }() - case .getModuleConfigResponse?: try { - guard case .getModuleConfigResponse(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - }() - case .getCannedMessageModuleMessagesRequest?: try { - guard case .getCannedMessageModuleMessagesRequest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 10) - }() - case .getCannedMessageModuleMessagesResponse?: try { - guard case .getCannedMessageModuleMessagesResponse(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularStringField(value: v, fieldNumber: 11) - }() - case .getDeviceMetadataRequest?: try { - guard case .getDeviceMetadataRequest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 12) - }() - case .getDeviceMetadataResponse?: try { - guard case .getDeviceMetadataResponse(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 13) - }() - case .getRingtoneRequest?: try { - guard case .getRingtoneRequest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 14) - }() - case .getRingtoneResponse?: try { - guard case .getRingtoneResponse(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularStringField(value: v, fieldNumber: 15) - }() - case .setOwner?: try { - guard case .setOwner(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 32) - }() - case .setChannel?: try { - guard case .setChannel(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 33) - }() - case .setConfig?: try { - guard case .setConfig(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 34) - }() - case .setModuleConfig?: try { - guard case .setModuleConfig(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 35) - }() - case .setCannedMessageModuleMessages?: try { - guard case .setCannedMessageModuleMessages(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularStringField(value: v, fieldNumber: 36) - }() - case .setRingtoneMessage?: try { - guard case .setRingtoneMessage(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularStringField(value: v, fieldNumber: 37) - }() - case .beginEditSettings?: try { - guard case .beginEditSettings(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 64) - }() - case .commitEditSettings?: try { - guard case .commitEditSettings(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 65) - }() - case .rebootOtaSeconds?: try { - guard case .rebootOtaSeconds(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularInt32Field(value: v, fieldNumber: 95) - }() - case .exitSimulator?: try { - guard case .exitSimulator(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 96) - }() - case .rebootSeconds?: try { - guard case .rebootSeconds(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularInt32Field(value: v, fieldNumber: 97) - }() - case .shutdownSeconds?: try { - guard case .shutdownSeconds(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularInt32Field(value: v, fieldNumber: 98) - }() - case .factoryReset?: try { - guard case .factoryReset(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularInt32Field(value: v, fieldNumber: 99) - }() - case .nodedbReset?: try { - guard case .nodedbReset(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularInt32Field(value: v, fieldNumber: 100) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: AdminMessage, rhs: AdminMessage) -> Bool { - if lhs.payloadVariant != rhs.payloadVariant {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension AdminMessage.ConfigType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "DEVICE_CONFIG"), - 1: .same(proto: "POSITION_CONFIG"), - 2: .same(proto: "POWER_CONFIG"), - 3: .same(proto: "NETWORK_CONFIG"), - 4: .same(proto: "DISPLAY_CONFIG"), - 5: .same(proto: "LORA_CONFIG"), - 6: .same(proto: "BLUETOOTH_CONFIG"), - ] -} - -extension AdminMessage.ModuleConfigType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "MQTT_CONFIG"), - 1: .same(proto: "SERIAL_CONFIG"), - 2: .same(proto: "EXTNOTIF_CONFIG"), - 3: .same(proto: "STOREFORWARD_CONFIG"), - 4: .same(proto: "RANGETEST_CONFIG"), - 5: .same(proto: "TELEMETRY_CONFIG"), - 6: .same(proto: "CANNEDMSG_CONFIG"), - 7: .same(proto: "AUDIO_CONFIG"), - 8: .same(proto: "REMOTEHARDWARE_CONFIG"), - ] -} diff --git a/Meshtastic/Protobufs/apponly.pb.swift b/Meshtastic/Protobufs/apponly.pb.swift deleted file mode 100644 index 46ab82c8..00000000 --- a/Meshtastic/Protobufs/apponly.pb.swift +++ /dev/null @@ -1,102 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: apponly.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 -} - -/// -/// This is the most compact possible representation for a set of channels. -/// It includes only one PRIMARY channel (which must be first) and -/// any SECONDARY channels. -/// No DISABLED channels are included. -/// This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL -struct ChannelSet { - // 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. - - /// - /// Channel list with settings - var settings: [ChannelSettings] = [] - - /// - /// LoRa config - var loraConfig: Config.LoRaConfig { - get {return _loraConfig ?? Config.LoRaConfig()} - set {_loraConfig = newValue} - } - /// Returns true if `loraConfig` has been explicitly set. - var hasLoraConfig: Bool {return self._loraConfig != nil} - /// Clears the value of `loraConfig`. Subsequent reads from it will return its default value. - mutating func clearLoraConfig() {self._loraConfig = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _loraConfig: Config.LoRaConfig? = nil -} - -#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 { - static let protoMessageName: String = "ChannelSet" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "settings"), - 2: .standard(proto: "lora_config"), - ] - - 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.decodeRepeatedMessageField(value: &self.settings) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._loraConfig) }() - 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.settings.isEmpty { - try visitor.visitRepeatedMessageField(value: self.settings, fieldNumber: 1) - } - try { if let v = self._loraConfig { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ChannelSet, rhs: ChannelSet) -> Bool { - if lhs.settings != rhs.settings {return false} - if lhs._loraConfig != rhs._loraConfig {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/cannedmessages.pb.swift b/Meshtastic/Protobufs/cannedmessages.pb.swift deleted file mode 100644 index 3d4c6596..00000000 --- a/Meshtastic/Protobufs/cannedmessages.pb.swift +++ /dev/null @@ -1,75 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: cannedmessages.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 -} - -/// -/// 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 module separated by '|' characters. - var messages: 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 CannedMessageModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "CannedMessageModuleConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "messages"), - ] - - 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.messages) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.messages.isEmpty { - try visitor.visitSingularStringField(value: self.messages, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: CannedMessageModuleConfig, rhs: CannedMessageModuleConfig) -> Bool { - if lhs.messages != rhs.messages {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/channel.pb.swift b/Meshtastic/Protobufs/channel.pb.swift deleted file mode 100644 index 219dcb6c..00000000 --- a/Meshtastic/Protobufs/channel.pb.swift +++ /dev/null @@ -1,326 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: channel.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 -} - -/// -/// Full settings (center freq, spread factor, pre-shared secret key etc...) -/// needed to configure a radio for speaking on a particular channel This -/// information can be encoded as a QRcode/url so that other users can configure -/// their radio to join the same channel. -/// A note about how channel names are shown to users: channelname-Xy -/// poundsymbol is a prefix used to indicate this is a channel name (idea from @professr). -/// Where X is a letter from A-Z (base 26) representing a hash of the PSK for this -/// channel - so that if the user changes anything about the channel (which does -/// force a new PSK) this letter will also change. Thus preventing user confusion if -/// two friends try to type in a channel name of "BobsChan" and then can't talk -/// because their PSKs will be different. -/// The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26" -/// This also allows the option of someday if people have the PSK off (zero), the -/// users COULD type in a channel name and be able to talk. -/// Y is a lower case letter from a-z that represents the channel 'speed' settings -/// (for some future definition of speed) -/// FIXME: Add description of multi-channel support and how primary vs secondary channels are used. -/// FIXME: explain how apps use channels for security. -/// explain how remote settings and remote gpio are managed as an example -struct ChannelSettings { - // 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. - - /// - /// Deprecated in favor of LoraConfig.channel_num - var channelNum: UInt32 = 0 - - /// - /// A simple pre-shared key for now for crypto. - /// Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256). - /// A special shorthand is used for 1 byte long psks. - /// These psks should be treated as only minimally secure, - /// because they are listed in this source code. - /// Those bytes are mapped using the following scheme: - /// `0` = No crypto - /// `1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf} - /// `2` through 10 = The default channel key, except with 1 through 9 added to the last byte. - /// Shown to user as simple1 through 10 - var psk: Data = Data() - - /// - /// A SHORT name that will be packed into the URL. - /// Less than 12 bytes. - /// Something for end users to call the channel - /// If this is the empty string it is assumed that this channel - /// is the special (minimally secure) "Default"channel. - /// In user interfaces it should be rendered as a local language translation of "X". - /// For channel_num hashing empty string will be treated as "X". - /// Where "X" is selected based on the English words listed above for ModemPreset - var name: String = String() - - /// - /// Used to construct a globally unique channel ID. - /// The full globally unique ID will be: "name.id" where ID is shown as base36. - /// Assuming that the number of meshtastic users is below 20K (true for a long time) - /// the chance of this 64 bit random number colliding with anyone else is super low. - /// And the penalty for collision is low as well, it just means that anyone trying to decrypt channel messages might need to - /// try multiple candidate channels. - /// Any time a non wire compatible change is made to a channel, this field should be regenerated. - /// There are a small number of 'special' globally known (and fairly) insecure standard channels. - /// Those channels do not have a numeric id included in the settings, but instead it is pulled from - /// a table of well known IDs. - /// (see Well Known Channels FIXME) - var id: UInt32 = 0 - - /// - /// If true, messages on the mesh will be sent to the *public* internet by any gateway ndoe - var uplinkEnabled: Bool = false - - /// - /// If true, messages seen on the internet will be forwarded to the local mesh. - var downlinkEnabled: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// A pair of a channel number, mode and the (sharable) settings for that channel -struct Channel { - // 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 index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1) - /// (Someday - not currently implemented) An index of -1 could be used to mean "set by name", - /// in which case the target node will find and set the channel by settings.name. - var index: Int32 = 0 - - /// - /// The new settings, or NULL to disable that channel - var settings: ChannelSettings { - get {return _settings ?? ChannelSettings()} - set {_settings = newValue} - } - /// Returns true if `settings` has been explicitly set. - var hasSettings: Bool {return self._settings != nil} - /// 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() - - /// - /// How this channel is being used (or not). - /// Note: this field is an enum to give us options for the future. - /// In particular, someday we might make a 'SCANNING' option. - /// SCANNING channels could have different frequencies and the radio would - /// occasionally check that freq to see if anything is being transmitted. - /// For devices that have multiple physical radios attached, we could keep multiple PRIMARY/SCANNING channels active at once to allow - /// cross band routing as needed. - /// If a device has only a single radio (the common case) only one channel can be PRIMARY at a time - /// (but any number of SECONDARY channels can't be sent received on that common frequency) - enum Role: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// This channel is not in use right now - case disabled // = 0 - - /// - /// This channel is used to set the frequency for the radio - all other enabled channels must be SECONDARY - case primary // = 1 - - /// - /// Secondary channels are only used for encryption/decryption/authentication purposes. - /// Their radio settings (freq etc) are ignored, only psk is used. - case secondary // = 2 - case UNRECOGNIZED(Int) - - init() { - self = .disabled - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .disabled - case 1: self = .primary - case 2: self = .secondary - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .disabled: return 0 - case .primary: return 1 - case .secondary: return 2 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - - fileprivate var _settings: ChannelSettings? = nil -} - -#if swift(>=4.2) - -extension Channel.Role: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Channel.Role] = [ - .disabled, - .primary, - .secondary, - ] -} - -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension ChannelSettings: @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 { - static let protoMessageName: String = "ChannelSettings" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "channel_num"), - 2: .same(proto: "psk"), - 3: .same(proto: "name"), - 4: .same(proto: "id"), - 5: .standard(proto: "uplink_enabled"), - 6: .standard(proto: "downlink_enabled"), - ] - - 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.channelNum) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.psk) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 4: try { try decoder.decodeSingularFixed32Field(value: &self.id) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self.uplinkEnabled) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self.downlinkEnabled) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.channelNum != 0 { - try visitor.visitSingularUInt32Field(value: self.channelNum, fieldNumber: 1) - } - if !self.psk.isEmpty { - try visitor.visitSingularBytesField(value: self.psk, fieldNumber: 2) - } - if !self.name.isEmpty { - try visitor.visitSingularStringField(value: self.name, fieldNumber: 3) - } - if self.id != 0 { - try visitor.visitSingularFixed32Field(value: self.id, fieldNumber: 4) - } - if self.uplinkEnabled != false { - try visitor.visitSingularBoolField(value: self.uplinkEnabled, fieldNumber: 5) - } - if self.downlinkEnabled != false { - try visitor.visitSingularBoolField(value: self.downlinkEnabled, fieldNumber: 6) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ChannelSettings, rhs: ChannelSettings) -> Bool { - if lhs.channelNum != rhs.channelNum {return false} - if lhs.psk != rhs.psk {return false} - if lhs.name != rhs.name {return false} - if lhs.id != rhs.id {return false} - if lhs.uplinkEnabled != rhs.uplinkEnabled {return false} - if lhs.downlinkEnabled != rhs.downlinkEnabled {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Channel" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "index"), - 2: .same(proto: "settings"), - 3: .same(proto: "role"), - ] - - 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.decodeSingularInt32Field(value: &self.index) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._settings) }() - case 3: try { try decoder.decodeSingularEnumField(value: &self.role) }() - 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.index != 0 { - try visitor.visitSingularInt32Field(value: self.index, fieldNumber: 1) - } - 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) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Channel, rhs: Channel) -> Bool { - if lhs.index != rhs.index {return false} - if lhs._settings != rhs._settings {return false} - if lhs.role != rhs.role {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Channel.Role: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "DISABLED"), - 1: .same(proto: "PRIMARY"), - 2: .same(proto: "SECONDARY"), - ] -} diff --git a/Meshtastic/Protobufs/config.pb.swift b/Meshtastic/Protobufs/config.pb.swift deleted file mode 100644 index 7dec26a2..00000000 --- a/Meshtastic/Protobufs/config.pb.swift +++ /dev/null @@ -1,2255 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: config.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 Config { - // 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. - - /// - /// Payload Variant - var payloadVariant: Config.OneOf_PayloadVariant? = nil - - var device: Config.DeviceConfig { - get { - if case .device(let v)? = payloadVariant {return v} - return Config.DeviceConfig() - } - set {payloadVariant = .device(newValue)} - } - - var position: Config.PositionConfig { - get { - if case .position(let v)? = payloadVariant {return v} - return Config.PositionConfig() - } - set {payloadVariant = .position(newValue)} - } - - var power: Config.PowerConfig { - get { - if case .power(let v)? = payloadVariant {return v} - return Config.PowerConfig() - } - set {payloadVariant = .power(newValue)} - } - - var network: Config.NetworkConfig { - get { - if case .network(let v)? = payloadVariant {return v} - return Config.NetworkConfig() - } - set {payloadVariant = .network(newValue)} - } - - var display: Config.DisplayConfig { - get { - if case .display(let v)? = payloadVariant {return v} - return Config.DisplayConfig() - } - set {payloadVariant = .display(newValue)} - } - - var lora: Config.LoRaConfig { - get { - if case .lora(let v)? = payloadVariant {return v} - return Config.LoRaConfig() - } - set {payloadVariant = .lora(newValue)} - } - - var bluetooth: Config.BluetoothConfig { - get { - if case .bluetooth(let v)? = payloadVariant {return v} - return Config.BluetoothConfig() - } - set {payloadVariant = .bluetooth(newValue)} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// Payload Variant - enum OneOf_PayloadVariant: Equatable { - case device(Config.DeviceConfig) - case position(Config.PositionConfig) - case power(Config.PowerConfig) - case network(Config.NetworkConfig) - case display(Config.DisplayConfig) - case lora(Config.LoRaConfig) - case bluetooth(Config.BluetoothConfig) - - #if !swift(>=4.1) - static func ==(lhs: Config.OneOf_PayloadVariant, rhs: Config.OneOf_PayloadVariant) -> 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 (.device, .device): return { - guard case .device(let l) = lhs, case .device(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.position, .position): return { - guard case .position(let l) = lhs, case .position(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.power, .power): return { - guard case .power(let l) = lhs, case .power(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.network, .network): return { - guard case .network(let l) = lhs, case .network(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.display, .display): return { - guard case .display(let l) = lhs, case .display(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.lora, .lora): return { - guard case .lora(let l) = lhs, case .lora(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.bluetooth, .bluetooth): return { - guard case .bluetooth(let l) = lhs, case .bluetooth(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// - /// Configuration - struct DeviceConfig { - // 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. - - /// - /// Sets the role of node - var role: Config.DeviceConfig.Role = .client - - /// - /// Disabling this will disable the SerialConsole by not initilizing the StreamAPI - var serialEnabled: Bool = false - - /// - /// By default we turn off logging as soon as an API client connects (to keep shared serial link quiet). - /// Set this to true to leave the debug log outputting even when API is active. - var debugLogEnabled: Bool = false - - /// - /// For boards without a hard wired button, this is the pin number that will be used - /// Boards that have more than one button can swap the function with this one. defaults to BUTTON_PIN if defined. - var buttonGpio: UInt32 = 0 - - /// - /// For boards without a PWM buzzer, this is the pin number that will be used - /// Defaults to PIN_BUZZER if defined. - var buzzerGpio: UInt32 = 0 - - /// - /// Sets the role of node - var rebroadcastMode: Config.DeviceConfig.RebroadcastMode = .all - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// Defines the device's role on the Mesh network - enum Role: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Client device role - case client // = 0 - - /// - /// Client Mute device role - /// Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh. - case clientMute // = 1 - - /// - /// Router device role. - /// Mesh packets will prefer to be routed over this node. This node will not be used by client apps. - /// The wifi/ble radios 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 - - /// - /// Router Client device role - /// Mesh packets will prefer to be routed over this node. The Router Client can be used as both a Router and an app connected Client. - case routerClient // = 3 - - /// - /// Repeater device role - /// Mesh packets will simply be rebroadcasted over this node. Nodes configured with this role will not originate NodeInfo, Position, Telemetry - /// or any other packet type. They will simply rebroadcast any mesh packets on the same frequency, channel num, spread factor, and coding rate. - case repeater // = 4 - - /// - /// Tracker device role - /// Position Mesh packets will be prioritized higher and sent more frequently by default. - case tracker // = 5 - case UNRECOGNIZED(Int) - - init() { - self = .client - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .client - case 1: self = .clientMute - case 2: self = .router - case 3: self = .routerClient - case 4: self = .repeater - case 5: self = .tracker - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .client: return 0 - case .clientMute: return 1 - case .router: return 2 - case .routerClient: return 3 - case .repeater: return 4 - case .tracker: return 5 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// Defines the device's behavior for how messages are rebroadcast - enum RebroadcastMode: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Default behavior. - /// Rebroadcast any observed message, if it was on our private channel or from another mesh with the same lora params. - case all // = 0 - - /// - /// Same as behavior as ALL but skips packet decoding and simply rebroadcasts them. - /// Only available in Repeater role. Setting this on any other roles will result in ALL behavior. - case allSkipDecoding // = 1 - - /// - /// Ignores observed messages from foreign meshes that are open or those which it cannot decrypt. - /// Only rebroadcasts message on the nodes local primary / secondary channels. - case localOnly // = 2 - case UNRECOGNIZED(Int) - - init() { - self = .all - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .all - case 1: self = .allSkipDecoding - case 2: self = .localOnly - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .all: return 0 - case .allSkipDecoding: return 1 - case .localOnly: return 2 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - } - - /// - /// Position Config - struct PositionConfig { - // 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. - - /// - /// We should send our position this often (but only if it has changed significantly) - /// Defaults to 15 minutes - var positionBroadcastSecs: UInt32 = 0 - - /// - /// Adaptive position braoadcast, which is now the default. - var positionBroadcastSmartEnabled: Bool = false - - /// - /// If set, this node is at a fixed position. - /// We will generate GPS position updates at the regular interval, but use whatever the last lat/lon/alt we have for the node. - /// The lat/lon/alt can be set by an internal GPS or with the help of the app. - var fixedPosition: Bool = false - - /// - /// Is GPS enabled for this node? - var gpsEnabled: Bool = false - - /// - /// 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 = 0 - - /// - /// How long should we try to get our position during each gps_update_interval attempt? (in seconds) - /// Or if zero, use the default of 30 seconds. - /// If we don't get a new gps fix in that time, the gps will be put into sleep until the next gps_update_rate - /// window. - var gpsAttemptTime: UInt32 = 0 - - /// - /// Bit field of boolean configuration options for POSITION messages - /// (bitwise OR of PositionFlags) - var positionFlags: UInt32 = 0 - - /// - /// (Re)define GPS_RX_PIN for your board. - var rxGpio: UInt32 = 0 - - /// - /// (Re)define GPS_TX_PIN for your board. - var txGpio: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// Bit field of boolean configuration options, indicating which optional - /// fields to include when assembling POSITION messages - /// Longitude and latitude are always included (also time if GPS-synced) - /// NOTE: the more fields are included, the larger the message will be - - /// leading to longer airtime and a higher risk of packet loss - enum PositionFlags: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Required for compilation - case unset // = 0 - - /// - /// Include an altitude value (if available) - case altitude // = 1 - - /// - /// Altitude value is MSL - case altitudeMsl // = 2 - - /// - /// Include geoidal separation - case geoidalSeparation // = 4 - - /// - /// Include the DOP value ; PDOP used by default, see below - case dop // = 8 - - /// - /// If POS_DOP set, send separate HDOP / VDOP values instead of PDOP - case hvdop // = 16 - - /// - /// Include number of "satellites in view" - case satinview // = 32 - - /// - /// Include a sequence number incremented per packet - case seqNo // = 64 - - /// - /// Include positional timestamp (from GPS solution) - case timestamp // = 128 - - /// - /// Include positional heading - /// Intended for use with vehicle not walking speeds - /// walking speeds are likely to be error prone like the compass - case heading // = 256 - - /// - /// Include positional speed - /// Intended for use with vehicle not walking speeds - /// walking speeds are likely to be error prone like the compass - case speed // = 512 - case UNRECOGNIZED(Int) - - init() { - self = .unset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .unset - case 1: self = .altitude - case 2: self = .altitudeMsl - case 4: self = .geoidalSeparation - case 8: self = .dop - case 16: self = .hvdop - case 32: self = .satinview - case 64: self = .seqNo - case 128: self = .timestamp - case 256: self = .heading - case 512: self = .speed - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .unset: return 0 - case .altitude: return 1 - case .altitudeMsl: return 2 - case .geoidalSeparation: return 4 - case .dop: return 8 - case .hvdop: return 16 - case .satinview: return 32 - case .seqNo: return 64 - case .timestamp: return 128 - case .heading: return 256 - case .speed: return 512 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - } - - /// - /// Power Config\ - /// See [Power Config](/docs/settings/config/power) for additional power config details. - struct PowerConfig { - // 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. - - /// - /// If set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in - /// we should try to minimize power consumption as much as possible. - /// YOU DO NOT NEED TO SET THIS IF YOU'VE set is_router (it is implied in that case). - /// Advanced Option - var isPowerSaving: Bool = false - - /// - /// If non-zero, the device will fully power off this many seconds after external power is removed. - var onBatteryShutdownAfterSecs: UInt32 = 0 - - /// - /// Ratio of voltage divider for battery pin eg. 3.20 (R1=100k, R2=220k) - /// Overrides the ADC_MULTIPLIER defined in variant for battery voltage calculation. - /// Should be set to floating point value between 2 and 4 - /// Fixes issues on Heltec v2 - var adcMultiplierOverride: Float = 0 - - /// - /// Wait Bluetooth Seconds - /// The number of seconds for to wait before turning off BLE in No Bluetooth states - /// 0 for default of 1 minute - var waitBluetoothSecs: UInt32 = 0 - - /// - /// Mesh Super Deep Sleep Timeout Seconds - /// While in Light Sleep if this value is exceeded we will lower into super deep sleep - /// for sds_secs (default 1 year) or a button press - /// 0 for default of two hours, MAXUINT for disabled - var meshSdsTimeoutSecs: UInt32 = 0 - - /// - /// Super Deep Sleep Seconds - /// While in Light Sleep if mesh_sds_timeout_secs is exceeded we will lower into super deep sleep - /// for this value (default 1 year) or a button press - /// 0 for default of one year - var sdsSecs: UInt32 = 0 - - /// - /// Light Sleep Seconds - /// In light sleep the CPU is suspended, LoRa radio is on, BLE is off an GPS is on - /// ESP32 Only - /// 0 for default of 300 - var lsSecs: UInt32 = 0 - - /// - /// Minimum Wake Seconds - /// While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value - /// 0 for default of 10 seconds - var minWakeSecs: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - /// - /// Network Config - struct NetworkConfig { - // 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. - - /// - /// Enable WiFi (disables Bluetooth) - var wifiEnabled: Bool = false - - /// - /// If set, this node will try to join the specified wifi network and - /// acquire an address via DHCP - var wifiSsid: String = String() - - /// - /// If set, will be use to authenticate to the named wifi - var wifiPsk: String = String() - - /// - /// NTP server to use if WiFi is conneced, defaults to `0.pool.ntp.org` - var ntpServer: String = String() - - /// - /// Enable Ethernet - var ethEnabled: Bool = false - - /// - /// acquire an address via DHCP or assign static - var addressMode: Config.NetworkConfig.AddressMode = .dhcp - - /// - /// struct to keep static address - var ipv4Config: Config.NetworkConfig.IpV4Config { - get {return _ipv4Config ?? Config.NetworkConfig.IpV4Config()} - set {_ipv4Config = newValue} - } - /// Returns true if `ipv4Config` has been explicitly set. - var hasIpv4Config: Bool {return self._ipv4Config != nil} - /// Clears the value of `ipv4Config`. Subsequent reads from it will return its default value. - mutating func clearIpv4Config() {self._ipv4Config = nil} - - /// - /// rsyslog Server and Port - var rsyslogServer: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - enum AddressMode: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// obtain ip address via DHCP - case dhcp // = 0 - - /// - /// use static ip address - case `static` // = 1 - case UNRECOGNIZED(Int) - - init() { - self = .dhcp - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .dhcp - case 1: self = .static - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .dhcp: return 0 - case .static: return 1 - case .UNRECOGNIZED(let i): return i - } - } - - } - - struct IpV4Config { - // 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. - - /// - /// Static IP address - var ip: UInt32 = 0 - - /// - /// Static gateway address - var gateway: UInt32 = 0 - - /// - /// Static subnet mask - var subnet: UInt32 = 0 - - /// - /// Static DNS server address - var dns: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - init() {} - - fileprivate var _ipv4Config: Config.NetworkConfig.IpV4Config? = nil - } - - /// - /// Display Config - struct DisplayConfig { - // 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. - - /// - /// Number of seconds the screen stays on after pressing the user button or receiving a message - /// 0 for default of one minute MAXUINT for always on - var screenOnSecs: UInt32 = 0 - - /// - /// How the GPS coordinates are formatted on the OLED screen. - var gpsFormat: Config.DisplayConfig.GpsCoordinateFormat = .dec - - /// - /// Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds. - /// Potentially useful for devices without user buttons. - var autoScreenCarouselSecs: UInt32 = 0 - - /// - /// If this is set, the displayed compass will always point north. if unset, the old behaviour - /// (top of display is heading direction) is used. - var compassNorthTop: Bool = false - - /// - /// Flip screen vertically, for cases that mount the screen upside down - var flipScreen: Bool = false - - /// - /// Perferred display units - var units: Config.DisplayConfig.DisplayUnits = .metric - - /// - /// Override auto-detect in screen - var oled: Config.DisplayConfig.OledType = .oledAuto - - /// - /// Display Mode - var displaymode: Config.DisplayConfig.DisplayMode = .default - - /// - /// Print first line in pseudo-bold? FALSE is original style, TRUE is bold - var headingBold: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// How the GPS coordinates are displayed on the OLED screen. - enum GpsCoordinateFormat: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// GPS coordinates are displayed in the normal decimal degrees format: - /// DD.DDDDDD DDD.DDDDDD - case dec // = 0 - - /// - /// GPS coordinates are displayed in the degrees minutes seconds format: - /// DD°MM'SS"C DDD°MM'SS"C, where C is the compass point representing the locations quadrant - case dms // = 1 - - /// - /// Universal Transverse Mercator format: - /// ZZB EEEEEE NNNNNNN, where Z is zone, B is band, E is easting, N is northing - case utm // = 2 - - /// - /// Military Grid Reference System format: - /// ZZB CD EEEEE NNNNN, where Z is zone, B is band, C is the east 100k square, D is the north 100k square, - /// E is easting, N is northing - case mgrs // = 3 - - /// - /// Open Location Code (aka Plus Codes). - case olc // = 4 - - /// - /// Ordnance Survey Grid Reference (the National Grid System of the UK). - /// Format: AB EEEEE NNNNN, where A is the east 100k square, B is the north 100k square, - /// E is the easting, N is the northing - case osgr // = 5 - case UNRECOGNIZED(Int) - - init() { - self = .dec - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .dec - case 1: self = .dms - case 2: self = .utm - case 3: self = .mgrs - case 4: self = .olc - case 5: self = .osgr - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .dec: return 0 - case .dms: return 1 - case .utm: return 2 - case .mgrs: return 3 - case .olc: return 4 - case .osgr: return 5 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// Unit display preference - enum DisplayUnits: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Metric (Default) - case metric // = 0 - - /// - /// Imperial - case imperial // = 1 - case UNRECOGNIZED(Int) - - init() { - self = .metric - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .metric - case 1: self = .imperial - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .metric: return 0 - case .imperial: return 1 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// 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 - - /// - /// Can not be auto detected but set by proto. Used for 128x128 screens - case oledSh1107 // = 3 - case UNRECOGNIZED(Int) - - init() { - self = .oledAuto - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .oledAuto - case 1: self = .oledSsd1306 - case 2: self = .oledSh1106 - case 3: self = .oledSh1107 - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .oledAuto: return 0 - case .oledSsd1306: return 1 - case .oledSh1106: return 2 - case .oledSh1107: return 3 - case .UNRECOGNIZED(let i): return i - } - } - - } - - enum DisplayMode: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Default. The old style for the 128x64 OLED screen - case `default` // = 0 - - /// - /// Rearrange display elements to cater for bicolor OLED displays - case twocolor // = 1 - - /// - /// Same as TwoColor, but with inverted top bar. Not so good for Epaper displays - case inverted // = 2 - - /// - /// TFT Full Color Displays (not implemented yet) - case color // = 3 - case UNRECOGNIZED(Int) - - init() { - self = .default - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .default - case 1: self = .twocolor - case 2: self = .inverted - case 3: self = .color - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .default: return 0 - case .twocolor: return 1 - case .inverted: return 2 - case .color: return 3 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - } - - /// - /// Lora Config - struct LoRaConfig { - // 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. - - /// - /// When enabled, the `modem_preset` fields will be adheared to, else the `bandwidth`/`spread_factor`/`coding_rate` - /// will be taked from their respective manually defined fields - var usePreset: Bool = false - - /// - /// Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH. - /// As a heuristic: If bandwidth is specified, do not use modem_config. - /// 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 modemPreset: Config.LoRaConfig.ModemPreset = .longFast - - /// - /// Bandwidth in MHz - /// Certain bandwidth numbers are 'special' and will be converted to the - /// appropriate floating point value: 31 -> 31.25MHz - var bandwidth: UInt32 = 0 - - /// - /// A number from 7 to 12. - /// Indicates number of chirps per symbol as 1<=4.2) - -extension Config.DeviceConfig.Role: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.DeviceConfig.Role] = [ - .client, - .clientMute, - .router, - .routerClient, - .repeater, - .tracker, - ] -} - -extension Config.DeviceConfig.RebroadcastMode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.DeviceConfig.RebroadcastMode] = [ - .all, - .allSkipDecoding, - .localOnly, - ] -} - -extension Config.PositionConfig.PositionFlags: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.PositionConfig.PositionFlags] = [ - .unset, - .altitude, - .altitudeMsl, - .geoidalSeparation, - .dop, - .hvdop, - .satinview, - .seqNo, - .timestamp, - .heading, - .speed, - ] -} - -extension Config.NetworkConfig.AddressMode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.NetworkConfig.AddressMode] = [ - .dhcp, - .static, - ] -} - -extension Config.DisplayConfig.GpsCoordinateFormat: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.DisplayConfig.GpsCoordinateFormat] = [ - .dec, - .dms, - .utm, - .mgrs, - .olc, - .osgr, - ] -} - -extension Config.DisplayConfig.DisplayUnits: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.DisplayConfig.DisplayUnits] = [ - .metric, - .imperial, - ] -} - -extension Config.DisplayConfig.OledType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.DisplayConfig.OledType] = [ - .oledAuto, - .oledSsd1306, - .oledSh1106, - .oledSh1107, - ] -} - -extension Config.DisplayConfig.DisplayMode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.DisplayConfig.DisplayMode] = [ - .default, - .twocolor, - .inverted, - .color, - ] -} - -extension Config.LoRaConfig.RegionCode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.LoRaConfig.RegionCode] = [ - .unset, - .us, - .eu433, - .eu868, - .cn, - .jp, - .anz, - .kr, - .tw, - .ru, - .in, - .nz865, - .th, - .lora24, - .ua433, - .ua868, - ] -} - -extension Config.LoRaConfig.ModemPreset: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.LoRaConfig.ModemPreset] = [ - .longFast, - .longSlow, - .veryLongSlow, - .mediumSlow, - .mediumFast, - .shortSlow, - .shortFast, - .longModerate, - ] -} - -extension Config.BluetoothConfig.PairingMode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Config.BluetoothConfig.PairingMode] = [ - .randomPin, - .fixedPin, - .noPin, - ] -} - -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension Config: @unchecked Sendable {} -extension Config.OneOf_PayloadVariant: @unchecked Sendable {} -extension Config.DeviceConfig: @unchecked Sendable {} -extension Config.DeviceConfig.Role: @unchecked Sendable {} -extension Config.DeviceConfig.RebroadcastMode: @unchecked Sendable {} -extension Config.PositionConfig: @unchecked Sendable {} -extension Config.PositionConfig.PositionFlags: @unchecked Sendable {} -extension Config.PowerConfig: @unchecked Sendable {} -extension Config.NetworkConfig: @unchecked Sendable {} -extension Config.NetworkConfig.AddressMode: @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.DisplayConfig.DisplayMode: @unchecked Sendable {} -extension Config.LoRaConfig: @unchecked Sendable {} -extension Config.LoRaConfig.RegionCode: @unchecked Sendable {} -extension Config.LoRaConfig.ModemPreset: @unchecked Sendable {} -extension Config.BluetoothConfig: @unchecked Sendable {} -extension Config.BluetoothConfig.PairingMode: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Config" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "device"), - 2: .same(proto: "position"), - 3: .same(proto: "power"), - 4: .same(proto: "network"), - 5: .same(proto: "display"), - 6: .same(proto: "lora"), - 7: .same(proto: "bluetooth"), - ] - - 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 { - var v: Config.DeviceConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .device(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .device(v) - } - }() - case 2: try { - var v: Config.PositionConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .position(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .position(v) - } - }() - case 3: try { - var v: Config.PowerConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .power(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .power(v) - } - }() - case 4: try { - var v: Config.NetworkConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .network(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .network(v) - } - }() - case 5: try { - var v: Config.DisplayConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .display(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .display(v) - } - }() - case 6: try { - var v: Config.LoRaConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .lora(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .lora(v) - } - }() - case 7: try { - var v: Config.BluetoothConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .bluetooth(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .bluetooth(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 - switch self.payloadVariant { - case .device?: try { - guard case .device(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .position?: try { - guard case .position(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case .power?: try { - guard case .power(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - }() - case .network?: try { - guard case .network(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - }() - case .display?: try { - guard case .display(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - }() - case .lora?: try { - guard case .lora(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - }() - case .bluetooth?: try { - guard case .bluetooth(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config, rhs: Config) -> Bool { - if lhs.payloadVariant != rhs.payloadVariant {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.DeviceConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".DeviceConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "role"), - 2: .standard(proto: "serial_enabled"), - 3: .standard(proto: "debug_log_enabled"), - 4: .standard(proto: "button_gpio"), - 5: .standard(proto: "buzzer_gpio"), - 6: .standard(proto: "rebroadcast_mode"), - ] - - 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.decodeSingularEnumField(value: &self.role) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.serialEnabled) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self.debugLogEnabled) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.buttonGpio) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.buzzerGpio) }() - case 6: try { try decoder.decodeSingularEnumField(value: &self.rebroadcastMode) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.role != .client { - try visitor.visitSingularEnumField(value: self.role, fieldNumber: 1) - } - if self.serialEnabled != false { - try visitor.visitSingularBoolField(value: self.serialEnabled, fieldNumber: 2) - } - if self.debugLogEnabled != false { - try visitor.visitSingularBoolField(value: self.debugLogEnabled, fieldNumber: 3) - } - if self.buttonGpio != 0 { - try visitor.visitSingularUInt32Field(value: self.buttonGpio, fieldNumber: 4) - } - if self.buzzerGpio != 0 { - try visitor.visitSingularUInt32Field(value: self.buzzerGpio, fieldNumber: 5) - } - if self.rebroadcastMode != .all { - try visitor.visitSingularEnumField(value: self.rebroadcastMode, fieldNumber: 6) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.DeviceConfig, rhs: Config.DeviceConfig) -> Bool { - if lhs.role != rhs.role {return false} - if lhs.serialEnabled != rhs.serialEnabled {return false} - if lhs.debugLogEnabled != rhs.debugLogEnabled {return false} - if lhs.buttonGpio != rhs.buttonGpio {return false} - if lhs.buzzerGpio != rhs.buzzerGpio {return false} - if lhs.rebroadcastMode != rhs.rebroadcastMode {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.DeviceConfig.Role: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "CLIENT"), - 1: .same(proto: "CLIENT_MUTE"), - 2: .same(proto: "ROUTER"), - 3: .same(proto: "ROUTER_CLIENT"), - 4: .same(proto: "REPEATER"), - 5: .same(proto: "TRACKER"), - ] -} - -extension Config.DeviceConfig.RebroadcastMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "ALL"), - 1: .same(proto: "ALL_SKIP_DECODING"), - 2: .same(proto: "LOCAL_ONLY"), - ] -} - -extension Config.PositionConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".PositionConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "position_broadcast_secs"), - 2: .standard(proto: "position_broadcast_smart_enabled"), - 3: .standard(proto: "fixed_position"), - 4: .standard(proto: "gps_enabled"), - 5: .standard(proto: "gps_update_interval"), - 6: .standard(proto: "gps_attempt_time"), - 7: .standard(proto: "position_flags"), - 8: .standard(proto: "rx_gpio"), - 9: .standard(proto: "tx_gpio"), - ] - - 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.positionBroadcastSecs) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.positionBroadcastSmartEnabled) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self.fixedPosition) }() - case 4: try { try decoder.decodeSingularBoolField(value: &self.gpsEnabled) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.gpsUpdateInterval) }() - case 6: try { try decoder.decodeSingularUInt32Field(value: &self.gpsAttemptTime) }() - case 7: try { try decoder.decodeSingularUInt32Field(value: &self.positionFlags) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &self.rxGpio) }() - case 9: try { try decoder.decodeSingularUInt32Field(value: &self.txGpio) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.positionBroadcastSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.positionBroadcastSecs, fieldNumber: 1) - } - if self.positionBroadcastSmartEnabled != false { - try visitor.visitSingularBoolField(value: self.positionBroadcastSmartEnabled, fieldNumber: 2) - } - if self.fixedPosition != false { - try visitor.visitSingularBoolField(value: self.fixedPosition, fieldNumber: 3) - } - if self.gpsEnabled != false { - try visitor.visitSingularBoolField(value: self.gpsEnabled, fieldNumber: 4) - } - if self.gpsUpdateInterval != 0 { - try visitor.visitSingularUInt32Field(value: self.gpsUpdateInterval, fieldNumber: 5) - } - if self.gpsAttemptTime != 0 { - try visitor.visitSingularUInt32Field(value: self.gpsAttemptTime, fieldNumber: 6) - } - if self.positionFlags != 0 { - try visitor.visitSingularUInt32Field(value: self.positionFlags, fieldNumber: 7) - } - if self.rxGpio != 0 { - try visitor.visitSingularUInt32Field(value: self.rxGpio, fieldNumber: 8) - } - if self.txGpio != 0 { - try visitor.visitSingularUInt32Field(value: self.txGpio, fieldNumber: 9) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.PositionConfig, rhs: Config.PositionConfig) -> Bool { - if lhs.positionBroadcastSecs != rhs.positionBroadcastSecs {return false} - if lhs.positionBroadcastSmartEnabled != rhs.positionBroadcastSmartEnabled {return false} - if lhs.fixedPosition != rhs.fixedPosition {return false} - if lhs.gpsEnabled != rhs.gpsEnabled {return false} - if lhs.gpsUpdateInterval != rhs.gpsUpdateInterval {return false} - if lhs.gpsAttemptTime != rhs.gpsAttemptTime {return false} - if lhs.positionFlags != rhs.positionFlags {return false} - if lhs.rxGpio != rhs.rxGpio {return false} - if lhs.txGpio != rhs.txGpio {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.PositionConfig.PositionFlags: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNSET"), - 1: .same(proto: "ALTITUDE"), - 2: .same(proto: "ALTITUDE_MSL"), - 4: .same(proto: "GEOIDAL_SEPARATION"), - 8: .same(proto: "DOP"), - 16: .same(proto: "HVDOP"), - 32: .same(proto: "SATINVIEW"), - 64: .same(proto: "SEQ_NO"), - 128: .same(proto: "TIMESTAMP"), - 256: .same(proto: "HEADING"), - 512: .same(proto: "SPEED"), - ] -} - -extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".PowerConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "is_power_saving"), - 2: .standard(proto: "on_battery_shutdown_after_secs"), - 3: .standard(proto: "adc_multiplier_override"), - 4: .standard(proto: "wait_bluetooth_secs"), - 5: .standard(proto: "mesh_sds_timeout_secs"), - 6: .standard(proto: "sds_secs"), - 7: .standard(proto: "ls_secs"), - 8: .standard(proto: "min_wake_secs"), - ] - - 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.isPowerSaving) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.onBatteryShutdownAfterSecs) }() - case 3: try { try decoder.decodeSingularFloatField(value: &self.adcMultiplierOverride) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.waitBluetoothSecs) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.meshSdsTimeoutSecs) }() - case 6: try { try decoder.decodeSingularUInt32Field(value: &self.sdsSecs) }() - case 7: try { try decoder.decodeSingularUInt32Field(value: &self.lsSecs) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &self.minWakeSecs) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.isPowerSaving != false { - try visitor.visitSingularBoolField(value: self.isPowerSaving, fieldNumber: 1) - } - if self.onBatteryShutdownAfterSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.onBatteryShutdownAfterSecs, fieldNumber: 2) - } - if self.adcMultiplierOverride != 0 { - try visitor.visitSingularFloatField(value: self.adcMultiplierOverride, fieldNumber: 3) - } - if self.waitBluetoothSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.waitBluetoothSecs, fieldNumber: 4) - } - if self.meshSdsTimeoutSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.meshSdsTimeoutSecs, fieldNumber: 5) - } - if self.sdsSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.sdsSecs, fieldNumber: 6) - } - if self.lsSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.lsSecs, fieldNumber: 7) - } - if self.minWakeSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.minWakeSecs, fieldNumber: 8) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.PowerConfig, rhs: Config.PowerConfig) -> Bool { - if lhs.isPowerSaving != rhs.isPowerSaving {return false} - if lhs.onBatteryShutdownAfterSecs != rhs.onBatteryShutdownAfterSecs {return false} - if lhs.adcMultiplierOverride != rhs.adcMultiplierOverride {return false} - if lhs.waitBluetoothSecs != rhs.waitBluetoothSecs {return false} - if lhs.meshSdsTimeoutSecs != rhs.meshSdsTimeoutSecs {return false} - if lhs.sdsSecs != rhs.sdsSecs {return false} - if lhs.lsSecs != rhs.lsSecs {return false} - if lhs.minWakeSecs != rhs.minWakeSecs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.NetworkConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".NetworkConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "wifi_enabled"), - 3: .standard(proto: "wifi_ssid"), - 4: .standard(proto: "wifi_psk"), - 5: .standard(proto: "ntp_server"), - 6: .standard(proto: "eth_enabled"), - 7: .standard(proto: "address_mode"), - 8: .standard(proto: "ipv4_config"), - 9: .standard(proto: "rsyslog_server"), - ] - - 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.wifiEnabled) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.wifiSsid) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.wifiPsk) }() - case 5: try { try decoder.decodeSingularStringField(value: &self.ntpServer) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self.ethEnabled) }() - case 7: try { try decoder.decodeSingularEnumField(value: &self.addressMode) }() - case 8: try { try decoder.decodeSingularMessageField(value: &self._ipv4Config) }() - case 9: try { try decoder.decodeSingularStringField(value: &self.rsyslogServer) }() - 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.wifiEnabled != false { - try visitor.visitSingularBoolField(value: self.wifiEnabled, fieldNumber: 1) - } - if !self.wifiSsid.isEmpty { - try visitor.visitSingularStringField(value: self.wifiSsid, fieldNumber: 3) - } - if !self.wifiPsk.isEmpty { - try visitor.visitSingularStringField(value: self.wifiPsk, fieldNumber: 4) - } - if !self.ntpServer.isEmpty { - try visitor.visitSingularStringField(value: self.ntpServer, fieldNumber: 5) - } - if self.ethEnabled != false { - try visitor.visitSingularBoolField(value: self.ethEnabled, fieldNumber: 6) - } - if self.addressMode != .dhcp { - try visitor.visitSingularEnumField(value: self.addressMode, fieldNumber: 7) - } - try { if let v = self._ipv4Config { - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - } }() - if !self.rsyslogServer.isEmpty { - try visitor.visitSingularStringField(value: self.rsyslogServer, fieldNumber: 9) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.NetworkConfig, rhs: Config.NetworkConfig) -> Bool { - if lhs.wifiEnabled != rhs.wifiEnabled {return false} - if lhs.wifiSsid != rhs.wifiSsid {return false} - if lhs.wifiPsk != rhs.wifiPsk {return false} - if lhs.ntpServer != rhs.ntpServer {return false} - if lhs.ethEnabled != rhs.ethEnabled {return false} - if lhs.addressMode != rhs.addressMode {return false} - if lhs._ipv4Config != rhs._ipv4Config {return false} - if lhs.rsyslogServer != rhs.rsyslogServer {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.NetworkConfig.AddressMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "DHCP"), - 1: .same(proto: "STATIC"), - ] -} - -extension Config.NetworkConfig.IpV4Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.NetworkConfig.protoMessageName + ".IpV4Config" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "ip"), - 2: .same(proto: "gateway"), - 3: .same(proto: "subnet"), - 4: .same(proto: "dns"), - ] - - 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.ip) }() - case 2: try { try decoder.decodeSingularFixed32Field(value: &self.gateway) }() - case 3: try { try decoder.decodeSingularFixed32Field(value: &self.subnet) }() - case 4: try { try decoder.decodeSingularFixed32Field(value: &self.dns) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.ip != 0 { - try visitor.visitSingularFixed32Field(value: self.ip, fieldNumber: 1) - } - if self.gateway != 0 { - try visitor.visitSingularFixed32Field(value: self.gateway, fieldNumber: 2) - } - if self.subnet != 0 { - try visitor.visitSingularFixed32Field(value: self.subnet, fieldNumber: 3) - } - if self.dns != 0 { - try visitor.visitSingularFixed32Field(value: self.dns, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.NetworkConfig.IpV4Config, rhs: Config.NetworkConfig.IpV4Config) -> Bool { - if lhs.ip != rhs.ip {return false} - if lhs.gateway != rhs.gateway {return false} - if lhs.subnet != rhs.subnet {return false} - if lhs.dns != rhs.dns {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".DisplayConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "screen_on_secs"), - 2: .standard(proto: "gps_format"), - 3: .standard(proto: "auto_screen_carousel_secs"), - 4: .standard(proto: "compass_north_top"), - 5: .standard(proto: "flip_screen"), - 6: .same(proto: "units"), - 7: .same(proto: "oled"), - 8: .same(proto: "displaymode"), - 9: .standard(proto: "heading_bold"), - ] - - 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.screenOnSecs) }() - case 2: try { try decoder.decodeSingularEnumField(value: &self.gpsFormat) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.autoScreenCarouselSecs) }() - 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) }() - case 8: try { try decoder.decodeSingularEnumField(value: &self.displaymode) }() - case 9: try { try decoder.decodeSingularBoolField(value: &self.headingBold) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.screenOnSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.screenOnSecs, fieldNumber: 1) - } - if self.gpsFormat != .dec { - try visitor.visitSingularEnumField(value: self.gpsFormat, fieldNumber: 2) - } - if self.autoScreenCarouselSecs != 0 { - try visitor.visitSingularUInt32Field(value: self.autoScreenCarouselSecs, fieldNumber: 3) - } - if self.compassNorthTop != false { - try visitor.visitSingularBoolField(value: self.compassNorthTop, fieldNumber: 4) - } - if self.flipScreen != false { - try visitor.visitSingularBoolField(value: self.flipScreen, fieldNumber: 5) - } - if self.units != .metric { - try visitor.visitSingularEnumField(value: self.units, fieldNumber: 6) - } - if self.oled != .oledAuto { - try visitor.visitSingularEnumField(value: self.oled, fieldNumber: 7) - } - if self.displaymode != .default { - try visitor.visitSingularEnumField(value: self.displaymode, fieldNumber: 8) - } - if self.headingBold != false { - try visitor.visitSingularBoolField(value: self.headingBold, fieldNumber: 9) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.DisplayConfig, rhs: Config.DisplayConfig) -> Bool { - if lhs.screenOnSecs != rhs.screenOnSecs {return false} - if lhs.gpsFormat != rhs.gpsFormat {return false} - if lhs.autoScreenCarouselSecs != rhs.autoScreenCarouselSecs {return false} - 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.displaymode != rhs.displaymode {return false} - if lhs.headingBold != rhs.headingBold {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.DisplayConfig.GpsCoordinateFormat: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "DEC"), - 1: .same(proto: "DMS"), - 2: .same(proto: "UTM"), - 3: .same(proto: "MGRS"), - 4: .same(proto: "OLC"), - 5: .same(proto: "OSGR"), - ] -} - -extension Config.DisplayConfig.DisplayUnits: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "METRIC"), - 1: .same(proto: "IMPERIAL"), - ] -} - -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"), - 3: .same(proto: "OLED_SH1107"), - ] -} - -extension Config.DisplayConfig.DisplayMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "DEFAULT"), - 1: .same(proto: "TWOCOLOR"), - 2: .same(proto: "INVERTED"), - 3: .same(proto: "COLOR"), - ] -} - -extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".LoRaConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "use_preset"), - 2: .standard(proto: "modem_preset"), - 3: .same(proto: "bandwidth"), - 4: .standard(proto: "spread_factor"), - 5: .standard(proto: "coding_rate"), - 6: .standard(proto: "frequency_offset"), - 7: .same(proto: "region"), - 8: .standard(proto: "hop_limit"), - 9: .standard(proto: "tx_enabled"), - 10: .standard(proto: "tx_power"), - 11: .standard(proto: "channel_num"), - 12: .standard(proto: "override_duty_cycle"), - 13: .standard(proto: "sx126x_rx_boosted_gain"), - 14: .standard(proto: "override_frequency"), - 103: .standard(proto: "ignore_incoming"), - ] - - 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.usePreset) }() - case 2: try { try decoder.decodeSingularEnumField(value: &self.modemPreset) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.bandwidth) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.spreadFactor) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.codingRate) }() - case 6: try { try decoder.decodeSingularFloatField(value: &self.frequencyOffset) }() - case 7: try { try decoder.decodeSingularEnumField(value: &self.region) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &self.hopLimit) }() - case 9: try { try decoder.decodeSingularBoolField(value: &self.txEnabled) }() - case 10: try { try decoder.decodeSingularInt32Field(value: &self.txPower) }() - case 11: try { try decoder.decodeSingularUInt32Field(value: &self.channelNum) }() - case 12: try { try decoder.decodeSingularBoolField(value: &self.overrideDutyCycle) }() - case 13: try { try decoder.decodeSingularBoolField(value: &self.sx126XRxBoostedGain) }() - case 14: try { try decoder.decodeSingularFloatField(value: &self.overrideFrequency) }() - case 103: try { try decoder.decodeRepeatedUInt32Field(value: &self.ignoreIncoming) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.usePreset != false { - try visitor.visitSingularBoolField(value: self.usePreset, fieldNumber: 1) - } - if self.modemPreset != .longFast { - try visitor.visitSingularEnumField(value: self.modemPreset, fieldNumber: 2) - } - if self.bandwidth != 0 { - try visitor.visitSingularUInt32Field(value: self.bandwidth, fieldNumber: 3) - } - if self.spreadFactor != 0 { - try visitor.visitSingularUInt32Field(value: self.spreadFactor, fieldNumber: 4) - } - if self.codingRate != 0 { - try visitor.visitSingularUInt32Field(value: self.codingRate, fieldNumber: 5) - } - if self.frequencyOffset != 0 { - try visitor.visitSingularFloatField(value: self.frequencyOffset, fieldNumber: 6) - } - if self.region != .unset { - try visitor.visitSingularEnumField(value: self.region, fieldNumber: 7) - } - if self.hopLimit != 0 { - try visitor.visitSingularUInt32Field(value: self.hopLimit, fieldNumber: 8) - } - if self.txEnabled != false { - try visitor.visitSingularBoolField(value: self.txEnabled, fieldNumber: 9) - } - if self.txPower != 0 { - try visitor.visitSingularInt32Field(value: self.txPower, fieldNumber: 10) - } - if self.channelNum != 0 { - try visitor.visitSingularUInt32Field(value: self.channelNum, fieldNumber: 11) - } - if self.overrideDutyCycle != false { - try visitor.visitSingularBoolField(value: self.overrideDutyCycle, fieldNumber: 12) - } - if self.sx126XRxBoostedGain != false { - try visitor.visitSingularBoolField(value: self.sx126XRxBoostedGain, fieldNumber: 13) - } - if self.overrideFrequency != 0 { - try visitor.visitSingularFloatField(value: self.overrideFrequency, fieldNumber: 14) - } - if !self.ignoreIncoming.isEmpty { - try visitor.visitPackedUInt32Field(value: self.ignoreIncoming, fieldNumber: 103) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.LoRaConfig, rhs: Config.LoRaConfig) -> Bool { - if lhs.usePreset != rhs.usePreset {return false} - if lhs.modemPreset != rhs.modemPreset {return false} - if lhs.bandwidth != rhs.bandwidth {return false} - if lhs.spreadFactor != rhs.spreadFactor {return false} - if lhs.codingRate != rhs.codingRate {return false} - if lhs.frequencyOffset != rhs.frequencyOffset {return false} - if lhs.region != rhs.region {return false} - if lhs.hopLimit != rhs.hopLimit {return false} - if lhs.txEnabled != rhs.txEnabled {return false} - if lhs.txPower != rhs.txPower {return false} - if lhs.channelNum != rhs.channelNum {return false} - if lhs.overrideDutyCycle != rhs.overrideDutyCycle {return false} - if lhs.sx126XRxBoostedGain != rhs.sx126XRxBoostedGain {return false} - if lhs.overrideFrequency != rhs.overrideFrequency {return false} - if lhs.ignoreIncoming != rhs.ignoreIncoming {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.LoRaConfig.RegionCode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNSET"), - 1: .same(proto: "US"), - 2: .same(proto: "EU_433"), - 3: .same(proto: "EU_868"), - 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: "NZ_865"), - 12: .same(proto: "TH"), - 13: .same(proto: "LORA_24"), - 14: .same(proto: "UA_433"), - 15: .same(proto: "UA_868"), - ] -} - -extension Config.LoRaConfig.ModemPreset: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "LONG_FAST"), - 1: .same(proto: "LONG_SLOW"), - 2: .same(proto: "VERY_LONG_SLOW"), - 3: .same(proto: "MEDIUM_SLOW"), - 4: .same(proto: "MEDIUM_FAST"), - 5: .same(proto: "SHORT_SLOW"), - 6: .same(proto: "SHORT_FAST"), - 7: .same(proto: "LONG_MODERATE"), - ] -} - -extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".BluetoothConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "enabled"), - 2: .same(proto: "mode"), - 3: .standard(proto: "fixed_pin"), - ] - - 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.enabled) }() - case 2: try { try decoder.decodeSingularEnumField(value: &self.mode) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.fixedPin) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) - } - if self.mode != .randomPin { - try visitor.visitSingularEnumField(value: self.mode, fieldNumber: 2) - } - if self.fixedPin != 0 { - try visitor.visitSingularUInt32Field(value: self.fixedPin, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Config.BluetoothConfig, rhs: Config.BluetoothConfig) -> Bool { - if lhs.enabled != rhs.enabled {return false} - if lhs.mode != rhs.mode {return false} - if lhs.fixedPin != rhs.fixedPin {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Config.BluetoothConfig.PairingMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "RANDOM_PIN"), - 1: .same(proto: "FIXED_PIN"), - 2: .same(proto: "NO_PIN"), - ] -} diff --git a/Meshtastic/Protobufs/device_metadata.pb.swift b/Meshtastic/Protobufs/device_metadata.pb.swift deleted file mode 100644 index 7c41e60f..00000000 --- a/Meshtastic/Protobufs/device_metadata.pb.swift +++ /dev/null @@ -1,145 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: device_metadata.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 -} - -/// -/// Device metadata response -struct DeviceMetadata { - // 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. - - /// - /// Device firmware version string - var firmwareVersion: String = String() - - /// - /// Device state version - var deviceStateVersion: UInt32 = 0 - - /// - /// Indicates whether the device can shutdown CPU natively or via power management chip - var canShutdown: Bool = false - - /// - /// Indicates that the device has native wifi capability - var hasWifi_p: Bool = false - - /// - /// Indicates that the device has native bluetooth capability - var hasBluetooth_p: Bool = false - - /// - /// Indicates that the device has an ethernet peripheral - var hasEthernet_p: Bool = false - - /// - /// Indicates that the device's role in the mesh - var role: Config.DeviceConfig.Role = .client - - /// - /// Indicates the device's current enabled position flags - var positionFlags: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension DeviceMetadata: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension DeviceMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "DeviceMetadata" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "firmware_version"), - 2: .standard(proto: "device_state_version"), - 3: .same(proto: "canShutdown"), - 4: .same(proto: "hasWifi"), - 5: .same(proto: "hasBluetooth"), - 6: .same(proto: "hasEthernet"), - 7: .same(proto: "role"), - 8: .standard(proto: "position_flags"), - ] - - 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.firmwareVersion) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.deviceStateVersion) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self.canShutdown) }() - case 4: try { try decoder.decodeSingularBoolField(value: &self.hasWifi_p) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self.hasBluetooth_p) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self.hasEthernet_p) }() - case 7: try { try decoder.decodeSingularEnumField(value: &self.role) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &self.positionFlags) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.firmwareVersion.isEmpty { - try visitor.visitSingularStringField(value: self.firmwareVersion, fieldNumber: 1) - } - if self.deviceStateVersion != 0 { - try visitor.visitSingularUInt32Field(value: self.deviceStateVersion, fieldNumber: 2) - } - if self.canShutdown != false { - try visitor.visitSingularBoolField(value: self.canShutdown, fieldNumber: 3) - } - if self.hasWifi_p != false { - try visitor.visitSingularBoolField(value: self.hasWifi_p, fieldNumber: 4) - } - if self.hasBluetooth_p != false { - try visitor.visitSingularBoolField(value: self.hasBluetooth_p, fieldNumber: 5) - } - if self.hasEthernet_p != false { - try visitor.visitSingularBoolField(value: self.hasEthernet_p, fieldNumber: 6) - } - if self.role != .client { - try visitor.visitSingularEnumField(value: self.role, fieldNumber: 7) - } - if self.positionFlags != 0 { - try visitor.visitSingularUInt32Field(value: self.positionFlags, fieldNumber: 8) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: DeviceMetadata, rhs: DeviceMetadata) -> Bool { - if lhs.firmwareVersion != rhs.firmwareVersion {return false} - if lhs.deviceStateVersion != rhs.deviceStateVersion {return false} - if lhs.canShutdown != rhs.canShutdown {return false} - if lhs.hasWifi_p != rhs.hasWifi_p {return false} - if lhs.hasBluetooth_p != rhs.hasBluetooth_p {return false} - if lhs.hasEthernet_p != rhs.hasEthernet_p {return false} - if lhs.role != rhs.role {return false} - if lhs.positionFlags != rhs.positionFlags {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/deviceonly.pb.swift b/Meshtastic/Protobufs/deviceonly.pb.swift deleted file mode 100644 index b75c793c..00000000 --- a/Meshtastic/Protobufs/deviceonly.pb.swift +++ /dev/null @@ -1,508 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: deviceonly.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 -} - -/// -/// TODO: REPLACE -enum ScreenFonts: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// TODO: REPLACE - case fontSmall // = 0 - - /// - /// TODO: REPLACE - case fontMedium // = 1 - - /// - /// TODO: REPLACE - case fontLarge // = 2 - case UNRECOGNIZED(Int) - - init() { - self = .fontSmall - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .fontSmall - case 1: self = .fontMedium - case 2: self = .fontLarge - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .fontSmall: return 0 - case .fontMedium: return 1 - case .fontLarge: return 2 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension ScreenFonts: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [ScreenFonts] = [ - .fontSmall, - .fontMedium, - .fontLarge, - ] -} - -#endif // swift(>=4.2) - -/// -/// This message is never sent over the wire, but it is used for serializing DB -/// state to flash in the device code -/// FIXME, since we write this each time we enter deep sleep (and have infinite -/// flash) it would be better to use some sort of append only data structure for -/// the receive queue and use the preferences store for the other stuff -struct DeviceState { - // 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. - - /// - /// Read only settings/info about this node - var myNode: MyNodeInfo { - get {return _storage._myNode ?? MyNodeInfo()} - set {_uniqueStorage()._myNode = newValue} - } - /// Returns true if `myNode` has been explicitly set. - var hasMyNode: Bool {return _storage._myNode != nil} - /// Clears the value of `myNode`. Subsequent reads from it will return its default value. - mutating func clearMyNode() {_uniqueStorage()._myNode = nil} - - /// - /// My owner info - var owner: User { - get {return _storage._owner ?? User()} - set {_uniqueStorage()._owner = newValue} - } - /// Returns true if `owner` has been explicitly set. - var hasOwner: Bool {return _storage._owner != nil} - /// 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} - } - - /// - /// Received packets saved for delivery to the phone - var receiveQueue: [MeshPacket] { - get {return _storage._receiveQueue} - set {_uniqueStorage()._receiveQueue = newValue} - } - - /// - /// 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 - /// NodeDB.cpp in the device code. - var version: UInt32 { - get {return _storage._version} - set {_uniqueStorage()._version = newValue} - } - - /// - /// We keep the last received text message (only) stored in the device flash, - /// so we can show it on the screen. - /// Might be null - var rxTextMessage: MeshPacket { - get {return _storage._rxTextMessage ?? MeshPacket()} - set {_uniqueStorage()._rxTextMessage = newValue} - } - /// Returns true if `rxTextMessage` has been explicitly set. - var hasRxTextMessage: Bool {return _storage._rxTextMessage != nil} - /// Clears the value of `rxTextMessage`. Subsequent reads from it will return its default value. - mutating func clearRxTextMessage() {_uniqueStorage()._rxTextMessage = nil} - - /// - /// Used only during development. - /// Indicates developer is testing and changes should never be saved to flash. - var noSave: Bool { - get {return _storage._noSave} - set {_uniqueStorage()._noSave = newValue} - } - - /// - /// Some GPSes seem to have bogus settings from the factory, so we always do one factory reset. - var didGpsReset: Bool { - get {return _storage._didGpsReset} - set {_uniqueStorage()._didGpsReset = newValue} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -/// -/// The on-disk saved channels -struct ChannelFile { - // 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 channels our node knows about - var channels: [Channel] = [] - - /// - /// 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 - /// NodeDB.cpp in the device code. - var version: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// This can be used for customizing the firmware distribution. If populated, -/// show a secondary bootup screen with cuatom logo and text for 2.5 seconds. -struct OEMStore { - // 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 Logo width in Px - var oemIconWidth: UInt32 = 0 - - /// - /// The Logo height in Px - var oemIconHeight: UInt32 = 0 - - /// - /// The Logo in xbm bytechar format - var oemIconBits: Data = Data() - - /// - /// Use this font for the OEM text. - var oemFont: ScreenFonts = .fontSmall - - /// - /// Use this font for the OEM text. - var oemText: String = String() - - /// - /// The default device encryption key, 16 or 32 byte - var oemAesKey: Data = Data() - - /// - /// A Preset LocalConfig to apply during factory reset - var oemLocalConfig: LocalConfig { - get {return _oemLocalConfig ?? LocalConfig()} - set {_oemLocalConfig = newValue} - } - /// Returns true if `oemLocalConfig` has been explicitly set. - var hasOemLocalConfig: Bool {return self._oemLocalConfig != nil} - /// Clears the value of `oemLocalConfig`. Subsequent reads from it will return its default value. - mutating func clearOemLocalConfig() {self._oemLocalConfig = nil} - - /// - /// A Preset LocalModuleConfig to apply during factory reset - var oemLocalModuleConfig: LocalModuleConfig { - get {return _oemLocalModuleConfig ?? LocalModuleConfig()} - set {_oemLocalModuleConfig = newValue} - } - /// Returns true if `oemLocalModuleConfig` has been explicitly set. - var hasOemLocalModuleConfig: Bool {return self._oemLocalModuleConfig != nil} - /// Clears the value of `oemLocalModuleConfig`. Subsequent reads from it will return its default value. - mutating func clearOemLocalModuleConfig() {self._oemLocalModuleConfig = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _oemLocalConfig: LocalConfig? = nil - fileprivate var _oemLocalModuleConfig: LocalModuleConfig? = nil -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension ScreenFonts: @unchecked Sendable {} -extension DeviceState: @unchecked Sendable {} -extension ChannelFile: @unchecked Sendable {} -extension OEMStore: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension ScreenFonts: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "FONT_SMALL"), - 1: .same(proto: "FONT_MEDIUM"), - 2: .same(proto: "FONT_LARGE"), - ] -} - -extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "DeviceState" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 2: .standard(proto: "my_node"), - 3: .same(proto: "owner"), - 4: .standard(proto: "node_db"), - 5: .standard(proto: "receive_queue"), - 8: .same(proto: "version"), - 7: .standard(proto: "rx_text_message"), - 9: .standard(proto: "no_save"), - 11: .standard(proto: "did_gps_reset"), - ] - - fileprivate class _StorageClass { - var _myNode: MyNodeInfo? = nil - var _owner: User? = nil - var _nodeDb: [NodeInfo] = [] - var _receiveQueue: [MeshPacket] = [] - var _version: UInt32 = 0 - var _rxTextMessage: MeshPacket? = nil - var _noSave: Bool = false - var _didGpsReset: Bool = false - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _myNode = source._myNode - _owner = source._owner - _nodeDb = source._nodeDb - _receiveQueue = source._receiveQueue - _version = source._version - _rxTextMessage = source._rxTextMessage - _noSave = source._noSave - _didGpsReset = source._didGpsReset - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _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 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) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &_storage._receiveQueue) }() - case 7: try { try decoder.decodeSingularMessageField(value: &_storage._rxTextMessage) }() - 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) }() - default: break - } - } - } - } - - 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 - try { if let v = _storage._myNode { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - 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) - } - 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) - } - if _storage._noSave != false { - try visitor.visitSingularBoolField(value: _storage._noSave, fieldNumber: 9) - } - if _storage._didGpsReset != false { - try visitor.visitSingularBoolField(value: _storage._didGpsReset, fieldNumber: 11) - } - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: DeviceState, rhs: DeviceState) -> Bool { - 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._myNode != rhs_storage._myNode {return false} - if _storage._owner != rhs_storage._owner {return false} - if _storage._nodeDb != rhs_storage._nodeDb {return false} - if _storage._receiveQueue != rhs_storage._receiveQueue {return false} - if _storage._version != rhs_storage._version {return false} - if _storage._rxTextMessage != rhs_storage._rxTextMessage {return false} - if _storage._noSave != rhs_storage._noSave {return false} - if _storage._didGpsReset != rhs_storage._didGpsReset {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "ChannelFile" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "channels"), - 2: .same(proto: "version"), - ] - - 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.decodeRepeatedMessageField(value: &self.channels) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.version) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.channels.isEmpty { - try visitor.visitRepeatedMessageField(value: self.channels, fieldNumber: 1) - } - if self.version != 0 { - try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ChannelFile, rhs: ChannelFile) -> Bool { - if lhs.channels != rhs.channels {return false} - if lhs.version != rhs.version {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "OEMStore" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "oem_icon_width"), - 2: .standard(proto: "oem_icon_height"), - 3: .standard(proto: "oem_icon_bits"), - 4: .standard(proto: "oem_font"), - 5: .standard(proto: "oem_text"), - 6: .standard(proto: "oem_aes_key"), - 7: .standard(proto: "oem_local_config"), - 8: .standard(proto: "oem_local_module_config"), - ] - - 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.oemIconWidth) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.oemIconHeight) }() - case 3: try { try decoder.decodeSingularBytesField(value: &self.oemIconBits) }() - case 4: try { try decoder.decodeSingularEnumField(value: &self.oemFont) }() - case 5: try { try decoder.decodeSingularStringField(value: &self.oemText) }() - case 6: try { try decoder.decodeSingularBytesField(value: &self.oemAesKey) }() - case 7: try { try decoder.decodeSingularMessageField(value: &self._oemLocalConfig) }() - case 8: try { try decoder.decodeSingularMessageField(value: &self._oemLocalModuleConfig) }() - 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.oemIconWidth != 0 { - try visitor.visitSingularUInt32Field(value: self.oemIconWidth, fieldNumber: 1) - } - if self.oemIconHeight != 0 { - try visitor.visitSingularUInt32Field(value: self.oemIconHeight, fieldNumber: 2) - } - if !self.oemIconBits.isEmpty { - try visitor.visitSingularBytesField(value: self.oemIconBits, fieldNumber: 3) - } - if self.oemFont != .fontSmall { - try visitor.visitSingularEnumField(value: self.oemFont, fieldNumber: 4) - } - if !self.oemText.isEmpty { - try visitor.visitSingularStringField(value: self.oemText, fieldNumber: 5) - } - if !self.oemAesKey.isEmpty { - try visitor.visitSingularBytesField(value: self.oemAesKey, fieldNumber: 6) - } - try { if let v = self._oemLocalConfig { - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - } }() - try { if let v = self._oemLocalModuleConfig { - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: OEMStore, rhs: OEMStore) -> Bool { - if lhs.oemIconWidth != rhs.oemIconWidth {return false} - if lhs.oemIconHeight != rhs.oemIconHeight {return false} - if lhs.oemIconBits != rhs.oemIconBits {return false} - if lhs.oemFont != rhs.oemFont {return false} - if lhs.oemText != rhs.oemText {return false} - if lhs.oemAesKey != rhs.oemAesKey {return false} - if lhs._oemLocalConfig != rhs._oemLocalConfig {return false} - if lhs._oemLocalModuleConfig != rhs._oemLocalModuleConfig {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/localonly.pb.swift b/Meshtastic/Protobufs/localonly.pb.swift deleted file mode 100644 index 741b8e2d..00000000 --- a/Meshtastic/Protobufs/localonly.pb.swift +++ /dev/null @@ -1,510 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: localonly.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 LocalConfig { - // 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 part of the config that is specific to the Device - var device: Config.DeviceConfig { - get {return _storage._device ?? Config.DeviceConfig()} - set {_uniqueStorage()._device = newValue} - } - /// Returns true if `device` has been explicitly set. - var hasDevice: Bool {return _storage._device != nil} - /// Clears the value of `device`. Subsequent reads from it will return its default value. - mutating func clearDevice() {_uniqueStorage()._device = nil} - - /// - /// The part of the config that is specific to the GPS Position - var position: Config.PositionConfig { - get {return _storage._position ?? Config.PositionConfig()} - set {_uniqueStorage()._position = newValue} - } - /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return _storage._position != nil} - /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() {_uniqueStorage()._position = nil} - - /// - /// The part of the config that is specific to the Power settings - var power: Config.PowerConfig { - get {return _storage._power ?? Config.PowerConfig()} - set {_uniqueStorage()._power = newValue} - } - /// Returns true if `power` has been explicitly set. - var hasPower: Bool {return _storage._power != nil} - /// Clears the value of `power`. Subsequent reads from it will return its default value. - mutating func clearPower() {_uniqueStorage()._power = nil} - - /// - /// The part of the config that is specific to the Wifi Settings - var network: Config.NetworkConfig { - get {return _storage._network ?? Config.NetworkConfig()} - set {_uniqueStorage()._network = newValue} - } - /// Returns true if `network` has been explicitly set. - var hasNetwork: Bool {return _storage._network != nil} - /// Clears the value of `network`. Subsequent reads from it will return its default value. - mutating func clearNetwork() {_uniqueStorage()._network = nil} - - /// - /// The part of the config that is specific to the Display - var display: Config.DisplayConfig { - get {return _storage._display ?? Config.DisplayConfig()} - set {_uniqueStorage()._display = newValue} - } - /// Returns true if `display` has been explicitly set. - var hasDisplay: Bool {return _storage._display != nil} - /// Clears the value of `display`. Subsequent reads from it will return its default value. - mutating func clearDisplay() {_uniqueStorage()._display = nil} - - /// - /// The part of the config that is specific to the Lora Radio - var lora: Config.LoRaConfig { - get {return _storage._lora ?? Config.LoRaConfig()} - set {_uniqueStorage()._lora = newValue} - } - /// Returns true if `lora` has been explicitly set. - var hasLora: Bool {return _storage._lora != nil} - /// Clears the value of `lora`. Subsequent reads from it will return its default value. - mutating func clearLora() {_uniqueStorage()._lora = nil} - - /// - /// The part of the config that is specific to the Bluetooth settings - var bluetooth: Config.BluetoothConfig { - get {return _storage._bluetooth ?? Config.BluetoothConfig()} - set {_uniqueStorage()._bluetooth = newValue} - } - /// Returns true if `bluetooth` has been explicitly set. - var hasBluetooth: Bool {return _storage._bluetooth != nil} - /// Clears the value of `bluetooth`. Subsequent reads from it will return its default value. - mutating func clearBluetooth() {_uniqueStorage()._bluetooth = 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 - /// NodeDB.cpp in the device code. - var version: UInt32 { - get {return _storage._version} - set {_uniqueStorage()._version = newValue} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -struct LocalModuleConfig { - // 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 part of the config that is specific to the MQTT module - var mqtt: ModuleConfig.MQTTConfig { - get {return _storage._mqtt ?? ModuleConfig.MQTTConfig()} - set {_uniqueStorage()._mqtt = newValue} - } - /// Returns true if `mqtt` has been explicitly set. - var hasMqtt: Bool {return _storage._mqtt != nil} - /// Clears the value of `mqtt`. Subsequent reads from it will return its default value. - mutating func clearMqtt() {_uniqueStorage()._mqtt = nil} - - /// - /// The part of the config that is specific to the Serial module - var serial: ModuleConfig.SerialConfig { - get {return _storage._serial ?? ModuleConfig.SerialConfig()} - set {_uniqueStorage()._serial = newValue} - } - /// Returns true if `serial` has been explicitly set. - var hasSerial: Bool {return _storage._serial != nil} - /// Clears the value of `serial`. Subsequent reads from it will return its default value. - mutating func clearSerial() {_uniqueStorage()._serial = nil} - - /// - /// The part of the config that is specific to the ExternalNotification module - var externalNotification: ModuleConfig.ExternalNotificationConfig { - get {return _storage._externalNotification ?? ModuleConfig.ExternalNotificationConfig()} - set {_uniqueStorage()._externalNotification = newValue} - } - /// Returns true if `externalNotification` has been explicitly set. - var hasExternalNotification: Bool {return _storage._externalNotification != nil} - /// Clears the value of `externalNotification`. Subsequent reads from it will return its default value. - mutating func clearExternalNotification() {_uniqueStorage()._externalNotification = nil} - - /// - /// The part of the config that is specific to the Store & Forward module - var storeForward: ModuleConfig.StoreForwardConfig { - get {return _storage._storeForward ?? ModuleConfig.StoreForwardConfig()} - set {_uniqueStorage()._storeForward = newValue} - } - /// Returns true if `storeForward` has been explicitly set. - var hasStoreForward: Bool {return _storage._storeForward != nil} - /// Clears the value of `storeForward`. Subsequent reads from it will return its default value. - mutating func clearStoreForward() {_uniqueStorage()._storeForward = nil} - - /// - /// The part of the config that is specific to the RangeTest module - var rangeTest: ModuleConfig.RangeTestConfig { - get {return _storage._rangeTest ?? ModuleConfig.RangeTestConfig()} - set {_uniqueStorage()._rangeTest = newValue} - } - /// Returns true if `rangeTest` has been explicitly set. - var hasRangeTest: Bool {return _storage._rangeTest != nil} - /// Clears the value of `rangeTest`. Subsequent reads from it will return its default value. - mutating func clearRangeTest() {_uniqueStorage()._rangeTest = nil} - - /// - /// The part of the config that is specific to the Telemetry module - var telemetry: ModuleConfig.TelemetryConfig { - get {return _storage._telemetry ?? ModuleConfig.TelemetryConfig()} - 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} - - /// - /// The part of the config that is specific to the Canned Message module - var cannedMessage: ModuleConfig.CannedMessageConfig { - get {return _storage._cannedMessage ?? ModuleConfig.CannedMessageConfig()} - set {_uniqueStorage()._cannedMessage = newValue} - } - /// Returns true if `cannedMessage` has been explicitly set. - var hasCannedMessage: Bool {return _storage._cannedMessage != nil} - /// 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} - - /// - /// The part of the config that is specific to the Remote Hardware module - var remoteHardware: ModuleConfig.RemoteHardwareConfig { - get {return _storage._remoteHardware ?? ModuleConfig.RemoteHardwareConfig()} - set {_uniqueStorage()._remoteHardware = newValue} - } - /// Returns true if `remoteHardware` has been explicitly set. - var hasRemoteHardware: Bool {return _storage._remoteHardware != nil} - /// Clears the value of `remoteHardware`. Subsequent reads from it will return its default value. - mutating func clearRemoteHardware() {_uniqueStorage()._remoteHardware = 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 - /// NodeDB.cpp in the device code. - var version: UInt32 { - get {return _storage._version} - set {_uniqueStorage()._version = newValue} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension LocalConfig: @unchecked Sendable {} -extension LocalModuleConfig: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "LocalConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "device"), - 2: .same(proto: "position"), - 3: .same(proto: "power"), - 4: .same(proto: "network"), - 5: .same(proto: "display"), - 6: .same(proto: "lora"), - 7: .same(proto: "bluetooth"), - 8: .same(proto: "version"), - ] - - fileprivate class _StorageClass { - var _device: Config.DeviceConfig? = nil - var _position: Config.PositionConfig? = nil - var _power: Config.PowerConfig? = nil - var _network: Config.NetworkConfig? = nil - var _display: Config.DisplayConfig? = nil - var _lora: Config.LoRaConfig? = nil - var _bluetooth: Config.BluetoothConfig? = nil - var _version: UInt32 = 0 - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _device = source._device - _position = source._position - _power = source._power - _network = source._network - _display = source._display - _lora = source._lora - _bluetooth = source._bluetooth - _version = source._version - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _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.decodeSingularMessageField(value: &_storage._device) }() - case 2: try { try decoder.decodeSingularMessageField(value: &_storage._position) }() - case 3: try { try decoder.decodeSingularMessageField(value: &_storage._power) }() - case 4: try { try decoder.decodeSingularMessageField(value: &_storage._network) }() - case 5: try { try decoder.decodeSingularMessageField(value: &_storage._display) }() - case 6: try { try decoder.decodeSingularMessageField(value: &_storage._lora) }() - case 7: try { try decoder.decodeSingularMessageField(value: &_storage._bluetooth) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &_storage._version) }() - default: break - } - } - } - } - - 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 - try { if let v = _storage._device { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = _storage._position { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try { if let v = _storage._power { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try { if let v = _storage._network { - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - } }() - try { if let v = _storage._display { - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - } }() - try { if let v = _storage._lora { - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - } }() - try { if let v = _storage._bluetooth { - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - } }() - if _storage._version != 0 { - try visitor.visitSingularUInt32Field(value: _storage._version, fieldNumber: 8) - } - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: LocalConfig, rhs: LocalConfig) -> Bool { - 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._device != rhs_storage._device {return false} - if _storage._position != rhs_storage._position {return false} - if _storage._power != rhs_storage._power {return false} - if _storage._network != rhs_storage._network {return false} - if _storage._display != rhs_storage._display {return false} - if _storage._lora != rhs_storage._lora {return false} - if _storage._bluetooth != rhs_storage._bluetooth {return false} - if _storage._version != rhs_storage._version {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "LocalModuleConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "mqtt"), - 2: .same(proto: "serial"), - 3: .standard(proto: "external_notification"), - 4: .standard(proto: "store_forward"), - 5: .standard(proto: "range_test"), - 6: .same(proto: "telemetry"), - 7: .standard(proto: "canned_message"), - 9: .same(proto: "audio"), - 10: .standard(proto: "remote_hardware"), - 8: .same(proto: "version"), - ] - - fileprivate class _StorageClass { - var _mqtt: ModuleConfig.MQTTConfig? = nil - var _serial: ModuleConfig.SerialConfig? = nil - var _externalNotification: ModuleConfig.ExternalNotificationConfig? = nil - var _storeForward: ModuleConfig.StoreForwardConfig? = nil - var _rangeTest: ModuleConfig.RangeTestConfig? = nil - var _telemetry: ModuleConfig.TelemetryConfig? = nil - var _cannedMessage: ModuleConfig.CannedMessageConfig? = nil - var _audio: ModuleConfig.AudioConfig? = nil - var _remoteHardware: ModuleConfig.RemoteHardwareConfig? = nil - var _version: UInt32 = 0 - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _mqtt = source._mqtt - _serial = source._serial - _externalNotification = source._externalNotification - _storeForward = source._storeForward - _rangeTest = source._rangeTest - _telemetry = source._telemetry - _cannedMessage = source._cannedMessage - _audio = source._audio - _remoteHardware = source._remoteHardware - _version = source._version - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _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.decodeSingularMessageField(value: &_storage._mqtt) }() - case 2: try { try decoder.decodeSingularMessageField(value: &_storage._serial) }() - case 3: try { try decoder.decodeSingularMessageField(value: &_storage._externalNotification) }() - case 4: try { try decoder.decodeSingularMessageField(value: &_storage._storeForward) }() - case 5: try { try decoder.decodeSingularMessageField(value: &_storage._rangeTest) }() - 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) }() - case 10: try { try decoder.decodeSingularMessageField(value: &_storage._remoteHardware) }() - default: break - } - } - } - } - - 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 - try { if let v = _storage._mqtt { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = _storage._serial { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try { if let v = _storage._externalNotification { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try { if let v = _storage._storeForward { - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - } }() - try { if let v = _storage._rangeTest { - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - } }() - try { if let v = _storage._telemetry { - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - } }() - try { if let v = _storage._cannedMessage { - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - } }() - 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 { if let v = _storage._remoteHardware { - try visitor.visitSingularMessageField(value: v, fieldNumber: 10) - } }() - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: LocalModuleConfig, rhs: LocalModuleConfig) -> Bool { - 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._mqtt != rhs_storage._mqtt {return false} - if _storage._serial != rhs_storage._serial {return false} - if _storage._externalNotification != rhs_storage._externalNotification {return false} - if _storage._storeForward != rhs_storage._storeForward {return false} - 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._remoteHardware != rhs_storage._remoteHardware {return false} - if _storage._version != rhs_storage._version {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/mesh.pb.swift b/Meshtastic/Protobufs/mesh.pb.swift deleted file mode 100644 index c2a49acf..00000000 --- a/Meshtastic/Protobufs/mesh.pb.swift +++ /dev/null @@ -1,3781 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: mesh.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 -} - -/// -/// Note: these enum names must EXACTLY match the string used in the device -/// bin/build-all.sh script. -/// Because they will be used to find firmware filenames in the android app for OTA updates. -/// 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). - case heltecV20 // = 5 - - /// - /// TODO: REPLACE - case tbeamV0P7 // = 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 - case heltecV21 // = 10 - - /// - /// Ancient heltec WiFi_Lora_32 board - case heltecV1 // = 11 - - /// - /// New T-BEAM with ESP32-S3 CPU - case lilygoTbeamS3Core // = 12 - - /// - /// RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/ - case rak11200 // = 13 - - /// - /// B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano - case nanoG1 // = 14 - - /// - /// TODO: REPLACE - case tloraV211P8 // = 15 - - /// - /// TODO: REPLACE - case tloraT3S3 // = 16 - - /// - /// B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station - case stationG1 // = 25 - - /// - /// 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 - - /// - /// The simulator built into the android app - case androidSim // = 38 - - /// - /// Custom DIY device based on @NanoVHF schematics: https://github.com/NanoVHF/Meshtastic-DIY/tree/main/Schematics - case diyV1 // = 39 - - /// - /// nRF52840 Dongle : https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle/ - case nrf52840Pca10059 // = 40 - - /// - /// Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio/tree/master/hardware/board_esp32_v3 - case drDev // = 41 - - /// - /// M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ - case m5Stack // = 42 - - /// - /// New Heltec LoRA32 with ESP32-S3 CPU - case heltecV3 // = 43 - - /// - /// New Heltec Wireless Stick Lite with ESP32-S3 CPU - case heltecWslV3 // = 44 - - /// - /// New BETAFPV ELRS Micro TX Module 2.4G with ESP32 CPU - case betafpv2400Tx // = 45 - - /// - /// 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. - case privateHw // = 255 - case UNRECOGNIZED(Int) - - init() { - self = .unset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .unset - case 1: self = .tloraV2 - case 2: self = .tloraV1 - case 3: self = .tloraV211P6 - case 4: self = .tbeam - case 5: self = .heltecV20 - case 6: self = .tbeamV0P7 - case 7: self = .tEcho - case 8: self = .tloraV11P3 - case 9: self = .rak4631 - case 10: self = .heltecV21 - case 11: self = .heltecV1 - case 12: self = .lilygoTbeamS3Core - case 13: self = .rak11200 - case 14: self = .nanoG1 - case 15: self = .tloraV211P8 - case 16: self = .tloraT3S3 - case 25: self = .stationG1 - case 32: self = .loraRelayV1 - case 33: self = .nrf52840Dk - case 34: self = .ppr - case 35: self = .genieblocks - case 36: self = .nrf52Unknown - case 37: self = .portduino - case 38: self = .androidSim - case 39: self = .diyV1 - case 40: self = .nrf52840Pca10059 - case 41: self = .drDev - case 42: self = .m5Stack - case 43: self = .heltecV3 - case 44: self = .heltecWslV3 - case 45: self = .betafpv2400Tx - case 255: self = .privateHw - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .unset: return 0 - case .tloraV2: return 1 - case .tloraV1: return 2 - case .tloraV211P6: return 3 - case .tbeam: return 4 - case .heltecV20: return 5 - case .tbeamV0P7: return 6 - case .tEcho: return 7 - case .tloraV11P3: return 8 - case .rak4631: return 9 - case .heltecV21: return 10 - case .heltecV1: return 11 - case .lilygoTbeamS3Core: return 12 - case .rak11200: return 13 - case .nanoG1: return 14 - case .tloraV211P8: return 15 - case .tloraT3S3: return 16 - case .stationG1: return 25 - case .loraRelayV1: return 32 - case .nrf52840Dk: return 33 - case .ppr: return 34 - case .genieblocks: return 35 - case .nrf52Unknown: return 36 - case .portduino: return 37 - case .androidSim: return 38 - case .diyV1: return 39 - case .nrf52840Pca10059: return 40 - case .drDev: return 41 - case .m5Stack: return 42 - case .heltecV3: return 43 - case .heltecWslV3: return 44 - case .betafpv2400Tx: return 45 - case .privateHw: return 255 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension HardwareModel: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [HardwareModel] = [ - .unset, - .tloraV2, - .tloraV1, - .tloraV211P6, - .tbeam, - .heltecV20, - .tbeamV0P7, - .tEcho, - .tloraV11P3, - .rak4631, - .heltecV21, - .heltecV1, - .lilygoTbeamS3Core, - .rak11200, - .nanoG1, - .tloraV211P8, - .tloraT3S3, - .stationG1, - .loraRelayV1, - .nrf52840Dk, - .ppr, - .genieblocks, - .nrf52Unknown, - .portduino, - .androidSim, - .diyV1, - .nrf52840Pca10059, - .drDev, - .m5Stack, - .heltecV3, - .heltecWslV3, - .betafpv2400Tx, - .privateHw, - ] -} - -#endif // swift(>=4.2) - -/// -/// Shared constants between device and phone -enum Constants: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// First enum must be zero, and we are just using this enum to - /// pass int constants between two very different environments - case zero // = 0 - - /// - /// From mesh.options - /// note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is - /// outside of this envelope - case dataPayloadLen // = 237 - case UNRECOGNIZED(Int) - - init() { - self = .zero - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .zero - case 237: self = .dataPayloadLen - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .zero: return 0 - case .dataPayloadLen: return 237 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension Constants: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Constants] = [ - .zero, - .dataPayloadLen, - ] -} - -#endif // swift(>=4.2) - -/// -/// Error codes for critical errors -/// The device might report these fault codes on the screen. -/// If you encounter a fault code, please post on the meshtastic.discourse.group -/// and we'll try to help. -enum CriticalErrorCode: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// TODO: REPLACE - case none // = 0 - - /// - /// A software bug was detected while trying to send lora - case txWatchdog // = 1 - - /// - /// A software bug was detected on entry to sleep - case sleepEnterWait // = 2 - - /// - /// No Lora radio hardware could be found - case noRadio // = 3 - - /// - /// Not normally used - case unspecified // = 4 - - /// - /// We failed while configuring a UBlox GPS - case ubloxUnitFailed // = 5 - - /// - /// This board was expected to have a power management chip and it is missing or broken - case noAxp192 // = 6 - - /// - /// The channel tried to set a radio setting which is not supported by this chipset, - /// radio comms settings are now undefined. - case invalidRadioSetting // = 7 - - /// - /// Radio transmit hardware failure. We sent data to the radio chip, but it didn't - /// reply with an interrupt. - case transmitFailed // = 8 - - /// - /// We detected that the main CPU voltage dropped below the minumum acceptable value - case brownout // = 9 - - /// 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 - case radioSpiBug // = 11 - case UNRECOGNIZED(Int) - - init() { - self = .none - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .none - case 1: self = .txWatchdog - case 2: self = .sleepEnterWait - case 3: self = .noRadio - case 4: self = .unspecified - case 5: self = .ubloxUnitFailed - case 6: self = .noAxp192 - case 7: self = .invalidRadioSetting - case 8: self = .transmitFailed - case 9: self = .brownout - case 10: self = .sx1262Failure - case 11: self = .radioSpiBug - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .none: return 0 - case .txWatchdog: return 1 - case .sleepEnterWait: return 2 - case .noRadio: return 3 - case .unspecified: return 4 - case .ubloxUnitFailed: return 5 - case .noAxp192: return 6 - case .invalidRadioSetting: return 7 - case .transmitFailed: return 8 - case .brownout: return 9 - case .sx1262Failure: return 10 - case .radioSpiBug: return 11 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension CriticalErrorCode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [CriticalErrorCode] = [ - .none, - .txWatchdog, - .sleepEnterWait, - .noRadio, - .unspecified, - .ubloxUnitFailed, - .noAxp192, - .invalidRadioSetting, - .transmitFailed, - .brownout, - .sx1262Failure, - .radioSpiBug, - ] -} - -#endif // swift(>=4.2) - -/// -/// a gps position -struct Position { - // 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 new preferred location encoding, multiply by 1e-7 to get degrees - /// in floating point - var latitudeI: Int32 { - get {return _storage._latitudeI} - set {_uniqueStorage()._latitudeI = newValue} - } - - /// - /// TODO: REPLACE - var longitudeI: Int32 { - get {return _storage._longitudeI} - set {_uniqueStorage()._longitudeI = newValue} - } - - /// - /// In meters above MSL (but see issue #359) - var altitude: Int32 { - get {return _storage._altitude} - set {_uniqueStorage()._altitude = 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 - /// the mesh (because there are devices on the mesh without GPS), it will only - /// be sent by devices which has a hardware GPS clock. - /// seconds since 1970 - var time: UInt32 { - get {return _storage._time} - 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} - } - - /// - /// Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds - var timestamp: UInt32 { - get {return _storage._timestamp} - set {_uniqueStorage()._timestamp = newValue} - } - - /// - /// Pos. timestamp milliseconds adjustment (rarely available or required) - var timestampMillisAdjust: Int32 { - get {return _storage._timestampMillisAdjust} - set {_uniqueStorage()._timestampMillisAdjust = newValue} - } - - /// - /// HAE altitude in meters - can be used instead of MSL altitude - var altitudeHae: Int32 { - get {return _storage._altitudeHae} - set {_uniqueStorage()._altitudeHae = newValue} - } - - /// - /// Geoidal separation in meters - var altitudeGeoidalSeparation: Int32 { - get {return _storage._altitudeGeoidalSeparation} - set {_uniqueStorage()._altitudeGeoidalSeparation = newValue} - } - - /// - /// Horizontal, Vertical and Position Dilution of Precision, in 1/100 units - /// - 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} - } - - /// - /// GPS accuracy (a hardware specific constant) in mm - /// multiplied with DOP to calculate positional accuracy - /// Default: "'bout three meters-ish" :) - var gpsAccuracy: UInt32 { - get {return _storage._gpsAccuracy} - set {_uniqueStorage()._gpsAccuracy = newValue} - } - - /// - /// Ground speed in m/s and True North TRACK in 1/100 degrees - /// Clarification of terms: - /// - "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} - } - - /// - /// GPS fix quality (from NMEA GxGGA statement or similar) - var fixQuality: UInt32 { - get {return _storage._fixQuality} - set {_uniqueStorage()._fixQuality = newValue} - } - - /// - /// GPS fix type 2D/3D (from NMEA GxGSA statement) - var fixType: UInt32 { - get {return _storage._fixType} - set {_uniqueStorage()._fixType = newValue} - } - - /// - /// GPS "Satellites in View" number - var satsInView: UInt32 { - get {return _storage._satsInView} - set {_uniqueStorage()._satsInView = newValue} - } - - /// - /// Sensor ID - in case multiple positioning sensors are being used - var sensorID: UInt32 { - get {return _storage._sensorID} - set {_uniqueStorage()._sensorID = newValue} - } - - /// - /// Estimated/expected time (in seconds) until next update: - /// - if we update at fixed intervals of X seconds, use X - /// - if we update at dynamic intervals (based on relative movement etc), - /// but "AT LEAST every Y seconds", use Y - var nextUpdate: UInt32 { - get {return _storage._nextUpdate} - set {_uniqueStorage()._nextUpdate = newValue} - } - - /// - /// A sequence number, incremented with each Position message to help - /// detect lost updates if needed - var seqNumber: UInt32 { - get {return _storage._seqNumber} - set {_uniqueStorage()._seqNumber = newValue} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// How the location was acquired: manual, onboard GPS, external (EUD) GPS - enum LocSource: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// TODO: REPLACE - case locUnset // = 0 - - /// - /// TODO: REPLACE - case locManual // = 1 - - /// - /// TODO: REPLACE - case locInternal // = 2 - - /// - /// TODO: REPLACE - case locExternal // = 3 - case UNRECOGNIZED(Int) - - init() { - self = .locUnset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .locUnset - case 1: self = .locManual - case 2: self = .locInternal - case 3: self = .locExternal - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .locUnset: return 0 - case .locManual: return 1 - case .locInternal: return 2 - case .locExternal: return 3 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// How the altitude was acquired: manual, GPS int/ext, etc - /// Default: same as location_source if present - enum AltSource: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// TODO: REPLACE - case altUnset // = 0 - - /// - /// TODO: REPLACE - case altManual // = 1 - - /// - /// TODO: REPLACE - case altInternal // = 2 - - /// - /// TODO: REPLACE - case altExternal // = 3 - - /// - /// TODO: REPLACE - case altBarometric // = 4 - case UNRECOGNIZED(Int) - - init() { - self = .altUnset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .altUnset - case 1: self = .altManual - case 2: self = .altInternal - case 3: self = .altExternal - case 4: self = .altBarometric - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .altUnset: return 0 - case .altManual: return 1 - case .altInternal: return 2 - case .altExternal: return 3 - case .altBarometric: return 4 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -#if swift(>=4.2) - -extension Position.LocSource: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Position.LocSource] = [ - .locUnset, - .locManual, - .locInternal, - .locExternal, - ] -} - -extension Position.AltSource: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Position.AltSource] = [ - .altUnset, - .altManual, - .altInternal, - .altExternal, - .altBarometric, - ] -} - -#endif // swift(>=4.2) - -/// -/// Broadcast when a newly powered mesh node wants to find a node num it can use -/// Sent from the phone over bluetooth to set the user id for the owner of this node. -/// Also sent from nodes to each other when a new node signs on (so all clients can have this info) -/// The algorithm is as follows: -/// when a node starts up, it broadcasts their user and the normal flow is for all -/// other nodes to reply with their User as well (so the new node can build its nodedb) -/// If a node ever receives a User (not just the first broadcast) message where -/// the sender node number equals our node number, that indicates a collision has -/// occurred and the following steps should happen: -/// If the receiving node (that was already in the mesh)'s macaddr is LOWER than the -/// new User who just tried to sign in: it gets to keep its nodenum. -/// We send a broadcast message of OUR User (we use a broadcast so that the other node can -/// receive our message, considering we have the same id - it also serves to let -/// observers correct their nodedb) - this case is rare so it should be okay. -/// If any node receives a User where the macaddr is GTE than their local macaddr, -/// they have been vetoed and should pick a new random nodenum (filtering against -/// whatever it knows about the nodedb) and rebroadcast their User. -/// A few nodenums are reserved and will never be requested: -/// 0xff - broadcast -/// 0 through 3 - for future use -struct User { - // 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. - - /// - /// A globally unique ID string for this user. - /// In the case of Signal that would mean +16504442323, for the default macaddr derived id it would be !<8 hexidecimal bytes>. - /// Note: app developers are encouraged to also use the following standard - /// node IDs "^all" (for broadcast), "^local" (for the locally connected node) - var id: String = String() - - /// - /// A full name for this user, i.e. "Kevin Hester" - var longName: String = String() - - /// - /// A VERY short name, ideally two characters. - /// Suitable for a tiny OLED screen - var shortName: String = String() - - /// - /// This is the addr of the radio. - /// Not populated by the phone, but added by the esp32 when broadcasting - var macaddr: Data = Data() - - /// - /// 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 hwModel: HardwareModel = .unset - - /// - /// In some regions Ham radio operators have different bandwidth limitations than others. - /// If this user is a licensed operator, set this flag. - /// Also, "long_name" should be their licence number. - var isLicensed: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// A message used in our Dynamic Source Routing protocol (RFC 4728 based) -struct RouteDiscovery { - // 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 list of nodenums this packet has visited so far - var route: [UInt32] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// 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 - // methods supported on all messages. - - var variant: Routing.OneOf_Variant? = nil - - /// - /// A route request going from the requester - var routeRequest: RouteDiscovery { - get { - if case .routeRequest(let v)? = variant {return v} - return RouteDiscovery() - } - set {variant = .routeRequest(newValue)} - } - - /// - /// A route reply - var routeReply: RouteDiscovery { - get { - if case .routeReply(let v)? = variant {return v} - return RouteDiscovery() - } - set {variant = .routeReply(newValue)} - } - - /// - /// A failure in delivering a message (usually used for routing control messages, but might be provided - /// in addition to ack.fail_id to provide details on the type of failure). - var errorReason: Routing.Error { - get { - if case .errorReason(let v)? = variant {return v} - return .none - } - set {variant = .errorReason(newValue)} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - enum OneOf_Variant: Equatable { - /// - /// A route request going from the requester - case routeRequest(RouteDiscovery) - /// - /// A route reply - case routeReply(RouteDiscovery) - /// - /// A failure in delivering a message (usually used for routing control messages, but might be provided - /// in addition to ack.fail_id to provide details on the type of failure). - case errorReason(Routing.Error) - - #if !swift(>=4.1) - static func ==(lhs: Routing.OneOf_Variant, rhs: Routing.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 (.routeRequest, .routeRequest): return { - guard case .routeRequest(let l) = lhs, case .routeRequest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.routeReply, .routeReply): return { - guard case .routeReply(let l) = lhs, case .routeReply(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.errorReason, .errorReason): return { - guard case .errorReason(let l) = lhs, case .errorReason(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// - /// A failure in delivering a message (usually used for routing control messages, but might be provided in addition to ack.fail_id to provide - /// details on the type of failure). - enum Error: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// This message is not a failure - case none // = 0 - - /// - /// Our node doesn't have a route to the requested destination anymore. - case noRoute // = 1 - - /// - /// We received a nak while trying to forward on your behalf - case gotNak // = 2 - - /// - /// TODO: REPLACE - case timeout // = 3 - - /// - /// No suitable interface could be found for delivering this packet - case noInterface // = 4 - - /// - /// We reached the max retransmission count (typically for naive flood routing) - case maxRetransmit // = 5 - - /// - /// No suitable channel was found for sending this packet (i.e. was requested channel index disabled?) - case noChannel // = 6 - - /// - /// The packet was too big for sending (exceeds interface MTU after encoding) - case tooLarge // = 7 - - /// - /// The request had want_response set, the request reached the destination node, but no service on that node wants to send a response - /// (possibly due to bad channel permissions) - case noResponse // = 8 - - /// - /// Cannot send currently because duty cycle regulations will be violated. - case dutyCycleLimit // = 9 - - /// - /// The application layer service on the remote node received your request, but considered your request somehow invalid - 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) - case notAuthorized // = 33 - case UNRECOGNIZED(Int) - - init() { - self = .none - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .none - case 1: self = .noRoute - case 2: self = .gotNak - case 3: self = .timeout - case 4: self = .noInterface - case 5: self = .maxRetransmit - case 6: self = .noChannel - case 7: self = .tooLarge - case 8: self = .noResponse - case 9: self = .dutyCycleLimit - case 32: self = .badRequest - case 33: self = .notAuthorized - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .none: return 0 - case .noRoute: return 1 - case .gotNak: return 2 - case .timeout: return 3 - case .noInterface: return 4 - case .maxRetransmit: return 5 - case .noChannel: return 6 - case .tooLarge: return 7 - case .noResponse: return 8 - case .dutyCycleLimit: return 9 - case .badRequest: return 32 - case .notAuthorized: return 33 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} -} - -#if swift(>=4.2) - -extension Routing.Error: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Routing.Error] = [ - .none, - .noRoute, - .gotNak, - .timeout, - .noInterface, - .maxRetransmit, - .noChannel, - .tooLarge, - .noResponse, - .dutyCycleLimit, - .badRequest, - .notAuthorized, - ] -} - -#endif // swift(>=4.2) - -/// -/// (Formerly called SubPacket) -/// The payload portion fo a packet, this is the actual bytes that are sent -/// inside a radio packet (because from/to are broken out by the comms library) -struct DataMessage { - // 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. - - /// - /// Formerly named typ and of type Type - var portnum: PortNum = .unknownApp - - /// - /// TODO: REPLACE - var payload: Data = Data() - - /// - /// Not normally used, but for testing a sender can request that recipient - /// responds in kind (i.e. if it received a position, it should unicast back it's position). - /// Note: that if you set this on a broadcast you will receive many replies. - var wantResponse: Bool = false - - /// - /// The address of the destination node. - /// This field is is filled in by the mesh radio device software, application - /// layer software should never need it. - /// RouteDiscovery messages _must_ populate this. - /// Other message types might need to if they are doing multihop routing. - var dest: UInt32 = 0 - - /// - /// The address of the original sender for this message. - /// This field should _only_ be populated for reliable multihop packets (to keep - /// packets small). - var source: UInt32 = 0 - - /// - /// Only used in routing or response messages. - /// Indicates the original message ID that this message is reporting failure on. (formerly called original_id) - var requestID: UInt32 = 0 - - /// - /// If set, this message is intened to be a reply to a previously sent message with the defined id. - var replyID: UInt32 = 0 - - /// - /// 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 emoji: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// Waypoint message, used to share arbitrary locations across the mesh -struct Waypoint { - // 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 waypoint - var id: UInt32 = 0 - - /// - /// latitude_i - var latitudeI: Int32 = 0 - - /// - /// longitude_i - var longitudeI: Int32 = 0 - - /// - /// Time the waypoint is to expire (epoch) - var expire: UInt32 = 0 - - /// - /// If greater than zero, treat the value as a nodenum only allowing them to update the waypoint. - /// If zero, the waypoint is open to be edited by any member of the mesh. - var lockedTo: UInt32 = 0 - - /// - /// Name of the waypoint - max 30 chars - var name: String = String() - - /// - /// Description of the waypoint - max 100 chars - var description_p: String = String() - - /// - /// Designator icon for the waypoint in the form of a unicode emoji - var icon: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// A packet envelope sent/received over the mesh -/// only payload_variant is sent in the payload portion of the LORA packet. -/// The other fields are either not sent at all, or sent in the special 16 byte LORA header. -struct MeshPacket { - // 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 sending node number. - /// Note: Our crypto implementation uses this field as well. - /// 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} - set {_uniqueStorage()._from = newValue} - } - - /// - /// The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only - /// hurts the ble link though. - var to: UInt32 { - get {return _storage._to} - set {_uniqueStorage()._to = newValue} - } - - /// - /// (Usually) If set, this indicates the index in the secondary_channels table that this packet was sent/received on. - /// If unset, packet was on the primary channel. - /// A particular node might know only a subset of channels in use on the mesh. - /// Therefore channel_index is inherently a local concept and meaningless to send between nodes. - /// Very briefly, while sending and receiving deep inside the device Router code, this field instead - /// contains the 'channel hash' instead of the index. - /// This 'trick' is only used while the payload_variant is an 'encrypted'. - var channel: UInt32 { - get {return _storage._channel} - set {_uniqueStorage()._channel = newValue} - } - - var payloadVariant: OneOf_PayloadVariant? { - get {return _storage._payloadVariant} - set {_uniqueStorage()._payloadVariant = newValue} - } - - /// - /// TODO: REPLACE - var decoded: DataMessage { - get { - if case .decoded(let v)? = _storage._payloadVariant {return v} - return DataMessage() - } - set {_uniqueStorage()._payloadVariant = .decoded(newValue)} - } - - /// - /// TODO: REPLACE - var encrypted: Data { - get { - if case .encrypted(let v)? = _storage._payloadVariant {return v} - return Data() - } - set {_uniqueStorage()._payloadVariant = .encrypted(newValue)} - } - - /// - /// A unique ID for this packet. - /// Always 0 for no-ack packets or non broadcast packets (and therefore take zero bytes of space). - /// Otherwise a unique ID for this packet, useful for flooding algorithms. - /// ID only needs to be unique on a _per sender_ basis, and it only - /// 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/overview/encryption) for details. - /// FIXME - really should be fixed32 instead, this encoding only - /// hurts the ble link though. - var id: UInt32 { - get {return _storage._id} - set {_uniqueStorage()._id = newValue} - } - - /// - /// The time this message was received by the esp32 (secs since 1970). - /// Note: this field is _never_ sent on the radio link itself (to save space) Times - /// are typically not sent over the mesh, but they will be added to any Packet - /// (chain of SubPacket) sent to the phone (so the phone can know exact time of reception) - var rxTime: UInt32 { - get {return _storage._rxTime} - set {_uniqueStorage()._rxTime = newValue} - } - - /// - /// *Never* sent over the radio links. - /// Set during reception to indicate the SNR of this packet. - /// Used to collect statistics on current link quality. - var rxSnr: Float { - get {return _storage._rxSnr} - set {_uniqueStorage()._rxSnr = newValue} - } - - /// - /// If unset treated as zero (no forwarding, send to adjacent nodes only) - /// if 1, allow hopping through one node, etc... - /// For our usecase real world topologies probably have a max of about 3. - /// This field is normally placed into a few of bits in the header. - var hopLimit: UInt32 { - get {return _storage._hopLimit} - set {_uniqueStorage()._hopLimit = newValue} - } - - /// - /// This packet is being sent as a reliable message, we would prefer it to arrive at the destination. - /// We would like to receive a ack packet in response. - /// Broadcasts messages treat this flag specially: Since acks for broadcasts would - /// rapidly flood the channel, the normal ack behavior is suppressed. - /// Instead, the original sender listens to see if at least one node is rebroadcasting this packet (because naive flooding algorithm). - /// If it hears that the odds (given typical LoRa topologies) the odds are very high that every node should eventually receive the message. - /// So FloodingRouter.cpp generates an implicit ack which is delivered to the original sender. - /// If after some time we don't hear anyone rebroadcast our packet, we will timeout and retransmit, using the regular resend logic. - /// Note: This flag is normally sent in a flag bit in the header when sent over the wire - var wantAck: Bool { - get {return _storage._wantAck} - set {_uniqueStorage()._wantAck = newValue} - } - - /// - /// The priority of this message for sending. - /// See MeshPacket.Priority description for more details. - var priority: MeshPacket.Priority { - get {return _storage._priority} - set {_uniqueStorage()._priority = newValue} - } - - /// - /// rssi of received packet. Only sent to phone for dispay purposes. - var rxRssi: Int32 { - get {return _storage._rxRssi} - set {_uniqueStorage()._rxRssi = newValue} - } - - /// - /// Describe if this message is delayed - var delayed: MeshPacket.Delayed { - get {return _storage._delayed} - set {_uniqueStorage()._delayed = newValue} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - enum OneOf_PayloadVariant: Equatable { - /// - /// TODO: REPLACE - case decoded(DataMessage) - /// - /// TODO: REPLACE - case encrypted(Data) - - #if !swift(>=4.1) - static func ==(lhs: MeshPacket.OneOf_PayloadVariant, rhs: MeshPacket.OneOf_PayloadVariant) -> 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 (.decoded, .decoded): return { - guard case .decoded(let l) = lhs, case .decoded(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.encrypted, .encrypted): return { - guard case .encrypted(let l) = lhs, case .encrypted(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// - /// The priority of this message for sending. - /// Higher priorities are sent first (when managing the transmit queue). - /// This field is never sent over the air, it is only used internally inside of a local device node. - /// API clients (either on the local node or connected directly to the node) - /// can set this parameter if necessary. - /// (values must be <= 127 to keep protobuf field to one byte in size. - /// Detailed background on this field: - /// I noticed a funny side effect of lora being so slow: Usually when making - /// a protocol there isn’t much need to use message priority to change the order - /// of transmission (because interfaces are fairly fast). - /// But for lora where packets can take a few seconds each, it is very important - /// to make sure that critical packets are sent ASAP. - /// In the case of meshtastic that means we want to send protocol acks as soon as possible - /// (to prevent unneeded retransmissions), we want routing messages to be sent next, - /// then messages marked as reliable and finally ‘background’ packets like periodic position updates. - /// So I bit the bullet and implemented a new (internal - not sent over the air) - /// field in MeshPacket called ‘priority’. - /// And the transmission queue in the router object is now a priority queue. - enum Priority: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Treated as Priority.DEFAULT - case unset // = 0 - - /// - /// TODO: REPLACE - case min // = 1 - - /// - /// Background position updates are sent with very low priority - - /// if the link is super congested they might not go out at all - case background // = 10 - - /// - /// This priority is used for most messages that don't have a priority set - case `default` // = 64 - - /// - /// If priority is unset but the message is marked as want_ack, - /// assume it is important and use a slightly higher priority - case reliable // = 70 - - /// - /// 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) - - init() { - self = .unset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .unset - case 1: self = .min - case 10: self = .background - case 64: self = .default - case 70: self = .reliable - case 120: self = .ack - case 127: self = .max - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .unset: return 0 - case .min: return 1 - case .background: return 10 - case .default: return 64 - case .reliable: return 70 - case .ack: return 120 - case .max: return 127 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// Identify if this is a delayed packet - enum Delayed: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// If unset, the message is being sent in real time. - case noDelay // = 0 - - /// - /// The message is delayed and was originally a broadcast - case broadcast // = 1 - - /// - /// The message is delayed and was originally a direct message - case direct // = 2 - case UNRECOGNIZED(Int) - - init() { - self = .noDelay - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .noDelay - case 1: self = .broadcast - case 2: self = .direct - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .noDelay: return 0 - case .broadcast: return 1 - case .direct: return 2 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -#if swift(>=4.2) - -extension MeshPacket.Priority: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [MeshPacket.Priority] = [ - .unset, - .min, - .background, - .default, - .reliable, - .ack, - .max, - ] -} - -extension MeshPacket.Delayed: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [MeshPacket.Delayed] = [ - .noDelay, - .broadcast, - .direct, - ] -} - -#endif // swift(>=4.2) - -/// -/// The bluetooth to device link: -/// Old BTLE protocol docs from TODO, merge in above and make real docs... -/// use protocol buffers, and NanoPB -/// messages from device to phone: -/// POSITION_UPDATE (..., time) -/// TEXT_RECEIVED(from, text, time) -/// OPAQUE_RECEIVED(from, payload, time) (for signal messages or other applications) -/// messages from phone to device: -/// SET_MYID(id, human readable long, human readable short) (send down the unique ID -/// string used for this node, a human readable string shown for that id, and a very -/// short human readable string suitable for oled screen) SEND_OPAQUE(dest, payload) -/// (for signal messages or other applications) SEND_TEXT(dest, text) Get all -/// nodes() (returns list of nodes, with full info, last time seen, loc, battery -/// level etc) SET_CONFIG (switches device to a new set of radio params and -/// preshared key, drops all existing nodes, force our node to rejoin this new group) -/// Full information about a node on the mesh -struct NodeInfo { - // 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 node number - var num: UInt32 = 0 - - /// - /// The user info for this node - var user: User { - get {return _user ?? User()} - set {_user = newValue} - } - /// Returns true if `user` has been explicitly set. - var hasUser: Bool {return self._user != nil} - /// Clears the value of `user`. Subsequent reads from it will return its default value. - mutating func clearUser() {self._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} - } - /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return self._position != nil} - /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() {self._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 - - /// - /// Set to indicate the last time we received a packet from this node - var lastHeard: UInt32 = 0 - - /// - /// The latest device metrics for the node. - var deviceMetrics: DeviceMetrics { - get {return _deviceMetrics ?? DeviceMetrics()} - set {_deviceMetrics = newValue} - } - /// Returns true if `deviceMetrics` has been explicitly set. - var hasDeviceMetrics: Bool {return self._deviceMetrics != nil} - /// Clears the value of `deviceMetrics`. Subsequent reads from it will return its default value. - mutating func clearDeviceMetrics() {self._deviceMetrics = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _user: User? = nil - fileprivate var _position: Position? = nil - fileprivate var _deviceMetrics: DeviceMetrics? = nil -} - -/// -/// Unique local debugging info for this node -/// Note: we don't include position or the user info, because that will come in the -/// Sent to the phone in response to WantNodes. -struct MyNodeInfo { - // 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. - - /// - /// Tells the phone what our node number is, default starting value is - /// lowbyte of macaddr, but it will be fixed if that is already in use - var myNodeNum: UInt32 = 0 - - /// - /// Note: This flag merely means we detected a hardware GPS in our node. - /// Not the same as UserPreferences.location_sharing - var hasGps_p: Bool = false - - /// - /// The maximum number of 'software' channels that can be set on this node. - var maxChannels: UInt32 = 0 - - /// - /// 0.0.5 etc... - var firmwareVersion: String = String() - - /// - /// An error message we'd like to report back to the mothership through analytics. - /// It indicates a serious bug occurred on the device, the device coped with it, - /// but we still want to tell the devs about the bug. - /// This field will be cleared after the phone reads MyNodeInfo - /// (i.e. it will only be reported once) - /// a numeric error code to go with error message, zero means no error - var errorCode: CriticalErrorCode = .none - - /// - /// A numeric error address (nonzero if available) - var errorAddress: UInt32 = 0 - - /// - /// The total number of errors this node has ever encountered - /// (well - since the last time we discarded preferences) - var errorCount: UInt32 = 0 - - /// - /// The total number of reboots this node has ever encountered - /// (well - since the last time we discarded preferences) - var rebootCount: UInt32 = 0 - - /// - /// Calculated bitrate of the current channel (in Bytes Per Second) - var bitrate: Float = 0 - - /// - /// How long before we consider a message abandoned and we can clear our - /// caches of any messages in flight Normally quite large to handle the worst case - /// message delivery time, 5 minutes. - /// Formerly called FLOOD_EXPIRE_TIME in the device code - var messageTimeoutMsec: UInt32 = 0 - - /// - /// The minimum app version that can talk to this device. - /// Phone/PC apps should compare this to their build number and if too low tell the user they must update their app - var minAppVersion: UInt32 = 0 - - /// - /// 24 time windows of 1hr each with the airtime transmitted out of the device per hour. - var airPeriodTx: [UInt32] = [] - - /// - /// 24 time windows of 1hr each with the airtime of valid packets for your mesh. - var airPeriodRx: [UInt32] = [] - - /// - /// Is the device wifi capable? - var hasWifi_p: Bool = false - - /// - /// 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() {} -} - -/// -/// Debug output from the device. -/// To minimize the size of records inside the device code, if a time/source/level is not set -/// on the message it is assumed to be a continuation of the previously sent message. -/// This allows the device code to use fixed maxlen 64 byte strings for messages, -/// and then extend as needed by emitting multiple records. -struct LogRecord { - // 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. - - /// - /// Log levels, chosen to match python logging conventions. - var message: String = String() - - /// - /// Seconds since 1970 - or 0 for unknown/unset - var time: UInt32 = 0 - - /// - /// Usually based on thread name - if known - var source: String = String() - - /// - /// Not yet set - var level: LogRecord.Level = .unset - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// 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) - - init() { - self = .unset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .unset - case 5: self = .trace - case 10: self = .debug - case 20: self = .info - case 30: self = .warning - case 40: self = .error - case 50: self = .critical - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .unset: return 0 - case .trace: return 5 - case .debug: return 10 - case .info: return 20 - case .warning: return 30 - case .error: return 40 - case .critical: return 50 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} -} - -#if swift(>=4.2) - -extension LogRecord.Level: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [LogRecord.Level] = [ - .unset, - .critical, - .error, - .warning, - .info, - .debug, - .trace, - ] -} - -#endif // swift(>=4.2) - -struct QueueStatus { - // 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. - - /// Last attempt to queue status, ErrorCode - var res: Int32 = 0 - - /// Free entries in the outgoing queue - var free: UInt32 = 0 - - /// Maximum entries in the outgoing queue - var maxlen: UInt32 = 0 - - /// What was mesh packet id that generated this response? - var meshPacketID: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// -/// Packets from the radio to the phone will appear on the fromRadio characteristic. -/// It will support READ and NOTIFY. When a new packet arrives the device will BLE notify? -/// It will sit in that descriptor until consumed by the phone, -/// at which point the next item in the FIFO will be populated. -struct FromRadio { - // 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 packet id, used to allow the phone to request missing read packets from the FIFO, - /// see our bluetooth docs - var id: UInt32 { - get {return _storage._id} - set {_uniqueStorage()._id = newValue} - } - - /// - /// Log levels, chosen to match python logging conventions. - var payloadVariant: OneOf_PayloadVariant? { - get {return _storage._payloadVariant} - set {_uniqueStorage()._payloadVariant = newValue} - } - - /// - /// Log levels, chosen to match python logging conventions. - var packet: MeshPacket { - get { - if case .packet(let v)? = _storage._payloadVariant {return v} - return MeshPacket() - } - set {_uniqueStorage()._payloadVariant = .packet(newValue)} - } - - /// - /// Tells the phone what our node number is, can be -1 if we've not yet joined a mesh. - /// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. - var myInfo: MyNodeInfo { - get { - if case .myInfo(let v)? = _storage._payloadVariant {return v} - return MyNodeInfo() - } - set {_uniqueStorage()._payloadVariant = .myInfo(newValue)} - } - - /// - /// One packet is sent for each node in the on radio DB - /// starts over with the first node in our DB - var nodeInfo: NodeInfo { - get { - if case .nodeInfo(let v)? = _storage._payloadVariant {return v} - return NodeInfo() - } - set {_uniqueStorage()._payloadVariant = .nodeInfo(newValue)} - } - - /// - /// Include a part of the config (was: RadioConfig radio) - var config: Config { - get { - if case .config(let v)? = _storage._payloadVariant {return v} - return Config() - } - set {_uniqueStorage()._payloadVariant = .config(newValue)} - } - - /// - /// Set to send debug console output over our protobuf stream - var logRecord: LogRecord { - get { - if case .logRecord(let v)? = _storage._payloadVariant {return v} - return LogRecord() - } - set {_uniqueStorage()._payloadVariant = .logRecord(newValue)} - } - - /// - /// Sent as true once the device has finished sending all of the responses to want_config - /// recipient should check if this ID matches our original request nonce, if - /// not, it means your config responses haven't started yet. - /// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. - var configCompleteID: UInt32 { - get { - if case .configCompleteID(let v)? = _storage._payloadVariant {return v} - return 0 - } - set {_uniqueStorage()._payloadVariant = .configCompleteID(newValue)} - } - - /// - /// Sent to tell clients the radio has just rebooted. - /// Set to true if present. - /// Not used on all transports, currently just used for the serial console. - /// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. - var rebooted: Bool { - get { - if case .rebooted(let v)? = _storage._payloadVariant {return v} - return false - } - set {_uniqueStorage()._payloadVariant = .rebooted(newValue)} - } - - /// - /// Include module config - var moduleConfig: ModuleConfig { - get { - if case .moduleConfig(let v)? = _storage._payloadVariant {return v} - return ModuleConfig() - } - set {_uniqueStorage()._payloadVariant = .moduleConfig(newValue)} - } - - /// - /// One packet is sent for each channel - var channel: Channel { - get { - if case .channel(let v)? = _storage._payloadVariant {return v} - return Channel() - } - set {_uniqueStorage()._payloadVariant = .channel(newValue)} - } - - /// - /// Queue status info - var queueStatus: QueueStatus { - get { - if case .queueStatus(let v)? = _storage._payloadVariant {return v} - return QueueStatus() - } - set {_uniqueStorage()._payloadVariant = .queueStatus(newValue)} - } - - /// - /// File Transfer Chunk - var xmodemPacket: XModem { - get { - if case .xmodemPacket(let v)? = _storage._payloadVariant {return v} - return XModem() - } - set {_uniqueStorage()._payloadVariant = .xmodemPacket(newValue)} - } - - 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. - /// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. - case myInfo(MyNodeInfo) - /// - /// One packet is sent for each node in the on radio DB - /// starts over with the first node in our DB - case nodeInfo(NodeInfo) - /// - /// Include a part of the config (was: RadioConfig radio) - case config(Config) - /// - /// Set to send debug console output over our protobuf stream - case logRecord(LogRecord) - /// - /// Sent as true once the device has finished sending all of the responses to want_config - /// recipient should check if this ID matches our original request nonce, if - /// not, it means your config responses haven't started yet. - /// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. - case configCompleteID(UInt32) - /// - /// Sent to tell clients the radio has just rebooted. - /// Set to true if present. - /// Not used on all transports, currently just used for the serial console. - /// NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. - case rebooted(Bool) - /// - /// Include module config - case moduleConfig(ModuleConfig) - /// - /// One packet is sent for each channel - case channel(Channel) - /// - /// Queue status info - case queueStatus(QueueStatus) - /// - /// File Transfer Chunk - case xmodemPacket(XModem) - - #if !swift(>=4.1) - static func ==(lhs: FromRadio.OneOf_PayloadVariant, rhs: FromRadio.OneOf_PayloadVariant) -> 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 (.packet, .packet): return { - guard case .packet(let l) = lhs, case .packet(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.myInfo, .myInfo): return { - guard case .myInfo(let l) = lhs, case .myInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nodeInfo, .nodeInfo): return { - guard case .nodeInfo(let l) = lhs, case .nodeInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.config, .config): return { - guard case .config(let l) = lhs, case .config(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.logRecord, .logRecord): return { - guard case .logRecord(let l) = lhs, case .logRecord(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.configCompleteID, .configCompleteID): return { - guard case .configCompleteID(let l) = lhs, case .configCompleteID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.rebooted, .rebooted): return { - guard case .rebooted(let l) = lhs, case .rebooted(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.moduleConfig, .moduleConfig): return { - guard case .moduleConfig(let l) = lhs, case .moduleConfig(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.channel, .channel): return { - guard case .channel(let l) = lhs, case .channel(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.queueStatus, .queueStatus): return { - guard case .queueStatus(let l) = lhs, case .queueStatus(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.xmodemPacket, .xmodemPacket): return { - guard case .xmodemPacket(let l) = lhs, case .xmodemPacket(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -/// -/// Packets/commands to the radio will be written (reliably) to the toRadio characteristic. -/// Once the write completes the phone can assume it is handled. -struct ToRadio { - // 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. - - /// - /// Log levels, chosen to match python logging conventions. - var payloadVariant: ToRadio.OneOf_PayloadVariant? = nil - - /// - /// Send this packet on the mesh - var packet: MeshPacket { - get { - if case .packet(let v)? = payloadVariant {return v} - return MeshPacket() - } - set {payloadVariant = .packet(newValue)} - } - - /// - /// Phone wants radio to send full node db to the phone, This is - /// typically the first packet sent to the radio when the phone gets a - /// bluetooth connection. The radio will respond by sending back a - /// MyNodeInfo, a owner, a radio config and a series of - /// FromRadio.node_infos, and config_complete - /// the integer you write into this field will be reported back in the - /// config_complete_id response this allows clients to never be confused by - /// a stale old partially sent config. - var wantConfigID: UInt32 { - get { - if case .wantConfigID(let v)? = payloadVariant {return v} - return 0 - } - set {payloadVariant = .wantConfigID(newValue)} - } - - /// - /// Tell API server we are disconnecting now. - /// This is useful for serial links where there is no hardware/protocol based notification that the client has dropped the link. - /// (Sending this message is optional for clients) - var disconnect: Bool { - get { - if case .disconnect(let v)? = payloadVariant {return v} - return false - } - set {payloadVariant = .disconnect(newValue)} - } - - var xmodemPacket: XModem { - get { - if case .xmodemPacket(let v)? = payloadVariant {return v} - return XModem() - } - set {payloadVariant = .xmodemPacket(newValue)} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// Log levels, chosen to match python logging conventions. - enum OneOf_PayloadVariant: Equatable { - /// - /// Send this packet on the mesh - case packet(MeshPacket) - /// - /// Phone wants radio to send full node db to the phone, This is - /// typically the first packet sent to the radio when the phone gets a - /// bluetooth connection. The radio will respond by sending back a - /// MyNodeInfo, a owner, a radio config and a series of - /// FromRadio.node_infos, and config_complete - /// the integer you write into this field will be reported back in the - /// config_complete_id response this allows clients to never be confused by - /// a stale old partially sent config. - case wantConfigID(UInt32) - /// - /// Tell API server we are disconnecting now. - /// This is useful for serial links where there is no hardware/protocol based notification that the client has dropped the link. - /// (Sending this message is optional for clients) - case disconnect(Bool) - case xmodemPacket(XModem) - - #if !swift(>=4.1) - static func ==(lhs: ToRadio.OneOf_PayloadVariant, rhs: ToRadio.OneOf_PayloadVariant) -> 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 (.packet, .packet): return { - guard case .packet(let l) = lhs, case .packet(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.wantConfigID, .wantConfigID): return { - guard case .wantConfigID(let l) = lhs, case .wantConfigID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.disconnect, .disconnect): return { - guard case .disconnect(let l) = lhs, case .disconnect(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.xmodemPacket, .xmodemPacket): return { - guard case .xmodemPacket(let l) = lhs, case .xmodemPacket(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - init() {} -} - -/// -/// Compressed message payload -struct Compressed { - // 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. - - /// - /// PortNum to determine the how to handle the compressed payload. - var portnum: PortNum = .unknownApp - - /// - /// Compressed data. - var data: Data = Data() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension HardwareModel: @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 Waypoint: @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 QueueStatus: @unchecked Sendable {} -extension FromRadio: @unchecked Sendable {} -extension FromRadio.OneOf_PayloadVariant: @unchecked Sendable {} -extension ToRadio: @unchecked Sendable {} -extension ToRadio.OneOf_PayloadVariant: @unchecked Sendable {} -extension Compressed: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension HardwareModel: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNSET"), - 1: .same(proto: "TLORA_V2"), - 2: .same(proto: "TLORA_V1"), - 3: .same(proto: "TLORA_V2_1_1P6"), - 4: .same(proto: "TBEAM"), - 5: .same(proto: "HELTEC_V2_0"), - 6: .same(proto: "TBEAM_V0P7"), - 7: .same(proto: "T_ECHO"), - 8: .same(proto: "TLORA_V1_1P3"), - 9: .same(proto: "RAK4631"), - 10: .same(proto: "HELTEC_V2_1"), - 11: .same(proto: "HELTEC_V1"), - 12: .same(proto: "LILYGO_TBEAM_S3_CORE"), - 13: .same(proto: "RAK11200"), - 14: .same(proto: "NANO_G1"), - 15: .same(proto: "TLORA_V2_1_1P8"), - 16: .same(proto: "TLORA_T3_S3"), - 25: .same(proto: "STATION_G1"), - 32: .same(proto: "LORA_RELAY_V1"), - 33: .same(proto: "NRF52840DK"), - 34: .same(proto: "PPR"), - 35: .same(proto: "GENIEBLOCKS"), - 36: .same(proto: "NRF52_UNKNOWN"), - 37: .same(proto: "PORTDUINO"), - 38: .same(proto: "ANDROID_SIM"), - 39: .same(proto: "DIY_V1"), - 40: .same(proto: "NRF52840_PCA10059"), - 41: .same(proto: "DR_DEV"), - 42: .same(proto: "M5STACK"), - 43: .same(proto: "HELTEC_V3"), - 44: .same(proto: "HELTEC_WSL_V3"), - 45: .same(proto: "BETAFPV_2400_TX"), - 255: .same(proto: "PRIVATE_HW"), - ] -} - -extension Constants: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "ZERO"), - 237: .same(proto: "DATA_PAYLOAD_LEN"), - ] -} - -extension CriticalErrorCode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NONE"), - 1: .same(proto: "TX_WATCHDOG"), - 2: .same(proto: "SLEEP_ENTER_WAIT"), - 3: .same(proto: "NO_RADIO"), - 4: .same(proto: "UNSPECIFIED"), - 5: .same(proto: "UBLOX_UNIT_FAILED"), - 6: .same(proto: "NO_AXP192"), - 7: .same(proto: "INVALID_RADIO_SETTING"), - 8: .same(proto: "TRANSMIT_FAILED"), - 9: .same(proto: "BROWNOUT"), - 10: .same(proto: "SX1262_FAILURE"), - 11: .same(proto: "RADIO_SPI_BUG"), - ] -} - -extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Position" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "latitude_i"), - 2: .standard(proto: "longitude_i"), - 3: .same(proto: "altitude"), - 4: .same(proto: "time"), - 5: .standard(proto: "location_source"), - 6: .standard(proto: "altitude_source"), - 7: .same(proto: "timestamp"), - 8: .standard(proto: "timestamp_millis_adjust"), - 9: .standard(proto: "altitude_hae"), - 10: .standard(proto: "altitude_geoidal_separation"), - 11: .same(proto: "PDOP"), - 12: .same(proto: "HDOP"), - 13: .same(proto: "VDOP"), - 14: .standard(proto: "gps_accuracy"), - 15: .standard(proto: "ground_speed"), - 16: .standard(proto: "ground_track"), - 17: .standard(proto: "fix_quality"), - 18: .standard(proto: "fix_type"), - 19: .standard(proto: "sats_in_view"), - 20: .standard(proto: "sensor_id"), - 21: .standard(proto: "next_update"), - 22: .standard(proto: "seq_number"), - ] - - fileprivate class _StorageClass { - var _latitudeI: Int32 = 0 - var _longitudeI: Int32 = 0 - var _altitude: Int32 = 0 - var _time: UInt32 = 0 - var _locationSource: Position.LocSource = .locUnset - var _altitudeSource: Position.AltSource = .altUnset - var _timestamp: UInt32 = 0 - var _timestampMillisAdjust: Int32 = 0 - var _altitudeHae: Int32 = 0 - var _altitudeGeoidalSeparation: Int32 = 0 - var _pdop: UInt32 = 0 - var _hdop: UInt32 = 0 - var _vdop: UInt32 = 0 - var _gpsAccuracy: UInt32 = 0 - var _groundSpeed: UInt32 = 0 - var _groundTrack: UInt32 = 0 - var _fixQuality: UInt32 = 0 - var _fixType: UInt32 = 0 - var _satsInView: UInt32 = 0 - var _sensorID: UInt32 = 0 - var _nextUpdate: UInt32 = 0 - var _seqNumber: UInt32 = 0 - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _latitudeI = source._latitudeI - _longitudeI = source._longitudeI - _altitude = source._altitude - _time = source._time - _locationSource = source._locationSource - _altitudeSource = source._altitudeSource - _timestamp = source._timestamp - _timestampMillisAdjust = source._timestampMillisAdjust - _altitudeHae = source._altitudeHae - _altitudeGeoidalSeparation = source._altitudeGeoidalSeparation - _pdop = source._pdop - _hdop = source._hdop - _vdop = source._vdop - _gpsAccuracy = source._gpsAccuracy - _groundSpeed = source._groundSpeed - _groundTrack = source._groundTrack - _fixQuality = source._fixQuality - _fixType = source._fixType - _satsInView = source._satsInView - _sensorID = source._sensorID - _nextUpdate = source._nextUpdate - _seqNumber = source._seqNumber - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _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.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.decodeSingularFixed32Field(value: &_storage._time) }() - case 5: try { try decoder.decodeSingularEnumField(value: &_storage._locationSource) }() - case 6: try { try decoder.decodeSingularEnumField(value: &_storage._altitudeSource) }() - case 7: try { try decoder.decodeSingularFixed32Field(value: &_storage._timestamp) }() - case 8: try { try decoder.decodeSingularInt32Field(value: &_storage._timestampMillisAdjust) }() - case 9: try { try decoder.decodeSingularSInt32Field(value: &_storage._altitudeHae) }() - case 10: try { try decoder.decodeSingularSInt32Field(value: &_storage._altitudeGeoidalSeparation) }() - case 11: try { try decoder.decodeSingularUInt32Field(value: &_storage._pdop) }() - case 12: try { try decoder.decodeSingularUInt32Field(value: &_storage._hdop) }() - case 13: try { try decoder.decodeSingularUInt32Field(value: &_storage._vdop) }() - case 14: try { try decoder.decodeSingularUInt32Field(value: &_storage._gpsAccuracy) }() - case 15: try { try decoder.decodeSingularUInt32Field(value: &_storage._groundSpeed) }() - case 16: try { try decoder.decodeSingularUInt32Field(value: &_storage._groundTrack) }() - case 17: try { try decoder.decodeSingularUInt32Field(value: &_storage._fixQuality) }() - case 18: try { try decoder.decodeSingularUInt32Field(value: &_storage._fixType) }() - case 19: try { try decoder.decodeSingularUInt32Field(value: &_storage._satsInView) }() - case 20: try { try decoder.decodeSingularUInt32Field(value: &_storage._sensorID) }() - case 21: try { try decoder.decodeSingularUInt32Field(value: &_storage._nextUpdate) }() - case 22: try { try decoder.decodeSingularUInt32Field(value: &_storage._seqNumber) }() - default: break - } - } - } - } - - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if _storage._latitudeI != 0 { - try visitor.visitSingularSFixed32Field(value: _storage._latitudeI, fieldNumber: 1) - } - if _storage._longitudeI != 0 { - try visitor.visitSingularSFixed32Field(value: _storage._longitudeI, fieldNumber: 2) - } - if _storage._altitude != 0 { - try visitor.visitSingularInt32Field(value: _storage._altitude, fieldNumber: 3) - } - if _storage._time != 0 { - try visitor.visitSingularFixed32Field(value: _storage._time, fieldNumber: 4) - } - if _storage._locationSource != .locUnset { - try visitor.visitSingularEnumField(value: _storage._locationSource, fieldNumber: 5) - } - if _storage._altitudeSource != .altUnset { - try visitor.visitSingularEnumField(value: _storage._altitudeSource, fieldNumber: 6) - } - if _storage._timestamp != 0 { - try visitor.visitSingularFixed32Field(value: _storage._timestamp, fieldNumber: 7) - } - if _storage._timestampMillisAdjust != 0 { - try visitor.visitSingularInt32Field(value: _storage._timestampMillisAdjust, fieldNumber: 8) - } - if _storage._altitudeHae != 0 { - try visitor.visitSingularSInt32Field(value: _storage._altitudeHae, fieldNumber: 9) - } - if _storage._altitudeGeoidalSeparation != 0 { - try visitor.visitSingularSInt32Field(value: _storage._altitudeGeoidalSeparation, fieldNumber: 10) - } - if _storage._pdop != 0 { - try visitor.visitSingularUInt32Field(value: _storage._pdop, fieldNumber: 11) - } - if _storage._hdop != 0 { - try visitor.visitSingularUInt32Field(value: _storage._hdop, fieldNumber: 12) - } - if _storage._vdop != 0 { - try visitor.visitSingularUInt32Field(value: _storage._vdop, fieldNumber: 13) - } - if _storage._gpsAccuracy != 0 { - try visitor.visitSingularUInt32Field(value: _storage._gpsAccuracy, fieldNumber: 14) - } - if _storage._groundSpeed != 0 { - try visitor.visitSingularUInt32Field(value: _storage._groundSpeed, fieldNumber: 15) - } - if _storage._groundTrack != 0 { - try visitor.visitSingularUInt32Field(value: _storage._groundTrack, fieldNumber: 16) - } - if _storage._fixQuality != 0 { - try visitor.visitSingularUInt32Field(value: _storage._fixQuality, fieldNumber: 17) - } - if _storage._fixType != 0 { - try visitor.visitSingularUInt32Field(value: _storage._fixType, fieldNumber: 18) - } - if _storage._satsInView != 0 { - try visitor.visitSingularUInt32Field(value: _storage._satsInView, fieldNumber: 19) - } - if _storage._sensorID != 0 { - try visitor.visitSingularUInt32Field(value: _storage._sensorID, fieldNumber: 20) - } - if _storage._nextUpdate != 0 { - try visitor.visitSingularUInt32Field(value: _storage._nextUpdate, fieldNumber: 21) - } - if _storage._seqNumber != 0 { - try visitor.visitSingularUInt32Field(value: _storage._seqNumber, fieldNumber: 22) - } - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Position, rhs: Position) -> Bool { - 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._latitudeI != rhs_storage._latitudeI {return false} - if _storage._longitudeI != rhs_storage._longitudeI {return false} - if _storage._altitude != rhs_storage._altitude {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} - if _storage._timestamp != rhs_storage._timestamp {return false} - if _storage._timestampMillisAdjust != rhs_storage._timestampMillisAdjust {return false} - if _storage._altitudeHae != rhs_storage._altitudeHae {return false} - if _storage._altitudeGeoidalSeparation != rhs_storage._altitudeGeoidalSeparation {return false} - if _storage._pdop != rhs_storage._pdop {return false} - if _storage._hdop != rhs_storage._hdop {return false} - if _storage._vdop != rhs_storage._vdop {return false} - if _storage._gpsAccuracy != rhs_storage._gpsAccuracy {return false} - if _storage._groundSpeed != rhs_storage._groundSpeed {return false} - if _storage._groundTrack != rhs_storage._groundTrack {return false} - if _storage._fixQuality != rhs_storage._fixQuality {return false} - if _storage._fixType != rhs_storage._fixType {return false} - if _storage._satsInView != rhs_storage._satsInView {return false} - if _storage._sensorID != rhs_storage._sensorID {return false} - if _storage._nextUpdate != rhs_storage._nextUpdate {return false} - if _storage._seqNumber != rhs_storage._seqNumber {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Position.LocSource: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "LOC_UNSET"), - 1: .same(proto: "LOC_MANUAL"), - 2: .same(proto: "LOC_INTERNAL"), - 3: .same(proto: "LOC_EXTERNAL"), - ] -} - -extension Position.AltSource: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "ALT_UNSET"), - 1: .same(proto: "ALT_MANUAL"), - 2: .same(proto: "ALT_INTERNAL"), - 3: .same(proto: "ALT_EXTERNAL"), - 4: .same(proto: "ALT_BAROMETRIC"), - ] -} - -extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "User" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "id"), - 2: .standard(proto: "long_name"), - 3: .standard(proto: "short_name"), - 4: .same(proto: "macaddr"), - 5: .standard(proto: "hw_model"), - 6: .standard(proto: "is_licensed"), - ] - - 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.id) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.longName) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.shortName) }() - case 4: try { try decoder.decodeSingularBytesField(value: &self.macaddr) }() - case 5: try { try decoder.decodeSingularEnumField(value: &self.hwModel) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self.isLicensed) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.id.isEmpty { - try visitor.visitSingularStringField(value: self.id, fieldNumber: 1) - } - if !self.longName.isEmpty { - try visitor.visitSingularStringField(value: self.longName, fieldNumber: 2) - } - if !self.shortName.isEmpty { - try visitor.visitSingularStringField(value: self.shortName, fieldNumber: 3) - } - if !self.macaddr.isEmpty { - try visitor.visitSingularBytesField(value: self.macaddr, fieldNumber: 4) - } - if self.hwModel != .unset { - try visitor.visitSingularEnumField(value: self.hwModel, fieldNumber: 5) - } - if self.isLicensed != false { - try visitor.visitSingularBoolField(value: self.isLicensed, fieldNumber: 6) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: User, rhs: User) -> Bool { - if lhs.id != rhs.id {return false} - if lhs.longName != rhs.longName {return false} - if lhs.shortName != rhs.shortName {return false} - if lhs.macaddr != rhs.macaddr {return false} - if lhs.hwModel != rhs.hwModel {return false} - if lhs.isLicensed != rhs.isLicensed {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension RouteDiscovery: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "RouteDiscovery" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "route"), - ] - - 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.decodeRepeatedFixed32Field(value: &self.route) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.route.isEmpty { - try visitor.visitPackedFixed32Field(value: self.route, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: RouteDiscovery, rhs: RouteDiscovery) -> Bool { - if lhs.route != rhs.route {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Routing: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Routing" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "route_request"), - 2: .standard(proto: "route_reply"), - 3: .standard(proto: "error_reason"), - ] - - 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 { - var v: RouteDiscovery? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .routeRequest(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .routeRequest(v) - } - }() - case 2: try { - var v: RouteDiscovery? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .routeReply(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .routeReply(v) - } - }() - case 3: try { - var v: Routing.Error? - try decoder.decodeSingularEnumField(value: &v) - if let v = v { - if self.variant != nil {try decoder.handleConflictingOneOf()} - self.variant = .errorReason(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 - switch self.variant { - case .routeRequest?: try { - guard case .routeRequest(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .routeReply?: try { - guard case .routeReply(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case .errorReason?: try { - guard case .errorReason(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularEnumField(value: v, fieldNumber: 3) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Routing, rhs: Routing) -> Bool { - if lhs.variant != rhs.variant {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Routing.Error: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NONE"), - 1: .same(proto: "NO_ROUTE"), - 2: .same(proto: "GOT_NAK"), - 3: .same(proto: "TIMEOUT"), - 4: .same(proto: "NO_INTERFACE"), - 5: .same(proto: "MAX_RETRANSMIT"), - 6: .same(proto: "NO_CHANNEL"), - 7: .same(proto: "TOO_LARGE"), - 8: .same(proto: "NO_RESPONSE"), - 9: .same(proto: "DUTY_CYCLE_LIMIT"), - 32: .same(proto: "BAD_REQUEST"), - 33: .same(proto: "NOT_AUTHORIZED"), - ] -} - -extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Data" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "portnum"), - 2: .same(proto: "payload"), - 3: .standard(proto: "want_response"), - 4: .same(proto: "dest"), - 5: .same(proto: "source"), - 6: .standard(proto: "request_id"), - 7: .standard(proto: "reply_id"), - 8: .same(proto: "emoji"), - ] - - 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.decodeSingularEnumField(value: &self.portnum) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.payload) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self.wantResponse) }() - case 4: try { try decoder.decodeSingularFixed32Field(value: &self.dest) }() - 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.decodeSingularFixed32Field(value: &self.emoji) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.portnum != .unknownApp { - try visitor.visitSingularEnumField(value: self.portnum, fieldNumber: 1) - } - if !self.payload.isEmpty { - try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 2) - } - if self.wantResponse != false { - try visitor.visitSingularBoolField(value: self.wantResponse, fieldNumber: 3) - } - if self.dest != 0 { - try visitor.visitSingularFixed32Field(value: self.dest, fieldNumber: 4) - } - if self.source != 0 { - try visitor.visitSingularFixed32Field(value: self.source, fieldNumber: 5) - } - if self.requestID != 0 { - try visitor.visitSingularFixed32Field(value: self.requestID, fieldNumber: 6) - } - if self.replyID != 0 { - try visitor.visitSingularFixed32Field(value: self.replyID, fieldNumber: 7) - } - if self.emoji != 0 { - try visitor.visitSingularFixed32Field(value: self.emoji, fieldNumber: 8) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: DataMessage, rhs: DataMessage) -> Bool { - if lhs.portnum != rhs.portnum {return false} - if lhs.payload != rhs.payload {return false} - if lhs.wantResponse != rhs.wantResponse {return false} - if lhs.dest != rhs.dest {return false} - if lhs.source != rhs.source {return false} - if lhs.requestID != rhs.requestID {return false} - if lhs.replyID != rhs.replyID {return false} - if lhs.emoji != rhs.emoji {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Waypoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Waypoint" - 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: .standard(proto: "locked_to"), - 6: .same(proto: "name"), - 7: .same(proto: "description"), - 8: .same(proto: "icon"), - ] - - 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.decodeSingularUInt32Field(value: &self.lockedTo) }() - case 6: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 7: try { try decoder.decodeSingularStringField(value: &self.description_p) }() - case 8: try { try decoder.decodeSingularFixed32Field(value: &self.icon) }() - 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.lockedTo != 0 { - try visitor.visitSingularUInt32Field(value: self.lockedTo, fieldNumber: 5) - } - if !self.name.isEmpty { - try visitor.visitSingularStringField(value: self.name, fieldNumber: 6) - } - if !self.description_p.isEmpty { - try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 7) - } - if self.icon != 0 { - try visitor.visitSingularFixed32Field(value: self.icon, fieldNumber: 8) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Waypoint, rhs: Waypoint) -> 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.lockedTo != rhs.lockedTo {return false} - if lhs.name != rhs.name {return false} - if lhs.description_p != rhs.description_p {return false} - if lhs.icon != rhs.icon {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "MeshPacket" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "from"), - 2: .same(proto: "to"), - 3: .same(proto: "channel"), - 4: .same(proto: "decoded"), - 5: .same(proto: "encrypted"), - 6: .same(proto: "id"), - 7: .standard(proto: "rx_time"), - 8: .standard(proto: "rx_snr"), - 9: .standard(proto: "hop_limit"), - 10: .standard(proto: "want_ack"), - 11: .same(proto: "priority"), - 12: .standard(proto: "rx_rssi"), - 13: .same(proto: "delayed"), - ] - - fileprivate class _StorageClass { - var _from: UInt32 = 0 - var _to: UInt32 = 0 - var _channel: UInt32 = 0 - var _payloadVariant: MeshPacket.OneOf_PayloadVariant? - var _id: UInt32 = 0 - var _rxTime: UInt32 = 0 - var _rxSnr: Float = 0 - var _hopLimit: UInt32 = 0 - var _wantAck: Bool = false - var _priority: MeshPacket.Priority = .unset - var _rxRssi: Int32 = 0 - var _delayed: MeshPacket.Delayed = .noDelay - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _from = source._from - _to = source._to - _channel = source._channel - _payloadVariant = source._payloadVariant - _id = source._id - _rxTime = source._rxTime - _rxSnr = source._rxSnr - _hopLimit = source._hopLimit - _wantAck = source._wantAck - _priority = source._priority - _rxRssi = source._rxRssi - _delayed = source._delayed - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _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.decodeSingularFixed32Field(value: &_storage._from) }() - case 2: try { try decoder.decodeSingularFixed32Field(value: &_storage._to) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &_storage._channel) }() - case 4: try { - var v: DataMessage? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .decoded(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .decoded(v) - } - }() - case 5: try { - var v: Data? - try decoder.decodeSingularBytesField(value: &v) - if let v = v { - if _storage._payloadVariant != nil {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .encrypted(v) - } - }() - case 6: try { try decoder.decodeSingularFixed32Field(value: &_storage._id) }() - case 7: try { try decoder.decodeSingularFixed32Field(value: &_storage._rxTime) }() - case 8: try { try decoder.decodeSingularFloatField(value: &_storage._rxSnr) }() - case 9: try { try decoder.decodeSingularUInt32Field(value: &_storage._hopLimit) }() - case 10: try { try decoder.decodeSingularBoolField(value: &_storage._wantAck) }() - case 11: try { try decoder.decodeSingularEnumField(value: &_storage._priority) }() - case 12: try { try decoder.decodeSingularInt32Field(value: &_storage._rxRssi) }() - case 13: try { try decoder.decodeSingularEnumField(value: &_storage._delayed) }() - default: break - } - } - } - } - - 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) - } - if _storage._to != 0 { - try visitor.visitSingularFixed32Field(value: _storage._to, fieldNumber: 2) - } - if _storage._channel != 0 { - try visitor.visitSingularUInt32Field(value: _storage._channel, fieldNumber: 3) - } - switch _storage._payloadVariant { - case .decoded?: try { - guard case .decoded(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - }() - case .encrypted?: try { - guard case .encrypted(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularBytesField(value: v, fieldNumber: 5) - }() - case nil: break - } - if _storage._id != 0 { - try visitor.visitSingularFixed32Field(value: _storage._id, fieldNumber: 6) - } - if _storage._rxTime != 0 { - try visitor.visitSingularFixed32Field(value: _storage._rxTime, fieldNumber: 7) - } - if _storage._rxSnr != 0 { - try visitor.visitSingularFloatField(value: _storage._rxSnr, fieldNumber: 8) - } - if _storage._hopLimit != 0 { - try visitor.visitSingularUInt32Field(value: _storage._hopLimit, fieldNumber: 9) - } - if _storage._wantAck != false { - try visitor.visitSingularBoolField(value: _storage._wantAck, fieldNumber: 10) - } - if _storage._priority != .unset { - try visitor.visitSingularEnumField(value: _storage._priority, fieldNumber: 11) - } - if _storage._rxRssi != 0 { - try visitor.visitSingularInt32Field(value: _storage._rxRssi, fieldNumber: 12) - } - if _storage._delayed != .noDelay { - try visitor.visitSingularEnumField(value: _storage._delayed, fieldNumber: 13) - } - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: MeshPacket, rhs: MeshPacket) -> Bool { - 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._from != rhs_storage._from {return false} - if _storage._to != rhs_storage._to {return false} - if _storage._channel != rhs_storage._channel {return false} - if _storage._payloadVariant != rhs_storage._payloadVariant {return false} - if _storage._id != rhs_storage._id {return false} - if _storage._rxTime != rhs_storage._rxTime {return false} - if _storage._rxSnr != rhs_storage._rxSnr {return false} - if _storage._hopLimit != rhs_storage._hopLimit {return false} - if _storage._wantAck != rhs_storage._wantAck {return false} - if _storage._priority != rhs_storage._priority {return false} - if _storage._rxRssi != rhs_storage._rxRssi {return false} - if _storage._delayed != rhs_storage._delayed {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension MeshPacket.Priority: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNSET"), - 1: .same(proto: "MIN"), - 10: .same(proto: "BACKGROUND"), - 64: .same(proto: "DEFAULT"), - 70: .same(proto: "RELIABLE"), - 120: .same(proto: "ACK"), - 127: .same(proto: "MAX"), - ] -} - -extension MeshPacket.Delayed: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NO_DELAY"), - 1: .same(proto: "DELAYED_BROADCAST"), - 2: .same(proto: "DELAYED_DIRECT"), - ] -} - -extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "NodeInfo" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "num"), - 2: .same(proto: "user"), - 3: .same(proto: "position"), - 4: .same(proto: "snr"), - 5: .standard(proto: "last_heard"), - 6: .standard(proto: "device_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.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.decodeSingularFloatField(value: &self.snr) }() - case 5: try { try decoder.decodeSingularFixed32Field(value: &self.lastHeard) }() - case 6: try { try decoder.decodeSingularMessageField(value: &self._deviceMetrics) }() - 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.num != 0 { - try visitor.visitSingularUInt32Field(value: self.num, fieldNumber: 1) - } - try { if let v = self._user { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try { if let v = self._position { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - if self.snr != 0 { - try visitor.visitSingularFloatField(value: self.snr, fieldNumber: 4) - } - if self.lastHeard != 0 { - try visitor.visitSingularFixed32Field(value: self.lastHeard, fieldNumber: 5) - } - try { if let v = self._deviceMetrics { - 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._deviceMetrics != rhs._deviceMetrics {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "MyNodeInfo" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "my_node_num"), - 2: .standard(proto: "has_gps"), - 3: .standard(proto: "max_channels"), - 4: .standard(proto: "firmware_version"), - 5: .standard(proto: "error_code"), - 6: .standard(proto: "error_address"), - 7: .standard(proto: "error_count"), - 8: .standard(proto: "reboot_count"), - 9: .same(proto: "bitrate"), - 10: .standard(proto: "message_timeout_msec"), - 11: .standard(proto: "min_app_version"), - 12: .standard(proto: "air_period_tx"), - 13: .standard(proto: "air_period_rx"), - 14: .standard(proto: "has_wifi"), - 15: .standard(proto: "channel_utilization"), - 16: .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.myNodeNum) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.hasGps_p) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.maxChannels) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.firmwareVersion) }() - case 5: try { try decoder.decodeSingularEnumField(value: &self.errorCode) }() - case 6: try { try decoder.decodeSingularUInt32Field(value: &self.errorAddress) }() - case 7: try { try decoder.decodeSingularUInt32Field(value: &self.errorCount) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &self.rebootCount) }() - case 9: try { try decoder.decodeSingularFloatField(value: &self.bitrate) }() - case 10: try { try decoder.decodeSingularUInt32Field(value: &self.messageTimeoutMsec) }() - case 11: try { try decoder.decodeSingularUInt32Field(value: &self.minAppVersion) }() - case 12: try { try decoder.decodeRepeatedUInt32Field(value: &self.airPeriodTx) }() - case 13: try { try decoder.decodeRepeatedUInt32Field(value: &self.airPeriodRx) }() - case 14: try { try decoder.decodeSingularBoolField(value: &self.hasWifi_p) }() - case 15: try { try decoder.decodeSingularFloatField(value: &self.channelUtilization) }() - case 16: try { try decoder.decodeSingularFloatField(value: &self.airUtilTx) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.myNodeNum != 0 { - try visitor.visitSingularUInt32Field(value: self.myNodeNum, fieldNumber: 1) - } - if self.hasGps_p != false { - try visitor.visitSingularBoolField(value: self.hasGps_p, fieldNumber: 2) - } - if self.maxChannels != 0 { - try visitor.visitSingularUInt32Field(value: self.maxChannels, fieldNumber: 3) - } - if !self.firmwareVersion.isEmpty { - try visitor.visitSingularStringField(value: self.firmwareVersion, fieldNumber: 4) - } - if self.errorCode != .none { - try visitor.visitSingularEnumField(value: self.errorCode, fieldNumber: 5) - } - if self.errorAddress != 0 { - try visitor.visitSingularUInt32Field(value: self.errorAddress, fieldNumber: 6) - } - if self.errorCount != 0 { - try visitor.visitSingularUInt32Field(value: self.errorCount, fieldNumber: 7) - } - if self.rebootCount != 0 { - try visitor.visitSingularUInt32Field(value: self.rebootCount, fieldNumber: 8) - } - if self.bitrate != 0 { - try visitor.visitSingularFloatField(value: self.bitrate, fieldNumber: 9) - } - if self.messageTimeoutMsec != 0 { - try visitor.visitSingularUInt32Field(value: self.messageTimeoutMsec, fieldNumber: 10) - } - if self.minAppVersion != 0 { - try visitor.visitSingularUInt32Field(value: self.minAppVersion, fieldNumber: 11) - } - if !self.airPeriodTx.isEmpty { - try visitor.visitPackedUInt32Field(value: self.airPeriodTx, fieldNumber: 12) - } - if !self.airPeriodRx.isEmpty { - try visitor.visitPackedUInt32Field(value: self.airPeriodRx, fieldNumber: 13) - } - if self.hasWifi_p != false { - try visitor.visitSingularBoolField(value: self.hasWifi_p, fieldNumber: 14) - } - if self.channelUtilization != 0 { - try visitor.visitSingularFloatField(value: self.channelUtilization, fieldNumber: 15) - } - if self.airUtilTx != 0 { - try visitor.visitSingularFloatField(value: self.airUtilTx, fieldNumber: 16) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: MyNodeInfo, rhs: MyNodeInfo) -> Bool { - if lhs.myNodeNum != rhs.myNodeNum {return false} - if lhs.hasGps_p != rhs.hasGps_p {return false} - if lhs.maxChannels != rhs.maxChannels {return false} - if lhs.firmwareVersion != rhs.firmwareVersion {return false} - if lhs.errorCode != rhs.errorCode {return false} - if lhs.errorAddress != rhs.errorAddress {return false} - if lhs.errorCount != rhs.errorCount {return false} - if lhs.rebootCount != rhs.rebootCount {return false} - if lhs.bitrate != rhs.bitrate {return false} - if lhs.messageTimeoutMsec != rhs.messageTimeoutMsec {return false} - if lhs.minAppVersion != rhs.minAppVersion {return false} - if lhs.airPeriodTx != rhs.airPeriodTx {return false} - if lhs.airPeriodRx != rhs.airPeriodRx {return false} - if lhs.hasWifi_p != rhs.hasWifi_p {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 LogRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "LogRecord" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "message"), - 2: .same(proto: "time"), - 3: .same(proto: "source"), - 4: .same(proto: "level"), - ] - - 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.message) }() - case 2: try { try decoder.decodeSingularFixed32Field(value: &self.time) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.source) }() - case 4: try { try decoder.decodeSingularEnumField(value: &self.level) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.message.isEmpty { - try visitor.visitSingularStringField(value: self.message, fieldNumber: 1) - } - if self.time != 0 { - try visitor.visitSingularFixed32Field(value: self.time, fieldNumber: 2) - } - if !self.source.isEmpty { - try visitor.visitSingularStringField(value: self.source, fieldNumber: 3) - } - if self.level != .unset { - try visitor.visitSingularEnumField(value: self.level, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: LogRecord, rhs: LogRecord) -> Bool { - if lhs.message != rhs.message {return false} - if lhs.time != rhs.time {return false} - if lhs.source != rhs.source {return false} - if lhs.level != rhs.level {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension LogRecord.Level: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNSET"), - 5: .same(proto: "TRACE"), - 10: .same(proto: "DEBUG"), - 20: .same(proto: "INFO"), - 30: .same(proto: "WARNING"), - 40: .same(proto: "ERROR"), - 50: .same(proto: "CRITICAL"), - ] -} - -extension QueueStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "QueueStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "res"), - 2: .same(proto: "free"), - 3: .same(proto: "maxlen"), - 4: .standard(proto: "mesh_packet_id"), - ] - - 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.decodeSingularInt32Field(value: &self.res) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.free) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.maxlen) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.meshPacketID) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.res != 0 { - try visitor.visitSingularInt32Field(value: self.res, fieldNumber: 1) - } - if self.free != 0 { - try visitor.visitSingularUInt32Field(value: self.free, fieldNumber: 2) - } - if self.maxlen != 0 { - try visitor.visitSingularUInt32Field(value: self.maxlen, fieldNumber: 3) - } - if self.meshPacketID != 0 { - try visitor.visitSingularUInt32Field(value: self.meshPacketID, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: QueueStatus, rhs: QueueStatus) -> Bool { - if lhs.res != rhs.res {return false} - if lhs.free != rhs.free {return false} - if lhs.maxlen != rhs.maxlen {return false} - if lhs.meshPacketID != rhs.meshPacketID {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "FromRadio" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "id"), - 2: .same(proto: "packet"), - 3: .standard(proto: "my_info"), - 4: .standard(proto: "node_info"), - 5: .same(proto: "config"), - 6: .standard(proto: "log_record"), - 7: .standard(proto: "config_complete_id"), - 8: .same(proto: "rebooted"), - 9: .same(proto: "moduleConfig"), - 10: .same(proto: "channel"), - 11: .same(proto: "queueStatus"), - 12: .same(proto: "xmodemPacket"), - ] - - fileprivate class _StorageClass { - var _id: UInt32 = 0 - var _payloadVariant: FromRadio.OneOf_PayloadVariant? - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _id = source._id - _payloadVariant = source._payloadVariant - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _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._id) }() - case 2: try { - var v: MeshPacket? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .packet(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .packet(v) - } - }() - case 3: try { - var v: MyNodeInfo? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .myInfo(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .myInfo(v) - } - }() - case 4: try { - var v: NodeInfo? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .nodeInfo(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .nodeInfo(v) - } - }() - case 5: try { - var v: Config? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .config(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .config(v) - } - }() - case 6: try { - var v: LogRecord? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .logRecord(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .logRecord(v) - } - }() - case 7: try { - var v: UInt32? - try decoder.decodeSingularUInt32Field(value: &v) - if let v = v { - if _storage._payloadVariant != nil {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .configCompleteID(v) - } - }() - case 8: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if _storage._payloadVariant != nil {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .rebooted(v) - } - }() - case 9: try { - var v: ModuleConfig? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .moduleConfig(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .moduleConfig(v) - } - }() - case 10: try { - var v: Channel? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .channel(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .channel(v) - } - }() - case 11: try { - var v: QueueStatus? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .queueStatus(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .queueStatus(v) - } - }() - case 12: try { - var v: XModem? - var hadOneofValue = false - if let current = _storage._payloadVariant { - hadOneofValue = true - if case .xmodemPacket(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - _storage._payloadVariant = .xmodemPacket(v) - } - }() - default: break - } - } - } - } - - 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._id != 0 { - try visitor.visitSingularUInt32Field(value: _storage._id, fieldNumber: 1) - } - switch _storage._payloadVariant { - case .packet?: try { - guard case .packet(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case .myInfo?: try { - guard case .myInfo(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - }() - case .nodeInfo?: try { - guard case .nodeInfo(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - }() - case .config?: try { - guard case .config(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - }() - case .logRecord?: try { - guard case .logRecord(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - }() - case .configCompleteID?: try { - guard case .configCompleteID(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularUInt32Field(value: v, fieldNumber: 7) - }() - case .rebooted?: try { - guard case .rebooted(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 8) - }() - case .moduleConfig?: try { - guard case .moduleConfig(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - }() - case .channel?: try { - guard case .channel(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 10) - }() - case .queueStatus?: try { - guard case .queueStatus(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 11) - }() - case .xmodemPacket?: try { - guard case .xmodemPacket(let v)? = _storage._payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 12) - }() - case nil: break - } - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: FromRadio, rhs: FromRadio) -> Bool { - 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._id != rhs_storage._id {return false} - if _storage._payloadVariant != rhs_storage._payloadVariant {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "ToRadio" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "packet"), - 3: .standard(proto: "want_config_id"), - 4: .same(proto: "disconnect"), - 5: .same(proto: "xmodemPacket"), - ] - - 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 { - var v: MeshPacket? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .packet(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .packet(v) - } - }() - case 3: try { - var v: UInt32? - try decoder.decodeSingularUInt32Field(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .wantConfigID(v) - } - }() - case 4: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} - self.payloadVariant = .disconnect(v) - } - }() - case 5: try { - var v: XModem? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .xmodemPacket(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .xmodemPacket(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 - switch self.payloadVariant { - case .packet?: try { - guard case .packet(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .wantConfigID?: try { - guard case .wantConfigID(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularUInt32Field(value: v, fieldNumber: 3) - }() - case .disconnect?: try { - guard case .disconnect(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 4) - }() - case .xmodemPacket?: try { - guard case .xmodemPacket(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ToRadio, rhs: ToRadio) -> Bool { - if lhs.payloadVariant != rhs.payloadVariant {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Compressed: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "Compressed" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "portnum"), - 2: .same(proto: "data"), - ] - - 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.decodeSingularEnumField(value: &self.portnum) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.data) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.portnum != .unknownApp { - try visitor.visitSingularEnumField(value: self.portnum, fieldNumber: 1) - } - if !self.data.isEmpty { - try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Compressed, rhs: Compressed) -> Bool { - if lhs.portnum != rhs.portnum {return false} - if lhs.data != rhs.data {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/module_config.pb.swift b/Meshtastic/Protobufs/module_config.pb.swift deleted file mode 100644 index 74a8e7a1..00000000 --- a/Meshtastic/Protobufs/module_config.pb.swift +++ /dev/null @@ -1,1736 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: module_config.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 -} - -/// -/// Module Config -struct ModuleConfig { - // 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 payloadVariant: ModuleConfig.OneOf_PayloadVariant? = nil - - /// - /// TODO: REPLACE - var mqtt: ModuleConfig.MQTTConfig { - get { - if case .mqtt(let v)? = payloadVariant {return v} - return ModuleConfig.MQTTConfig() - } - set {payloadVariant = .mqtt(newValue)} - } - - /// - /// TODO: REPLACE - var serial: ModuleConfig.SerialConfig { - get { - if case .serial(let v)? = payloadVariant {return v} - return ModuleConfig.SerialConfig() - } - set {payloadVariant = .serial(newValue)} - } - - /// - /// TODO: REPLACE - var externalNotification: ModuleConfig.ExternalNotificationConfig { - get { - if case .externalNotification(let v)? = payloadVariant {return v} - return ModuleConfig.ExternalNotificationConfig() - } - set {payloadVariant = .externalNotification(newValue)} - } - - /// - /// TODO: REPLACE - var storeForward: ModuleConfig.StoreForwardConfig { - get { - if case .storeForward(let v)? = payloadVariant {return v} - return ModuleConfig.StoreForwardConfig() - } - set {payloadVariant = .storeForward(newValue)} - } - - /// - /// TODO: REPLACE - var rangeTest: ModuleConfig.RangeTestConfig { - get { - if case .rangeTest(let v)? = payloadVariant {return v} - return ModuleConfig.RangeTestConfig() - } - set {payloadVariant = .rangeTest(newValue)} - } - - /// - /// TODO: REPLACE - var telemetry: ModuleConfig.TelemetryConfig { - get { - if case .telemetry(let v)? = payloadVariant {return v} - return ModuleConfig.TelemetryConfig() - } - set {payloadVariant = .telemetry(newValue)} - } - - /// - /// TODO: REPLACE - var cannedMessage: ModuleConfig.CannedMessageConfig { - get { - if case .cannedMessage(let v)? = payloadVariant {return v} - return ModuleConfig.CannedMessageConfig() - } - 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)} - } - - /// - /// TODO: REPLACE - var remoteHardware: ModuleConfig.RemoteHardwareConfig { - get { - if case .remoteHardware(let v)? = payloadVariant {return v} - return ModuleConfig.RemoteHardwareConfig() - } - set {payloadVariant = .remoteHardware(newValue)} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// TODO: REPLACE - enum OneOf_PayloadVariant: Equatable { - /// - /// TODO: REPLACE - case mqtt(ModuleConfig.MQTTConfig) - /// - /// TODO: REPLACE - case serial(ModuleConfig.SerialConfig) - /// - /// TODO: REPLACE - case externalNotification(ModuleConfig.ExternalNotificationConfig) - /// - /// TODO: REPLACE - case storeForward(ModuleConfig.StoreForwardConfig) - /// - /// TODO: REPLACE - case rangeTest(ModuleConfig.RangeTestConfig) - /// - /// TODO: REPLACE - case telemetry(ModuleConfig.TelemetryConfig) - /// - /// TODO: REPLACE - case cannedMessage(ModuleConfig.CannedMessageConfig) - /// - /// TODO: REPLACE - case audio(ModuleConfig.AudioConfig) - /// - /// TODO: REPLACE - case remoteHardware(ModuleConfig.RemoteHardwareConfig) - - #if !swift(>=4.1) - static func ==(lhs: ModuleConfig.OneOf_PayloadVariant, rhs: ModuleConfig.OneOf_PayloadVariant) -> 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 (.mqtt, .mqtt): return { - guard case .mqtt(let l) = lhs, case .mqtt(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.serial, .serial): return { - guard case .serial(let l) = lhs, case .serial(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.externalNotification, .externalNotification): return { - guard case .externalNotification(let l) = lhs, case .externalNotification(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.storeForward, .storeForward): return { - guard case .storeForward(let l) = lhs, case .storeForward(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.rangeTest, .rangeTest): return { - guard case .rangeTest(let l) = lhs, case .rangeTest(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.telemetry, .telemetry): return { - guard case .telemetry(let l) = lhs, case .telemetry(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cannedMessage, .cannedMessage): return { - 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 - }() - case (.remoteHardware, .remoteHardware): return { - guard case .remoteHardware(let l) = lhs, case .remoteHardware(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// - /// MQTT Client Config - struct MQTTConfig { - // 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. - - /// - /// If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as - /// is_uplink_enabled or is_downlink_enabled. - var enabled: Bool = false - - /// - /// The server to use for our MQTT global message gateway feature. - /// If not set, the default server will be used - var address: String = String() - - /// - /// MQTT username to use (most useful for a custom MQTT server). - /// If using a custom server, this will be honoured even if empty. - /// If using the default server, this will only be honoured if set, otherwise the device will use the default username - var username: String = String() - - /// - /// MQTT password to use (most useful for a custom MQTT server). - /// If using a custom server, this will be honoured even if empty. - /// If using the default server, this will only be honoured if set, otherwise the device will use the default password - var password: String = String() - - /// - /// Whether to send encrypted or decrypted packets to MQTT. - /// This parameter is only honoured if you also set server - /// (the default official mqtt.meshtastic.org server can handle encrypted packets) - /// Decrypted packets may be useful for external systems that want to consume meshtastic packets - var encryptionEnabled: Bool = false - - /// - /// Whether to send / consume json packets on MQTT - var jsonEnabled: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - /// - /// RemoteHardwareModule Config - struct RemoteHardwareConfig { - // 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 the Module is enabled - var enabled: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - 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 - - /// - /// PTT Pin - var pttPin: UInt32 = 0 - - /// - /// The audio sample rate to use for codec2 - var bitrate: ModuleConfig.AudioConfig.Audio_Baud = .codec2Default - - /// - /// I2S Word Select - var i2SWs: UInt32 = 0 - - /// - /// I2S Data IN - var i2SSd: UInt32 = 0 - - /// - /// I2S Data OUT - var i2SDin: UInt32 = 0 - - /// - /// I2S Clock - var i2SSck: UInt32 = 0 - - 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 { - // 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. - - /// - /// Preferences for the SerialModule - /// FIXME - Move this out of UserPreferences and into a section for module configuration. - var enabled: Bool = false - - /// - /// TODO: REPLACE - var echo: Bool = false - - /// - /// TODO: REPLACE - var rxd: UInt32 = 0 - - /// - /// TODO: REPLACE - var txd: UInt32 = 0 - - /// - /// TODO: REPLACE - var baud: ModuleConfig.SerialConfig.Serial_Baud = .baudDefault - - /// - /// TODO: REPLACE - var timeout: UInt32 = 0 - - /// - /// TODO: REPLACE - var mode: ModuleConfig.SerialConfig.Serial_Mode = .default - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// TODO: REPLACE - enum Serial_Baud: SwiftProtobuf.Enum { - typealias RawValue = Int - case baudDefault // = 0 - case baud110 // = 1 - case baud300 // = 2 - case baud600 // = 3 - case baud1200 // = 4 - case baud2400 // = 5 - case baud4800 // = 6 - case baud9600 // = 7 - case baud19200 // = 8 - case baud38400 // = 9 - case baud57600 // = 10 - case baud115200 // = 11 - case baud230400 // = 12 - case baud460800 // = 13 - case baud576000 // = 14 - case baud921600 // = 15 - case UNRECOGNIZED(Int) - - init() { - self = .baudDefault - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .baudDefault - case 1: self = .baud110 - case 2: self = .baud300 - case 3: self = .baud600 - case 4: self = .baud1200 - case 5: self = .baud2400 - case 6: self = .baud4800 - case 7: self = .baud9600 - case 8: self = .baud19200 - case 9: self = .baud38400 - case 10: self = .baud57600 - case 11: self = .baud115200 - case 12: self = .baud230400 - case 13: self = .baud460800 - case 14: self = .baud576000 - case 15: self = .baud921600 - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .baudDefault: return 0 - case .baud110: return 1 - case .baud300: return 2 - case .baud600: return 3 - case .baud1200: return 4 - case .baud2400: return 5 - case .baud4800: return 6 - case .baud9600: return 7 - case .baud19200: return 8 - case .baud38400: return 9 - case .baud57600: return 10 - case .baud115200: return 11 - case .baud230400: return 12 - case .baud460800: return 13 - case .baud576000: return 14 - case .baud921600: return 15 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// TODO: REPLACE - enum Serial_Mode: SwiftProtobuf.Enum { - typealias RawValue = Int - case `default` // = 0 - case simple // = 1 - case proto // = 2 - case textmsg // = 3 - case nmea // = 4 - case UNRECOGNIZED(Int) - - init() { - self = .default - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .default - case 1: self = .simple - case 2: self = .proto - case 3: self = .textmsg - case 4: self = .nmea - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .default: return 0 - case .simple: return 1 - case .proto: return 2 - case .textmsg: return 3 - case .nmea: return 4 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - } - - /// - /// External Notifications Config - struct ExternalNotificationConfig { - // 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. - - /// - /// Enable the ExternalNotificationModule - var enabled: Bool = false - - /// - /// When using in On/Off mode, keep the output on for this many - /// milliseconds. Default 1000ms (1 second). - var outputMs: UInt32 = 0 - - /// - /// Define the output pin GPIO setting Defaults to - /// EXT_NOTIFY_OUT if set for the board. - /// In standalone devices this pin should drive the LED to match the UI. - var output: UInt32 = 0 - - /// - /// Optional: Define a secondary output pin for a vibra motor - /// This is used in standalone devices to match the UI. - var outputVibra: UInt32 = 0 - - /// - /// Optional: Define a tertiary output pin for an active buzzer - /// This is used in standalone devices to to match the UI. - var outputBuzzer: UInt32 = 0 - - /// - /// IF this is true, the 'output' Pin will be pulled active high, false - /// means active low. - var active: Bool = false - - /// - /// True: Alert when a text message arrives (output) - var alertMessage: Bool = false - - /// - /// True: Alert when a text message arrives (output_vibra) - var alertMessageVibra: Bool = false - - /// - /// True: Alert when a text message arrives (output_buzzer) - var alertMessageBuzzer: Bool = false - - /// - /// True: Alert when the bell character is received (output) - var alertBell: Bool = false - - /// - /// True: Alert when the bell character is received (output_vibra) - var alertBellVibra: Bool = false - - /// - /// True: Alert when the bell character is received (output_buzzer) - var alertBellBuzzer: Bool = false - - /// - /// use a PWM output instead of a simple on/off output. This will ignore - /// the 'output', 'output_ms' and 'active' settings and use the - /// device.buzzer_gpio instead. - var usePwm: Bool = false - - /// - /// The notification will toggle with 'output_ms' for this time of seconds. - /// Default is 0 which means don't repeat at all. 60 would mean blink - /// and/or beep for 60 seconds - var nagTimeout: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - /// - /// Store and Forward Module Config - struct StoreForwardConfig { - // 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. - - /// - /// Enable the Store and Forward Module - var enabled: Bool = false - - /// - /// TODO: REPLACE - var heartbeat: Bool = false - - /// - /// TODO: REPLACE - var records: UInt32 = 0 - - /// - /// TODO: REPLACE - var historyReturnMax: UInt32 = 0 - - /// - /// TODO: REPLACE - var historyReturnWindow: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - /// - /// Preferences for the RangeTestModule - struct RangeTestConfig { - // 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. - - /// - /// Enable the Range Test Module - var enabled: Bool = false - - /// - /// Send out range test messages from this node - var sender: UInt32 = 0 - - /// - /// Bool value indicating that this node should save a RangeTest.csv file. - /// ESP32 Only - var save: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - /// - /// Configuration for both device and environment metrics - struct TelemetryConfig { - // 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. - - /// - /// Interval in seconds of how often we should try to send our - /// device metrics to the mesh - var deviceUpdateInterval: UInt32 = 0 - - var environmentUpdateInterval: UInt32 = 0 - - /// - /// Preferences for the Telemetry Module (Environment) - /// Enable/Disable the telemetry measurement module measurement collection - var environmentMeasurementEnabled: Bool = false - - /// - /// Enable/Disable the telemetry measurement module on-device display - var environmentScreenEnabled: Bool = false - - /// - /// We'll always read the sensor in Celsius, but sometimes we might want to - /// display the results in Fahrenheit as a "user preference". - var environmentDisplayFahrenheit: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - /// - /// TODO: REPLACE - struct CannedMessageConfig { - // 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. - - /// - /// Enable the rotary encoder #1. This is a 'dumb' encoder sending pulses on both A and B pins while rotating. - var rotary1Enabled: Bool = false - - /// - /// GPIO pin for rotary encoder A port. - var inputbrokerPinA: UInt32 = 0 - - /// - /// GPIO pin for rotary encoder B port. - var inputbrokerPinB: UInt32 = 0 - - /// - /// GPIO pin for rotary encoder Press port. - var inputbrokerPinPress: UInt32 = 0 - - /// - /// Generate input event on CW of this kind. - var inputbrokerEventCw: ModuleConfig.CannedMessageConfig.InputEventChar = .none - - /// - /// Generate input event on CCW of this kind. - var inputbrokerEventCcw: ModuleConfig.CannedMessageConfig.InputEventChar = .none - - /// - /// Generate input event on Press of this kind. - var inputbrokerEventPress: ModuleConfig.CannedMessageConfig.InputEventChar = .none - - /// - /// 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 = false - - /// - /// Enable/disable CannedMessageModule. - var enabled: Bool = false - - /// - /// Input event origin accepted by the canned message module. - /// Can be e.g. "rotEnc1", "upDownEnc1" or keyword "_any" - var allowInputSource: String = String() - - /// - /// CannedMessageModule also sends a bell character with the messages. - /// ExternalNotificationModule can benefit from this feature. - var sendBell: Bool = false - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// TODO: REPLACE - enum InputEventChar: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// TODO: REPLACE - case none // = 0 - - /// - /// TODO: REPLACE - case up // = 17 - - /// - /// TODO: REPLACE - case down // = 18 - - /// - /// TODO: REPLACE - case left // = 19 - - /// - /// TODO: REPLACE - case right // = 20 - - /// - /// '\n' - case select // = 10 - - /// - /// TODO: REPLACE - case back // = 27 - - /// - /// TODO: REPLACE - case cancel // = 24 - case UNRECOGNIZED(Int) - - init() { - self = .none - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .none - case 10: self = .select - case 17: self = .up - case 18: self = .down - case 19: self = .left - case 20: self = .right - case 24: self = .cancel - case 27: self = .back - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .none: return 0 - case .select: return 10 - case .up: return 17 - case .down: return 18 - case .left: return 19 - case .right: return 20 - case .cancel: return 24 - case .back: return 27 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} - } - - init() {} -} - -#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] = [ - .baudDefault, - .baud110, - .baud300, - .baud600, - .baud1200, - .baud2400, - .baud4800, - .baud9600, - .baud19200, - .baud38400, - .baud57600, - .baud115200, - .baud230400, - .baud460800, - .baud576000, - .baud921600, - ] -} - -extension ModuleConfig.SerialConfig.Serial_Mode: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [ModuleConfig.SerialConfig.Serial_Mode] = [ - .default, - .simple, - .proto, - .textmsg, - .nmea, - ] -} - -extension ModuleConfig.CannedMessageConfig.InputEventChar: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [ModuleConfig.CannedMessageConfig.InputEventChar] = [ - .none, - .up, - .down, - .left, - .right, - .select, - .back, - .cancel, - ] -} - -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension ModuleConfig: @unchecked Sendable {} -extension ModuleConfig.OneOf_PayloadVariant: @unchecked Sendable {} -extension ModuleConfig.MQTTConfig: @unchecked Sendable {} -extension ModuleConfig.RemoteHardwareConfig: @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 {} -extension ModuleConfig.ExternalNotificationConfig: @unchecked Sendable {} -extension ModuleConfig.StoreForwardConfig: @unchecked Sendable {} -extension ModuleConfig.RangeTestConfig: @unchecked Sendable {} -extension ModuleConfig.TelemetryConfig: @unchecked Sendable {} -extension ModuleConfig.CannedMessageConfig: @unchecked Sendable {} -extension ModuleConfig.CannedMessageConfig.InputEventChar: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "ModuleConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "mqtt"), - 2: .same(proto: "serial"), - 3: .standard(proto: "external_notification"), - 4: .standard(proto: "store_forward"), - 5: .standard(proto: "range_test"), - 6: .same(proto: "telemetry"), - 7: .standard(proto: "canned_message"), - 8: .same(proto: "audio"), - 9: .standard(proto: "remote_hardware"), - ] - - 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 { - var v: ModuleConfig.MQTTConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .mqtt(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .mqtt(v) - } - }() - case 2: try { - var v: ModuleConfig.SerialConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .serial(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .serial(v) - } - }() - case 3: try { - var v: ModuleConfig.ExternalNotificationConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .externalNotification(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .externalNotification(v) - } - }() - case 4: try { - var v: ModuleConfig.StoreForwardConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .storeForward(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .storeForward(v) - } - }() - case 5: try { - var v: ModuleConfig.RangeTestConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .rangeTest(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .rangeTest(v) - } - }() - case 6: try { - var v: ModuleConfig.TelemetryConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .telemetry(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .telemetry(v) - } - }() - case 7: try { - var v: ModuleConfig.CannedMessageConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .cannedMessage(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - 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) - } - }() - case 9: try { - var v: ModuleConfig.RemoteHardwareConfig? - var hadOneofValue = false - if let current = self.payloadVariant { - hadOneofValue = true - if case .remoteHardware(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.payloadVariant = .remoteHardware(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 - switch self.payloadVariant { - case .mqtt?: try { - guard case .mqtt(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - }() - case .serial?: try { - guard case .serial(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case .externalNotification?: try { - guard case .externalNotification(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - }() - case .storeForward?: try { - guard case .storeForward(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - }() - case .rangeTest?: try { - guard case .rangeTest(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - }() - case .telemetry?: try { - guard case .telemetry(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - }() - case .cannedMessage?: try { - 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 .remoteHardware?: try { - guard case .remoteHardware(let v)? = self.payloadVariant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig, rhs: ModuleConfig) -> Bool { - if lhs.payloadVariant != rhs.payloadVariant {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".MQTTConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "enabled"), - 2: .same(proto: "address"), - 3: .same(proto: "username"), - 4: .same(proto: "password"), - 5: .standard(proto: "encryption_enabled"), - 6: .standard(proto: "json_enabled"), - ] - - 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.enabled) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.address) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.username) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.password) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self.encryptionEnabled) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self.jsonEnabled) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) - } - if !self.address.isEmpty { - try visitor.visitSingularStringField(value: self.address, fieldNumber: 2) - } - if !self.username.isEmpty { - try visitor.visitSingularStringField(value: self.username, fieldNumber: 3) - } - if !self.password.isEmpty { - try visitor.visitSingularStringField(value: self.password, fieldNumber: 4) - } - if self.encryptionEnabled != false { - try visitor.visitSingularBoolField(value: self.encryptionEnabled, fieldNumber: 5) - } - if self.jsonEnabled != false { - try visitor.visitSingularBoolField(value: self.jsonEnabled, fieldNumber: 6) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.MQTTConfig, rhs: ModuleConfig.MQTTConfig) -> Bool { - if lhs.enabled != rhs.enabled {return false} - if lhs.address != rhs.address {return false} - if lhs.username != rhs.username {return false} - if lhs.password != rhs.password {return false} - if lhs.encryptionEnabled != rhs.encryptionEnabled {return false} - if lhs.jsonEnabled != rhs.jsonEnabled {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.RemoteHardwareConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".RemoteHardwareConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "enabled"), - ] - - 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.enabled) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.RemoteHardwareConfig, rhs: ModuleConfig.RemoteHardwareConfig) -> Bool { - if lhs.enabled != rhs.enabled {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -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: "ptt_pin"), - 3: .same(proto: "bitrate"), - 4: .standard(proto: "i2s_ws"), - 5: .standard(proto: "i2s_sd"), - 6: .standard(proto: "i2s_din"), - 7: .standard(proto: "i2s_sck"), - ] - - 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.pttPin) }() - case 3: try { try decoder.decodeSingularEnumField(value: &self.bitrate) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.i2SWs) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.i2SSd) }() - case 6: try { try decoder.decodeSingularUInt32Field(value: &self.i2SDin) }() - case 7: try { try decoder.decodeSingularUInt32Field(value: &self.i2SSck) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.codec2Enabled != false { - try visitor.visitSingularBoolField(value: self.codec2Enabled, fieldNumber: 1) - } - if self.pttPin != 0 { - try visitor.visitSingularUInt32Field(value: self.pttPin, fieldNumber: 2) - } - if self.bitrate != .codec2Default { - try visitor.visitSingularEnumField(value: self.bitrate, fieldNumber: 3) - } - if self.i2SWs != 0 { - try visitor.visitSingularUInt32Field(value: self.i2SWs, fieldNumber: 4) - } - if self.i2SSd != 0 { - try visitor.visitSingularUInt32Field(value: self.i2SSd, fieldNumber: 5) - } - if self.i2SDin != 0 { - try visitor.visitSingularUInt32Field(value: self.i2SDin, fieldNumber: 6) - } - if self.i2SSck != 0 { - try visitor.visitSingularUInt32Field(value: self.i2SSck, fieldNumber: 7) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.AudioConfig, rhs: ModuleConfig.AudioConfig) -> Bool { - if lhs.codec2Enabled != rhs.codec2Enabled {return false} - if lhs.pttPin != rhs.pttPin {return false} - if lhs.bitrate != rhs.bitrate {return false} - if lhs.i2SWs != rhs.i2SWs {return false} - if lhs.i2SSd != rhs.i2SSd {return false} - if lhs.i2SDin != rhs.i2SDin {return false} - if lhs.i2SSck != rhs.i2SSck {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 = [ - 1: .same(proto: "enabled"), - 2: .same(proto: "echo"), - 3: .same(proto: "rxd"), - 4: .same(proto: "txd"), - 5: .same(proto: "baud"), - 6: .same(proto: "timeout"), - 7: .same(proto: "mode"), - ] - - 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.enabled) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.echo) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.rxd) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.txd) }() - case 5: try { try decoder.decodeSingularEnumField(value: &self.baud) }() - case 6: try { try decoder.decodeSingularUInt32Field(value: &self.timeout) }() - case 7: try { try decoder.decodeSingularEnumField(value: &self.mode) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) - } - if self.echo != false { - try visitor.visitSingularBoolField(value: self.echo, fieldNumber: 2) - } - if self.rxd != 0 { - try visitor.visitSingularUInt32Field(value: self.rxd, fieldNumber: 3) - } - if self.txd != 0 { - try visitor.visitSingularUInt32Field(value: self.txd, fieldNumber: 4) - } - if self.baud != .baudDefault { - try visitor.visitSingularEnumField(value: self.baud, fieldNumber: 5) - } - if self.timeout != 0 { - try visitor.visitSingularUInt32Field(value: self.timeout, fieldNumber: 6) - } - if self.mode != .default { - try visitor.visitSingularEnumField(value: self.mode, fieldNumber: 7) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.SerialConfig, rhs: ModuleConfig.SerialConfig) -> Bool { - if lhs.enabled != rhs.enabled {return false} - if lhs.echo != rhs.echo {return false} - if lhs.rxd != rhs.rxd {return false} - if lhs.txd != rhs.txd {return false} - if lhs.baud != rhs.baud {return false} - if lhs.timeout != rhs.timeout {return false} - if lhs.mode != rhs.mode {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.SerialConfig.Serial_Baud: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "BAUD_DEFAULT"), - 1: .same(proto: "BAUD_110"), - 2: .same(proto: "BAUD_300"), - 3: .same(proto: "BAUD_600"), - 4: .same(proto: "BAUD_1200"), - 5: .same(proto: "BAUD_2400"), - 6: .same(proto: "BAUD_4800"), - 7: .same(proto: "BAUD_9600"), - 8: .same(proto: "BAUD_19200"), - 9: .same(proto: "BAUD_38400"), - 10: .same(proto: "BAUD_57600"), - 11: .same(proto: "BAUD_115200"), - 12: .same(proto: "BAUD_230400"), - 13: .same(proto: "BAUD_460800"), - 14: .same(proto: "BAUD_576000"), - 15: .same(proto: "BAUD_921600"), - ] -} - -extension ModuleConfig.SerialConfig.Serial_Mode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "DEFAULT"), - 1: .same(proto: "SIMPLE"), - 2: .same(proto: "PROTO"), - 3: .same(proto: "TEXTMSG"), - 4: .same(proto: "NMEA"), - ] -} - -extension ModuleConfig.ExternalNotificationConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".ExternalNotificationConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "enabled"), - 2: .standard(proto: "output_ms"), - 3: .same(proto: "output"), - 8: .standard(proto: "output_vibra"), - 9: .standard(proto: "output_buzzer"), - 4: .same(proto: "active"), - 5: .standard(proto: "alert_message"), - 10: .standard(proto: "alert_message_vibra"), - 11: .standard(proto: "alert_message_buzzer"), - 6: .standard(proto: "alert_bell"), - 12: .standard(proto: "alert_bell_vibra"), - 13: .standard(proto: "alert_bell_buzzer"), - 7: .standard(proto: "use_pwm"), - 14: .standard(proto: "nag_timeout"), - ] - - 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.enabled) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.outputMs) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.output) }() - case 4: try { try decoder.decodeSingularBoolField(value: &self.active) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self.alertMessage) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self.alertBell) }() - case 7: try { try decoder.decodeSingularBoolField(value: &self.usePwm) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &self.outputVibra) }() - case 9: try { try decoder.decodeSingularUInt32Field(value: &self.outputBuzzer) }() - case 10: try { try decoder.decodeSingularBoolField(value: &self.alertMessageVibra) }() - case 11: try { try decoder.decodeSingularBoolField(value: &self.alertMessageBuzzer) }() - case 12: try { try decoder.decodeSingularBoolField(value: &self.alertBellVibra) }() - case 13: try { try decoder.decodeSingularBoolField(value: &self.alertBellBuzzer) }() - case 14: try { try decoder.decodeSingularUInt32Field(value: &self.nagTimeout) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) - } - if self.outputMs != 0 { - try visitor.visitSingularUInt32Field(value: self.outputMs, fieldNumber: 2) - } - if self.output != 0 { - try visitor.visitSingularUInt32Field(value: self.output, fieldNumber: 3) - } - if self.active != false { - try visitor.visitSingularBoolField(value: self.active, fieldNumber: 4) - } - if self.alertMessage != false { - try visitor.visitSingularBoolField(value: self.alertMessage, fieldNumber: 5) - } - if self.alertBell != false { - try visitor.visitSingularBoolField(value: self.alertBell, fieldNumber: 6) - } - if self.usePwm != false { - try visitor.visitSingularBoolField(value: self.usePwm, fieldNumber: 7) - } - if self.outputVibra != 0 { - try visitor.visitSingularUInt32Field(value: self.outputVibra, fieldNumber: 8) - } - if self.outputBuzzer != 0 { - try visitor.visitSingularUInt32Field(value: self.outputBuzzer, fieldNumber: 9) - } - if self.alertMessageVibra != false { - try visitor.visitSingularBoolField(value: self.alertMessageVibra, fieldNumber: 10) - } - if self.alertMessageBuzzer != false { - try visitor.visitSingularBoolField(value: self.alertMessageBuzzer, fieldNumber: 11) - } - if self.alertBellVibra != false { - try visitor.visitSingularBoolField(value: self.alertBellVibra, fieldNumber: 12) - } - if self.alertBellBuzzer != false { - try visitor.visitSingularBoolField(value: self.alertBellBuzzer, fieldNumber: 13) - } - if self.nagTimeout != 0 { - try visitor.visitSingularUInt32Field(value: self.nagTimeout, fieldNumber: 14) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.ExternalNotificationConfig, rhs: ModuleConfig.ExternalNotificationConfig) -> Bool { - if lhs.enabled != rhs.enabled {return false} - if lhs.outputMs != rhs.outputMs {return false} - if lhs.output != rhs.output {return false} - if lhs.outputVibra != rhs.outputVibra {return false} - if lhs.outputBuzzer != rhs.outputBuzzer {return false} - if lhs.active != rhs.active {return false} - if lhs.alertMessage != rhs.alertMessage {return false} - if lhs.alertMessageVibra != rhs.alertMessageVibra {return false} - if lhs.alertMessageBuzzer != rhs.alertMessageBuzzer {return false} - if lhs.alertBell != rhs.alertBell {return false} - if lhs.alertBellVibra != rhs.alertBellVibra {return false} - if lhs.alertBellBuzzer != rhs.alertBellBuzzer {return false} - if lhs.usePwm != rhs.usePwm {return false} - if lhs.nagTimeout != rhs.nagTimeout {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.StoreForwardConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".StoreForwardConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "enabled"), - 2: .same(proto: "heartbeat"), - 3: .same(proto: "records"), - 4: .standard(proto: "history_return_max"), - 5: .standard(proto: "history_return_window"), - ] - - 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.enabled) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.heartbeat) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.records) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.historyReturnMax) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.historyReturnWindow) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) - } - if self.heartbeat != false { - try visitor.visitSingularBoolField(value: self.heartbeat, fieldNumber: 2) - } - if self.records != 0 { - try visitor.visitSingularUInt32Field(value: self.records, fieldNumber: 3) - } - if self.historyReturnMax != 0 { - try visitor.visitSingularUInt32Field(value: self.historyReturnMax, fieldNumber: 4) - } - if self.historyReturnWindow != 0 { - try visitor.visitSingularUInt32Field(value: self.historyReturnWindow, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.StoreForwardConfig, rhs: ModuleConfig.StoreForwardConfig) -> Bool { - if lhs.enabled != rhs.enabled {return false} - if lhs.heartbeat != rhs.heartbeat {return false} - if lhs.records != rhs.records {return false} - if lhs.historyReturnMax != rhs.historyReturnMax {return false} - if lhs.historyReturnWindow != rhs.historyReturnWindow {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.RangeTestConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".RangeTestConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "enabled"), - 2: .same(proto: "sender"), - 3: .same(proto: "save"), - ] - - 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.enabled) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.sender) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self.save) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) - } - if self.sender != 0 { - try visitor.visitSingularUInt32Field(value: self.sender, fieldNumber: 2) - } - if self.save != false { - try visitor.visitSingularBoolField(value: self.save, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.RangeTestConfig, rhs: ModuleConfig.RangeTestConfig) -> Bool { - if lhs.enabled != rhs.enabled {return false} - if lhs.sender != rhs.sender {return false} - if lhs.save != rhs.save {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".TelemetryConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "device_update_interval"), - 2: .standard(proto: "environment_update_interval"), - 3: .standard(proto: "environment_measurement_enabled"), - 4: .standard(proto: "environment_screen_enabled"), - 5: .standard(proto: "environment_display_fahrenheit"), - ] - - 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.deviceUpdateInterval) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.environmentUpdateInterval) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self.environmentMeasurementEnabled) }() - case 4: try { try decoder.decodeSingularBoolField(value: &self.environmentScreenEnabled) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self.environmentDisplayFahrenheit) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.deviceUpdateInterval != 0 { - try visitor.visitSingularUInt32Field(value: self.deviceUpdateInterval, fieldNumber: 1) - } - if self.environmentUpdateInterval != 0 { - try visitor.visitSingularUInt32Field(value: self.environmentUpdateInterval, fieldNumber: 2) - } - if self.environmentMeasurementEnabled != false { - try visitor.visitSingularBoolField(value: self.environmentMeasurementEnabled, fieldNumber: 3) - } - if self.environmentScreenEnabled != false { - try visitor.visitSingularBoolField(value: self.environmentScreenEnabled, fieldNumber: 4) - } - if self.environmentDisplayFahrenheit != false { - try visitor.visitSingularBoolField(value: self.environmentDisplayFahrenheit, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.TelemetryConfig, rhs: ModuleConfig.TelemetryConfig) -> Bool { - if lhs.deviceUpdateInterval != rhs.deviceUpdateInterval {return false} - if lhs.environmentUpdateInterval != rhs.environmentUpdateInterval {return false} - if lhs.environmentMeasurementEnabled != rhs.environmentMeasurementEnabled {return false} - if lhs.environmentScreenEnabled != rhs.environmentScreenEnabled {return false} - if lhs.environmentDisplayFahrenheit != rhs.environmentDisplayFahrenheit {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.CannedMessageConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".CannedMessageConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "rotary1_enabled"), - 2: .standard(proto: "inputbroker_pin_a"), - 3: .standard(proto: "inputbroker_pin_b"), - 4: .standard(proto: "inputbroker_pin_press"), - 5: .standard(proto: "inputbroker_event_cw"), - 6: .standard(proto: "inputbroker_event_ccw"), - 7: .standard(proto: "inputbroker_event_press"), - 8: .standard(proto: "updown1_enabled"), - 9: .same(proto: "enabled"), - 10: .standard(proto: "allow_input_source"), - 11: .standard(proto: "send_bell"), - ] - - 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.rotary1Enabled) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.inputbrokerPinA) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.inputbrokerPinB) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.inputbrokerPinPress) }() - case 5: try { try decoder.decodeSingularEnumField(value: &self.inputbrokerEventCw) }() - case 6: try { try decoder.decodeSingularEnumField(value: &self.inputbrokerEventCcw) }() - case 7: try { try decoder.decodeSingularEnumField(value: &self.inputbrokerEventPress) }() - case 8: try { try decoder.decodeSingularBoolField(value: &self.updown1Enabled) }() - case 9: try { try decoder.decodeSingularBoolField(value: &self.enabled) }() - case 10: try { try decoder.decodeSingularStringField(value: &self.allowInputSource) }() - case 11: try { try decoder.decodeSingularBoolField(value: &self.sendBell) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.rotary1Enabled != false { - try visitor.visitSingularBoolField(value: self.rotary1Enabled, fieldNumber: 1) - } - if self.inputbrokerPinA != 0 { - try visitor.visitSingularUInt32Field(value: self.inputbrokerPinA, fieldNumber: 2) - } - if self.inputbrokerPinB != 0 { - try visitor.visitSingularUInt32Field(value: self.inputbrokerPinB, fieldNumber: 3) - } - if self.inputbrokerPinPress != 0 { - try visitor.visitSingularUInt32Field(value: self.inputbrokerPinPress, fieldNumber: 4) - } - if self.inputbrokerEventCw != .none { - try visitor.visitSingularEnumField(value: self.inputbrokerEventCw, fieldNumber: 5) - } - if self.inputbrokerEventCcw != .none { - try visitor.visitSingularEnumField(value: self.inputbrokerEventCcw, fieldNumber: 6) - } - if self.inputbrokerEventPress != .none { - try visitor.visitSingularEnumField(value: self.inputbrokerEventPress, fieldNumber: 7) - } - if self.updown1Enabled != false { - try visitor.visitSingularBoolField(value: self.updown1Enabled, fieldNumber: 8) - } - if self.enabled != false { - try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 9) - } - if !self.allowInputSource.isEmpty { - try visitor.visitSingularStringField(value: self.allowInputSource, fieldNumber: 10) - } - if self.sendBell != false { - try visitor.visitSingularBoolField(value: self.sendBell, fieldNumber: 11) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ModuleConfig.CannedMessageConfig, rhs: ModuleConfig.CannedMessageConfig) -> Bool { - if lhs.rotary1Enabled != rhs.rotary1Enabled {return false} - if lhs.inputbrokerPinA != rhs.inputbrokerPinA {return false} - if lhs.inputbrokerPinB != rhs.inputbrokerPinB {return false} - if lhs.inputbrokerPinPress != rhs.inputbrokerPinPress {return false} - if lhs.inputbrokerEventCw != rhs.inputbrokerEventCw {return false} - if lhs.inputbrokerEventCcw != rhs.inputbrokerEventCcw {return false} - if lhs.inputbrokerEventPress != rhs.inputbrokerEventPress {return false} - if lhs.updown1Enabled != rhs.updown1Enabled {return false} - if lhs.enabled != rhs.enabled {return false} - if lhs.allowInputSource != rhs.allowInputSource {return false} - if lhs.sendBell != rhs.sendBell {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension ModuleConfig.CannedMessageConfig.InputEventChar: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NONE"), - 10: .same(proto: "SELECT"), - 17: .same(proto: "UP"), - 18: .same(proto: "DOWN"), - 19: .same(proto: "LEFT"), - 20: .same(proto: "RIGHT"), - 24: .same(proto: "CANCEL"), - 27: .same(proto: "BACK"), - ] -} diff --git a/Meshtastic/Protobufs/mqtt.pb.swift b/Meshtastic/Protobufs/mqtt.pb.swift deleted file mode 100644 index 0f347c87..00000000 --- a/Meshtastic/Protobufs/mqtt.pb.swift +++ /dev/null @@ -1,110 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: mqtt.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 -} - -/// -/// This message wraps a MeshPacket with extra metadata about the sender and how it arrived. -struct ServiceEnvelope { - // 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 (probably encrypted) packet - var packet: MeshPacket { - get {return _packet ?? MeshPacket()} - set {_packet = newValue} - } - /// Returns true if `packet` has been explicitly set. - var hasPacket: Bool {return self._packet != nil} - /// Clears the value of `packet`. Subsequent reads from it will return its default value. - mutating func clearPacket() {self._packet = nil} - - /// - /// The global channel ID it was sent on - var channelID: String = String() - - /// - /// The sending gateway node ID. Can we use this to authenticate/prevent fake - /// nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as - /// the globally trusted nodenum - var gatewayID: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - 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 { - static let protoMessageName: String = "ServiceEnvelope" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "packet"), - 2: .standard(proto: "channel_id"), - 3: .standard(proto: "gateway_id"), - ] - - 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._packet) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.channelID) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.gatewayID) }() - 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 - 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) - } - if !self.gatewayID.isEmpty { - try visitor.visitSingularStringField(value: self.gatewayID, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: ServiceEnvelope, rhs: ServiceEnvelope) -> Bool { - if lhs._packet != rhs._packet {return false} - if lhs.channelID != rhs.channelID {return false} - if lhs.gatewayID != rhs.gatewayID {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/portnums.pb.swift b/Meshtastic/Protobufs/portnums.pb.swift deleted file mode 100644 index 91949cd8..00000000 --- a/Meshtastic/Protobufs/portnums.pb.swift +++ /dev/null @@ -1,278 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: portnums.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 -} - -/// -/// For any new 'apps' that run on the device or via sister apps on phones/PCs they should pick and use a -/// unique 'portnum' for their application. -/// If you are making a new app using meshtastic, please send in a pull request to add your 'portnum' to this -/// master table. -/// PortNums should be assigned in the following range: -/// 0-63 Core Meshtastic use, do not use for third party apps -/// 64-127 Registered 3rd party apps, send in a pull request that adds a new entry to portnums.proto to register your application -/// 256-511 Use one of these portnums for your private applications that you don't want to register publically -/// All other values are reserved. -/// Note: This was formerly a Type enum named 'typ' with the same id # -/// We have change to this 'portnum' based scheme for specifying app handlers for particular payloads. -/// This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT values identically. -enum PortNum: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Deprecated: do not use in new code (formerly called OPAQUE) - /// A message sent from a device outside of the mesh, in a form the mesh does not understand - /// NOTE: This must be 0, because it is documented in IMeshService.aidl to be so - case unknownApp // = 0 - - /// - /// A simple UTF-8 text message, which even the little micros in the mesh - /// can understand and show on their screen eventually in some circumstances - /// even signal might send messages in this form (see below) - case textMessageApp // = 1 - - /// - /// Reserved for built-in GPIO/example app. - /// See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number - case remoteHardwareApp // = 2 - - /// - /// The built-in position messaging app. - /// Payload is a [Position](/docs/developers/protobufs/api#position) message - case positionApp // = 3 - - /// - /// The built-in user info app. - /// Payload is a [User](/docs/developers/protobufs/api#user) message - case nodeinfoApp // = 4 - - /// - /// Protocol control packets for mesh protocol use. - /// Payload is a [Routing](/docs/developers/protobufs/api#routing) message - case routingApp // = 5 - - /// - /// Admin control packets. - /// Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message - case adminApp // = 6 - - /// - /// Compressed TEXT_MESSAGE payloads. - case textMessageCompressedApp // = 7 - - /// - /// Waypoint payloads. - /// 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. - case replyApp // = 32 - - /// - /// Used for the python IP tunnel feature - case ipTunnelApp // = 33 - - /// - /// Provides a hardware serial interface to send and receive from the Meshtastic network. - /// 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. - /// Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp. - case serialApp // = 64 - - /// - /// STORE_FORWARD_APP (Work in Progress) - /// Maintained by Jm Casler (MC Hamster) : jm@casler.org - case storeForwardApp // = 65 - - /// - /// Optional port for messages for the range test module. - case rangeTestApp // = 66 - - /// - /// Provides a format to send and receive telemetry data from the Meshtastic network. - /// Maintained by Charles Crossan (crossan007) : crossan007@gmail.com - case telemetryApp // = 67 - - /// - /// Experimental tools for estimating node position without a GPS - /// Maintained by Github user a-f-G-U-C (a Meshtastic contributor) - /// Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS - case zpsApp // = 68 - - /// - /// Used to let multiple instances of Linux native applications communicate - /// as if they did using their LoRa chip. - /// Maintained by GitHub user GUVWAF. - /// Project files at https://github.com/GUVWAF/Meshtasticator - case simulatorApp // = 69 - - /// - /// Provides a traceroute functionality to show the route a packet towards - /// a certain destination would take on the mesh. - case tracerouteApp // = 70 - - /// - /// 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/firmware/blob/master/bin/regen-protos.sh)) - case privateApp // = 256 - - /// - /// ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder - case atakForwarder // = 257 - - /// - /// Currently we limit port nums to no higher than this value - case max // = 511 - case UNRECOGNIZED(Int) - - init() { - self = .unknownApp - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .unknownApp - case 1: self = .textMessageApp - case 2: self = .remoteHardwareApp - case 3: self = .positionApp - case 4: self = .nodeinfoApp - case 5: self = .routingApp - 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 - case 65: self = .storeForwardApp - case 66: self = .rangeTestApp - case 67: self = .telemetryApp - case 68: self = .zpsApp - case 69: self = .simulatorApp - case 70: self = .tracerouteApp - case 256: self = .privateApp - case 257: self = .atakForwarder - case 511: self = .max - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .unknownApp: return 0 - case .textMessageApp: return 1 - case .remoteHardwareApp: return 2 - case .positionApp: return 3 - case .nodeinfoApp: return 4 - case .routingApp: return 5 - 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 - case .storeForwardApp: return 65 - case .rangeTestApp: return 66 - case .telemetryApp: return 67 - case .zpsApp: return 68 - case .simulatorApp: return 69 - case .tracerouteApp: return 70 - case .privateApp: return 256 - case .atakForwarder: return 257 - case .max: return 511 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension PortNum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [PortNum] = [ - .unknownApp, - .textMessageApp, - .remoteHardwareApp, - .positionApp, - .nodeinfoApp, - .routingApp, - .adminApp, - .textMessageCompressedApp, - .waypointApp, - .audioApp, - .replyApp, - .ipTunnelApp, - .serialApp, - .storeForwardApp, - .rangeTestApp, - .telemetryApp, - .zpsApp, - .simulatorApp, - .tracerouteApp, - .privateApp, - .atakForwarder, - .max, - ] -} - -#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 { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNKNOWN_APP"), - 1: .same(proto: "TEXT_MESSAGE_APP"), - 2: .same(proto: "REMOTE_HARDWARE_APP"), - 3: .same(proto: "POSITION_APP"), - 4: .same(proto: "NODEINFO_APP"), - 5: .same(proto: "ROUTING_APP"), - 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"), - 65: .same(proto: "STORE_FORWARD_APP"), - 66: .same(proto: "RANGE_TEST_APP"), - 67: .same(proto: "TELEMETRY_APP"), - 68: .same(proto: "ZPS_APP"), - 69: .same(proto: "SIMULATOR_APP"), - 70: .same(proto: "TRACEROUTE_APP"), - 256: .same(proto: "PRIVATE_APP"), - 257: .same(proto: "ATAK_FORWARDER"), - 511: .same(proto: "MAX"), - ] -} diff --git a/Meshtastic/Protobufs/remote_hardware.pb.swift b/Meshtastic/Protobufs/remote_hardware.pb.swift deleted file mode 100644 index 4701735f..00000000 --- a/Meshtastic/Protobufs/remote_hardware.pb.swift +++ /dev/null @@ -1,194 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: remote_hardware.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 -} - -/// -/// 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. -/// In the future other remote hardware operations can be added based on user interest -/// (i.e. serial output, spi/i2c input/output). -/// FIXME - currently this feature is turned on by default which is dangerous -/// because no security yet (beyond the channel mechanism). -/// It should be off by default and then protected based on some TBD mechanism -/// (a special channel once multichannel support is included?) -struct HardwareMessage { - // 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. - - /// - /// What type of HardwareMessage is this? - var type: HardwareMessage.TypeEnum = .unset - - /// - /// What gpios are we changing. Not used for all MessageTypes, see MessageType for details - var gpioMask: UInt64 = 0 - - /// - /// For gpios that were listed in gpio_mask as valid, what are the signal levels for those gpios. - /// Not used for all MessageTypes, see MessageType for details - var gpioValue: UInt64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// TODO: REPLACE - enum TypeEnum: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Unset/unused - case unset // = 0 - - /// - /// Set gpio gpios based on gpio_mask/gpio_value - case writeGpios // = 1 - - /// - /// We are now interested in watching the gpio_mask gpios. - /// If the selected gpios change, please broadcast GPIOS_CHANGED. - /// Will implicitly change the gpios requested to be INPUT gpios. - case watchGpios // = 2 - - /// - /// The gpios listed in gpio_mask have changed, the new values are listed in gpio_value - case gpiosChanged // = 3 - - /// - /// Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated - case readGpios // = 4 - - /// - /// A reply to READ_GPIOS. gpio_mask and gpio_value will be populated - case readGpiosReply // = 5 - case UNRECOGNIZED(Int) - - init() { - self = .unset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .unset - case 1: self = .writeGpios - case 2: self = .watchGpios - case 3: self = .gpiosChanged - case 4: self = .readGpios - case 5: self = .readGpiosReply - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .unset: return 0 - case .writeGpios: return 1 - case .watchGpios: return 2 - case .gpiosChanged: return 3 - case .readGpios: return 4 - case .readGpiosReply: return 5 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} -} - -#if swift(>=4.2) - -extension HardwareMessage.TypeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [HardwareMessage.TypeEnum] = [ - .unset, - .writeGpios, - .watchGpios, - .gpiosChanged, - .readGpios, - .readGpiosReply, - ] -} - -#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 { - static let protoMessageName: String = "HardwareMessage" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "type"), - 2: .standard(proto: "gpio_mask"), - 3: .standard(proto: "gpio_value"), - ] - - 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.decodeSingularEnumField(value: &self.type) }() - case 2: try { try decoder.decodeSingularUInt64Field(value: &self.gpioMask) }() - case 3: try { try decoder.decodeSingularUInt64Field(value: &self.gpioValue) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.type != .unset { - try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1) - } - if self.gpioMask != 0 { - try visitor.visitSingularUInt64Field(value: self.gpioMask, fieldNumber: 2) - } - if self.gpioValue != 0 { - try visitor.visitSingularUInt64Field(value: self.gpioValue, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: HardwareMessage, rhs: HardwareMessage) -> Bool { - if lhs.type != rhs.type {return false} - if lhs.gpioMask != rhs.gpioMask {return false} - if lhs.gpioValue != rhs.gpioValue {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension HardwareMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNSET"), - 1: .same(proto: "WRITE_GPIOS"), - 2: .same(proto: "WATCH_GPIOS"), - 3: .same(proto: "GPIOS_CHANGED"), - 4: .same(proto: "READ_GPIOS"), - 5: .same(proto: "READ_GPIOS_REPLY"), - ] -} diff --git a/Meshtastic/Protobufs/rtttl.pb.swift b/Meshtastic/Protobufs/rtttl.pb.swift deleted file mode 100644 index 3fc7fa98..00000000 --- a/Meshtastic/Protobufs/rtttl.pb.swift +++ /dev/null @@ -1,75 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: rtttl.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 -} - -/// -/// Canned message module configuration. -struct RTTTLConfig { - // 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. - - /// - /// Ringtone for PWM Buzzer in RTTTL Format. - var ringtone: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension RTTTLConfig: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension RTTTLConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "RTTTLConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "ringtone"), - ] - - 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.ringtone) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.ringtone.isEmpty { - try visitor.visitSingularStringField(value: self.ringtone, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: RTTTLConfig, rhs: RTTTLConfig) -> Bool { - if lhs.ringtone != rhs.ringtone {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/storeforward.pb.swift b/Meshtastic/Protobufs/storeforward.pb.swift deleted file mode 100644 index 2311daa4..00000000 --- a/Meshtastic/Protobufs/storeforward.pb.swift +++ /dev/null @@ -1,651 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: storeforward.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 -} - -/// -/// 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 variant: StoreAndForward.OneOf_Variant? = nil - - /// - /// TODO: REPLACE - var stats: StoreAndForward.Statistics { - get { - if case .stats(let v)? = variant {return v} - return StoreAndForward.Statistics() - } - set {variant = .stats(newValue)} - } - - /// - /// TODO: REPLACE - var history: StoreAndForward.History { - get { - if case .history(let v)? = variant {return v} - return StoreAndForward.History() - } - set {variant = .history(newValue)} - } - - /// - /// TODO: REPLACE - var heartbeat: StoreAndForward.Heartbeat { - get { - if case .heartbeat(let v)? = variant {return v} - return StoreAndForward.Heartbeat() - } - set {variant = .heartbeat(newValue)} - } - - /// - /// Empty Payload - var empty: Bool { - get { - if case .empty(let v)? = variant {return v} - return false - } - set {variant = .empty(newValue)} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// - /// TODO: REPLACE - enum OneOf_Variant: Equatable { - /// - /// TODO: REPLACE - case stats(StoreAndForward.Statistics) - /// - /// TODO: REPLACE - case history(StoreAndForward.History) - /// - /// TODO: REPLACE - case heartbeat(StoreAndForward.Heartbeat) - /// - /// Empty Payload - case empty(Bool) - - #if !swift(>=4.1) - static func ==(lhs: StoreAndForward.OneOf_Variant, rhs: StoreAndForward.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 (.stats, .stats): return { - guard case .stats(let l) = lhs, case .stats(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.history, .history): return { - guard case .history(let l) = lhs, case .history(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.heartbeat, .heartbeat): return { - guard case .heartbeat(let l) = lhs, case .heartbeat(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.empty, .empty): return { - guard case .empty(let l) = lhs, case .empty(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif - } - - /// - /// 001 - 063 = From Router - /// 064 - 127 = From Client - enum RequestResponse: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// Unset/unused - case unset // = 0 - - /// - /// Router is an in error state. - case routerError // = 1 - - /// - /// Router heartbeat - case routerHeartbeat // = 2 - - /// - /// Router has requested the client respond. This can work as a - /// "are you there" message. - case routerPing // = 3 - - /// - /// The response to a "Ping" - case routerPong // = 4 - - /// - /// Router is currently busy. Please try again later. - case routerBusy // = 5 - - /// - /// Router is responding to a request for history. - case routerHistory // = 6 - - /// - /// Router is responding to a request for stats. - case routerStats // = 7 - - /// - /// Client is an in error state. - case clientError // = 64 - - /// - /// Client has requested a replay from the router. - case clientHistory // = 65 - - /// - /// Client has requested stats from the router. - case clientStats // = 66 - - /// - /// Client has requested the router respond. This can work as a - /// "are you there" message. - case clientPing // = 67 - - /// - /// The response to a "Ping" - case clientPong // = 68 - - /// - /// Client has requested that the router abort processing the client's request - case clientAbort // = 106 - case UNRECOGNIZED(Int) - - init() { - self = .unset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .unset - case 1: self = .routerError - case 2: self = .routerHeartbeat - case 3: self = .routerPing - case 4: self = .routerPong - case 5: self = .routerBusy - case 6: self = .routerHistory - case 7: self = .routerStats - case 64: self = .clientError - case 65: self = .clientHistory - case 66: self = .clientStats - case 67: self = .clientPing - case 68: self = .clientPong - case 106: self = .clientAbort - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .unset: return 0 - case .routerError: return 1 - case .routerHeartbeat: return 2 - case .routerPing: return 3 - case .routerPong: return 4 - case .routerBusy: return 5 - case .routerHistory: return 6 - case .routerStats: return 7 - case .clientError: return 64 - case .clientHistory: return 65 - case .clientStats: return 66 - case .clientPing: return 67 - case .clientPong: return 68 - case .clientAbort: return 106 - case .UNRECOGNIZED(let i): return i - } - } - - } - - /// - /// 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 - // methods supported on all messages. - - /// - /// Number of messages we have ever seen - var messagesTotal: UInt32 = 0 - - /// - /// Number of messages we have currently saved our history. - var messagesSaved: UInt32 = 0 - - /// - /// Maximum number of messages we will save - var messagesMax: UInt32 = 0 - - /// - /// Router uptime in seconds - var upTime: UInt32 = 0 - - /// - /// Number of times any client sent a request to the S&F. - var requests: UInt32 = 0 - - /// - /// Number of times the history was requested. - var requestsHistory: UInt32 = 0 - - /// - /// Is the heartbeat enabled on the server? - var heartbeat: Bool = false - - /// - /// Is the heartbeat enabled on the server? - var returnMax: UInt32 = 0 - - /// - /// Is the heartbeat enabled on the server? - var returnWindow: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - 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 - // methods supported on all messages. - - /// - /// Number of that will be sent to the client - var historyMessages: UInt32 = 0 - - /// - /// The window of messages that was used to filter the history client requested - var window: UInt32 = 0 - - /// - /// The window of messages that was used to filter the history client requested - var lastRequest: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - 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 - // methods supported on all messages. - - /// - /// Number of that will be sent to the client - var period: UInt32 = 0 - - /// - /// If set, this is not the primary Store & Forward router on the mesh - var secondary: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - - init() {} -} - -#if swift(>=4.2) - -extension StoreAndForward.RequestResponse: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [StoreAndForward.RequestResponse] = [ - .unset, - .routerError, - .routerHeartbeat, - .routerPing, - .routerPong, - .routerBusy, - .routerHistory, - .routerStats, - .clientError, - .clientHistory, - .clientStats, - .clientPing, - .clientPong, - .clientAbort, - ] -} - -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension StoreAndForward: @unchecked Sendable {} -extension StoreAndForward.OneOf_Variant: @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 { - static let protoMessageName: String = "StoreAndForward" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "rr"), - 2: .same(proto: "stats"), - 3: .same(proto: "history"), - 4: .same(proto: "heartbeat"), - 5: .same(proto: "empty"), - ] - - 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.decodeSingularEnumField(value: &self.rr) }() - case 2: try { - var v: StoreAndForward.Statistics? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .stats(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .stats(v) - } - }() - case 3: try { - var v: StoreAndForward.History? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .history(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .history(v) - } - }() - case 4: try { - var v: StoreAndForward.Heartbeat? - var hadOneofValue = false - if let current = self.variant { - hadOneofValue = true - if case .heartbeat(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.variant = .heartbeat(v) - } - }() - case 5: try { - var v: Bool? - try decoder.decodeSingularBoolField(value: &v) - if let v = v { - if self.variant != nil {try decoder.handleConflictingOneOf()} - self.variant = .empty(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.rr != .unset { - try visitor.visitSingularEnumField(value: self.rr, fieldNumber: 1) - } - switch self.variant { - case .stats?: try { - guard case .stats(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - }() - case .history?: try { - guard case .history(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - }() - case .heartbeat?: try { - guard case .heartbeat(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - }() - case .empty?: try { - guard case .empty(let v)? = self.variant else { preconditionFailure() } - try visitor.visitSingularBoolField(value: v, fieldNumber: 5) - }() - case nil: break - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: StoreAndForward, rhs: StoreAndForward) -> Bool { - if lhs.rr != rhs.rr {return false} - if lhs.variant != rhs.variant {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension StoreAndForward.RequestResponse: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "UNSET"), - 1: .same(proto: "ROUTER_ERROR"), - 2: .same(proto: "ROUTER_HEARTBEAT"), - 3: .same(proto: "ROUTER_PING"), - 4: .same(proto: "ROUTER_PONG"), - 5: .same(proto: "ROUTER_BUSY"), - 6: .same(proto: "ROUTER_HISTORY"), - 7: .same(proto: "ROUTER_STATS"), - 64: .same(proto: "CLIENT_ERROR"), - 65: .same(proto: "CLIENT_HISTORY"), - 66: .same(proto: "CLIENT_STATS"), - 67: .same(proto: "CLIENT_PING"), - 68: .same(proto: "CLIENT_PONG"), - 106: .same(proto: "CLIENT_ABORT"), - ] -} - -extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = StoreAndForward.protoMessageName + ".Statistics" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "messages_total"), - 2: .standard(proto: "messages_saved"), - 3: .standard(proto: "messages_max"), - 4: .standard(proto: "up_time"), - 5: .same(proto: "requests"), - 6: .standard(proto: "requests_history"), - 7: .same(proto: "heartbeat"), - 8: .standard(proto: "return_max"), - 9: .standard(proto: "return_window"), - ] - - 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.messagesTotal) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.messagesSaved) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.messagesMax) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.upTime) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.requests) }() - case 6: try { try decoder.decodeSingularUInt32Field(value: &self.requestsHistory) }() - case 7: try { try decoder.decodeSingularBoolField(value: &self.heartbeat) }() - case 8: try { try decoder.decodeSingularUInt32Field(value: &self.returnMax) }() - case 9: try { try decoder.decodeSingularUInt32Field(value: &self.returnWindow) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.messagesTotal != 0 { - try visitor.visitSingularUInt32Field(value: self.messagesTotal, fieldNumber: 1) - } - if self.messagesSaved != 0 { - try visitor.visitSingularUInt32Field(value: self.messagesSaved, fieldNumber: 2) - } - if self.messagesMax != 0 { - try visitor.visitSingularUInt32Field(value: self.messagesMax, fieldNumber: 3) - } - if self.upTime != 0 { - try visitor.visitSingularUInt32Field(value: self.upTime, fieldNumber: 4) - } - if self.requests != 0 { - try visitor.visitSingularUInt32Field(value: self.requests, fieldNumber: 5) - } - if self.requestsHistory != 0 { - try visitor.visitSingularUInt32Field(value: self.requestsHistory, fieldNumber: 6) - } - if self.heartbeat != false { - try visitor.visitSingularBoolField(value: self.heartbeat, fieldNumber: 7) - } - if self.returnMax != 0 { - try visitor.visitSingularUInt32Field(value: self.returnMax, fieldNumber: 8) - } - if self.returnWindow != 0 { - try visitor.visitSingularUInt32Field(value: self.returnWindow, fieldNumber: 9) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: StoreAndForward.Statistics, rhs: StoreAndForward.Statistics) -> Bool { - if lhs.messagesTotal != rhs.messagesTotal {return false} - if lhs.messagesSaved != rhs.messagesSaved {return false} - if lhs.messagesMax != rhs.messagesMax {return false} - if lhs.upTime != rhs.upTime {return false} - if lhs.requests != rhs.requests {return false} - if lhs.requestsHistory != rhs.requestsHistory {return false} - if lhs.heartbeat != rhs.heartbeat {return false} - if lhs.returnMax != rhs.returnMax {return false} - if lhs.returnWindow != rhs.returnWindow {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension StoreAndForward.History: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = StoreAndForward.protoMessageName + ".History" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "history_messages"), - 2: .same(proto: "window"), - 3: .standard(proto: "last_request"), - ] - - 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.historyMessages) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.window) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.lastRequest) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.historyMessages != 0 { - try visitor.visitSingularUInt32Field(value: self.historyMessages, fieldNumber: 1) - } - if self.window != 0 { - try visitor.visitSingularUInt32Field(value: self.window, fieldNumber: 2) - } - if self.lastRequest != 0 { - try visitor.visitSingularUInt32Field(value: self.lastRequest, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: StoreAndForward.History, rhs: StoreAndForward.History) -> Bool { - if lhs.historyMessages != rhs.historyMessages {return false} - if lhs.window != rhs.window {return false} - if lhs.lastRequest != rhs.lastRequest {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension StoreAndForward.Heartbeat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = StoreAndForward.protoMessageName + ".Heartbeat" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "period"), - 2: .same(proto: "secondary"), - ] - - 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.period) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.secondary) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.period != 0 { - try visitor.visitSingularUInt32Field(value: self.period, fieldNumber: 1) - } - if self.secondary != 0 { - try visitor.visitSingularUInt32Field(value: self.secondary, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: StoreAndForward.Heartbeat, rhs: StoreAndForward.Heartbeat) -> Bool { - if lhs.period != rhs.period {return false} - if lhs.secondary != rhs.secondary {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Meshtastic/Protobufs/telemetry.pb.swift b/Meshtastic/Protobufs/telemetry.pb.swift deleted file mode 100644 index de098cdc..00000000 --- a/Meshtastic/Protobufs/telemetry.pb.swift +++ /dev/null @@ -1,496 +0,0 @@ -// 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 -} - -/// -/// TODO: REPLACE -enum TelemetrySensorType: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// - /// No external telemetry sensor explicitly set - case sensorUnset // = 0 - - /// - /// High accuracy temperature, pressure, humidity - case bme280 // = 1 - - /// - /// High accuracy temperature, pressure, humidity, and air resistance - case bme680 // = 2 - - /// - /// Very high accuracy temperature - case mcp9808 // = 3 - - /// - /// Moderate accuracy current and voltage - case ina260 // = 4 - - /// - /// Moderate accuracy current and voltage - case ina219 // = 5 - - /// - /// High accuracy temperature and pressure - case bmp280 // = 6 - - /// - /// High accuracy temperature and humidity - case shtc3 // = 7 - - /// - /// High accuracy pressure - case lps22 // = 8 - - /// - /// 3-Axis magnetic sensor - case qmc6310 // = 9 - - /// - /// 6-Axis inertial measurement sensor - case qmi8658 // = 10 - - /// - /// 3-Axis magnetic sensor - case qmc5883L // = 11 - - /// - /// High accuracy temperature and humidity - case sht31 // = 12 - case UNRECOGNIZED(Int) - - init() { - self = .sensorUnset - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .sensorUnset - case 1: self = .bme280 - case 2: self = .bme680 - case 3: self = .mcp9808 - case 4: self = .ina260 - case 5: self = .ina219 - case 6: self = .bmp280 - case 7: self = .shtc3 - case 8: self = .lps22 - case 9: self = .qmc6310 - case 10: self = .qmi8658 - case 11: self = .qmc5883L - case 12: self = .sht31 - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .sensorUnset: return 0 - case .bme280: return 1 - case .bme680: return 2 - case .mcp9808: return 3 - case .ina260: return 4 - case .ina219: return 5 - case .bmp280: return 6 - case .shtc3: return 7 - case .lps22: return 8 - case .qmc6310: return 9 - case .qmi8658: return 10 - case .qmc5883L: return 11 - case .sht31: return 12 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension TelemetrySensorType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [TelemetrySensorType] = [ - .sensorUnset, - .bme280, - .bme680, - .mcp9808, - .ina260, - .ina219, - .bmp280, - .shtc3, - .lps22, - .qmc6310, - .qmi8658, - .qmc5883L, - .sht31, - ] -} - -#endif // swift(>=4.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 TelemetrySensorType: @unchecked Sendable {} -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 TelemetrySensorType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "SENSOR_UNSET"), - 1: .same(proto: "BME280"), - 2: .same(proto: "BME680"), - 3: .same(proto: "MCP9808"), - 4: .same(proto: "INA260"), - 5: .same(proto: "INA219"), - 6: .same(proto: "BMP280"), - 7: .same(proto: "SHTC3"), - 8: .same(proto: "LPS22"), - 9: .same(proto: "QMC6310"), - 10: .same(proto: "QMI8658"), - 11: .same(proto: "QMC5883L"), - 12: .same(proto: "SHT31"), - ] -} - -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/Meshtastic/Protobufs/xmodem.pb.swift b/Meshtastic/Protobufs/xmodem.pb.swift deleted file mode 100644 index fc57c812..00000000 --- a/Meshtastic/Protobufs/xmodem.pb.swift +++ /dev/null @@ -1,173 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: xmodem.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 XModem { - // 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 control: XModem.Control = .nul - - var seq: UInt32 = 0 - - var crc16: UInt32 = 0 - - var buffer: Data = Data() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - enum Control: SwiftProtobuf.Enum { - typealias RawValue = Int - case nul // = 0 - case soh // = 1 - case stx // = 2 - case eot // = 4 - case ack // = 6 - case nak // = 21 - case can // = 24 - case ctrlz // = 26 - case UNRECOGNIZED(Int) - - init() { - self = .nul - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .nul - case 1: self = .soh - case 2: self = .stx - case 4: self = .eot - case 6: self = .ack - case 21: self = .nak - case 24: self = .can - case 26: self = .ctrlz - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .nul: return 0 - case .soh: return 1 - case .stx: return 2 - case .eot: return 4 - case .ack: return 6 - case .nak: return 21 - case .can: return 24 - case .ctrlz: return 26 - case .UNRECOGNIZED(let i): return i - } - } - - } - - init() {} -} - -#if swift(>=4.2) - -extension XModem.Control: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [XModem.Control] = [ - .nul, - .soh, - .stx, - .eot, - .ack, - .nak, - .can, - .ctrlz, - ] -} - -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension XModem: @unchecked Sendable {} -extension XModem.Control: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -extension XModem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = "XModem" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "control"), - 2: .same(proto: "seq"), - 3: .same(proto: "crc16"), - 4: .same(proto: "buffer"), - ] - - 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.decodeSingularEnumField(value: &self.control) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.seq) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.crc16) }() - case 4: try { try decoder.decodeSingularBytesField(value: &self.buffer) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.control != .nul { - try visitor.visitSingularEnumField(value: self.control, fieldNumber: 1) - } - if self.seq != 0 { - try visitor.visitSingularUInt32Field(value: self.seq, fieldNumber: 2) - } - if self.crc16 != 0 { - try visitor.visitSingularUInt32Field(value: self.crc16, fieldNumber: 3) - } - if !self.buffer.isEmpty { - try visitor.visitSingularBytesField(value: self.buffer, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: XModem, rhs: XModem) -> Bool { - if lhs.control != rhs.control {return false} - if lhs.seq != rhs.seq {return false} - if lhs.crc16 != rhs.crc16 {return false} - if lhs.buffer != rhs.buffer {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension XModem.Control: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NUL"), - 1: .same(proto: "SOH"), - 2: .same(proto: "STX"), - 4: .same(proto: "EOT"), - 6: .same(proto: "ACK"), - 21: .same(proto: "NAK"), - 24: .same(proto: "CAN"), - 26: .same(proto: "CTRLZ"), - ] -} diff --git a/gen_protos.sh b/gen_protos.sh index fd756c64..d36fafed 100755 --- a/gen_protos.sh +++ b/gen_protos.sh @@ -1,36 +1,18 @@ #!/bin/bash # simple sanity checking for repo -if [ ! -d "../protobufs/meshtastic" ]; then - echo "Please check out the https://github.com/meshtastic/protobufs parent directory." +if [ ! -d "../protobufs" ]; then + echo "Please check out the protobuf submodule by running: `git submodule update --init`" exit fi # simple sanity checking for executable -if [ ! -x "`which protoc`" ]; then +if [ ! -x "$(which protoc)" ]; then echo "Please install swift-protobuf by running: brew install swift-protobuf" exit fi -if [ ! -x "`which gsed`" ]; then - echo "Please install gnu-sed by running: brew install gnu-sed" - exit -fi +protoc --proto_path=./protobufs --swift_out=./Meshtastic/Protobufs ./protobufs/meshtastic/*.proto -pdir=$(realpath "../protobufs/meshtastic") -sdir=$(realpath "./Meshtastic/Protobufs") - -gsed -i 's/import "meshtastic\//import "/g' ../protobufs/meshtastic/* -gsed -i 's/package meshtastic;//g' ../protobufs/meshtastic/* - -echo "pdir:$pdir sdir:$sdir" -pfiles="admin.proto apponly.proto cannedmessages.proto channel.proto config.proto device_metadata.proto deviceonly.proto localonly.proto mesh.proto module_config.proto mqtt.proto portnums.proto remote_hardware.proto rtttl.proto storeforward.proto telemetry.proto xmodem.proto" -for pf in $pfiles -do - echo "Generating $pf..." - protoc --swift_out=${sdir} --proto_path=${pdir} $pf -done echo "Done generating the swift files from the proto files." echo "Build, test, and commit changes." - -cd ../protobufs/meshtastic && git reset --hard