From 26e785926f89cacb3dacba55f8ec38e249e1f4db Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 07:09:14 -0700 Subject: [PATCH 01/29] OS Log Viewer, device serial log over BLE --- Meshtastic.xcodeproj/project.pbxproj | 48 ++-- Meshtastic/Export/WriteCsvFile.swift | 22 ++ Meshtastic/Extensions/Logger.swift | 75 ++++++ Meshtastic/Helpers/BLEManager.swift | 78 +++++- Meshtastic/Helpers/Logger.swift | 19 -- .../Views/Settings/AdminMessageList.swift | 80 ------ Meshtastic/Views/Settings/AppLog.swift | 227 ++++++++++++++++++ .../Views/Settings/Logs/AppLogFilter.swift | 141 +++++++++++ .../Views/Settings/Logs/LogDetail.swift | 158 ++++++++++++ Meshtastic/Views/Settings/Settings.swift | 20 +- 10 files changed, 743 insertions(+), 125 deletions(-) create mode 100644 Meshtastic/Extensions/Logger.swift delete mode 100644 Meshtastic/Helpers/Logger.swift delete mode 100644 Meshtastic/Views/Settings/AdminMessageList.swift create mode 100644 Meshtastic/Views/Settings/AppLog.swift create mode 100644 Meshtastic/Views/Settings/Logs/AppLogFilter.swift create mode 100644 Meshtastic/Views/Settings/Logs/LogDetail.swift diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index a6703a88..b40b557b 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 25183D462C0A6D97001E31D5 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25183D452C0A6D97001E31D5 /* Logger.swift */; }; 6DA39D8E2A92DC52007E311C /* MeshtasticAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DA39D8D2A92DC52007E311C /* MeshtasticAppDelegate.swift */; }; 6DEDA55A2A957B8E00321D2E /* DetectionSensorLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DEDA5592A957B8E00321D2E /* DetectionSensorLog.swift */; }; 6DEDA55C2A9592F900321D2E /* MessageEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DEDA55B2A9592F900321D2E /* MessageEntityExtension.swift */; }; @@ -33,7 +32,6 @@ DD0E20FD2B87090400F2D100 /* clientonly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20FA2B87090400F2D100 /* clientonly.pb.swift */; }; DD0E20FE2B87090400F2D100 /* paxcount.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20FB2B87090400F2D100 /* paxcount.pb.swift */; }; DD0E21012B8A6F1300F2D100 /* DeviceHardware.json in Resources */ = {isa = PBXBuildFile; fileRef = DD0E21002B8A6BC500F2D100 /* DeviceHardware.json */; }; - DD0F791B28713C8A00A6FDAD /* AdminMessageList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */; }; DD13AA492AB73BF400BA0C98 /* PositionPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD13AA482AB73BF400BA0C98 /* PositionPopover.swift */; }; DD15E4F32B8BA56E00654F61 /* PaxCounterConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD15E4F22B8BA56E00654F61 /* PaxCounterConfig.swift */; }; DD15E4F52B8BFC8E00654F61 /* PaxCounterLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD15E4F42B8BFC8E00654F61 /* PaxCounterLog.swift */; }; @@ -168,6 +166,10 @@ DDCDC6CB29481FCC004C1DDA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DDCDC6CD29481FCC004C1DDA /* Localizable.strings */; }; DDCE4E2C2869F92900BE9F8F /* UserConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE4E2B2869F92900BE9F8F /* UserConfig.swift */; }; DDD43FE32A78C8900083A3E9 /* MqttClientProxyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD43FE22A78C8900083A3E9 /* MqttClientProxyManager.swift */; }; + DDD5BB092C285DDC007E03CA /* AppLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB082C285DDC007E03CA /* AppLog.swift */; }; + DDD5BB0B2C285E45007E03CA /* LogDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB0A2C285E45007E03CA /* LogDetail.swift */; }; + DDD5BB0D2C285F00007E03CA /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB0C2C285F00007E03CA /* Logger.swift */; }; + DDD5BB102C285FB3007E03CA /* AppLogFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB0F2C285FB3007E03CA /* AppLogFilter.swift */; }; DDD6EEAF29BC024700383354 /* Firmware.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD6EEAE29BC024700383354 /* Firmware.swift */; }; DDD94A502845C8F5004A87A0 /* DateTimeText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */; }; DDD9E4E4284B208E003777C5 /* UserEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD9E4E3284B208E003777C5 /* UserEntityExtension.swift */; }; @@ -245,7 +247,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 25183D452C0A6D97001E31D5 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; 6DA39D8D2A92DC52007E311C /* MeshtasticAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshtasticAppDelegate.swift; sourceTree = ""; }; 6DEDA5592A957B8E00321D2E /* DetectionSensorLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetectionSensorLog.swift; sourceTree = ""; }; 6DEDA55B2A9592F900321D2E /* MessageEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageEntityExtension.swift; sourceTree = ""; }; @@ -274,7 +275,6 @@ DD0E20FF2B892E1300F2D100 /* MeshtasticDataModelV 28.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 28.xcdatamodel"; sourceTree = ""; }; DD0E21002B8A6BC500F2D100 /* DeviceHardware.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = DeviceHardware.json; sourceTree = ""; }; DD0E9C222A30CE3A00580CBB /* MeshtasticDataModelV14.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV14.xcdatamodel; sourceTree = ""; }; - DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminMessageList.swift; sourceTree = ""; }; DD13AA482AB73BF400BA0C98 /* PositionPopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionPopover.swift; sourceTree = ""; }; DD14E72C2A80738F006E39BC /* MeshtasticDataModelV15.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV15.xcdatamodel; sourceTree = ""; }; DD15E4F22B8BA56E00654F61 /* PaxCounterConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaxCounterConfig.swift; sourceTree = ""; }; @@ -443,6 +443,10 @@ DDD28D372C0CD2670063CFA3 /* MeshtasticDataModelV 37.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 37.xcdatamodel"; sourceTree = ""; }; DDD3BBD4292D763200D609B3 /* MeshtasticTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeshtasticTests.swift; sourceTree = ""; }; DDD43FE22A78C8900083A3E9 /* MqttClientProxyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MqttClientProxyManager.swift; sourceTree = ""; }; + DDD5BB082C285DDC007E03CA /* AppLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLog.swift; sourceTree = ""; }; + DDD5BB0A2C285E45007E03CA /* LogDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogDetail.swift; sourceTree = ""; }; + DDD5BB0C2C285F00007E03CA /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; + DDD5BB0F2C285FB3007E03CA /* AppLogFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLogFilter.swift; sourceTree = ""; }; DDD6EEAE29BC024700383354 /* Firmware.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Firmware.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 = ""; }; @@ -606,9 +610,9 @@ DD4A911C2708C57100501B7E /* Settings */ = { isa = PBXGroup; children = ( + DDD5BB0E2C285F92007E03CA /* Logs */, DD93800C2BA74CE3008BEC06 /* Channels */, DD97E96728EFE9A00056DDA4 /* About.swift */, - DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */, DD4A911D2708C65400501B7E /* AppSettings.swift */, DDAB580C2B0DAA9E00147258 /* Routes.swift */, DDE9659B2B1C3B6A00531070 /* RouteRecorder.swift */, @@ -622,6 +626,7 @@ DDCE4E2B2869F92900BE9F8F /* UserConfig.swift */, DD61937A2863876A00E59241 /* Config */, DD1B8F3F2B35E2F10022AABC /* GPSStatus.swift */, + DDD5BB082C285DDC007E03CA /* AppLog.swift */, ); path = Settings; sourceTree = ""; @@ -917,19 +922,19 @@ DDC2E18D26CE25CB0042C5E4 /* Helpers */ = { isa = PBXGroup; children = ( - DDF45C332BC1A48E005ED5F2 /* MQTTIcon.swift */, - DD5E523D298F5A7D00D21B61 /* Weather */, + DD3CC6BD28E4CD9800FA9159 /* BatteryGauge.swift */, + DDB75A222A13CDA9006ED576 /* BatteryLevelCompact.swift */, + DD457187293C7E63000C49FB /* BLESignalStrengthIndicator.swift */, DD47E3D526F17ED900029299 /* CircleText.swift */, DDF924C926FBB953009FE055 /* ConnectedDevice.swift */, - DDC3B273283F411B00AC321C /* LastHeardText.swift */, DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */, DDB6ABDA28B0AC6000384BA1 /* DistanceText.swift */, - DD3CC6BD28E4CD9800FA9159 /* BatteryGauge.swift */, - DD97E96528EFD9820056DDA4 /* MeshtasticLogo.swift */, - DD457187293C7E63000C49FB /* BLESignalStrengthIndicator.swift */, - DDB75A1D2A0B0CD0006ED576 /* LoRaSignalStrengthIndicator.swift */, + DDC3B273283F411B00AC321C /* LastHeardText.swift */, DDB75A202A12B954006ED576 /* LoRaSignalStrength.swift */, - DDB75A222A13CDA9006ED576 /* BatteryLevelCompact.swift */, + DDB75A1D2A0B0CD0006ED576 /* LoRaSignalStrengthIndicator.swift */, + DD97E96528EFD9820056DDA4 /* MeshtasticLogo.swift */, + DDF45C332BC1A48E005ED5F2 /* MQTTIcon.swift */, + DD5E523D298F5A7D00D21B61 /* Weather */, ); path = Helpers; sourceTree = ""; @@ -947,7 +952,6 @@ DD964FBC296E6B01007C176F /* EmojiOnlyTextField.swift */, DDDB443C29F6592F00EE2349 /* NetworkManager.swift */, DD3619142B1EF9F900C41C8C /* LocationsHandler.swift */, - 25183D452C0A6D97001E31D5 /* Logger.swift */, ); path = Helpers; sourceTree = ""; @@ -970,6 +974,15 @@ path = Mqtt; sourceTree = ""; }; + DDD5BB0E2C285F92007E03CA /* Logs */ = { + isa = PBXGroup; + children = ( + DDD5BB0A2C285E45007E03CA /* LogDetail.swift */, + DDD5BB0F2C285FB3007E03CA /* AppLogFilter.swift */, + ); + path = Logs; + sourceTree = ""; + }; DDDB26402AABEF7B003AFCB7 /* Helpers */ = { isa = PBXGroup; children = ( @@ -1003,6 +1016,7 @@ DD1933772B084F4200771CD5 /* Measurement.swift */, DDFFA7462B3A7F3C004730DB /* Bundle.swift */, DDF45C362BC46A5A005ED5F2 /* TimeZone.swift */, + DDD5BB0C2C285F00007E03CA /* Logger.swift */, ); path = Extensions; sourceTree = ""; @@ -1237,6 +1251,7 @@ DD93800E2BA74D0C008BEC06 /* ChannelForm.swift in Sources */, DD41A61529AB0035003C5A37 /* NodeWeatherForecast.swift in Sources */, DDB6ABD628AE742000384BA1 /* BluetoothConfig.swift in Sources */, + DDD5BB102C285FB3007E03CA /* AppLogFilter.swift in Sources */, DD4640202AFF10F4002A5ECB /* WaypointForm.swift in Sources */, DD769E0328D18BF1001A3F05 /* DeviceMetricsLog.swift in Sources */, DDAF8C5326EB1DF10058C060 /* BLEManager.swift in Sources */, @@ -1258,8 +1273,10 @@ DD5E5213298EE33B00D21B61 /* deviceonly.pb.swift in Sources */, DDE5B4042B2279A700FCDD05 /* TraceRouteLog.swift in Sources */, DD5E5208298EE33B00D21B61 /* rtttl.pb.swift in Sources */, + DDD5BB0D2C285F00007E03CA /* Logger.swift in Sources */, DD6193792863875F00E59241 /* SerialConfig.swift in Sources */, DDDB263F2AABEE20003AFCB7 /* NodeList.swift in Sources */, + DDD5BB0B2C285E45007E03CA /* LogDetail.swift in Sources */, DDA0B6B2294CDC55001356EC /* Channels.swift in Sources */, DDE9659C2B1C3B6A00531070 /* RouteRecorder.swift in Sources */, B399E8A42B6F486400E4488E /* RetryButton.swift in Sources */, @@ -1307,7 +1324,6 @@ D93068D32B8129510066FBC8 /* MessageContextMenuItems.swift in Sources */, DD0E20FE2B87090400F2D100 /* paxcount.pb.swift in Sources */, DD5E520A298EE33B00D21B61 /* channel.pb.swift in Sources */, - 25183D462C0A6D97001E31D5 /* Logger.swift in Sources */, DD8EBF43285058FA00426DCA /* DisplayConfig.swift in Sources */, DD964FC42974767D007C176F /* MapViewFitExtension.swift in Sources */, DD47E3D626F17ED900029299 /* CircleText.swift in Sources */, @@ -1323,6 +1339,7 @@ D93068DD2B81CA820066FBC8 /* ConfigHeader.swift in Sources */, DDA1C48E28DB49D3009933EC /* ChannelRoles.swift in Sources */, D9BC22DB2B7DE8E2006A37D5 /* TileDownloadStatus.swift in Sources */, + DDD5BB092C285DDC007E03CA /* AppLog.swift in Sources */, DD8ED9C8289CE4B900B3B0AB /* RoutingError.swift in Sources */, DD5E5202298EE33B00D21B61 /* admin.pb.swift in Sources */, DDC1B81A2AB5377B00C71E39 /* MessagesTips.swift in Sources */, @@ -1371,7 +1388,6 @@ DD58C5F22919AD3C00D5BEFB /* ChannelEntityExtension.swift in Sources */, DDA9515E2BC6F56F00CEA535 /* IndoorAirQuality.swift in Sources */, DDDB444E29F8AB0E00EE2349 /* Int.swift in Sources */, - DD0F791B28713C8A00A6FDAD /* AdminMessageList.swift in Sources */, DD3CC6BC28E366DF00FA9159 /* Meshtastic.xcdatamodeld in Sources */, DDC4C9FF2A8D982900CE201C /* DetectionSensorConfig.swift in Sources */, D9C983A22B79D1A600BDBE6A /* RequestPositionButton.swift in Sources */, diff --git a/Meshtastic/Export/WriteCsvFile.swift b/Meshtastic/Export/WriteCsvFile.swift index 521dc937..56776554 100644 --- a/Meshtastic/Export/WriteCsvFile.swift +++ b/Meshtastic/Export/WriteCsvFile.swift @@ -6,6 +6,7 @@ // import SwiftUI +import OSLog func telemetryToCsvFile(telemetry: [TelemetryEntity], metricsType: Int) -> String { var csvString: String = "" @@ -64,6 +65,27 @@ func detectionsToCsv(detections: [MessageEntity]) -> String { return csvString } +func logToCsvFile(log: [OSLogEntryLog]) -> String { + var csvString: String = "" + let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current) + let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma").replacingOccurrences(of: ",", with: "") + // Create PAX Header + csvString = "Process, Category, Level, Message, \("timestamp".localized)" + for l in log { + csvString += "\n" + csvString += String(l.process) + csvString += ", " + csvString += String(l.category) + csvString += ", " + csvString += String(l.level.description) + csvString += ", " + csvString += String(l.composedMessage) + csvString += ", " + csvString += l.date.formattedDate(format: dateFormatString) + } + return csvString +} + func paxToCsvFile(pax: [PaxCounterEntity]) -> String { var csvString: String = "" let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current) diff --git a/Meshtastic/Extensions/Logger.swift b/Meshtastic/Extensions/Logger.swift new file mode 100644 index 00000000..fbc68ea7 --- /dev/null +++ b/Meshtastic/Extensions/Logger.swift @@ -0,0 +1,75 @@ +// +// Logger.swift +// Meshtastic +// +// Copyright(c) Garth Vander Houwen 6/3/24. +// + +import OSLog + +extension Logger { + + /// The logger's subsystem. + private static var subsystem = Bundle.main.bundleIdentifier! + + /// All admin messages + static let admin = Logger(subsystem: subsystem, category: "🏛 Admin") + + /// All logs related to data such as decoding error, parsing issues, etc. + static let data = Logger(subsystem: subsystem, category: "🗄️ Data") + + /// All logs related to the mesh + static let mesh = Logger(subsystem: subsystem, category: "🕸️ Mesh") + + /// All logs related to MQTT + static let mqtt = Logger(subsystem: subsystem, category: "📱 MQTT") + + /// All detailed logs originating from the device (radio). + static let radio = Logger(subsystem: subsystem, category: "📟 Radio") + + /// All logs related to services such as network calls, location, etc. + static let services = Logger(subsystem: subsystem, category: "🍏 Services") + + /// All logs related to tracking and analytics. + static let statistics = Logger(subsystem: subsystem, category: "📊 Stats") + + + /// Fetch from the logstore + static public func fetch(predicateFormat: String) async throws -> [OSLogEntryLog] { + + let store = try OSLogStore(scope: .currentProcessIdentifier) + let position = store.position(timeIntervalSinceLatestBoot: 0) + //let calendar = Calendar.current + //let dayAgo = calendar.date(byAdding: .day, value: -1, to: Date.now) + //let position = store.position(date: dayAgo!) + let predicate = NSPredicate(format: predicateFormat) + let entries = try store.getEntries(at: position, matching: predicate) + + var logs: [OSLogEntryLog] = [] + for entry in entries { + + try Task.checkCancellation() + + if let log = entry as? OSLogEntryLog { + logs.append(log) + } + } + + if logs.isEmpty { logs = [] } + return logs + } +} + +extension OSLogEntryLog.Level { + var description: String { + switch self { + case .undefined: "undefined" + case .debug: "🩺 Debug" + case .info: "ℹ️ Info" + case .notice: "⚠️ Notice" + case .error: "🚨 Error" + case .fault: "💥 Fault" + @unknown default: "default" + } + } +} diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index caab235d..bda553a3 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -5,6 +5,7 @@ import SwiftUI import MapKit import CocoaMQTT import OSLog +import RegexBuilder // --------------------------------------------------------------------------------------- // Meshtastic BLE Device Manager @@ -41,11 +42,13 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate var TORADIO_characteristic: CBCharacteristic! var FROMRADIO_characteristic: CBCharacteristic! var FROMNUM_characteristic: CBCharacteristic! + var LOGRADIO_characteristic: CBCharacteristic! let meshtasticServiceCBUUID = CBUUID(string: "0x6BA1B218-15A8-461F-9FA8-5DCAE273EAFD") let TORADIO_UUID = CBUUID(string: "0xF75C76D2-129E-4DAD-A1DD-7866124401E7") let FROMRADIO_UUID = CBUUID(string: "0x2C55E69E-4993-11ED-B878-0242AC120002") let EOL_FROMRADIO_UUID = CBUUID(string: "0x8BA2BCC2-EE02-4A55-A531-C525C5E454D5") let FROMNUM_UUID = CBUUID(string: "0xED9DA18C-A800-4F66-A670-AA7547E34453") + let LOGRADIO_UUID = CBUUID(string: "0x6C6FD238-78FA-436B-AACF-15C5BE1EF2E2") // MARK: init BLEManager override init() { @@ -277,7 +280,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } guard let services = peripheral.services else { return } for service in services where service.uuid == meshtasticServiceCBUUID { - peripheral.discoverCharacteristics([TORADIO_UUID, FROMRADIO_UUID, FROMNUM_UUID], for: service) + peripheral.discoverCharacteristics([TORADIO_UUID, FROMRADIO_UUID, FROMNUM_UUID, LOGRADIO_UUID], for: service) Logger.services.info("✅ BLE Service for Meshtastic discovered by \(peripheral.name ?? "Unknown")") } } @@ -310,6 +313,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.services.info("✅ BLE did discover FROMNUM (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") FROMNUM_characteristic = characteristic peripheral.setNotifyValue(true, for: characteristic) + + case LOGRADIO_UUID: + Logger.services.info("✅ BLE did discover LOGRADIO (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") + LOGRADIO_characteristic = characteristic + peripheral.setNotifyValue(true, for: characteristic) default: break @@ -514,6 +522,74 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } switch characteristic.uuid { + case LOGRADIO_UUID: + if (characteristic.value == nil || characteristic.value!.isEmpty) { + return + } + let coordsSearch = Regex { + Capture { + Regex { + "lat=" + OneOrMore(.digit) + } + } + Capture {" "} + Capture { + Regex { + "long=" + OneOrMore(.digit) + } + } + } + .anchorsMatchLineEndings() + if var log = String(data: characteristic.value!, encoding: .utf8) { + + /// Debug Log Level + if (log.starts(with: "DEBUG |")) { + do { + let logString = log + if let coordsMatch = try coordsSearch.firstMatch(in: logString) { + log = "\(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces))" + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.debug("🛰️ \(log.prefix(upTo: coordsMatch.range.lowerBound), privacy: .public) \(coordsMatch.0.replacingOccurrences(of: "[,]", with: "", options: .regularExpression), privacy: .private) \(log.suffix(from: coordsMatch.range.upperBound), privacy: .public)") + }else { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + } + + } catch { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + } + } else if (log.starts(with: "INFO |")) { + do { + let logString = log + if let coordsMatch = try coordsSearch.firstMatch(in: logString) { + log = "\(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces))" + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.info("🛰️ \(log.prefix(upTo: coordsMatch.range.lowerBound), privacy: .public) \(coordsMatch.0.replacingOccurrences(of: "[,]", with: "", options: .regularExpression), privacy: .private) \(log.suffix(from: coordsMatch.range.upperBound), privacy: .public)") + } else { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + } + } catch { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.info("✅ \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + } + } else if (log.starts(with: "WARN |")) { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.warning("⚠️ \(log.replacingOccurrences(of: "WARN |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + } else if (log.starts(with: "ERROR |")) { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.error("💥 \(log.replacingOccurrences(of: "ERROR |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + } else if (log.starts(with: "CRIT |")) { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.critical("💥 \(log.replacingOccurrences(of: "CRIT |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + } else { + log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) + Logger.radio.debug("📟 \(log)") + } + } case FROMRADIO_UUID: diff --git a/Meshtastic/Helpers/Logger.swift b/Meshtastic/Helpers/Logger.swift deleted file mode 100644 index bf9ad575..00000000 --- a/Meshtastic/Helpers/Logger.swift +++ /dev/null @@ -1,19 +0,0 @@ -import OSLog - -extension Logger { - - /// The logger's subsystem. - private static var subsystem = Bundle.main.bundleIdentifier! - - /// All logs related to data such as decoding error, parsing issues, etc. - static let data = Logger(subsystem: subsystem, category: "🗄️ Data") - - /// All logs related to the mesh - static let mesh = Logger(subsystem: subsystem, category: "🕸️ Mesh") - - /// All logs related to services such as network calls, location, etc. - static let services = Logger(subsystem: subsystem, category: "🍏 Services") - - /// All logs related to tracking and analytics. - static let statistics = Logger(subsystem: subsystem, category: "📈 Stats") -} diff --git a/Meshtastic/Views/Settings/AdminMessageList.swift b/Meshtastic/Views/Settings/AdminMessageList.swift deleted file mode 100644 index fc4fa5f8..00000000 --- a/Meshtastic/Views/Settings/AdminMessageList.swift +++ /dev/null @@ -1,80 +0,0 @@ -// -// AdminMessageList.swift -// Meshtastic -// -// Created by Garth Vander Houwen on 7/2/22. -// -/* - Abstract: - A view showing the details for a node. - */ - -import SwiftUI -import MapKit -import CoreLocation - -struct AdminMessageList: View { - - @Environment(\.managedObjectContext) var context - @EnvironmentObject var bleManager: BLEManager - - var user: UserEntity? - - var body: some View { - let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmmssa", options: 0, locale: Locale.current) - let localeTimeFormat = DateFormatter.dateFormat(fromTemplate: "h:mm:ss a", options: 0, locale: Locale.current) - let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mm:ss a") - let timeFormatString = (localeTimeFormat ?? "h:mm:ss a") - - List { - if user != nil { - - ForEach( user!.adminMessageList.reversed() ) { am in - - VStack(alignment: .leading) { - - Text("\(am.adminDescription ?? "unknown".localized)") - .font(.caption) - - Text("Sent \(Date(timeIntervalSince1970: TimeInterval(am.messageTimestamp)).formattedDate(format: dateFormatString))") - .foregroundColor(.gray) - .font(.caption2) - - HStack(spacing: 0) { - let ackErrorVal = RoutingError(rawValue: Int(am.ackError)) - - if am.ackTimestamp > 0 { - if am.realACK { - - Text(ackErrorVal?.display ?? "Empty Ack Error") - .foregroundColor(am.receivedACK ? .gray : .red) - .font(.caption2) - } else { - Text("Implicit ACK from another node") - .foregroundColor(.orange) - .font(.caption2) - } - } - - if am.receivedACK && am.ackTimestamp > 0 { - Text(" \(Date(timeIntervalSince1970: TimeInterval(am.ackTimestamp)).formattedDate(format: timeFormatString))") - .foregroundColor(am.realACK ? .gray : .orange) - .font(.caption2) - } - } - } - } - } - } - .navigationTitle("admin.log") - .navigationBarItems(trailing: - ZStack { - ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?") - }) - .onAppear { - if self.bleManager.context == nil { - self.bleManager.context = context - } - } - } -} diff --git a/Meshtastic/Views/Settings/AppLog.swift b/Meshtastic/Views/Settings/AppLog.swift new file mode 100644 index 00000000..45652edf --- /dev/null +++ b/Meshtastic/Views/Settings/AppLog.swift @@ -0,0 +1,227 @@ +// +// AppLog.swift +// Meshtastic +// +// Created by Garth Vander Houwen on 6/4/24. +// + +import SwiftUI +import OSLog + +/// Needed for TableColumnForEach +@available(iOS 17.4, *) +struct AppLog: View { + + @State private var logs: [OSLogEntryLog] = [] + @State private var sortOrder = [KeyPathComparator(\OSLogEntryLog.date, order: .reverse)] + @State private var selection: OSLogEntry.ID? + @State private var selectedLog: OSLogEntryLog? + @State private var presentingErrorDetails: Bool = false + @State private var searchText = "" + @State private var category: Int = -1 + @State private var level: Int = -1 + @State var isExporting = false + @State var exportString = "" + @State var isEditingFilters = false + + private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } + private let dateFormatStyle = Date.FormatStyle() + .hour(.twoDigits(amPM: .omitted)) + .minute() + .second() + .secondFraction(.fractional(3)) + + var body: some View { + + Table(logs, selection: $selection, sortOrder: $sortOrder) { + if idiom != .phone { + TableColumn("log.time") { value in + Text(value.date.formatted(dateFormatStyle)) + } + .width(min: 125, max: 150) + TableColumn("log.category", value: \.category) + .width(min: 125, max: 150) + TableColumn("log.level") { value in + Text(value.level.description) + } + .width(min: 75, max: 100) + + } + TableColumn("log.message", value: \.composedMessage) { value in + Text(value.composedMessage) + .font(idiom == .phone ? .caption : .body) + } + .width(ideal: 200, max: .infinity) + } + .monospaced() + .sheet(isPresented: $isEditingFilters) { + AppLogFilter(category: $category, level: $level) + } + .safeAreaInset(edge: .bottom, alignment: .trailing) { + HStack { + Button(action: { + withAnimation { + isEditingFilters = !isEditingFilters + } + }) { + Image(systemName: !isEditingFilters ? "line.3.horizontal.decrease.circle" : "line.3.horizontal.decrease.circle.fill") + .padding(.vertical, 5) + } + .tint(Color(UIColor.secondarySystemBackground)) + .foregroundColor(.accentColor) + .buttonStyle(.borderedProminent) + + } + .controlSize(.regular) + .padding(5) + } + .padding(.bottom, 5) + .padding(.trailing, 5) + .searchable(text: $searchText, placement: .navigationBarDrawer, prompt: "Search") + .disabled(selection != nil) + .overlay { + if logs.isEmpty { + ContentUnavailableView("No Logs Available", systemImage: "scroll") + } + } + .refreshable { + await logs = searchAppLogs() + logs.sort(using: sortOrder) + } + .onChange(of: sortOrder) { _, sortOrder in + withAnimation { + logs.sort(using: sortOrder) + } + } + .onChange(of: searchText) { _ in + Task { + await logs = searchAppLogs() + logs.sort(using: sortOrder) + } + } + .onChange(of: category) { _ in + Task { + await logs = searchAppLogs() + logs.sort(using: sortOrder) + } + } + .onChange(of: level) { _ in + Task { + await logs = searchAppLogs() + logs.sort(using: sortOrder) + } + } + .onChange(of: selection) { newSelection in + presentingErrorDetails = true + let log = logs.first { + $0.id == newSelection + } + selectedLog = log + } + .sheet(item: $selectedLog, onDismiss: didDismiss) { log in + LogDetail(log: log) + .padding() + } + .task { + logs = await searchAppLogs() + logs.sort(using: sortOrder) + } + .fileExporter( + isPresented: $isExporting, + document: CsvDocument(emptyCsv: exportString), + contentType: .commaSeparatedText, + defaultFilename: String("Meshtastic Application Logs"), + onCompletion: { result in + switch result { + case .success: + self.isExporting = false + Logger.services.info("Application log download succeeded.") + case .failure(let error): + Logger.services.error("Application log download failed: \(error.localizedDescription)") + } + } + ) + .navigationBarTitle("Debug Logs\(logs.isEmpty ? "" : " (\(logs.count))")", displayMode: .inline) + .toolbar { +#if targetEnvironment(macCatalyst) + ToolbarItem(placement: .topBarLeading) { + Button(action: { + Task { + await logs = searchAppLogs() + logs.sort(using: sortOrder) + } + }) { + Image(systemName: "arrow.clockwise.circle") + } + } +#endif + if !logs.isEmpty { + ToolbarItem(placement: .navigationBarTrailing) { + Button(action: { + exportString = logToCsvFile(log: logs) + isExporting = true + }) { + Image(systemName: "square.and.arrow.down") + } + } + } + } + } + + func didDismiss() { + selection = nil + selectedLog = nil + } +} + +@available(iOS 17.4, *) +extension AppLog { + @MainActor + private func searchAppLogs() async -> [OSLogEntryLog] { + do { + /// Case Insensitive Search Text Predicates + let searchPredicates = ["composedMessage", "category", "subsystem", "process"].map { property in + return NSPredicate(format: "%K CONTAINS[c] %@", property, searchText) + } + /// Create a compound predicate using each text search preicate as an OR + let textSearchPredicate = NSCompoundPredicate(type: .or, subpredicates: searchPredicates) + /// Create an array of predicates to hold our AND predicates + var predicates: [NSPredicate] = [] + /// Subsystem Predicate + let subsystemPredicate = NSPredicate(format: "subsystem IN %@", ["com.apple.SwiftUI", "com.apple.coredata", "gvh.MeshtasticClient"]) + predicates.append(subsystemPredicate) + /// Category + if category > -1 { + let categoryPredicate = NSPredicate(format: "category == %@", LogCategories(rawValue: category)!.description) + predicates.append(categoryPredicate) + } + /// Log Level + if level > -1 { + let levelPredicate = NSPredicate(format: "messageType == %@", LogLevels(rawValue: level)?.level ?? "info") + predicates.append(levelPredicate) + } + + if predicates.count > 0 || !searchText.isEmpty { + if !searchText.isEmpty { + let filterPredicates = NSCompoundPredicate(type: .and, subpredicates: predicates) + let compoundPredicate = NSCompoundPredicate(type: .and, subpredicates: [textSearchPredicate, filterPredicates]) + let logs = try await Logger.fetch(predicateFormat: compoundPredicate.predicateFormat) + return logs + } else { + let filterPredicates = NSCompoundPredicate(type: .and, subpredicates: predicates) + let logs = try await Logger.fetch(predicateFormat: filterPredicates.predicateFormat) + return logs + } + } else { + let logs = try await Logger.fetch(predicateFormat: subsystemPredicate.predicateFormat) + + return logs + } + + } catch { + return [] + } + } +} + +extension OSLogEntry: Identifiable { } diff --git a/Meshtastic/Views/Settings/Logs/AppLogFilter.swift b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift new file mode 100644 index 00000000..39e5e113 --- /dev/null +++ b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift @@ -0,0 +1,141 @@ +// +// AppLogFilter.swift +// Meshtastic +// +// Created by Garth Vander Houwen on 6/15/24. +// + +import Foundation +import OSLog +import SwiftUI + +enum LogCategories: Int, CaseIterable, Identifiable { + + case admin = 0 + case data = 1 + case mesh = 2 + case mqtt = 3 + case radio = 4 + case services = 5 + case stats = 6 + + var id: Int { self.rawValue } + var description: String { + switch self { + + case .admin: + return "🏛 Admin" + case .data: + return "🗄️ Data" + case .mesh: + return "🕸️ Mesh" + case .mqtt: + return "📱 MQTT" + case .radio: + return "📟 Radio" + case .services: + return "🍏 Services" + case .stats: + return "📊 Stats" + } + } +} + +enum LogLevels: Int, CaseIterable, Identifiable { + + case debug = 0 + case info = 1 + case notice = 2 + case error = 3 + case fault = 4 + + var id: Int { self.rawValue } + var level: String { + switch self { + case .debug: + return "debug" + case .info: + return "info" + case .notice: + return "notice" + case .error: + return "error" + case .fault: + return "fault" + } + } + var description: String { + switch self { + case .debug: + return "🩺 Debug" + case .info: + return "ℹ️ Info" + case .notice: + return "⚠️ Notice" + case .error: + return "🚨 Error" + case .fault: + return "💥 Fault" + } + } +} + +struct AppLogFilter: View { + + @Environment(\.dismiss) private var dismiss + /// Filters + var filterTitle = "App Log Filters" + //@Binding + @Binding var category: Int + @Binding var level: Int + + var body: some View { + + NavigationStack { + Form { + Section(header: Text(filterTitle)) { + HStack { + Label("Category", systemImage: "square.grid.2x2") + Picker("", selection: $category) { + Text("All Categories") + .tag(-1) + ForEach(LogCategories.allCases) { lc in + Text("\(lc.description)") + + } + } + .pickerStyle(DefaultPickerStyle()) + } + + HStack { + Label("Level", systemImage: "stairs") + Picker("", selection: $level) { + Text("All Levels") + .tag(-1) + ForEach(LogLevels.allCases) { ll in + Text("\(ll.description)") + //.tag(ll.rawValue) + + } + } + .pickerStyle(DefaultPickerStyle()) + } + } + } +#if targetEnvironment(macCatalyst) + Spacer() + Button { + dismiss() + } label: { + Label("close", systemImage: "xmark") + } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) + .padding(.bottom) +#endif + } + .presentationDetents([.fraction(0.6), .fraction(0.75)]) + .presentationDragIndicator(.visible) + } +} diff --git a/Meshtastic/Views/Settings/Logs/LogDetail.swift b/Meshtastic/Views/Settings/Logs/LogDetail.swift new file mode 100644 index 00000000..7308da5b --- /dev/null +++ b/Meshtastic/Views/Settings/Logs/LogDetail.swift @@ -0,0 +1,158 @@ +// +// LogDetail.swift +// Meshtastic +// +// Copyright(c) Garth Vander Houwen 6/5/24. +// + +import SwiftUI +import MapKit +import OSLog + +//@available(iOS 17.0, macOS 14.0, *) +struct LogDetail: View { + + @Environment(\.dismiss) private var dismiss + private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } + var log: OSLogEntryLog + var font: Font = .title2 + + private let dateFormatStyle = Date.FormatStyle() + .day(.defaultDigits) + .month(.defaultDigits) + .year(.twoDigits) + .hour(.twoDigits(amPM: .omitted)) + .minute() + .second() + .secondFraction(.fractional(3)) + + var body: some View { + + VStack { + HStack { + Text("OS Log Entry Details") + .font(.largeTitle) + } + Divider() + HStack(alignment: .top) { + VStack(alignment: .leading) { + List { + /// Time + Label { + Text("log.time".localized + ":") + .font(idiom == .phone ? .caption : .title) + .frame(width: idiom == .phone ? 115 : 190, alignment: .trailing) + Text(log.date.formatted(dateFormatStyle)) + .font(idiom == .phone ? .caption : .title) + } icon: { + Image(systemName: "timer") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .callout : .title) + .frame(width: 35) + } + .padding(.bottom, 5) + .listSectionSeparator(.hidden, edges: .top) + .listSectionSeparator(.visible, edges: .bottom) + /// Subsystem + Label { + Text("log.subsystem".localized + ":") + .font(idiom == .phone ? .caption : .title) + .frame(width: idiom == .phone ? 115 : 190, alignment: .trailing) + Text(log.subsystem) + .font(idiom == .phone ? .caption : .title) + } icon: { + Image(systemName: "gear") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .caption : .title) + .frame(width: 35) + } + .padding(.bottom, 5) + .listRowSeparator(.visible) + /// Process + Label { + Text("log.process".localized + ":") + .font(idiom == .phone ? .caption : .title) + .frame(width: idiom == .phone ? 115 : 190, alignment: .trailing) + Text(log.process) + .font(idiom == .phone ? .caption : .title) + } icon: { + Image(systemName: "tag") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .caption : .title) + .frame(width: 35) + } + .padding(.bottom, 5) + .listRowSeparator(.visible) + /// Category + Label { + Text("log.category".localized + ":") + .font(idiom == .phone ? .caption : .title) + .frame(width: idiom == .phone ? 115 : 190, alignment: .trailing) + Text(log.category) + .font(idiom == .phone ? .caption : .title) + } icon: { + Image(systemName: "square.grid.2x2") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .caption : .title) + .frame(width: 35) + } + .padding(.bottom, 5) + .listRowSeparator(.visible) + /// Level + Label { + Text("log.level".localized + ":") + .font(idiom == .phone ? .caption : .title) + .frame(width: idiom == .phone ? 115 : 190, alignment: .trailing) + Text(log.level.description) + .font(idiom == .phone ? .caption : .title) + } icon: { + Image(systemName: "stairs") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .caption : .title) + .frame(width: 35) + } + .padding(.bottom, 5) + .listRowSeparator(.visible) + /// message + Label { + Text("log.message".localized + ":") + .font(idiom == .phone ? .caption : .title) + .frame(width: idiom == .phone ? 115 : 190, alignment: .trailing) + Text(log.composedMessage) + .textSelection(.enabled) + .font(idiom == .phone ? .body : .title) + .padding(.bottom, 5) + + } icon: { + Image(systemName: "text.bubble") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .callout : .title) + .frame(width: 35) + } + .listRowSeparator(.hidden) + + } + .listStyle(.plain) + + } + Spacer() + } + .padding(.top) +#if targetEnvironment(macCatalyst) + Spacer() + Button { + dismiss() + } label: { + Label("close", systemImage: "xmark") + } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) + .padding(.bottom) +#endif + } + .monospaced() + .presentationDetents([.fraction(0.75), .fraction(0.85), .fraction(1.0)]) + .presentationDragIndicator(.visible) + } +} diff --git a/Meshtastic/Views/Settings/Settings.swift b/Meshtastic/Views/Settings/Settings.swift index f2a38030..2817e8b6 100644 --- a/Meshtastic/Views/Settings/Settings.swift +++ b/Meshtastic/Views/Settings/Settings.swift @@ -48,6 +48,7 @@ struct Settings: View { case meshLog case adminMessageLog case about + case appLog } var body: some View { NavigationSplitView { @@ -412,17 +413,18 @@ struct Settings: View { } } .tag(SettingsSidebar.meshLog) - NavigationLink { - let connectedNode = nodes.first(where: { $0.num == preferredNodeNum }) - AdminMessageList(user: connectedNode?.user) - } label: { - Label { - Text("admin.log") - } icon: { - Image(systemName: "building.columns") + if #available (iOS 17.4, *) { + NavigationLink { + AppLog() + } label: { + Label { + Text("Debug Logs") + } icon: { + Image(systemName: "stethoscope") + } } + .tag(SettingsSidebar.appLog) } - .tag(SettingsSidebar.adminMessageLog) } Section(header: Text("Firmware")) { NavigationLink { From 6930d87275ee79bd69db1d20aae5f5583f4ea4cb Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 07:36:03 -0700 Subject: [PATCH 02/29] Add device logging config, update protobufs --- Meshtastic.xcodeproj/project.pbxproj | 4 +- .../xcshareddata/swiftpm/Package.resolved | 83 +--- .../Meshtastic.xcdatamodeld/.xccurrentversion | 2 +- .../contents | 465 ++++++++++++++++++ .../Protobufs/meshtastic/admin.pb.swift | 30 ++ .../Protobufs/meshtastic/config.pb.swift | 129 +++++ Meshtastic/Protobufs/meshtastic/mesh.pb.swift | 325 ++++++++++++ .../Protobufs/meshtastic/powermon.pb.swift | 179 +++++++ .../Protobufs/meshtastic/telemetry.pb.swift | 126 +++++ .../Settings/Config/BluetoothConfig.swift | 42 +- protobufs | 2 +- 11 files changed, 1290 insertions(+), 97 deletions(-) create mode 100644 Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 38.xcdatamodel/contents create mode 100644 Meshtastic/Protobufs/meshtastic/powermon.pb.swift diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index b40b557b..c70dcb98 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -447,6 +447,7 @@ DDD5BB0A2C285E45007E03CA /* LogDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogDetail.swift; sourceTree = ""; }; DDD5BB0C2C285F00007E03CA /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; DDD5BB0F2C285FB3007E03CA /* AppLogFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLogFilter.swift; sourceTree = ""; }; + DDD5BB142C28680D007E03CA /* MeshtasticDataModelV 38.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 38.xcdatamodel"; sourceTree = ""; }; DDD6EEAE29BC024700383354 /* Firmware.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Firmware.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 = ""; }; @@ -1853,6 +1854,7 @@ DD3CC6BA28E366DF00FA9159 /* Meshtastic.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + DDD5BB142C28680D007E03CA /* MeshtasticDataModelV 38.xcdatamodel */, DDD28D372C0CD2670063CFA3 /* MeshtasticDataModelV 37.xcdatamodel */, DD31B04D2BDC6FD30024FA63 /* MeshtasticDataModelV 36.xcdatamodel */, DD268D8C2BCC7D11008073AE /* MeshtasticDataModelV 35.xcdatamodel */, @@ -1891,7 +1893,7 @@ DD5D0A9A2931AD6B00F7EA61 /* MeshtasticDataModelV2.xcdatamodel */, DD3CC6BB28E366DF00FA9159 /* MeshtasticDataModel.xcdatamodel */, ); - currentVersion = DDD28D372C0CD2670063CFA3 /* MeshtasticDataModelV 37.xcdatamodel */; + currentVersion = DDD5BB142C28680D007E03CA /* MeshtasticDataModelV 38.xcdatamodel */; name = Meshtastic.xcdatamodeld; path = Meshtastic/Meshtastic.xcdatamodeld; sourceTree = ""; diff --git a/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 0a15919c..a62998be 100644 --- a/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "32ea1ad7873163554215310b8eea710c94c63f855b5b01c0b790e7b537747ceb", + "originHash" : "e9855e3a299c14a10f11ee0b8f29e4170b09548533939361223a0f50e7caac8c", "pins" : [ { "identity" : "cocoamqtt", @@ -10,24 +10,6 @@ "version" : "2.1.5" } }, - { - "identity" : "collectionconcurrencykit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git", - "state" : { - "revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95", - "version" : "0.2.0" - } - }, - { - "identity" : "cryptoswift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", - "state" : { - "revision" : "c9c3df6ab812de32bae61fc0cd1bf6d45170ebf0", - "version" : "1.8.2" - } - }, { "identity" : "mqttcocoaasyncsocket", "kind" : "remoteSourceControl", @@ -37,15 +19,6 @@ "version" : "1.0.8" } }, - { - "identity" : "sourcekitten", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jpsim/SourceKitten.git", - "state" : { - "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", - "version" : "0.35.0" - } - }, { "identity" : "sqlite.swift", "kind" : "remoteSourceControl", @@ -64,15 +37,6 @@ "version" : "3.1.2" } }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", - "state" : { - "revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b", - "version" : "1.4.0" - } - }, { "identity" : "swift-protobuf", "kind" : "remoteSourceControl", @@ -81,51 +45,6 @@ "revision" : "ce20dc083ee485524b802669890291c0d8090170", "version" : "1.22.1" } - }, - { - "identity" : "swift-syntax", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", - "state" : { - "revision" : "303e5c5c36d6a558407d364878df131c3546fad8", - "version" : "510.0.2" - } - }, - { - "identity" : "swiftlint", - "kind" : "remoteSourceControl", - "location" : "https://github.com/realm/SwiftLint", - "state" : { - "revision" : "b515723b16eba33f15c4677ee65f3fef2ce8c255", - "version" : "0.55.1" - } - }, - { - "identity" : "swiftytexttable", - "kind" : "remoteSourceControl", - "location" : "https://github.com/scottrhoyt/SwiftyTextTable.git", - "state" : { - "revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3", - "version" : "0.9.0" - } - }, - { - "identity" : "swxmlhash", - "kind" : "remoteSourceControl", - "location" : "https://github.com/drmohundro/SWXMLHash.git", - "state" : { - "revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f", - "version" : "7.0.2" - } - }, - { - "identity" : "yams", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jpsim/Yams.git", - "state" : { - "revision" : "9234124cff5e22e178988c18d8b95a8ae8007f76", - "version" : "5.1.2" - } } ], "version" : 3 diff --git a/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion b/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion index 63ed7101..60188826 100644 --- a/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion +++ b/Meshtastic/Meshtastic.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - MeshtasticDataModelV 37.xcdatamodel + MeshtasticDataModelV 38.xcdatamodel diff --git a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 38.xcdatamodel/contents b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 38.xcdatamodel/contents new file mode 100644 index 00000000..10948c6b --- /dev/null +++ b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 38.xcdatamodel/contents @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Meshtastic/Protobufs/meshtastic/admin.pb.swift b/Meshtastic/Protobufs/meshtastic/admin.pb.swift index 230f5304..c3f1c12f 100644 --- a/Meshtastic/Protobufs/meshtastic/admin.pb.swift +++ b/Meshtastic/Protobufs/meshtastic/admin.pb.swift @@ -245,6 +245,16 @@ struct AdminMessage { set {payloadVariant = .deleteFileRequest(newValue)} } + /// + /// Set zero and offset for scale chips + var setScale: UInt32 { + get { + if case .setScale(let v)? = payloadVariant {return v} + return 0 + } + set {payloadVariant = .setScale(newValue)} + } + /// /// Set the owner for this node var setOwner: User { @@ -513,6 +523,9 @@ struct AdminMessage { /// Delete the file by the specified path from the device case deleteFileRequest(String) /// + /// Set zero and offset for scale chips + case setScale(UInt32) + /// /// Set the owner for this node case setOwner(User) /// @@ -667,6 +680,10 @@ struct AdminMessage { guard case .deleteFileRequest(let l) = lhs, case .deleteFileRequest(let r) = rhs else { preconditionFailure() } return l == r }() + case (.setScale, .setScale): return { + guard case .setScale(let l) = lhs, case .setScale(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 @@ -1039,6 +1056,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 20: .standard(proto: "get_node_remote_hardware_pins_response"), 21: .standard(proto: "enter_dfu_mode_request"), 22: .standard(proto: "delete_file_request"), + 23: .standard(proto: "set_scale"), 32: .standard(proto: "set_owner"), 33: .standard(proto: "set_channel"), 34: .standard(proto: "set_config"), @@ -1274,6 +1292,14 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat self.payloadVariant = .deleteFileRequest(v) } }() + case 23: try { + var v: UInt32? + try decoder.decodeSingularUInt32Field(value: &v) + if let v = v { + if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} + self.payloadVariant = .setScale(v) + } + }() case 32: try { var v: User? var hadOneofValue = false @@ -1546,6 +1572,10 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat guard case .deleteFileRequest(let v)? = self.payloadVariant else { preconditionFailure() } try visitor.visitSingularStringField(value: v, fieldNumber: 22) }() + case .setScale?: try { + guard case .setScale(let v)? = self.payloadVariant else { preconditionFailure() } + try visitor.visitSingularUInt32Field(value: v, fieldNumber: 23) + }() case .setOwner?: try { guard case .setOwner(let v)? = self.payloadVariant else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 32) diff --git a/Meshtastic/Protobufs/meshtastic/config.pb.swift b/Meshtastic/Protobufs/meshtastic/config.pb.swift index 90ea2f40..11453fa7 100644 --- a/Meshtastic/Protobufs/meshtastic/config.pb.swift +++ b/Meshtastic/Protobufs/meshtastic/config.pb.swift @@ -630,6 +630,11 @@ struct Config { /// I2C address of INA_2XX to use for reading device battery voltage var deviceBatteryInaAddress: UInt32 = 0 + /// + /// If non-zero, we want powermon log outputs. With the particular (bitfield) sources enabled. + /// Note: we picked an ID of 32 so that lower more efficient IDs can be used for more frequently used options. + var powermonEnables: UInt64 = 0 + var unknownFields = SwiftProtobuf.UnknownStorage() init() {} @@ -799,6 +804,10 @@ struct Config { /// Should we wake the screen up on accelerometer detected motion or tap var wakeOnTapOrMotion: Bool = false + /// + /// Indicates how to rotate or invert the compass output to accurate display on the display. + var compassOrientation: Config.DisplayConfig.CompassOrientation = .degrees0 + var unknownFields = SwiftProtobuf.UnknownStorage() /// @@ -998,6 +1007,76 @@ struct Config { } + enum CompassOrientation: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + /// The compass and the display are in the same orientation. + case degrees0 // = 0 + + /// + /// Rotate the compass by 90 degrees. + case degrees90 // = 1 + + /// + /// Rotate the compass by 180 degrees. + case degrees180 // = 2 + + /// + /// Rotate the compass by 270 degrees. + case degrees270 // = 3 + + /// + /// Don't rotate the compass, but invert the result. + case degrees0Inverted // = 4 + + /// + /// Rotate the compass by 90 degrees and invert. + case degrees90Inverted // = 5 + + /// + /// Rotate the compass by 180 degrees and invert. + case degrees180Inverted // = 6 + + /// + /// Rotate the compass by 270 degrees and invert. + case degrees270Inverted // = 7 + case UNRECOGNIZED(Int) + + init() { + self = .degrees0 + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .degrees0 + case 1: self = .degrees90 + case 2: self = .degrees180 + case 3: self = .degrees270 + case 4: self = .degrees0Inverted + case 5: self = .degrees90Inverted + case 6: self = .degrees180Inverted + case 7: self = .degrees270Inverted + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .degrees0: return 0 + case .degrees90: return 1 + case .degrees180: return 2 + case .degrees270: return 3 + case .degrees0Inverted: return 4 + case .degrees90Inverted: return 5 + case .degrees180Inverted: return 6 + case .degrees270Inverted: return 7 + case .UNRECOGNIZED(let i): return i + } + } + + } + init() {} } @@ -1334,6 +1413,10 @@ struct Config { /// Specified PIN for PairingMode.FixedPin var fixedPin: UInt32 = 0 + /// + /// Enables device (serial style logs) over Bluetooth + var deviceLoggingEnabled: Bool = false + var unknownFields = SwiftProtobuf.UnknownStorage() enum PairingMode: SwiftProtobuf.Enum { @@ -1485,6 +1568,20 @@ extension Config.DisplayConfig.DisplayMode: CaseIterable { ] } +extension Config.DisplayConfig.CompassOrientation: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Config.DisplayConfig.CompassOrientation] = [ + .degrees0, + .degrees90, + .degrees180, + .degrees270, + .degrees0Inverted, + .degrees90Inverted, + .degrees180Inverted, + .degrees270Inverted, + ] +} + extension Config.LoRaConfig.RegionCode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. static let allCases: [Config.LoRaConfig.RegionCode] = [ @@ -1553,6 +1650,7 @@ 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.DisplayConfig.CompassOrientation: @unchecked Sendable {} extension Config.LoRaConfig: @unchecked Sendable {} extension Config.LoRaConfig.RegionCode: @unchecked Sendable {} extension Config.LoRaConfig.ModemPreset: @unchecked Sendable {} @@ -1986,6 +2084,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 7: .standard(proto: "ls_secs"), 8: .standard(proto: "min_wake_secs"), 9: .standard(proto: "device_battery_ina_address"), + 32: .standard(proto: "powermon_enables"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -2002,6 +2101,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple case 7: try { try decoder.decodeSingularUInt32Field(value: &self.lsSecs) }() case 8: try { try decoder.decodeSingularUInt32Field(value: &self.minWakeSecs) }() case 9: try { try decoder.decodeSingularUInt32Field(value: &self.deviceBatteryInaAddress) }() + case 32: try { try decoder.decodeSingularUInt64Field(value: &self.powermonEnables) }() default: break } } @@ -2032,6 +2132,9 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if self.deviceBatteryInaAddress != 0 { try visitor.visitSingularUInt32Field(value: self.deviceBatteryInaAddress, fieldNumber: 9) } + if self.powermonEnables != 0 { + try visitor.visitSingularUInt64Field(value: self.powermonEnables, fieldNumber: 32) + } try unknownFields.traverse(visitor: &visitor) } @@ -2044,6 +2147,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if lhs.lsSecs != rhs.lsSecs {return false} if lhs.minWakeSecs != rhs.minWakeSecs {return false} if lhs.deviceBatteryInaAddress != rhs.deviceBatteryInaAddress {return false} + if lhs.powermonEnables != rhs.powermonEnables {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } @@ -2197,6 +2301,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 8: .same(proto: "displaymode"), 9: .standard(proto: "heading_bold"), 10: .standard(proto: "wake_on_tap_or_motion"), + 11: .standard(proto: "compass_orientation"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -2215,6 +2320,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp case 8: try { try decoder.decodeSingularEnumField(value: &self.displaymode) }() case 9: try { try decoder.decodeSingularBoolField(value: &self.headingBold) }() case 10: try { try decoder.decodeSingularBoolField(value: &self.wakeOnTapOrMotion) }() + case 11: try { try decoder.decodeSingularEnumField(value: &self.compassOrientation) }() default: break } } @@ -2251,6 +2357,9 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp if self.wakeOnTapOrMotion != false { try visitor.visitSingularBoolField(value: self.wakeOnTapOrMotion, fieldNumber: 10) } + if self.compassOrientation != .degrees0 { + try visitor.visitSingularEnumField(value: self.compassOrientation, fieldNumber: 11) + } try unknownFields.traverse(visitor: &visitor) } @@ -2265,6 +2374,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp if lhs.displaymode != rhs.displaymode {return false} if lhs.headingBold != rhs.headingBold {return false} if lhs.wakeOnTapOrMotion != rhs.wakeOnTapOrMotion {return false} + if lhs.compassOrientation != rhs.compassOrientation {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } @@ -2306,6 +2416,19 @@ extension Config.DisplayConfig.DisplayMode: SwiftProtobuf._ProtoNameProviding { ] } +extension Config.DisplayConfig.CompassOrientation: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DEGREES_0"), + 1: .same(proto: "DEGREES_90"), + 2: .same(proto: "DEGREES_180"), + 3: .same(proto: "DEGREES_270"), + 4: .same(proto: "DEGREES_0_INVERTED"), + 5: .same(proto: "DEGREES_90_INVERTED"), + 6: .same(proto: "DEGREES_180_INVERTED"), + 7: .same(proto: "DEGREES_270_INVERTED"), + ] +} + extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = Config.protoMessageName + ".LoRaConfig" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ @@ -2471,6 +2594,7 @@ extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageI 1: .same(proto: "enabled"), 2: .same(proto: "mode"), 3: .standard(proto: "fixed_pin"), + 4: .standard(proto: "device_logging_enabled"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -2482,6 +2606,7 @@ extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageI 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) }() + case 4: try { try decoder.decodeSingularBoolField(value: &self.deviceLoggingEnabled) }() default: break } } @@ -2497,6 +2622,9 @@ extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageI if self.fixedPin != 0 { try visitor.visitSingularUInt32Field(value: self.fixedPin, fieldNumber: 3) } + if self.deviceLoggingEnabled != false { + try visitor.visitSingularBoolField(value: self.deviceLoggingEnabled, fieldNumber: 4) + } try unknownFields.traverse(visitor: &visitor) } @@ -2504,6 +2632,7 @@ extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageI if lhs.enabled != rhs.enabled {return false} if lhs.mode != rhs.mode {return false} if lhs.fixedPin != rhs.fixedPin {return false} + if lhs.deviceLoggingEnabled != rhs.deviceLoggingEnabled {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/Meshtastic/Protobufs/meshtastic/mesh.pb.swift b/Meshtastic/Protobufs/meshtastic/mesh.pb.swift index 7d33c743..a8ee777c 100644 --- a/Meshtastic/Protobufs/meshtastic/mesh.pb.swift +++ b/Meshtastic/Protobufs/meshtastic/mesh.pb.swift @@ -114,6 +114,18 @@ enum HardwareModel: SwiftProtobuf.Enum { /// wiphone https://www.wiphone.io/ case wiphone // = 20 + /// + /// WIO Tracker WM1110 family from Seeed Studio. Includes wio-1110-tracker and wio-1110-sdk + case wioWm1110 // = 21 + + /// + /// RAK2560 Solar base station based on RAK4630 + case rak2560 // = 22 + + /// + /// Heltec HRU-3601: https://heltec.org/project/hru-3601/ + case heltecHru3601 // = 23 + /// /// B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station case stationG1 // = 25 @@ -288,6 +300,10 @@ enum HardwareModel: SwiftProtobuf.Enum { /// ESP32-D0WDQ6 With SX1276/SKY66122, SSD1306 OLED and No GPS case radiomaster900BanditNano // = 64 + /// + /// Heltec Capsule Sensor V3 with ESP32-S3 CPU, Portable LoRa device that can replace GNSS modules or sensors + case heltecCapsuleSensorV3 // = 65 + /// /// ------------------------------------------------------------------------------------------------------------------------------------------ /// 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. @@ -322,6 +338,9 @@ enum HardwareModel: SwiftProtobuf.Enum { case 18: self = .nanoG2Ultra case 19: self = .loraType case 20: self = .wiphone + case 21: self = .wioWm1110 + case 22: self = .rak2560 + case 23: self = .heltecHru3601 case 25: self = .stationG1 case 26: self = .rak11310 case 27: self = .senseloraRp2040 @@ -362,6 +381,7 @@ enum HardwareModel: SwiftProtobuf.Enum { case 62: self = .twcMeshV4 case 63: self = .nrf52PromicroDiy case 64: self = .radiomaster900BanditNano + case 65: self = .heltecCapsuleSensorV3 case 255: self = .privateHw default: self = .UNRECOGNIZED(rawValue) } @@ -390,6 +410,9 @@ enum HardwareModel: SwiftProtobuf.Enum { case .nanoG2Ultra: return 18 case .loraType: return 19 case .wiphone: return 20 + case .wioWm1110: return 21 + case .rak2560: return 22 + case .heltecHru3601: return 23 case .stationG1: return 25 case .rak11310: return 26 case .senseloraRp2040: return 27 @@ -430,6 +453,7 @@ enum HardwareModel: SwiftProtobuf.Enum { case .twcMeshV4: return 62 case .nrf52PromicroDiy: return 63 case .radiomaster900BanditNano: return 64 + case .heltecCapsuleSensorV3: return 65 case .privateHw: return 255 case .UNRECOGNIZED(let i): return i } @@ -463,6 +487,9 @@ extension HardwareModel: CaseIterable { .nanoG2Ultra, .loraType, .wiphone, + .wioWm1110, + .rak2560, + .heltecHru3601, .stationG1, .rak11310, .senseloraRp2040, @@ -503,6 +530,7 @@ extension HardwareModel: CaseIterable { .twcMeshV4, .nrf52PromicroDiy, .radiomaster900BanditNano, + .heltecCapsuleSensorV3, .privateHw, ] } @@ -2701,6 +2729,129 @@ struct NodeRemoteHardwarePin { fileprivate var _pin: RemoteHardwarePin? = nil } +struct ChunkedPayload { + // 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 ID of the entire payload + var payloadID: UInt32 = 0 + + /// + /// The total number of chunks in the payload + var chunkCount: UInt32 = 0 + + /// + /// The current chunk index in the total + var chunkIndex: UInt32 = 0 + + /// + /// The binary data of the current chunk + var payloadChunk: Data = Data() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// +/// Wrapper message for broken repeated oneof support +struct resend_chunks { + // 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 chunks: [UInt32] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// +/// Responses to a ChunkedPayload request +struct ChunkedPayloadResponse { + // 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 ID of the entire payload + var payloadID: UInt32 = 0 + + var payloadVariant: ChunkedPayloadResponse.OneOf_PayloadVariant? = nil + + /// + /// Request to transfer chunked payload + var requestTransfer: Bool { + get { + if case .requestTransfer(let v)? = payloadVariant {return v} + return false + } + set {payloadVariant = .requestTransfer(newValue)} + } + + /// + /// Accept the transfer chunked payload + var acceptTransfer: Bool { + get { + if case .acceptTransfer(let v)? = payloadVariant {return v} + return false + } + set {payloadVariant = .acceptTransfer(newValue)} + } + + /// + /// Request missing indexes in the chunked payload + var resendChunks: resend_chunks { + get { + if case .resendChunks(let v)? = payloadVariant {return v} + return resend_chunks() + } + set {payloadVariant = .resendChunks(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_PayloadVariant: Equatable { + /// + /// Request to transfer chunked payload + case requestTransfer(Bool) + /// + /// Accept the transfer chunked payload + case acceptTransfer(Bool) + /// + /// Request missing indexes in the chunked payload + case resendChunks(resend_chunks) + + #if !swift(>=4.1) + static func ==(lhs: ChunkedPayloadResponse.OneOf_PayloadVariant, rhs: ChunkedPayloadResponse.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 (.requestTransfer, .requestTransfer): return { + guard case .requestTransfer(let l) = lhs, case .requestTransfer(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.acceptTransfer, .acceptTransfer): return { + guard case .acceptTransfer(let l) = lhs, case .acceptTransfer(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.resendChunks, .resendChunks): return { + guard case .resendChunks(let l) = lhs, case .resendChunks(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + init() {} +} + #if swift(>=5.5) && canImport(_Concurrency) extension HardwareModel: @unchecked Sendable {} extension Constants: @unchecked Sendable {} @@ -2736,6 +2887,10 @@ extension Neighbor: @unchecked Sendable {} extension DeviceMetadata: @unchecked Sendable {} extension Heartbeat: @unchecked Sendable {} extension NodeRemoteHardwarePin: @unchecked Sendable {} +extension ChunkedPayload: @unchecked Sendable {} +extension resend_chunks: @unchecked Sendable {} +extension ChunkedPayloadResponse: @unchecked Sendable {} +extension ChunkedPayloadResponse.OneOf_PayloadVariant: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -2765,6 +2920,9 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding { 18: .same(proto: "NANO_G2_ULTRA"), 19: .same(proto: "LORA_TYPE"), 20: .same(proto: "WIPHONE"), + 21: .same(proto: "WIO_WM1110"), + 22: .same(proto: "RAK2560"), + 23: .same(proto: "HELTEC_HRU_3601"), 25: .same(proto: "STATION_G1"), 26: .same(proto: "RAK11310"), 27: .same(proto: "SENSELORA_RP2040"), @@ -2805,6 +2963,7 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding { 62: .same(proto: "TWC_MESH_V4"), 63: .same(proto: "NRF52_PROMICRO_DIY"), 64: .same(proto: "RADIOMASTER_900_BANDIT_NANO"), + 65: .same(proto: "HELTEC_CAPSULE_SENSOR_V3"), 255: .same(proto: "PRIVATE_HW"), ] } @@ -4775,3 +4934,169 @@ extension NodeRemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageIm return true } } + +extension ChunkedPayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChunkedPayload" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payload_id"), + 2: .standard(proto: "chunk_count"), + 3: .standard(proto: "chunk_index"), + 4: .standard(proto: "payload_chunk"), + ] + + 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.payloadID) }() + case 2: try { try decoder.decodeSingularUInt32Field(value: &self.chunkCount) }() + case 3: try { try decoder.decodeSingularUInt32Field(value: &self.chunkIndex) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self.payloadChunk) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.payloadID != 0 { + try visitor.visitSingularUInt32Field(value: self.payloadID, fieldNumber: 1) + } + if self.chunkCount != 0 { + try visitor.visitSingularUInt32Field(value: self.chunkCount, fieldNumber: 2) + } + if self.chunkIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.chunkIndex, fieldNumber: 3) + } + if !self.payloadChunk.isEmpty { + try visitor.visitSingularBytesField(value: self.payloadChunk, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ChunkedPayload, rhs: ChunkedPayload) -> Bool { + if lhs.payloadID != rhs.payloadID {return false} + if lhs.chunkCount != rhs.chunkCount {return false} + if lhs.chunkIndex != rhs.chunkIndex {return false} + if lhs.payloadChunk != rhs.payloadChunk {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension resend_chunks: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".resend_chunks" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "chunks"), + ] + + 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.decodeRepeatedUInt32Field(value: &self.chunks) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.chunks.isEmpty { + try visitor.visitPackedUInt32Field(value: self.chunks, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: resend_chunks, rhs: resend_chunks) -> Bool { + if lhs.chunks != rhs.chunks {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension ChunkedPayloadResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChunkedPayloadResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payload_id"), + 2: .standard(proto: "request_transfer"), + 3: .standard(proto: "accept_transfer"), + 4: .standard(proto: "resend_chunks"), + ] + + 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.payloadID) }() + case 2: try { + var v: Bool? + try decoder.decodeSingularBoolField(value: &v) + if let v = v { + if self.payloadVariant != nil {try decoder.handleConflictingOneOf()} + self.payloadVariant = .requestTransfer(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 = .acceptTransfer(v) + } + }() + case 4: try { + var v: resend_chunks? + var hadOneofValue = false + if let current = self.payloadVariant { + hadOneofValue = true + if case .resendChunks(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.payloadVariant = .resendChunks(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.payloadID != 0 { + try visitor.visitSingularUInt32Field(value: self.payloadID, fieldNumber: 1) + } + switch self.payloadVariant { + case .requestTransfer?: try { + guard case .requestTransfer(let v)? = self.payloadVariant else { preconditionFailure() } + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + }() + case .acceptTransfer?: try { + guard case .acceptTransfer(let v)? = self.payloadVariant else { preconditionFailure() } + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + }() + case .resendChunks?: try { + guard case .resendChunks(let v)? = self.payloadVariant else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ChunkedPayloadResponse, rhs: ChunkedPayloadResponse) -> Bool { + if lhs.payloadID != rhs.payloadID {return false} + if lhs.payloadVariant != rhs.payloadVariant {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Meshtastic/Protobufs/meshtastic/powermon.pb.swift b/Meshtastic/Protobufs/meshtastic/powermon.pb.swift new file mode 100644 index 00000000..c6762ef1 --- /dev/null +++ b/Meshtastic/Protobufs/meshtastic/powermon.pb.swift @@ -0,0 +1,179 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: meshtastic/powermon.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: There are no 'PowerMon' messages normally in use (PowerMons are sent only as structured logs - slogs). +///But we wrap our State enum in this message to effectively nest a namespace (without our linter yelling at us) +struct PowerMon { + // 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 unknownFields = SwiftProtobuf.UnknownStorage() + + /// Any significant power changing event in meshtastic should be tagged with a powermon state transition. + ///If you are making new meshtastic features feel free to add new entries at the end of this definition. + enum State: SwiftProtobuf.Enum { + typealias RawValue = Int + case none // = 0 + case cpuDeepSleep // = 1 + case cpuLightSleep // = 2 + + /// + ///The external Vext1 power is on. Many boards have auxillary power rails that the CPU turns on only + ///occasionally. In cases where that rail has multiple devices on it we usually want to have logging on + ///the state of that rail as an independent record. + ///For instance on the Heltec Tracker 1.1 board, this rail is the power source for the GPS and screen. + /// + ///The log messages will be short and complete (see PowerMon.Event in the protobufs for details). + ///something like "S:PM:C,0x00001234,REASON" where the hex number is the bitmask of all current states. + ///(We use a bitmask for states so that if a log message gets lost it won't be fatal) + case vext1On // = 4 + case loraRxon // = 8 + case loraTxon // = 16 + case loraRxactive // = 32 + case btOn // = 64 + case ledOn // = 128 + case screenOn // = 256 + case screenDrawing // = 512 + case wifiOn // = 1024 + + /// + ///GPS is actively trying to find our location + ///See GPSPowerState for more details + case gpsActive // = 2048 + case UNRECOGNIZED(Int) + + init() { + self = .none + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .none + case 1: self = .cpuDeepSleep + case 2: self = .cpuLightSleep + case 4: self = .vext1On + case 8: self = .loraRxon + case 16: self = .loraTxon + case 32: self = .loraRxactive + case 64: self = .btOn + case 128: self = .ledOn + case 256: self = .screenOn + case 512: self = .screenDrawing + case 1024: self = .wifiOn + case 2048: self = .gpsActive + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .none: return 0 + case .cpuDeepSleep: return 1 + case .cpuLightSleep: return 2 + case .vext1On: return 4 + case .loraRxon: return 8 + case .loraTxon: return 16 + case .loraRxactive: return 32 + case .btOn: return 64 + case .ledOn: return 128 + case .screenOn: return 256 + case .screenDrawing: return 512 + case .wifiOn: return 1024 + case .gpsActive: return 2048 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension PowerMon.State: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [PowerMon.State] = [ + .none, + .cpuDeepSleep, + .cpuLightSleep, + .vext1On, + .loraRxon, + .loraTxon, + .loraRxactive, + .btOn, + .ledOn, + .screenOn, + .screenDrawing, + .wifiOn, + .gpsActive, + ] +} + +#endif // swift(>=4.2) + +#if swift(>=5.5) && canImport(_Concurrency) +extension PowerMon: @unchecked Sendable {} +extension PowerMon.State: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "meshtastic" + +extension PowerMon: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PowerMon" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: PowerMon, rhs: PowerMon) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension PowerMon.State: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "None"), + 1: .same(proto: "CPU_DeepSleep"), + 2: .same(proto: "CPU_LightSleep"), + 4: .same(proto: "Vext1_On"), + 8: .same(proto: "Lora_RXOn"), + 16: .same(proto: "Lora_TXOn"), + 32: .same(proto: "Lora_RXActive"), + 64: .same(proto: "BT_On"), + 128: .same(proto: "LED_On"), + 256: .same(proto: "Screen_On"), + 512: .same(proto: "Screen_Drawing"), + 1024: .same(proto: "Wifi_On"), + 2048: .same(proto: "GPS_Active"), + ] +} diff --git a/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift b/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift index 7ddb75dc..f6116cf9 100644 --- a/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift +++ b/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift @@ -120,6 +120,14 @@ enum TelemetrySensorType: SwiftProtobuf.Enum { /// /// AHT10 Integrated temperature and humidity sensor case aht10 // = 23 + + /// + /// DFRobot Lark Weather station (temperature, humidity, pressure, wind speed and direction) + case dfrobotLark // = 24 + + /// + /// NAU7802 Scale Chip or compatible + case nau7802 // = 25 case UNRECOGNIZED(Int) init() { @@ -152,6 +160,8 @@ enum TelemetrySensorType: SwiftProtobuf.Enum { case 21: self = .ltr390Uv case 22: self = .tsl25911Fn case 23: self = .aht10 + case 24: self = .dfrobotLark + case 25: self = .nau7802 default: self = .UNRECOGNIZED(rawValue) } } @@ -182,6 +192,8 @@ enum TelemetrySensorType: SwiftProtobuf.Enum { case .ltr390Uv: return 21 case .tsl25911Fn: return 22 case .aht10: return 23 + case .dfrobotLark: return 24 + case .nau7802: return 25 case .UNRECOGNIZED(let i): return i } } @@ -217,6 +229,8 @@ extension TelemetrySensorType: CaseIterable { .ltr390Uv, .tsl25911Fn, .aht10, + .dfrobotLark, + .nau7802, ] } @@ -302,6 +316,27 @@ struct EnvironmentMetrics { /// VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. var whiteLux: Float = 0 + /// + /// Infrared lux + var irLux: Float = 0 + + /// + /// Ultraviolet lux + var uvLux: Float = 0 + + /// + /// Wind direction in degrees + /// 0 degrees = North, 90 = East, etc... + var windDirection: UInt32 = 0 + + /// + /// Wind speed in m/s + var windSpeed: Float = 0 + + /// + /// Weight in KG + var weight: Float = 0 + var unknownFields = SwiftProtobuf.UnknownStorage() init() {} @@ -503,6 +538,26 @@ struct Telemetry { init() {} } +/// +/// NAU7802 Telemetry configuration, for saving to flash +struct Nau7802Config { + // 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 offset setting for the NAU7802 + var zeroOffset: Int32 = 0 + + /// + /// The calibration factor for the NAU7802 + var calibrationFactor: Float = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + #if swift(>=5.5) && canImport(_Concurrency) extension TelemetrySensorType: @unchecked Sendable {} extension DeviceMetrics: @unchecked Sendable {} @@ -511,6 +566,7 @@ extension PowerMetrics: @unchecked Sendable {} extension AirQualityMetrics: @unchecked Sendable {} extension Telemetry: @unchecked Sendable {} extension Telemetry.OneOf_Variant: @unchecked Sendable {} +extension Nau7802Config: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -543,6 +599,8 @@ extension TelemetrySensorType: SwiftProtobuf._ProtoNameProviding { 21: .same(proto: "LTR390UV"), 22: .same(proto: "TSL25911FN"), 23: .same(proto: "AHT10"), + 24: .same(proto: "DFROBOT_LARK"), + 25: .same(proto: "NAU7802"), ] } @@ -615,6 +673,11 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 8: .same(proto: "distance"), 9: .same(proto: "lux"), 10: .standard(proto: "white_lux"), + 11: .standard(proto: "ir_lux"), + 12: .standard(proto: "uv_lux"), + 13: .standard(proto: "wind_direction"), + 14: .standard(proto: "wind_speed"), + 15: .same(proto: "weight"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -633,6 +696,11 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple case 8: try { try decoder.decodeSingularFloatField(value: &self.distance) }() case 9: try { try decoder.decodeSingularFloatField(value: &self.lux) }() case 10: try { try decoder.decodeSingularFloatField(value: &self.whiteLux) }() + case 11: try { try decoder.decodeSingularFloatField(value: &self.irLux) }() + case 12: try { try decoder.decodeSingularFloatField(value: &self.uvLux) }() + case 13: try { try decoder.decodeSingularUInt32Field(value: &self.windDirection) }() + case 14: try { try decoder.decodeSingularFloatField(value: &self.windSpeed) }() + case 15: try { try decoder.decodeSingularFloatField(value: &self.weight) }() default: break } } @@ -669,6 +737,21 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if self.whiteLux != 0 { try visitor.visitSingularFloatField(value: self.whiteLux, fieldNumber: 10) } + if self.irLux != 0 { + try visitor.visitSingularFloatField(value: self.irLux, fieldNumber: 11) + } + if self.uvLux != 0 { + try visitor.visitSingularFloatField(value: self.uvLux, fieldNumber: 12) + } + if self.windDirection != 0 { + try visitor.visitSingularUInt32Field(value: self.windDirection, fieldNumber: 13) + } + if self.windSpeed != 0 { + try visitor.visitSingularFloatField(value: self.windSpeed, fieldNumber: 14) + } + if self.weight != 0 { + try visitor.visitSingularFloatField(value: self.weight, fieldNumber: 15) + } try unknownFields.traverse(visitor: &visitor) } @@ -683,6 +766,11 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if lhs.distance != rhs.distance {return false} if lhs.lux != rhs.lux {return false} if lhs.whiteLux != rhs.whiteLux {return false} + if lhs.irLux != rhs.irLux {return false} + if lhs.uvLux != rhs.uvLux {return false} + if lhs.windDirection != rhs.windDirection {return false} + if lhs.windSpeed != rhs.windSpeed {return false} + if lhs.weight != rhs.weight {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } @@ -959,3 +1047,41 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation return true } } + +extension Nau7802Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Nau7802Config" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "zeroOffset"), + 2: .same(proto: "calibrationFactor"), + ] + + 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.zeroOffset) }() + case 2: try { try decoder.decodeSingularFloatField(value: &self.calibrationFactor) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.zeroOffset != 0 { + try visitor.visitSingularInt32Field(value: self.zeroOffset, fieldNumber: 1) + } + if self.calibrationFactor != 0 { + try visitor.visitSingularFloatField(value: self.calibrationFactor, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Nau7802Config, rhs: Nau7802Config) -> Bool { + if lhs.zeroOffset != rhs.zeroOffset {return false} + if lhs.calibrationFactor != rhs.calibrationFactor {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Meshtastic/Views/Settings/Config/BluetoothConfig.swift b/Meshtastic/Views/Settings/Config/BluetoothConfig.swift index 0b71dcb3..980ed8f4 100644 --- a/Meshtastic/Views/Settings/Config/BluetoothConfig.swift +++ b/Meshtastic/Views/Settings/Config/BluetoothConfig.swift @@ -5,8 +5,8 @@ // Copyright (c) Garth Vander Houwen 8/18/22. // -import SwiftUI import OSLog +import SwiftUI struct BluetoothConfig: View { @Environment(\.managedObjectContext) var context @@ -18,6 +18,7 @@ struct BluetoothConfig: View { @State var mode = 0 @State var fixedPin = "123456" @State var shortPin = false + @State var deviceLoggingEnabled = false var pinLength: Int = 6 let numberFormatter: NumberFormatter = { let formatter = NumberFormatter() @@ -68,18 +69,24 @@ struct BluetoothConfig: View { .foregroundColor(.red) } } + + Toggle(isOn: $deviceLoggingEnabled) { + Label("Device Logging Enabled", systemImage: "ladybug") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) } } .disabled(self.bleManager.connectedPeripheral == nil || node?.bluetoothConfig == nil) SaveConfigButton(node: node, hasChanges: $hasChanges) { - let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context) - if connectedNode != nil { + if let myNodeNum = bleManager.connectedPeripheral?.num, + let connectedNode = getNodeInfo(id: myNodeNum, context: context) { var bc = Config.BluetoothConfig() bc.enabled = enabled bc.mode = BluetoothModes(rawValue: mode)?.protoEnumValue() ?? Config.BluetoothConfig.PairingMode.randomPin bc.fixedPin = UInt32(fixedPin) ?? 123456 - let adminMessageId = bleManager.saveBluetoothConfig(config: bc, fromUser: connectedNode!.user!, toUser: node!.user!, adminIndex: connectedNode?.myInfo?.adminIndex ?? 0) + bc.deviceLoggingEnabled = deviceLoggingEnabled + let adminMessageId = bleManager.saveBluetoothConfig(config: bc, fromUser: connectedNode.user!, toUser: node!.user!, adminIndex: connectedNode.myInfo?.adminIndex ?? 0) if adminMessageId > 0 { // Should show a saved successfully alert once I know that to be true // for now just disable the button after a successful save @@ -90,21 +97,26 @@ struct BluetoothConfig: View { } .navigationTitle("bluetooth.config") - .navigationBarItems(trailing: - ZStack { - ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?") - }) + .navigationBarItems( + trailing: ZStack { + ConnectedDevice( + bluetoothOn: bleManager.isSwitchedOn, + deviceConnected: bleManager.connectedPeripheral != nil, + name: bleManager.connectedPeripheral?.shortName ?? "?" + ) + } + ) .onAppear { if self.bleManager.context == nil { self.bleManager.context = context } setBluetoothValues() // Need to request a BluetoothConfig from the remote node before allowing changes - if bleManager.connectedPeripheral != nil && node?.bluetoothConfig == nil { + if let connectedPeripheral = bleManager.connectedPeripheral, let node, node.bluetoothConfig == nil { Logger.mesh.info("empty bluetooth config") - let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context) - if node != nil && connectedNode != nil { - _ = bleManager.requestBluetoothConfig(fromUser: connectedNode!.user!, toUser: node!.user!, adminIndex: connectedNode?.myInfo?.adminIndex ?? 0) + let connectedNode = getNodeInfo(id: connectedPeripheral.num, context: context) + if let connectedNode { + _ = bleManager.requestBluetoothConfig(fromUser: connectedNode.user!, toUser: node.user!, adminIndex: connectedNode.myInfo?.adminIndex ?? 0) } } } @@ -123,11 +135,17 @@ struct BluetoothConfig: View { if newFixedPin != String(node!.bluetoothConfig!.fixedPin) { hasChanges = true } } } + .onChange(of: deviceLoggingEnabled) { newDeviceLogging in + if node != nil && node!.bluetoothConfig != nil { + if newDeviceLogging != node!.bluetoothConfig!.deviceLoggingEnabled { hasChanges = true } + } + } } func setBluetoothValues() { self.enabled = node?.bluetoothConfig?.enabled ?? true self.mode = Int(node?.bluetoothConfig?.mode ?? 0) self.fixedPin = String(node?.bluetoothConfig?.fixedPin ?? 123456) + self.deviceLoggingEnabled = node?.bluetoothConfig?.deviceLoggingEnabled ?? false self.hasChanges = false } } diff --git a/protobufs b/protobufs index 1c3029f2..4da558d0 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 1c3029f2868e5fc49809fd378f6c0c66aee0eaf4 +Subproject commit 4da558d0f73c46ef91b74431facee73c09affbfc From f7a9345b4e39f2da73696a63e83e0c781ce0be32 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 08:06:59 -0700 Subject: [PATCH 03/29] Update client proxy logging --- Meshtastic/Extensions/Int.swift | 12 +++++++++ .../Helpers/Mqtt/MqttClientProxyManager.swift | 27 +++++++++---------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Meshtastic/Extensions/Int.swift b/Meshtastic/Extensions/Int.swift index 40a12d8f..c9087d7f 100644 --- a/Meshtastic/Extensions/Int.swift +++ b/Meshtastic/Extensions/Int.swift @@ -15,3 +15,15 @@ extension Int { } } } + +extension UInt32 { + func toHex() -> String { + return String(format: "!%2X", self) + } +} + +extension Int64 { + func toHex() -> String { + return String(format: "!%2X", self) + } +} diff --git a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift index a2e363d0..66f94366 100644 --- a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift +++ b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift @@ -81,28 +81,28 @@ class MqttClientProxyManager { } } func subscribe(topic: String, qos: CocoaMQTTQoS) { - Logger.services.info("📲 MQTT Client Proxy subscribed to: \(topic)") + Logger.mqtt.info("📲 [MQTT Client Proxy] subscribed to: \(topic)") mqttClientProxy?.subscribe(topic, qos: qos) } func unsubscribe(topic: String) { mqttClientProxy?.unsubscribe(topic) - Logger.services.info("📲 MQTT Client Proxy unsubscribe for: \(topic)") + Logger.mqtt.info("📲 [MQTT Client Proxy] unsubscribe to topic: \(topic)") } func publish(message: String, topic: String, qos: CocoaMQTTQoS) { mqttClientProxy?.publish(topic, withString: message, qos: qos) - Logger.services.debug("📲 MQTT Client Proxy publish for: \(topic)") + Logger.mqtt.debug("📲 [MQTT Client Proxy] publish for: \(topic)") } func disconnect() { if let client = mqttClientProxy { client.disconnect() - Logger.services.info("📲 MQTT Client Proxy Disconnected") + Logger.mqtt.info("📲 [MQTT Client Proxy] disconnected") } } } extension MqttClientProxyManager: CocoaMQTTDelegate { func mqtt(_ mqtt: CocoaMQTT, didConnectAck ack: CocoaMQTTConnAck) { - Logger.services.info("📲 MQTT Client Proxy didConnectAck: \(ack)") + Logger.mqtt.info("📲 MQTT Client Proxy didConnectAck: \(ack)") if ack == .accept { delegate?.onMqttConnected() } else { @@ -130,34 +130,33 @@ extension MqttClientProxyManager: CocoaMQTTDelegate { } } func mqttDidDisconnect(_ mqtt: CocoaMQTT, withError err: Error?) { - Logger.services.debug("mqttDidDisconnect: \(err?.localizedDescription ?? "")") - + Logger.mqtt.debug("📲 [MQTT Client Proxy] disconnected: \(err?.localizedDescription ?? "")") if let error = err { delegate?.onMqttError(message: error.localizedDescription) } delegate?.onMqttDisconnected() } func mqtt(_ mqtt: CocoaMQTT, didPublishMessage message: CocoaMQTTMessage, id: UInt16) { - Logger.services.debug("📲 MQTT Client Proxy didPublishMessage from MqttClientProxyManager: \(message)") + Logger.mqtt.info("📲 [MQTT Client Proxy] published messsage from MqttClientProxyManager: \(message)") } func mqtt(_ mqtt: CocoaMQTT, didPublishAck id: UInt16) { - Logger.services.debug("📲 MQTT Client Proxy didPublishAck from MqttClientProxyManager: \(id)") + Logger.mqtt.info("📲 [MQTT Client Proxy] published Ack from MqttClientProxyManager: \(id)") } public func mqtt(_ mqtt: CocoaMQTT, didReceiveMessage message: CocoaMQTTMessage, id: UInt16) { delegate?.onMqttMessageReceived(message: message) - Logger.services.debug("📲 MQTT Client Proxy message received on topic: \(message.topic)") + Logger.mqtt.info("📲 [MQTT Client Proxy] message received on topic: \(message.topic)") } func mqtt(_ mqtt: CocoaMQTT, didSubscribeTopics success: NSDictionary, failed: [String]) { - Logger.services.info("📲 MQTT Client Proxy didSubscribeTopics: \(success.allKeys.count) topics. failed: \(failed.count) topics") + Logger.mqtt.debug("📲 [MQTT Client Proxy] subscribed to topics: \(success.allKeys.count) topics. failed: \(failed.count) topics") } func mqtt(_ mqtt: CocoaMQTT, didUnsubscribeTopics topics: [String]) { - Logger.services.info("didUnsubscribeTopics: \(topics.joined(separator: ", "))") + Logger.mqtt.debug("📲 [MQTT Client Proxy] unsubscribed from topics: \(topics.joined(separator: "- "))") } func mqttDidPing(_ mqtt: CocoaMQTT) { - Logger.services.info("📲 MQTT Client Proxy mqttDidPing") + Logger.mqtt.debug("📲 [MQTT Client Proxy] ping") } func mqttDidReceivePong(_ mqtt: CocoaMQTT) { - Logger.services.info("📲 MQTT Client Proxy mqttDidReceivePong") + Logger.mqtt.debug("📲 [MQTT Client Proxy] pong") } } From d456a7a6e644c34e2c79ebf4eb03987f4945ee1e Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 08:23:05 -0700 Subject: [PATCH 04/29] translation strings for log headers, add device log setting to save --- Meshtastic/Persistence/UpdateCoreData.swift | 18 +++++++++--------- de.lproj/Localizable.strings | 6 ++++++ en.lproj/Localizable.strings | 6 ++++++ fr.lproj/Localizable.strings | 6 ++++++ he.lproj/Localizable.strings | 6 ++++++ pl.lproj/Localizable.strings | 6 ++++++ pt-PT.lproj/Localizable.strings | 6 ++++++ se.lproj/Localizable.strings | 6 ++++++ zh-Hans.lproj/Localizable.strings | 6 ++++++ zh-Hant-TW.lproj/Localizable.strings | 6 ++++++ 10 files changed, 63 insertions(+), 9 deletions(-) diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index 1ef04ff7..c78ab2d2 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -383,18 +383,16 @@ func upsertPositionPacket (packet: MeshPacket, context: NSManagedObjectContext) } } -func upsertBluetoothConfigPacket(config: Meshtastic.Config.BluetoothConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertBluetoothConfigPacket(config: Config.BluetoothConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.bluetooth.config %@".localized, String(nodeNum)) MeshLogger.log("📶 \(logString)") - let fetchNodeInfoRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") + let fetchNodeInfoRequest = NodeInfoEntity.fetchRequest() fetchNodeInfoRequest.predicate = NSPredicate(format: "num == %lld", Int64(nodeNum)) do { - guard let fetchedNode = try context.fetch(fetchNodeInfoRequest) as? [NodeInfoEntity] else { - return - } + let fetchedNode = try context.fetch(fetchNodeInfoRequest) // Found a node, save Device Config if !fetchedNode.isEmpty { if fetchedNode[0].bluetoothConfig == nil { @@ -402,26 +400,28 @@ func upsertBluetoothConfigPacket(config: Meshtastic.Config.BluetoothConfig, node newBluetoothConfig.enabled = config.enabled newBluetoothConfig.mode = Int32(config.mode.rawValue) newBluetoothConfig.fixedPin = Int32(config.fixedPin) + newBluetoothConfig.deviceLoggingEnabled = config.deviceLoggingEnabled fetchedNode[0].bluetoothConfig = newBluetoothConfig } else { fetchedNode[0].bluetoothConfig?.enabled = config.enabled fetchedNode[0].bluetoothConfig?.mode = Int32(config.mode.rawValue) fetchedNode[0].bluetoothConfig?.fixedPin = Int32(config.fixedPin) + fetchedNode[0].bluetoothConfig?.deviceLoggingEnabled = config.deviceLoggingEnabled } do { try context.save() - Logger.data.info("💾 Updated Bluetooth Config for node number: \(String(nodeNum))") + Logger.data.info("💾 Updated Bluetooth Config for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data BluetoothConfigEntity: \(nsError)") + Logger.data.error("💥 Error Updating Core Data BluetoothConfigEntity: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Bluetooth Config") + Logger.data.error("💥 No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Bluetooth Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data BluetoothConfigEntity failed: \(nsError)") + Logger.data.error("💥 Fetching node for core data BluetoothConfigEntity failed: \(nsError, privacy: .public)") } } diff --git a/de.lproj/Localizable.strings b/de.lproj/Localizable.strings index 511ecdaa..83fe06d3 100644 --- a/de.lproj/Localizable.strings +++ b/de.lproj/Localizable.strings @@ -173,6 +173,12 @@ "interval.seventytwo.hours"="Seventy Two Hours"; "keyboard.type"="Keyboard Typ"; "logging"="Logging"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Einstellungen"; "map"="Mesh Karte"; diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index 4c507879..fb3af6f6 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="Seventy Two Hours"; "keyboard.type"="Keyboard Type"; "logging"="Logging"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Config"; "map"="Mesh Map"; diff --git a/fr.lproj/Localizable.strings b/fr.lproj/Localizable.strings index 785a2012..3c517ac3 100644 --- a/fr.lproj/Localizable.strings +++ b/fr.lproj/Localizable.strings @@ -154,6 +154,12 @@ "interval.seventytwo.hours"="Soixante douze heures"; "keyboard.type"="Type de clavier"; "logging"="Enregistrement"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="Configuration LoRa"; "map"="Carte de maillage"; diff --git a/he.lproj/Localizable.strings b/he.lproj/Localizable.strings index 154c2391..fd844980 100644 --- a/he.lproj/Localizable.strings +++ b/he.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="שבעים ושתיים שעות"; "keyboard.type"="סוג מקלדת"; "logging"="רישום"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="לורה"; "lora.config"="הגדרות לורה"; "map"="מפת מש"; diff --git a/pl.lproj/Localizable.strings b/pl.lproj/Localizable.strings index eb8372b0..e09d745b 100644 --- a/pl.lproj/Localizable.strings +++ b/pl.lproj/Localizable.strings @@ -175,6 +175,12 @@ "interval.seventytwo.hours"="Siedemdziesiąt Dwie Godziny"; "keyboard.type"="Typ Klawiatury"; "logging"="Rejestracja"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="Konfiguracja LoRa"; "map"="Mapa Sieci"; diff --git a/pt-PT.lproj/Localizable.strings b/pt-PT.lproj/Localizable.strings index 4c507879..fb3af6f6 100644 --- a/pt-PT.lproj/Localizable.strings +++ b/pt-PT.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="Seventy Two Hours"; "keyboard.type"="Keyboard Type"; "logging"="Logging"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Config"; "map"="Mesh Map"; diff --git a/se.lproj/Localizable.strings b/se.lproj/Localizable.strings index e45ca2fe..81d00170 100644 --- a/se.lproj/Localizable.strings +++ b/se.lproj/Localizable.strings @@ -177,6 +177,12 @@ "interval.seventytwo.hours"="Sjuttiotvå Timmar"; "keyboard.type"="Tangentbordstyp"; "logging"="Loggning"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa Konfiguration"; "map"="Mesh Karta"; diff --git a/zh-Hans.lproj/Localizable.strings b/zh-Hans.lproj/Localizable.strings index 5606f44b..3a241f3f 100644 --- a/zh-Hans.lproj/Localizable.strings +++ b/zh-Hans.lproj/Localizable.strings @@ -173,6 +173,12 @@ "interval.eventytwo.hours"="七十二小时"; "keyboard.type"="键盘类型"; "logging"="加载中"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa 配置"; "map"="Mesh 地图"; diff --git a/zh-Hant-TW.lproj/Localizable.strings b/zh-Hant-TW.lproj/Localizable.strings index 1665f916..fdc02df2 100644 --- a/zh-Hant-TW.lproj/Localizable.strings +++ b/zh-Hant-TW.lproj/Localizable.strings @@ -173,6 +173,12 @@ "interval.eventytwo.hours"="七十二小時"; "keyboard.type"="鍵盤類型"; "logging"="加載中"; +"log.time"="Time"; +"log.subsystem"="Subsystem"; +"log.process"="Process"; +"log.category"="Category"; +"log.level"="Level"; +"log.message"="Message"; "lora"="LoRa"; "lora.config"="LoRa 設定"; "map"="Mesh 地圖"; From 1ac5bc96977d71202baf7b6b00addfa219342d8c Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 08:40:38 -0700 Subject: [PATCH 05/29] Update logs --- Meshtastic/Helpers/MeshPackets.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index 3250334b..e81fee1d 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -683,6 +683,7 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage telemetry.voltage = telemetryMessage.deviceMetrics.voltage telemetry.uptimeSeconds = Int32(telemetryMessage.deviceMetrics.uptimeSeconds) telemetry.metricsType = 0 + Logger.statistics.info("📈 [Mesh Statistics] Channel Utilization: \(telemetryMessage.deviceMetrics.channelUtilization) Airtime: \(telemetryMessage.deviceMetrics.airUtilTx) for Node: \(packet.from.toHex())") } else if telemetryMessage.variant == Telemetry.OneOf_Variant.environmentMetrics(telemetryMessage.environmentMetrics) { // Environment Metrics telemetry.barometricPressure = telemetryMessage.environmentMetrics.barometricPressure @@ -708,7 +709,7 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage try context.save() // Only log telemetry from the mesh not the connected device if connectedNode != Int64(packet.from) { - Logger.data.info("💾 Telemetry Saved for Node: \(packet.from)") + Logger.data.info("💾 [Telemetry] Saved for Node: \(packet.from.toHex())") } else if telemetry.metricsType == 0 { // Connected Device Metrics // ------------------------ @@ -749,10 +750,10 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Saving Telemetry for Node \(packet.from) Error: \(nsError)") + Logger.data.error("💥 Error Saving Telemetry for Node \(packet.from, privacy: .public) Error: \(nsError, privacy: .public)") } } else { - Logger.data.error("Error Fetching NodeInfoEntity for Node \(packet.from)") + Logger.data.error("💥 Error Fetching NodeInfoEntity for Node \(packet.from.toHex(), privacy: .public)") } } From b73b3864ea17c5ed2d4fc6e70032fe3c353b2a83 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 12:25:08 -0700 Subject: [PATCH 06/29] Delete admin message list --- .../CoreData/UserEntityExtension.swift | 4 - Meshtastic/Helpers/BLEManager.swift | 132 ++++++++---------- Meshtastic/Persistence/UpdateCoreData.swift | 2 +- Meshtastic/Views/Settings/MeshLog.swift | 1 + 4 files changed, 62 insertions(+), 77 deletions(-) diff --git a/Meshtastic/Extensions/CoreData/UserEntityExtension.swift b/Meshtastic/Extensions/CoreData/UserEntityExtension.swift index a8adeaaf..0128cf93 100644 --- a/Meshtastic/Extensions/CoreData/UserEntityExtension.swift +++ b/Meshtastic/Extensions/CoreData/UserEntityExtension.swift @@ -14,10 +14,6 @@ extension UserEntity { self.value(forKey: "allMessages") as? [MessageEntity] ?? [MessageEntity]() } - var adminMessageList: [MessageEntity] { - self.value(forKey: "adminMessages") as? [MessageEntity] ?? [MessageEntity]() - } - var sensorMessageList: [MessageEntity] { self.value(forKey: "detectionSensorMessages") as? [MessageEntity] ?? [MessageEntity]() } diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index bda553a3..87e33b4a 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -396,7 +396,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } let messageDescription = "🛎️ Requested Device Metadata for node \(toUser.longName ?? "unknown".localized) by \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return Int64(meshPacket.id) } return 0 @@ -500,7 +500,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) { - Logger.services.error("didUpdateNotificationStateFor error: \(error?.localizedDescription ?? "Unknown")") + if let error { + Logger.services.error("💥 BLE didUpdateNotificationStateFor error: \(characteristic.uuid, privacy: .public) \(error.localizedDescription, privacy: .public)") + } else { + Logger.services.info("ℹ️ peripheral didUpdateNotificationStateFor \(characteristic.uuid, privacy: .public)") + } } // MARK: Data Read / Update Characteristic Event @@ -1141,7 +1145,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate return false } let messageDescription = "🚀 Sent Set Fixed Postion Admin Message to: \(fromUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: fromUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1166,7 +1170,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate return false } let messageDescription = "🚀 Sent Remove Fixed Position Admin Message to: \(fromUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: fromUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1236,7 +1240,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate return false } let messageDescription = "🚀 Sent Shutdown Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1261,7 +1265,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate return false } let messageDescription = "🚀 Sent Reboot Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1286,7 +1290,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate return false } let messageDescription = "🚀 Sent Reboot OTA Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1312,7 +1316,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } automaticallyReconnect = false let messageDescription = "🚀 Sent enter DFU mode Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1337,7 +1341,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } let messageDescription = "🚀 Sent Factory Reset Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1361,7 +1365,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🚀 Sent NodeDB Reset Admin Message to: \(toUser.longName ?? "unknown".localized) from: \(fromUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -1404,7 +1408,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🎛️ Requested Channel \(channel.index) for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return Int64(meshPacket.id) } return 0 @@ -1428,7 +1432,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Channel \(channel.index) for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return Int64(meshPacket.id) } return 0 @@ -1574,7 +1578,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate return 0 } let messageDescription = "🛟 Saved User Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return Int64(meshPacket.id) } return 0 @@ -1695,7 +1699,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate dataMessage.portnum = PortNum.adminApp meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Ham Parameters for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return Int64(meshPacket.id) } return 0 @@ -1719,7 +1723,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Bluetooth Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertBluetoothConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1747,7 +1751,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate dataMessage.portnum = PortNum.adminApp meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Device Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertDeviceConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1774,7 +1778,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate dataMessage.portnum = PortNum.adminApp meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Display Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertDisplayConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1801,7 +1805,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved LoRa Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertLoRaConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1832,7 +1836,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved Position Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertPositionConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1863,7 +1867,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved Power Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertPowerConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1894,7 +1898,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved Network Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertNetworkConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1924,7 +1928,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved Ambient Lighting Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertAmbientLightingModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1954,7 +1958,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved Canned Message Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertCannedMessagesModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -1985,7 +1989,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved Canned Message Module Messages for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return Int64(meshPacket.id) } @@ -2015,7 +2019,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Detection Sensor Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertDetectionSensorModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2044,7 +2048,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved External Notification Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertExternalNotificationModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2073,7 +2077,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved PAX Counter Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertPaxCounterModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2103,7 +2107,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved RTTTL Ringtone Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertRtttlConfigPacket(ringtone: ringtone, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2134,7 +2138,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved MQTT Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertMqttModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2163,7 +2167,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛟 Saved Range Test Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertRangeTestModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2193,7 +2197,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Serial Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertSerialModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2222,7 +2226,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛟 Saved Store & Forward Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertStoreForwardModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2251,7 +2255,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "Saved Telemetry Module Config for \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { upsertTelemetryModuleConfigPacket(config: config, nodeNum: toUser.num, context: context!) return Int64(meshPacket.id) } @@ -2282,7 +2286,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛎️ Sent a Get Channel \(channelIndex) Request Admin Message for node: \(toUser.longName ?? "unknown".localized))" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } @@ -2356,7 +2360,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛎️ Requested Bluetooth Config on admin channel \(adminIndex) for node: \(String(connectedPeripheral.num))" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2387,7 +2391,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛎️ Requested Device Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2418,7 +2422,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛎️ Requested Display Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2449,7 +2453,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛎️ Requested LoRa Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } @@ -2481,7 +2485,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let messageDescription = "🛎️ Requested Network Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2511,7 +2515,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Position Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2541,7 +2545,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Power Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2571,7 +2575,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Ambient Lighting Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2601,7 +2605,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Canned Messages Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2631,7 +2635,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested External Notificaiton Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2661,7 +2665,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested PAX Counter Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2691,7 +2695,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested RTTTL Ringtone Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2721,7 +2725,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Range Test Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2751,7 +2755,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested MQTT Module Config on admin channel \(adminIndex) for node: \(String(connectedPeripheral.num))" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2781,7 +2785,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Detection Sensor Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2811,7 +2815,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Serial Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2841,7 +2845,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Store and Forward Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false @@ -2871,14 +2875,14 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate meshPacket.decoded = dataMessage let messageDescription = "🛎️ Requested Telemetry Module Config on admin channel \(adminIndex) for node: \(toUser.longName ?? "unknown".localized)" - if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription, fromUser: fromUser, toUser: toUser) { + if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return true } return false } // Send an admin message to a radio, save a message to core data for logging - private func sendAdminMessageToRadio(meshPacket: MeshPacket, adminDescription: String, fromUser: UserEntity, toUser: UserEntity) -> Bool { + private func sendAdminMessageToRadio(meshPacket: MeshPacket, adminDescription: String) -> Bool { var toRadio: ToRadio! toRadio = ToRadio() @@ -2888,25 +2892,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } if connectedPeripheral?.peripheral.state ?? CBPeripheralState.disconnected == CBPeripheralState.connected { - let newMessage = MessageEntity(context: context!) - newMessage.messageId = Int64(meshPacket.id) - newMessage.messageTimestamp = Int32(Date().timeIntervalSince1970) - newMessage.receivedACK = false - newMessage.admin = true - newMessage.adminDescription = adminDescription - newMessage.fromUser = fromUser - newMessage.toUser = toUser - - do { - connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse) - try context!.save() - Logger.mesh.debug("\(adminDescription)") - return true - } catch { - context!.rollback() - let nsError = error as NSError - Logger.data.error("Error inserting new core data MessageEntity: \(nsError)") - } + connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse) + Logger.mesh.debug("\(adminDescription)") + return true } return false } diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index c78ab2d2..3479a538 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -134,7 +134,7 @@ public func clearCoreDataDatabase(context: NSManagedObjectContext, includeRoutes func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext) { - let logString = String.localizedStringWithFormat("mesh.log.nodeinfo.received %@".localized, String(packet.from)) + let logString = String.localizedStringWithFormat("mesh.log.nodeinfo.received %@".localized, packet.from.toHex()) MeshLogger.log("📟 \(logString)") guard packet.from > 0 else { return } diff --git a/Meshtastic/Views/Settings/MeshLog.swift b/Meshtastic/Views/Settings/MeshLog.swift index 10575098..beb5153a 100644 --- a/Meshtastic/Views/Settings/MeshLog.swift +++ b/Meshtastic/Views/Settings/MeshLog.swift @@ -41,6 +41,7 @@ struct MeshLog: View { // Stop adding logs when an error is thrown } } + .listStyle(.plain) .fileExporter( isPresented: $isExporting, document: document, From 12e090059d1b81f2f9737313c15b163e15162647 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 13:00:20 -0700 Subject: [PATCH 07/29] Backup database functionality --- Meshtastic.xcodeproj/project.pbxproj | 6 +- Meshtastic/Extensions/Url.swift | 20 +++ Meshtastic/Helpers/BLEManager.swift | 21 +++ Meshtastic/Persistence/Persistence.swift | 128 ++++++++++++++++ Meshtastic/Views/Bluetooth/Connect.swift | 93 ++++++------ Meshtastic/Views/Settings/AppData.swift | 157 ++++++++++++++++++++ Meshtastic/Views/Settings/AppSettings.swift | 20 +++ Meshtastic/Views/Settings/Settings.swift | 15 ++ 8 files changed, 415 insertions(+), 45 deletions(-) create mode 100644 Meshtastic/Views/Settings/AppData.swift diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index c70dcb98..371531fe 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -170,6 +170,7 @@ DDD5BB0B2C285E45007E03CA /* LogDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB0A2C285E45007E03CA /* LogDetail.swift */; }; DDD5BB0D2C285F00007E03CA /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB0C2C285F00007E03CA /* Logger.swift */; }; DDD5BB102C285FB3007E03CA /* AppLogFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB0F2C285FB3007E03CA /* AppLogFilter.swift */; }; + DDD5BB162C28B1E4007E03CA /* AppData.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD5BB152C28B1E4007E03CA /* AppData.swift */; }; DDD6EEAF29BC024700383354 /* Firmware.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD6EEAE29BC024700383354 /* Firmware.swift */; }; DDD94A502845C8F5004A87A0 /* DateTimeText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */; }; DDD9E4E4284B208E003777C5 /* UserEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD9E4E3284B208E003777C5 /* UserEntityExtension.swift */; }; @@ -448,6 +449,7 @@ DDD5BB0C2C285F00007E03CA /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; DDD5BB0F2C285FB3007E03CA /* AppLogFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLogFilter.swift; sourceTree = ""; }; DDD5BB142C28680D007E03CA /* MeshtasticDataModelV 38.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 38.xcdatamodel"; sourceTree = ""; }; + DDD5BB152C28B1E4007E03CA /* AppData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppData.swift; sourceTree = ""; }; DDD6EEAE29BC024700383354 /* Firmware.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Firmware.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 = ""; }; @@ -614,6 +616,8 @@ DDD5BB0E2C285F92007E03CA /* Logs */, DD93800C2BA74CE3008BEC06 /* Channels */, DD97E96728EFE9A00056DDA4 /* About.swift */, + DDD5BB152C28B1E4007E03CA /* AppData.swift */, + DDD5BB082C285DDC007E03CA /* AppLog.swift */, DD4A911D2708C65400501B7E /* AppSettings.swift */, DDAB580C2B0DAA9E00147258 /* Routes.swift */, DDE9659B2B1C3B6A00531070 /* RouteRecorder.swift */, @@ -627,7 +631,6 @@ DDCE4E2B2869F92900BE9F8F /* UserConfig.swift */, DD61937A2863876A00E59241 /* Config */, DD1B8F3F2B35E2F10022AABC /* GPSStatus.swift */, - DDD5BB082C285DDC007E03CA /* AppLog.swift */, ); path = Settings; sourceTree = ""; @@ -1318,6 +1321,7 @@ DD23A50F26FD1B4400D9B90C /* PeripheralModel.swift in Sources */, DDB6ABDB28B0AC6000384BA1 /* DistanceText.swift in Sources */, DD5E520D298EE33B00D21B61 /* storeforward.pb.swift in Sources */, + DDD5BB162C28B1E4007E03CA /* AppData.swift in Sources */, DD94B7402ACCE3BE00DCD1D1 /* MapSettingsForm.swift in Sources */, DD964FC2297272AE007C176F /* WaypointEntityExtension.swift in Sources */, 6DA39D8E2A92DC52007E311C /* MeshtasticAppDelegate.swift in Sources */, diff --git a/Meshtastic/Extensions/Url.swift b/Meshtastic/Extensions/Url.swift index 6d594dd9..b890e498 100644 --- a/Meshtastic/Extensions/Url.swift +++ b/Meshtastic/Extensions/Url.swift @@ -30,4 +30,24 @@ extension URL { return nil } } + var attributes: [FileAttributeKey: Any]? { + do { + return try FileManager.default.attributesOfItem(atPath: path) + } catch let error as NSError { + print("FileAttribute error: \(error)") + } + return nil + } + + var fileSize: UInt64 { + return attributes?[.size] as? UInt64 ?? UInt64(0) + } + + var fileSizeString: String { + return ByteCountFormatter.string(fromByteCount: Int64(fileSize), countStyle: .file) + } + + var creationDate: Date? { + return attributes?[.creationDate] as? Date + } } diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 87e33b4a..79bba86c 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -637,6 +637,27 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate connectedPeripheral.num = myInfo?.myNodeNum ?? 0 connectedPeripheral.name = myInfo?.bleName ?? "unknown".localized connectedPeripheral.longName = myInfo?.bleName ?? "unknown".localized + let newConnection = Int64(UserDefaults.preferredPeripheralNum) != Int64(decodedInfo.myInfo.myNodeNum) + if newConnection { + let container = NSPersistentContainer(name: "Meshtastic") + if let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first { + let databasePath = url.appendingPathComponent("backup") + .appendingPathComponent("\(UserDefaults.preferredPeripheralNum)") + .appendingPathComponent("Meshtastic.sqlite") + if FileManager.default.fileExists(atPath: databasePath.path) { + do { + disconnectPeripheral(reconnect: false) + try container.restorePersistentStore(from: databasePath) + UserDefaults.preferredPeripheralNum = Int(myInfo?.myNodeNum ?? 0) + context!.reset() + connectTo(peripheral: peripheral) + Logger.data.notice("🗂️ Restored Core data for /\(UserDefaults.preferredPeripheralNum)") + } catch { + Logger.data.error("Copy error: \(error)") + } + } + } + } } tryClearExistingChannels() } diff --git a/Meshtastic/Persistence/Persistence.swift b/Meshtastic/Persistence/Persistence.swift index 0da6a264..92a2e381 100644 --- a/Meshtastic/Persistence/Persistence.swift +++ b/Meshtastic/Persistence/Persistence.swift @@ -89,3 +89,131 @@ extension NSManagedObjectContext { NSManagedObjectContext.mergeChanges(fromRemoteContextSave: changes, into: [self]) } } + + +// Created by Tom Harrington on 5/12/20. +// Copyright © 2020 Atomic Bird LLC. All rights reserved. +// Gist from https://atomicbird.com/blog/core-data-back-up-store/ +// +extension NSPersistentContainer { + + enum CopyPersistentStoreErrors: Error { + case invalidDestination(String) + case destinationError(String) + case destinationNotRemoved(String) + case copyStoreError(String) + case invalidSource(String) + } + + /// Restore a persistent store for a URL `backupURL`. + /// + /// **Be very careful with this**. To restore a persistent store, the current persistent store must be removed from the container. When that happens, **all currently loaded Core Data objects** will become invalid. Using them after restoring will cause your app to crash. When calling this method you **must** ensure that you do not continue to use any previously fetched managed objects or existing fetched results controllers. **If this method does not throw, that does not mean your app is safe.** You need to take extra steps to prevent crashes. The details vary depending on the nature of your app. + /// - Parameter backupURL: A file URL containing backup copies of all currently loaded persistent stores. + /// - Throws: `CopyPersistentStoreError` in various situations. + /// - Returns: Nothing. If no errors are thrown, the restore is complete. + func restorePersistentStore(from backupURL: URL) throws -> Void { + guard backupURL.isFileURL else { + throw CopyPersistentStoreErrors.invalidSource("Backup URL must be a file URL") + } + + for persistentStoreDescription in persistentStoreDescriptions { + guard let loadedStoreURL = persistentStoreDescription.url else { + continue + } + guard FileManager.default.fileExists(atPath: backupURL.path) else { + throw CopyPersistentStoreErrors.invalidSource("Missing backup store for \(backupURL)") + } + do { + let storeOptions = persistentStoreDescription.options + let configurationName = persistentStoreDescription.configuration + let storeType = persistentStoreDescription.type + + // Replace the current store with the backup copy. This has a side effect of removing the current store from the Core Data stack. + // When restoring, it's necessary to use the current persistent store coordinator. + try persistentStoreCoordinator.replacePersistentStore(at: loadedStoreURL, destinationOptions: storeOptions, withPersistentStoreFrom: backupURL, sourceOptions: storeOptions, ofType: storeType) + // Add the persistent store at the same location we've been using, because it was removed in the previous step. + try persistentStoreCoordinator.addPersistentStore(ofType: storeType, configurationName: configurationName, at: loadedStoreURL, options: storeOptions) + } catch { + throw CopyPersistentStoreErrors.copyStoreError("Could not restore: \(error.localizedDescription)") + } + } + } + + /// Copy all loaded persistent stores to a new directory. Each currently loaded file-based persistent store will be copied (including journal files, external binary storage, and anything else Core Data needs) into the destination directory to a persistent store with the same name and type as the existing store. In-memory stores, if any, are skipped. + /// - Parameters: + /// - destinationURL: Destination for new persistent store files. Must be a file URL. If `overwriting` is `false` and `destinationURL` exists, it must be a directory. + /// - overwriting: If `true`, any existing copies of the persistent store will be replaced or updated. If `false`, existing copies will not be changed or remoted. When this is `false`, the destination persistent store file must not already exist. + /// - Throws: `CopyPersistentStoreError` + /// - Returns: Nothing. If no errors are thrown, all loaded persistent stores will be copied to the destination directory. + func copyPersistentStores(to destinationURL: URL, overwriting: Bool = false) throws -> Void { + print(destinationURL) + guard !destinationURL.relativeString.contains("/0/") else { + throw CopyPersistentStoreErrors.invalidDestination("Invalid 0 Node Id") + } + + guard destinationURL.isFileURL else { + throw CopyPersistentStoreErrors.invalidDestination("Destination URL must be a file URL") + } + + // If the destination exists and we aren't overwriting it, then it must be a directory. (If we are overwriting, we'll remove it anyway, so it doesn't matter whether it's a directory). + var isDirectory: ObjCBool = false + if !overwriting && FileManager.default.fileExists(atPath: destinationURL.path, isDirectory: &isDirectory) { + if !isDirectory.boolValue { + throw CopyPersistentStoreErrors.invalidDestination("Destination URL must be a directory") + } + // Don't check if destination stores exist in the destination dir, that comes later on a per-store basis. + } + // If we're overwriting, remove the destination. + if overwriting && FileManager.default.fileExists(atPath: destinationURL.path) { + do { + try FileManager.default.removeItem(at: destinationURL) + } catch { + throw CopyPersistentStoreErrors.destinationNotRemoved("Can't overwrite destination at \(destinationURL)") + } + } + + // Create the destination directory + do { + try FileManager.default.createDirectory(at: destinationURL, withIntermediateDirectories: true, attributes: nil) + } catch { + throw CopyPersistentStoreErrors.destinationError("Could not create destination directory at \(destinationURL)") + } + + for persistentStoreDescription in persistentStoreDescriptions { + guard let storeURL = persistentStoreDescription.url else { + continue + } + guard persistentStoreDescription.type != NSInMemoryStoreType else { + continue + } + let temporaryPSC = NSPersistentStoreCoordinator(managedObjectModel: persistentStoreCoordinator.managedObjectModel) + let destinationStoreURL = destinationURL.appendingPathComponent(storeURL.lastPathComponent) + if !overwriting && FileManager.default.fileExists(atPath: destinationStoreURL.path) { + // If the destination exists, the migratePersistentStore call will update it in place. That's fine unless we're not overwriting. + throw CopyPersistentStoreErrors.destinationError("Destination already exists at \(destinationStoreURL)") + } + do { + let newStore = try temporaryPSC.addPersistentStore(ofType: persistentStoreDescription.type, configurationName: persistentStoreDescription.configuration, at: persistentStoreDescription.url, options: persistentStoreDescription.options) + let _ = try temporaryPSC.migratePersistentStore(newStore, to: destinationStoreURL, options: persistentStoreDescription.options, withType: persistentStoreDescription.type) + + /// Cleanup extra files + let directory = destinationStoreURL.deletingLastPathComponent() + /// Delete -wal file + do { + try FileManager.default.removeItem(at: directory.appendingPathComponent("Meshtastic.sqlite-wal")) + /// Delete -shm file + do { + try FileManager.default.removeItem(at: directory.appendingPathComponent("Meshtastic.sqlite-shm")) + } catch { + print(error) + } + } catch { + print(error) + } + + } catch { + throw CopyPersistentStoreErrors.copyStoreError("\(error.localizedDescription)") + } + } + } +} diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 63537d86..a7d8ca71 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -26,7 +26,6 @@ struct Connect: View { @State var isUnsetRegion = false @State var invalidFirmwareVersion = false @State var liveActivityStarted = false - @State var presentingSwitchPreferredPeripheral = false @State var selectedPeripherialId = "" init () { @@ -49,7 +48,7 @@ struct Connect: View { List { if bleManager.isSwitchedOn { Section(header: Text("connected.radio").font(.title)) { - if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == .connected { + if let connectedPeripheral = bleManager.connectedPeripheral, connectedPeripheral.peripheral.state == .connected { if #available(iOS 17.0, macOS 14.0, *) { TipView(BluetoothConnectionTip(), arrowEdge: .bottom) } @@ -60,9 +59,9 @@ struct Connect: View { .padding(.trailing) VStack(alignment: .leading) { if node != nil { - Text(bleManager.connectedPeripheral.longName).font(.title2) + Text(connectedPeripheral.longName).font(.title2) } - Text("ble.name").font(.callout)+Text(": \(bleManager.connectedPeripheral.peripheral.name ?? "unknown".localized)") + Text("ble.name").font(.callout)+Text(": \(bleManager.connectedPeripheral?.peripheral.name ?? "unknown".localized)") .font(.callout).foregroundColor(Color.gray) if node != nil { Text("firmware.version").font(.callout)+Text(": \(node?.metadata?.firmwareVersion ?? "unknown".localized)") @@ -91,7 +90,8 @@ struct Connect: View { .padding([.top, .bottom]) .swipeActions { Button(role: .destructive) { - if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected { + if let connectedPeripheral = bleManager.connectedPeripheral, + connectedPeripheral.peripheral.state == .connected { bleManager.disconnectPeripheral(reconnect: false) } } label: { @@ -121,7 +121,8 @@ struct Connect: View { Text("Num: \(String(node!.num))") Text("Short Name: \(node?.user?.shortName ?? "?")") Text("Long Name: \(node?.user?.longName ?? "unknown".localized)") - Text("BLE RSSI: \(bleManager.connectedPeripheral.rssi)") + Text("BLE RSSI: \(connectedPeripheral.rssi)") + Button { if !bleManager.sendShutdown(fromUser: node!.user!, toUser: node!.user!, adminIndex: node!.myInfo!.adminIndex) { Logger.mesh.error("Shutdown Failed") @@ -210,8 +211,27 @@ struct Connect: View { } Button(action: { if UserDefaults.preferredPeripheralId.count > 0 && peripheral.peripheral.identifier.uuidString != UserDefaults.preferredPeripheralId { - presentingSwitchPreferredPeripheral = true - selectedPeripherialId = peripheral.peripheral.identifier.uuidString + if let connectedPeripheral = bleManager.connectedPeripheral, connectedPeripheral.peripheral.state == CBPeripheralState.connected { + bleManager.disconnectPeripheral() + } + //clearCoreDataDatabase(context: context, includeRoutes: false) + let container = NSPersistentContainer(name : "Meshtastic") + guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { + Logger.data.error("nil File path for back") + return + } + do { + try container.copyPersistentStores(to: url.appendingPathComponent("backup").appendingPathComponent("\(UserDefaults.preferredPeripheralNum)"), overwriting: true) + + Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") + } catch { + print("Copy error: \(error)") + } + UserDefaults.preferredPeripheralId = selectedPeripherialId + let radio = bleManager.peripherals.first(where: { $0.peripheral.identifier.uuidString == selectedPeripherialId }) + if radio != nil { + bleManager.connectTo(peripheral: radio!.peripheral) + } } else { self.bleManager.connectTo(peripheral: peripheral.peripheral) } @@ -225,23 +245,6 @@ struct Connect: View { }.padding([.bottom, .top]) } } - .confirmationDialog("Connecting to a new radio will clear all local app data on the phone.", isPresented: $presentingSwitchPreferredPeripheral, titleVisibility: .visible) { - - Button("Connect to new radio?", role: .destructive) { - UserDefaults.preferredPeripheralId = selectedPeripherialId - UserDefaults.preferredPeripheralNum = 0 - if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected { - bleManager.disconnectPeripheral() - } - clearCoreDataDatabase(context: context, includeRoutes: false) - - let radio = bleManager.peripherals.first(where: { $0.peripheral.identifier.uuidString == selectedPeripherialId }) - if radio != nil { - bleManager.connectTo(peripheral: radio!.peripheral) - } - } - } - .textCase(nil) } } else { @@ -254,9 +257,9 @@ struct Connect: View { HStack(alignment: .center) { Spacer() #if targetEnvironment(macCatalyst) - if bleManager.connectedPeripheral != nil { + if let connectedPeripheral = bleManager.connectedPeripheral { Button(role: .destructive, action: { - if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected { + if connectedPeripheral.peripheral.state == CBPeripheralState.connected { bleManager.disconnectPeripheral(reconnect: false) } }) { @@ -285,10 +288,18 @@ struct Connect: View { .padding(.bottom, 10) } .navigationTitle("bluetooth") - .navigationBarItems(leading: MeshtasticLogo(), trailing: - ZStack { - ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?", mqttProxyConnected: bleManager.mqttProxyConnected, mqttTopic: bleManager.mqttManager.topic) - }) + .navigationBarItems( + leading: MeshtasticLogo(), + trailing: ZStack { + ConnectedDevice( + bluetoothOn: bleManager.isSwitchedOn, + deviceConnected: bleManager.connectedPeripheral != nil, + name: bleManager.connectedPeripheral?.shortName ?? "?", + mqttProxyConnected: bleManager.mqttProxyConnected, + mqttTopic: bleManager.mqttManager.topic + ) + } + ) } .sheet(isPresented: $invalidFirmwareVersion, onDismiss: didDismissSheet) { InvalidVersion(minimumVersion: self.bleManager.minimumVersion, version: self.bleManager.connectedVersion) @@ -302,24 +313,18 @@ struct Connect: View { if UserDefaults.preferredPeripheralId.count > 0 && sub { - let fetchNodeInfoRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") + let fetchNodeInfoRequest = NodeInfoEntity.fetchRequest() fetchNodeInfoRequest.predicate = NSPredicate(format: "num == %lld", Int64(bleManager.connectedPeripheral?.num ?? -1)) do { - guard let fetchedNode = try context.fetch(fetchNodeInfoRequest) as? [NodeInfoEntity] else { - return - } - // Found a node, check it for a region - if !fetchedNode.isEmpty { - node = fetchedNode[0] - if node!.loRaConfig != nil && node!.loRaConfig?.regionCode ?? 0 == RegionCodes.unset.rawValue { - isUnsetRegion = true - } else { - isUnsetRegion = false - } + node = try context.fetch(fetchNodeInfoRequest).first + if let loRaConfig = node?.loRaConfig, loRaConfig.regionCode == RegionCodes.unset.rawValue { + isUnsetRegion = true + } else { + isUnsetRegion = false } } catch { - + Logger.data.error("💥 Error fetching node info: \(error.localizedDescription)") } } } diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift new file mode 100644 index 00000000..631cccf4 --- /dev/null +++ b/Meshtastic/Views/Settings/AppData.swift @@ -0,0 +1,157 @@ +// +// BackupData.swift +// Meshtastic +// +// Copyright(c) Garth Vander Houwen 6/8/24. +// + +import SwiftUI +import OSLog +import CoreData +import Foundation + +struct AppData: View { + + @Environment(\.managedObjectContext) var context + @EnvironmentObject var bleManager: BLEManager + @State private var files = [URL]() + private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } + + var body: some View { + + + VStack { + Button(action: { + let container = NSPersistentContainer(name : "Meshtastic") + guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { + Logger.data.error("nil File path for back") + return + } + do { + try container.copyPersistentStores(to: url.appendingPathComponent("backup").appendingPathComponent("\(UserDefaults.preferredPeripheralNum)"), overwriting: true) + loadFiles() + Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") + } catch { + print("Copy error: \(error)") + } + + }) { + Label { + Text("Backup Database") + .font(idiom == .phone ? .callout : .title) + } icon: { + Image(systemName: "cylinder.split.1x2") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .callout : .title) + .frame(width: 35) + } + } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) + + } + List(files, id: \.self) { file in + HStack { + VStack (alignment: .leading ) { + if file.pathExtension.contains("sqlite") { //} == "sqlite" { + Label { + Text("Node Core Data Backup \(file.pathComponents[9])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") + .swipeActions { + Button(role: .none) { + bleManager.disconnectPeripheral(reconnect: false) + let container = NSPersistentContainer(name : "Meshtastic") + do { + context.reset() + try container.restorePersistentStore(from: file.absoluteURL) + UserDefaults.preferredPeripheralId = "" + UserDefaults.preferredPeripheralNum = Int(file.pathComponents[10]) ?? 0 + Logger.data.notice("🗂️ Restored a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") + } catch { + print("Copy error: \(error)") + } + } label: { + Label("restore", systemImage: "arrow.counterclockwise") + } + Button(role: .destructive) { + do { + try FileManager.default.removeItem(at: file) + } catch { + print(error) + } + } label: { + Label("delete", systemImage: "trash") + } + } + } icon: { + Image(systemName: "cylinder.split.1x2") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .callout : .title) + .frame(width: 35) + } + } + else { + Label { + Text("\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") + .swipeActions { + Button(role: .destructive) { + do { + try FileManager.default.removeItem(at: file) + } catch { + print(error) + } + } label: { + Label("delete", systemImage: "trash") + } + } + + } icon: { + Image(systemName: "doc.text") + .symbolRenderingMode(.hierarchical) + .font(idiom == .phone ? .callout : .title) + .frame(width: 35) + } + } + } +#if targetEnvironment(macCatalyst) + Spacer() + VStack (alignment: .trailing) { + Button() { + do { + try FileManager.default.removeItem(at: file) + loadFiles() + } catch { + print(error) + } + } label: { + Label("", systemImage: "trash") + } + } +#endif + } + } + .navigationBarTitle("File Storage", displayMode: .inline) + .onAppear(perform: { + loadFiles() + }) + .listStyle(.inset) + } + + private func loadFiles() { + files = [] + guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { + Logger.data.error("🗂️ nil default document directory path for backup, core data backup failed.") + return + } + if let enumerator = FileManager.default.enumerator(at: url, includingPropertiesForKeys: [.isRegularFileKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]) { + for case let fileURL as URL in enumerator { + do { + let fileAttributes = try fileURL.resourceValues(forKeys:[.isRegularFileKey]) + if fileAttributes.isRegularFile! { + files.append(fileURL) + } + } catch { print(error, fileURL) } + } + } + } +} diff --git a/Meshtastic/Views/Settings/AppSettings.swift b/Meshtastic/Views/Settings/AppSettings.swift index 7eb03933..528843af 100644 --- a/Meshtastic/Views/Settings/AppSettings.swift +++ b/Meshtastic/Views/Settings/AppSettings.swift @@ -76,6 +76,26 @@ struct AppSettings: View { ) { Button("Erase all app data?", role: .destructive) { bleManager.disconnectPeripheral() + /// Delete any database backups too + if var url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first { + url = url.appendingPathComponent("backup").appendingPathComponent(String(UserDefaults.preferredPeripheralNum)) + do { + try FileManager.default.removeItem(at: url.appendingPathComponent("Meshtastic.sqlite")) + /// Delete -shm file + do { + try FileManager.default.removeItem(at: url.appendingPathComponent("Meshtastic.sqlite-wal")) + do { + try FileManager.default.removeItem(at: url.appendingPathComponent("Meshtastic.sqlite-shm")) + } catch { + Logger.services.error("Error Deleting Meshtastic.sqlite-shm file \(error)") + } + } catch { + Logger.services.error("Error Deleting Meshtastic.sqlite-wal file \(error)") + } + } catch { + Logger.services.error("Error Deleting Meshtastic.sqlite file \(error)") + } + } clearCoreDataDatabase(context: context, includeRoutes: true) context.refreshAllObjects() UserDefaults.standard.reset() diff --git a/Meshtastic/Views/Settings/Settings.swift b/Meshtastic/Views/Settings/Settings.swift index 2817e8b6..394bc941 100644 --- a/Meshtastic/Views/Settings/Settings.swift +++ b/Meshtastic/Views/Settings/Settings.swift @@ -49,6 +49,7 @@ struct Settings: View { case adminMessageLog case about case appLog + case appData } var body: some View { NavigationSplitView { @@ -426,6 +427,20 @@ struct Settings: View { .tag(SettingsSidebar.appLog) } } +#if DEBUG + Section(header: Text("Developers")) { + NavigationLink { + AppData() + } label: { + Label { + Text("App Files") + } icon: { + Image(systemName: "folder") + } + } + .tag(SettingsSidebar.appData) + } +#endif Section(header: Text("Firmware")) { NavigationLink { Firmware(node: nodes.first(where: { $0.num == preferredNodeNum })) From f132589e9c038ac817524136edf3aed5c5ed685b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 13:08:15 -0700 Subject: [PATCH 08/29] Log updates --- Meshtastic/Helpers/BLEManager.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 79bba86c..cf37fd3a 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -301,21 +301,21 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate switch characteristic.uuid { case TORADIO_UUID: - Logger.services.info("✅ BLE did discover TORADIO characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") + Logger.services.info("✅ [BLE] did discover TORADIO characteristic for Meshtastic by \(peripheral.name ?? "Unknown", privacy: .public)") TORADIO_characteristic = characteristic case FROMRADIO_UUID: - Logger.services.info("✅ BLE did discover FROMRADIO characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") + Logger.services.info("✅ [BLE] did discover FROMRADIO characteristic for Meshtastic by \(peripheral.name ?? "Unknown", privacy: .public)") FROMRADIO_characteristic = characteristic peripheral.readValue(for: FROMRADIO_characteristic) case FROMNUM_UUID: - Logger.services.info("✅ BLE did discover FROMNUM (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") + Logger.services.info("✅ [BLE] did discover FROMNUM (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown", privacy: .public)") FROMNUM_characteristic = characteristic peripheral.setNotifyValue(true, for: characteristic) - + case LOGRADIO_UUID: - Logger.services.info("✅ BLE did discover LOGRADIO (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") + Logger.services.info("✅ [BLE] did discover LOGRADIO (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown", privacy: .public)") LOGRADIO_characteristic = characteristic peripheral.setNotifyValue(true, for: characteristic) @@ -335,7 +335,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate func onMqttConnected() { mqttProxyConnected = true mqttError = "" - Logger.services.info("📲 Mqtt Client Proxy onMqttConnected now subscribing to \(self.mqttManager.topic).") + Logger.services.info("📲 [MQTT Client Proxy] onMqttConnected now subscribing to \(self.mqttManager.topic, privacy: .public).") mqttManager.mqttClientProxy?.subscribe(mqttManager.topic) } @@ -368,7 +368,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate func onMqttError(message: String) { mqttProxyConnected = false mqttError = message - Logger.services.info("📲 Mqtt Client Proxy onMqttError: \(message)") + Logger.services.info("📲 [MQTT Client Proxy] onMqttError: \(message, privacy: .public)") } // MARK: Protobuf Methods @@ -395,7 +395,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate return 0 } - let messageDescription = "🛎️ Requested Device Metadata for node \(toUser.longName ?? "unknown".localized) by \(fromUser.longName ?? "unknown".localized)" + let messageDescription = "🛎️ [Device Metadata] Requested for node \(toUser.longName ?? "unknown".localized) by \(fromUser.longName ?? "unknown".localized)" if sendAdminMessageToRadio(meshPacket: meshPacket, adminDescription: messageDescription) { return Int64(meshPacket.id) } From 921c648a6bff79c0f3b1674b8436cf1bef1f9edf Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 14:30:55 -0700 Subject: [PATCH 09/29] Update log privacy --- .../Helpers/Mqtt/MqttClientProxyManager.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift index 66f94366..277735a5 100644 --- a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift +++ b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift @@ -81,16 +81,16 @@ class MqttClientProxyManager { } } func subscribe(topic: String, qos: CocoaMQTTQoS) { - Logger.mqtt.info("📲 [MQTT Client Proxy] subscribed to: \(topic)") + Logger.mqtt.info("📲 [MQTT Client Proxy] subscribed to: \(topic, privacy: .public)") mqttClientProxy?.subscribe(topic, qos: qos) } func unsubscribe(topic: String) { mqttClientProxy?.unsubscribe(topic) - Logger.mqtt.info("📲 [MQTT Client Proxy] unsubscribe to topic: \(topic)") + Logger.mqtt.info("📲 [MQTT Client Proxy] unsubscribe to topic: \(topic, privacy: .public)") } func publish(message: String, topic: String, qos: CocoaMQTTQoS) { mqttClientProxy?.publish(topic, withString: message, qos: qos) - Logger.mqtt.debug("📲 [MQTT Client Proxy] publish for: \(topic)") + Logger.mqtt.debug("📲 [MQTT Client Proxy] publish for: \(topic, privacy: .public)") } func disconnect() { if let client = mqttClientProxy { @@ -137,21 +137,21 @@ extension MqttClientProxyManager: CocoaMQTTDelegate { delegate?.onMqttDisconnected() } func mqtt(_ mqtt: CocoaMQTT, didPublishMessage message: CocoaMQTTMessage, id: UInt16) { - Logger.mqtt.info("📲 [MQTT Client Proxy] published messsage from MqttClientProxyManager: \(message)") + Logger.mqtt.info("📲 [MQTT Client Proxy] published messsage from MqttClientProxyManager: \(message, privacy: .public)") } func mqtt(_ mqtt: CocoaMQTT, didPublishAck id: UInt16) { - Logger.mqtt.info("📲 [MQTT Client Proxy] published Ack from MqttClientProxyManager: \(id)") + Logger.mqtt.info("📲 [MQTT Client Proxy] published Ack from MqttClientProxyManager: \(id, privacy: .public)") } public func mqtt(_ mqtt: CocoaMQTT, didReceiveMessage message: CocoaMQTTMessage, id: UInt16) { delegate?.onMqttMessageReceived(message: message) - Logger.mqtt.info("📲 [MQTT Client Proxy] message received on topic: \(message.topic)") + Logger.mqtt.info("📲 [MQTT Client Proxy] message received on topic: \(message.topic, privacy: .public)") } func mqtt(_ mqtt: CocoaMQTT, didSubscribeTopics success: NSDictionary, failed: [String]) { - Logger.mqtt.debug("📲 [MQTT Client Proxy] subscribed to topics: \(success.allKeys.count) topics. failed: \(failed.count) topics") + Logger.mqtt.debug("📲 [MQTT Client Proxy] subscribed to topics: \(success.allKeys.count, privacy: .public) topics. failed: \(failed.count, privacy: .public) topics") } func mqtt(_ mqtt: CocoaMQTT, didUnsubscribeTopics topics: [String]) { - Logger.mqtt.debug("📲 [MQTT Client Proxy] unsubscribed from topics: \(topics.joined(separator: "- "))") + Logger.mqtt.debug("📲 [MQTT Client Proxy] unsubscribed from topics: \(topics.joined(separator: "- "), privacy: .public)") } func mqttDidPing(_ mqtt: CocoaMQTT) { Logger.mqtt.debug("📲 [MQTT Client Proxy] ping") From d6f5c77b1ab6841b6639168f395b9d6f233ba64d Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 14:40:28 -0700 Subject: [PATCH 10/29] position config --- .../Settings/Config/PositionConfig.swift | 766 +++++++++--------- 1 file changed, 382 insertions(+), 384 deletions(-) diff --git a/Meshtastic/Views/Settings/Config/PositionConfig.swift b/Meshtastic/Views/Settings/Config/PositionConfig.swift index 1f51b801..b723935b 100644 --- a/Meshtastic/Views/Settings/Config/PositionConfig.swift +++ b/Meshtastic/Views/Settings/Config/PositionConfig.swift @@ -10,7 +10,6 @@ import OSLog struct PositionFlags: OptionSet { let rawValue: Int - static let Altitude = PositionFlags(rawValue: 1) static let AltitudeMsl = PositionFlags(rawValue: 2) static let GeoidalSeparation = PositionFlags(rawValue: 4) @@ -28,12 +27,9 @@ struct PositionConfig: View { @Environment(\.managedObjectContext) var context @EnvironmentObject var bleManager: BLEManager @Environment(\.dismiss) private var goBack - var node: NodeInfoEntity? - @State var hasChanges = false @State var hasFlagChanges = false - @State var smartPositionEnabled = true @State var deviceGpsEnabled = true @State var gpsMode = 0 @@ -72,301 +68,313 @@ struct PositionConfig: View { /// Intended for use with vehicle not walking speeds /// walking speeds are likely to be error prone like the compass @State var includeHeading = false - /// Minimum Version for fixed postion admin messages @State var minimumVersion = "2.3.3" @State private var supportedVersion = true @State private var showingSetFixedAlert = false // @State private var showingRemoveFixedAlert = false + @ViewBuilder + var positionPacketSection: some View { + Section(header: Text("Position Packet")) { + + VStack(alignment: .leading) { + Picker("Broadcast Interval", selection: $positionBroadcastSeconds) { + ForEach(UpdateIntervals.allCases) { at in + if at.rawValue >= 300 { + Text(at.description) + } + } + } + .pickerStyle(DefaultPickerStyle()) + Text("The maximum interval that can elapse without a node broadcasting a position") + .foregroundColor(.gray) + .font(.callout) + } + + Toggle(isOn: $smartPositionEnabled) { + Label("Smart Position", systemImage: "brain") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + + if smartPositionEnabled { + VStack(alignment: .leading) { + Picker("Minimum Interval", selection: $broadcastSmartMinimumIntervalSecs) { + ForEach(UpdateIntervals.allCases) { at in + Text(at.description) + } + } + .pickerStyle(DefaultPickerStyle()) + Text("The fastest that position updates will be sent if the minimum distance has been satisfied") + .foregroundColor(.gray) + .font(.callout) + } + VStack(alignment: .leading) { + Picker("Minimum Distance", selection: $broadcastSmartMinimumDistance) { + ForEach(10..<151) { + if $0 == 0 { + Text("unset") + } else { + if $0.isMultiple(of: 5) { + Text("\($0)") + .tag($0) + } + } + } + } + .pickerStyle(DefaultPickerStyle()) + Text("The minimum distance change in meters to be considered for a smart position broadcast.") + .foregroundColor(.gray) + .font(.callout) + } + } + } + } + + @ViewBuilder + var deviceGPSSection: some View { + Section(header: Text("Device GPS")) { + Picker("", selection: $gpsMode) { + ForEach(GpsMode.allCases, id: \.self) { at in + Text(at.description) + .tag(at.id) + + } + } + .pickerStyle(SegmentedPickerStyle()) + .padding(.top, 5) + .padding(.bottom, 5) + .disabled(fixedPosition && !(gpsMode == 1)) + if gpsMode == 1 { + Text("Positions will be provided by your device GPS, if you select disabled or not present you can set a fixed position.") + .foregroundColor(.gray) + .font(.callout) + VStack(alignment: .leading) { + Picker("Update Interval", selection: $gpsUpdateInterval) { + ForEach(GpsUpdateIntervals.allCases) { ui in + Text(ui.description) + } + } + Text("How often should we try to get a GPS position.") + .foregroundColor(.gray) + .font(.callout) + } + } + if (gpsMode != 1 && node?.num ?? 0 == bleManager.connectedPeripheral?.num ?? -1) || fixedPosition { + VStack(alignment: .leading) { + Toggle(isOn: $fixedPosition) { + Label("Fixed Position", systemImage: "location.square.fill") + if !(node?.positionConfig?.fixedPosition ?? false) { + Text("Your current location will be set as the fixed position and broadcast over the mesh on the position interval.") + } else { + + } + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + } + } + } + } + + @ViewBuilder + var positionFlagsSection: some View { + Section(header: Text("Position Flags")) { + + Text("Optional fields to include when assembling position messages. the more fields are included, the larger the message will be - leading to longer airtime and a higher risk of packet loss") + .foregroundColor(.gray) + .font(.callout) + + Toggle(isOn: $includeAltitude) { + Label("Altitude", systemImage: "arrow.up") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + + Toggle(isOn: $includeSatsinview) { + Label("Number of satellites", systemImage: "skew") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + + Toggle(isOn: $includeSeqNo) { // 64 + Label("Sequence number", systemImage: "number") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + + Toggle(isOn: $includeTimestamp) { // 128 + Label("timestamp", systemImage: "clock") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + + Toggle(isOn: $includeHeading) { // 128 + Label("Vehicle heading", systemImage: "location.circle") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + + Toggle(isOn: $includeSpeed) { // 128 + + Label("Vehicle speed", systemImage: "speedometer") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + } + } + + @ViewBuilder + var advancedPositionFlagsSection: some View { + Section(header: Text("Advanced Position Flags")) { + + if includeAltitude { + Toggle(isOn: $includeAltitudeMsl) { + Label("Altitude is Mean Sea Level", systemImage: "arrow.up.to.line.compact") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + Toggle(isOn: $includeGeoidalSeparation) { + Label("Altitude Geoidal Separation", systemImage: "globe.americas") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + } + + Toggle(isOn: $includeDop) { + Text("Dilution of precision (DOP) PDOP used by default") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + + if includeDop { + Toggle(isOn: $includeHvdop) { + Text("If DOP is set, use HDOP / VDOP values instead of PDOP") + } + .toggleStyle(SwitchToggleStyle(tint: .accentColor)) + } + } + } + + @ViewBuilder + var advancedDeviceGPSSection: some View { + Section(header: Text("Advanced Device GPS")) { + Picker("GPS Receive GPIO", selection: $rxGpio) { + ForEach(0..<49) { + if $0 == 0 { + Text("unset") + } else { + Text("Pin \($0)") + } + } + } + .pickerStyle(DefaultPickerStyle()) + Picker("GPS Transmit GPIO", selection: $txGpio) { + ForEach(0..<49) { + if $0 == 0 { + Text("unset") + } else { + Text("Pin \($0)") + } + } + } + .pickerStyle(DefaultPickerStyle()) + Picker("GPS EN GPIO", selection: $gpsEnGpio) { + ForEach(0..<49) { + if $0 == 0 { + Text("unset") + } else { + Text("Pin \($0)") + } + } + } + .pickerStyle(DefaultPickerStyle()) + Text("(Re)define PIN_GPS_EN for your board.") + .font(.caption) + } + } + + var saveButton: some View { + SaveConfigButton(node: node, hasChanges: $hasChanges) { + if fixedPosition && !supportedVersion { + _ = bleManager.sendPosition(channel: 0, destNum: node?.num ?? 0, wantResponse: true) + } + let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral!.num, context: context) + + if connectedNode != nil { + var pc = Config.PositionConfig() + pc.positionBroadcastSmartEnabled = smartPositionEnabled + pc.gpsEnabled = gpsMode == 1 + pc.gpsMode = Config.PositionConfig.GpsMode(rawValue: gpsMode) ?? Config.PositionConfig.GpsMode.notPresent + pc.fixedPosition = fixedPosition + pc.gpsUpdateInterval = UInt32(gpsUpdateInterval) + pc.positionBroadcastSecs = UInt32(positionBroadcastSeconds) + pc.broadcastSmartMinimumIntervalSecs = UInt32(broadcastSmartMinimumIntervalSecs) + pc.broadcastSmartMinimumDistance = UInt32(broadcastSmartMinimumDistance) + pc.rxGpio = UInt32(rxGpio) + pc.txGpio = UInt32(txGpio) + pc.gpsEnGpio = UInt32(gpsEnGpio) + var pf: PositionFlags = [] + if includeAltitude { pf.insert(.Altitude) } + if includeAltitudeMsl { pf.insert(.AltitudeMsl) } + if includeGeoidalSeparation { pf.insert(.GeoidalSeparation) } + if includeDop { pf.insert(.Dop) } + if includeHvdop { pf.insert(.Hvdop) } + if includeSatsinview { pf.insert(.Satsinview) } + if includeSeqNo { pf.insert(.SeqNo) } + if includeTimestamp { pf.insert(.Timestamp) } + if includeSpeed { pf.insert(.Speed) } + if includeHeading { pf.insert(.Heading) } + pc.positionFlags = UInt32(pf.rawValue) + let adminMessageId = bleManager.savePositionConfig(config: pc, fromUser: connectedNode!.user!, toUser: node!.user!, adminIndex: connectedNode?.myInfo?.adminIndex ?? 0) + if adminMessageId > 0 { + // Disable the button after a successful save + hasChanges = false + goBack() + } + } + } + } + + var setFixedAlertTitle: String { + if node?.positionConfig?.fixedPosition == true { + return "Remove Fixed Position" + } else { + return "Set Fixed Position" + } + } + var body: some View { VStack { Form { ConfigHeader(title: "Position", config: \.positionConfig, node: node, onAppear: setPositionValues) - - Section(header: Text("Position Packet")) { - - VStack(alignment: .leading) { - Picker("Broadcast Interval", selection: $positionBroadcastSeconds) { - ForEach(UpdateIntervals.allCases) { at in - if at.rawValue >= 300 { - Text(at.description) - } - } - } - .pickerStyle(DefaultPickerStyle()) - Text("The maximum interval that can elapse without a node broadcasting a position") - .foregroundColor(.gray) - .font(.callout) - } - - Toggle(isOn: $smartPositionEnabled) { - Label("Smart Position", systemImage: "brain") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - if smartPositionEnabled { - VStack(alignment: .leading) { - Picker("Minimum Interval", selection: $broadcastSmartMinimumIntervalSecs) { - ForEach(UpdateIntervals.allCases) { at in - Text(at.description) - } - } - .pickerStyle(DefaultPickerStyle()) - Text("The fastest that position updates will be sent if the minimum distance has been satisfied") - .foregroundColor(.gray) - .font(.callout) - } - VStack(alignment: .leading) { - Picker("Minimum Distance", selection: $broadcastSmartMinimumDistance) { - ForEach(10..<151) { - if $0 == 0 { - Text("unset") - } else { - if $0.isMultiple(of: 5) { - Text("\($0)") - .tag($0) - } - } - } - } - .pickerStyle(DefaultPickerStyle()) - Text("The minimum distance change in meters to be considered for a smart position broadcast.") - .foregroundColor(.gray) - .font(.callout) - } - } - } - Section(header: Text("Device GPS")) { - Picker("", selection: $gpsMode) { - ForEach(GpsMode.allCases, id: \.self) { at in - Text(at.description) - .tag(at.id) - } - } - .pickerStyle(SegmentedPickerStyle()) - .padding(.top, 5) - .padding(.bottom, 5) - if gpsMode == 1 { - - Text("Positions will be provided by your device GPS, if you select disabled or not present you can set a fixed position.") - .foregroundColor(.gray) - .font(.callout) - VStack(alignment: .leading) { - Picker("Update Interval", selection: $gpsUpdateInterval) { - ForEach(GpsUpdateIntervals.allCases) { ui in - Text(ui.description) - } - } - Text("How often should we try to get a GPS position.") - .foregroundColor(.gray) - .font(.callout) - } - } - if gpsMode != 1 && node?.num ?? 0 == bleManager.connectedPeripheral?.num ?? -1 { - VStack(alignment: .leading) { - Toggle(isOn: $fixedPosition) { - Label("Fixed Position", systemImage: "location.square.fill") - if !(node?.positionConfig?.fixedPosition ?? false) { - Text("Your current location will be set as the fixed position and broadcast over the mesh on the position interval.") - } else { - - } - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - } - } - } - Section(header: Text("Position Flags")) { - - Text("Optional fields to include when assembling position messages. the more fields are included, the larger the message will be - leading to longer airtime and a higher risk of packet loss") - .foregroundColor(.gray) - .font(.callout) - - Toggle(isOn: $includeAltitude) { - Label("Altitude", systemImage: "arrow.up") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - Toggle(isOn: $includeSatsinview) { - Label("Number of satellites", systemImage: "skew") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - Toggle(isOn: $includeSeqNo) { // 64 - Label("Sequence number", systemImage: "number") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - Toggle(isOn: $includeTimestamp) { // 128 - Label("timestamp", systemImage: "clock") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - Toggle(isOn: $includeHeading) { // 128 - Label("Vehicle heading", systemImage: "location.circle") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - Toggle(isOn: $includeSpeed) { // 128 - - Label("Vehicle speed", systemImage: "speedometer") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - } - Section(header: Text("Advanced Position Flags")) { - - if includeAltitude { - Toggle(isOn: $includeAltitudeMsl) { - Label("Altitude is Mean Sea Level", systemImage: "arrow.up.to.line.compact") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - Toggle(isOn: $includeGeoidalSeparation) { - Label("Altitude Geoidal Separation", systemImage: "globe.americas") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - } - - Toggle(isOn: $includeDop) { - Text("Dilution of precision (DOP) PDOP used by default") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - - if includeDop { - Toggle(isOn: $includeHvdop) { - Text("If DOP is set use, HDOP / VDOP values instead of PDOP") - } - .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - } - } - + positionPacketSection + deviceGPSSection + positionFlagsSection + advancedPositionFlagsSection if gpsMode == 1 { - Section(header: Text("Advanced Device GPS")) { - Picker("GPS Receive GPIO", selection: $rxGpio) { - ForEach(0..<49) { - if $0 == 0 { - Text("unset") - } else { - Text("Pin \($0)") - } - } - } - .pickerStyle(DefaultPickerStyle()) - Picker("GPS Transmit GPIO", selection: $txGpio) { - ForEach(0..<49) { - if $0 == 0 { - Text("unset") - } else { - Text("Pin \($0)") - } - } - } - .pickerStyle(DefaultPickerStyle()) - Picker("GPS EN GPIO", selection: $gpsEnGpio) { - ForEach(0..<49) { - if $0 == 0 { - Text("unset") - } else { - Text("Pin \($0)") - } - } - } - .pickerStyle(DefaultPickerStyle()) - Text("(Re)define PIN_GPS_EN for your board.") - .font(.caption) - } + advancedDeviceGPSSection } } .disabled(self.bleManager.connectedPeripheral == nil || node?.positionConfig == nil) - .alert(node?.positionConfig?.fixedPosition ?? false ? "Remove Fixed Position" : "Set Fixed Position", isPresented: $showingSetFixedAlert) { + .alert(setFixedAlertTitle, isPresented: $showingSetFixedAlert) { Button("Cancel", role: .cancel) { fixedPosition = !fixedPosition } if node?.positionConfig?.fixedPosition ?? false { Button("Remove", role: .destructive) { - if !bleManager.removeFixedPosition(fromUser: node!.user!, channel: 0) { - Logger.mesh.error("Remove Fixed Position Failed") - } - let mutablePositions = node?.positions?.mutableCopy() as? NSMutableOrderedSet - mutablePositions?.removeAllObjects() - node?.positions = mutablePositions - node?.positionConfig?.fixedPosition = false - do { - try context.save() - Logger.data.info("💾 Updated Position Config with Fixed Position = false") - } catch { - context.rollback() - let nsError = error as NSError - Logger.data.error("Error Saving Position Config Entity \(nsError)") - } + removeFixedPosition() } } else { Button("Set") { - if !bleManager.setFixedPosition(fromUser: node!.user!, channel: 0) { - Logger.mesh.error("Set Position Failed") - } - node?.positionConfig?.fixedPosition = true - do { - try context.save() - Logger.data.info("💾 Updated Position Config with Fixed Position = true") - } catch { - context.rollback() - let nsError = error as NSError - Logger.data.error("Error Saving Position Config Entity \(nsError)") - } + setFixedPosition() } } } message: { Text(node?.positionConfig?.fixedPosition ?? false ? "This will disable fixed position and remove the currently set position." : "This will send a current position from your phone and enable fixed position.") } - - SaveConfigButton(node: node, hasChanges: $hasChanges) { - if fixedPosition && !supportedVersion { - _ = bleManager.sendPosition(channel: 0, destNum: node?.num ?? 0, wantResponse: true) - } - let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context) - - if connectedNode != nil { - var pc = Config.PositionConfig() - pc.positionBroadcastSmartEnabled = smartPositionEnabled - pc.gpsEnabled = gpsMode == 1 - pc.gpsMode = Config.PositionConfig.GpsMode(rawValue: gpsMode) ?? Config.PositionConfig.GpsMode.notPresent - pc.fixedPosition = fixedPosition - pc.gpsUpdateInterval = UInt32(gpsUpdateInterval) - pc.positionBroadcastSecs = UInt32(positionBroadcastSeconds) - pc.broadcastSmartMinimumIntervalSecs = UInt32(broadcastSmartMinimumIntervalSecs) - pc.broadcastSmartMinimumDistance = UInt32(broadcastSmartMinimumDistance) - pc.rxGpio = UInt32(rxGpio) - pc.txGpio = UInt32(txGpio) - pc.gpsEnGpio = UInt32(gpsEnGpio) - var pf: PositionFlags = [] - if includeAltitude { pf.insert(.Altitude) } - if includeAltitudeMsl { pf.insert(.AltitudeMsl) } - if includeGeoidalSeparation { pf.insert(.GeoidalSeparation) } - if includeDop { pf.insert(.Dop) } - if includeHvdop { pf.insert(.Hvdop) } - if includeSatsinview { pf.insert(.Satsinview) } - if includeSeqNo { pf.insert(.SeqNo) } - if includeTimestamp { pf.insert(.Timestamp) } - if includeSpeed { pf.insert(.Speed) } - if includeHeading { pf.insert(.Heading) } - pc.positionFlags = UInt32(pf.rawValue) - let adminMessageId = bleManager.savePositionConfig(config: pc, fromUser: connectedNode!.user!, toUser: node!.user!, adminIndex: connectedNode?.myInfo?.adminIndex ?? 0) - if adminMessageId > 0 { - // Disable the button after a successful save - hasChanges = false - goBack() - } - } - } + saveButton } .navigationTitle("position.config") - .navigationBarItems(trailing: - - ZStack { - - ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "?") - }) + .navigationBarItems( + trailing: ZStack { + ConnectedDevice( + bluetoothOn: bleManager.isSwitchedOn, + deviceConnected: bleManager.connectedPeripheral != nil, + name: bleManager.connectedPeripheral?.shortName ?? "?" + ) + } + ) .onAppear { if self.bleManager.context == nil { self.bleManager.context = context @@ -374,133 +382,88 @@ struct PositionConfig: View { setPositionValues() supportedVersion = bleManager.connectedVersion == "0.0.0" || self.minimumVersion.compare(bleManager.connectedVersion, options: .numeric) == .orderedAscending || minimumVersion.compare(bleManager.connectedVersion, options: .numeric) == .orderedSame // Need to request a PositionConfig from the remote node before allowing changes - if bleManager.connectedPeripheral != nil && node?.positionConfig == nil { + if let connectedPeripheral = bleManager.connectedPeripheral, node?.positionConfig == nil { Logger.mesh.info("empty position config") - let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context) - if node != nil && connectedNode != nil { - _ = bleManager.requestPositionConfig(fromUser: connectedNode!.user!, toUser: node!.user!, adminIndex: connectedNode?.myInfo?.adminIndex ?? 0) + let connectedNode = getNodeInfo(id: connectedPeripheral.num, context: context) + if let node, let connectedNode { + _ = bleManager.requestPositionConfig( + fromUser: connectedNode.user!, + toUser: node.user!, + adminIndex: connectedNode.myInfo?.adminIndex ?? 0 + ) } } } .onChange(of: fixedPosition) { newFixed in if supportedVersion { - if node != nil && node!.positionConfig != nil { + if let positionConfig = node?.positionConfig { /// Fixed Position is off to start - if !node!.positionConfig!.fixedPosition && newFixed { + if !positionConfig.fixedPosition && newFixed { showingSetFixedAlert = true - } else if node!.positionConfig!.fixedPosition && !newFixed { + } else if positionConfig.fixedPosition && !newFixed { /// Fixed Position is on to start showingSetFixedAlert = true } } } } - .onChange(of: deviceGpsEnabled) { newDeviceGps in - if node != nil && node!.positionConfig != nil { - if newDeviceGps != node!.positionConfig!.deviceGpsEnabled { hasChanges = true } - } + .onChange(of: gpsMode) { _ in + handleChanges() } - .onChange(of: gpsMode) { newGpsMode in - if node != nil && node!.positionConfig != nil { - if newGpsMode != node!.positionConfig!.gpsMode { hasChanges = true } - } + .onChange(of: rxGpio) { _ in + handleChanges() } - .onChange(of: rxGpio) { newRxGpio in - if node != nil && node!.positionConfig != nil { - if newRxGpio != node!.positionConfig!.rxGpio { hasChanges = true } - } + .onChange(of: txGpio) { _ in + handleChanges() } - .onChange(of: txGpio) { newTxGpio in - if node != nil && node!.positionConfig != nil { - if newTxGpio != node!.positionConfig!.txGpio { hasChanges = true } - } + .onChange(of: gpsEnGpio) { _ in + handleChanges() } - .onChange(of: txGpio) { newGpsEnGpio in - if node != nil && node!.positionConfig != nil { - if newGpsEnGpio != node!.positionConfig!.gpsEnGpio { hasChanges = true } - } + .onChange(of: smartPositionEnabled) { _ in + handleChanges() } - .onChange(of: smartPositionEnabled) { newSmartPositionEnabled in - if node != nil && node!.positionConfig != nil { - if newSmartPositionEnabled != node!.positionConfig!.smartPositionEnabled { hasChanges = true } - } + .onChange(of: positionBroadcastSeconds) { _ in + handleChanges() } - .onChange(of: positionBroadcastSeconds) { newPositionBroadcastSeconds in - if node != nil && node!.positionConfig != nil { - if newPositionBroadcastSeconds != node!.positionConfig!.positionBroadcastSeconds { hasChanges = true } - } + .onChange(of: broadcastSmartMinimumIntervalSecs) { _ in + handleChanges() } - .onChange(of: broadcastSmartMinimumIntervalSecs) { newBroadcastSmartMinimumIntervalSecs in - if node != nil && node!.positionConfig != nil { - if newBroadcastSmartMinimumIntervalSecs != node!.positionConfig!.broadcastSmartMinimumIntervalSecs { hasChanges = true } - } + .onChange(of: broadcastSmartMinimumDistance) { _ in + handleChanges() } - .onChange(of: broadcastSmartMinimumDistance) { newBroadcastSmartMinimumDistance in - if node != nil && node!.positionConfig != nil { - if newBroadcastSmartMinimumDistance != node!.positionConfig!.broadcastSmartMinimumDistance { hasChanges = true } - } + .onChange(of: gpsUpdateInterval) { _ in + handleChanges() } - .onChange(of: gpsUpdateInterval) { newGpsUpdateInterval in - if node != nil && node!.positionConfig != nil { - if newGpsUpdateInterval != node!.positionConfig!.gpsUpdateInterval { hasChanges = true } - } - } - .onChange(of: includeAltitude) { altFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Altitude) - if existingValue != altFlag { hasChanges = true } - } - .onChange(of: includeAltitudeMsl) { altMslFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.AltitudeMsl) - if existingValue != altMslFlag { hasChanges = true } - } - .onChange(of: includeSatsinview) { satsFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Satsinview) - if existingValue != satsFlag { hasChanges = true } - } - .onChange(of: includeSeqNo) { seqFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.SeqNo) - if existingValue != seqFlag { hasChanges = true } - } - .onChange(of: includeTimestamp) { timestampFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Timestamp) - if existingValue != timestampFlag { hasChanges = true } - } - .onChange(of: includeTimestamp) { timestampFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Timestamp) - if existingValue != timestampFlag { hasChanges = true } - } - .onChange(of: includeSpeed) { speedFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Speed) - if existingValue != speedFlag { hasChanges = true } - } - .onChange(of: includeHeading) { headingFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Heading) - if existingValue != headingFlag { hasChanges = true } - } - .onChange(of: includeGeoidalSeparation) { geoSepFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.GeoidalSeparation) - if existingValue != geoSepFlag { hasChanges = true } - } - .onChange(of: includeDop) { dopFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Dop) - if existingValue != dopFlag { hasChanges = true } - } - .onChange(of: includeHvdop) { hvdopFlag in - let pf = PositionFlags(rawValue: self.positionFlags) - let existingValue = pf.contains(.Hvdop) - if existingValue != hvdopFlag { hasChanges = true } + .onChange(of: positionFlags) { _ in + handleChanges() } } + + func handleChanges() { + guard let positionConfig = node?.positionConfig else { return } + let pf = PositionFlags(rawValue: self.positionFlags) + hasChanges = positionConfig.deviceGpsEnabled != deviceGpsEnabled || + positionConfig.gpsMode != gpsMode || + positionConfig.rxGpio != rxGpio || + positionConfig.txGpio != txGpio || + positionConfig.gpsEnGpio != gpsEnGpio || + positionConfig.smartPositionEnabled != smartPositionEnabled || + positionConfig.positionBroadcastSeconds != positionBroadcastSeconds || + positionConfig.broadcastSmartMinimumIntervalSecs != broadcastSmartMinimumIntervalSecs || + positionConfig.broadcastSmartMinimumDistance != broadcastSmartMinimumDistance || + positionConfig.gpsUpdateInterval != gpsUpdateInterval || + pf.contains(.Altitude) || + pf.contains(.AltitudeMsl) || + pf.contains(.Satsinview) || + pf.contains(.SeqNo) || + pf.contains(.Timestamp) || + pf.contains(.Speed) || + pf.contains(.Heading) || + pf.contains(.GeoidalSeparation) || + pf.contains(.Dop) || + pf.contains(.Hvdop) + } + func setPositionValues() { self.smartPositionEnabled = node?.positionConfig?.smartPositionEnabled ?? true self.deviceGpsEnabled = node?.positionConfig?.deviceGpsEnabled ?? false @@ -517,19 +480,54 @@ struct PositionConfig: View { self.broadcastSmartMinimumIntervalSecs = Int(node?.positionConfig?.broadcastSmartMinimumIntervalSecs ?? 30) self.broadcastSmartMinimumDistance = Int(node?.positionConfig?.broadcastSmartMinimumDistance ?? 50) self.positionFlags = Int(node?.positionConfig?.positionFlags ?? 3) - let pf = PositionFlags(rawValue: self.positionFlags) - if pf.contains(.Altitude) { self.includeAltitude = true } else { self.includeAltitude = false } - if pf.contains(.AltitudeMsl) { self.includeAltitudeMsl = true } else { self.includeAltitudeMsl = false } - if pf.contains(.GeoidalSeparation) { self.includeGeoidalSeparation = true } else { self.includeGeoidalSeparation = false } - if pf.contains(.Dop) { self.includeDop = true } else { self.includeDop = false } - if pf.contains(.Hvdop) { self.includeHvdop = true } else { self.includeHvdop = false } - if pf.contains(.Satsinview) { self.includeSatsinview = true } else { self.includeSatsinview = false } - if pf.contains(.SeqNo) { self.includeSeqNo = true } else { self.includeSeqNo = false } - if pf.contains(.Timestamp) { self.includeTimestamp = true } else { self.includeTimestamp = false } - if pf.contains(.Speed) { self.includeSpeed = true } else { self.includeSpeed = false } - if pf.contains(.Heading) { self.includeHeading = true } else { self.includeHeading = false } - + self.includeAltitude = pf.contains(.Altitude) + self.includeAltitudeMsl = pf.contains(.AltitudeMsl) + self.includeGeoidalSeparation = pf.contains(.GeoidalSeparation) + self.includeDop = pf.contains(.Dop) + self.includeHvdop = pf.contains(.Hvdop) + self.includeSatsinview = pf.contains(.Satsinview) + self.includeSeqNo = pf.contains(.SeqNo) + self.includeTimestamp = pf.contains(.Timestamp) + self.includeSpeed = pf.contains(.Speed) + self.includeHeading = pf.contains(.Heading) self.hasChanges = false } + + private func setFixedPosition() { + guard let nodeNum = bleManager.connectedPeripheral?.num, + nodeNum > 0 else { return } + if !bleManager.setFixedPosition(fromUser: node!.user!, channel: 0) { + Logger.mesh.error("Set Position Failed") + } + node?.positionConfig?.fixedPosition = true + do { + try context.save() + Logger.data.info("💾 Updated Position Config with Fixed Position = true") + } catch { + context.rollback() + let nsError = error as NSError + Logger.data.error("Error Saving Position Config Entity \(nsError)") + } + } + + private func removeFixedPosition() { + guard let nodeNum = bleManager.connectedPeripheral?.num, + nodeNum > 0 else { return } + if !bleManager.removeFixedPosition(fromUser: node!.user!, channel: 0) { + Logger.mesh.error("Remove Fixed Position Failed") + } + let mutablePositions = node?.positions?.mutableCopy() as? NSMutableOrderedSet + mutablePositions?.removeAllObjects() + node?.positions = mutablePositions + node?.positionConfig?.fixedPosition = false + do { + try context.save() + Logger.data.info("💾 Updated Position Config with Fixed Position = false") + } catch { + context.rollback() + let nsError = error as NSError + Logger.data.error("Error Saving Position Config Entity \(nsError)") + } + } } From fc97247b8ce6acfadfa1a2325e6cded84fcfdd62 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 16:11:02 -0700 Subject: [PATCH 11/29] Logging and linting --- Meshtastic/Extensions/FileManager.swift | 4 +- Meshtastic/Extensions/Logger.swift | 15 +- Meshtastic/Extensions/Url.swift | 3 +- Meshtastic/Helpers/BLEManager.swift | 132 +++++++++--------- .../Helpers/LocalNotificationManager.swift | 2 +- Meshtastic/Helpers/LocationHelper.swift | 2 +- Meshtastic/Helpers/LocationsHandler.swift | 12 +- .../Helpers/Map/OfflineTileManager.swift | 2 +- Meshtastic/Helpers/MeshLogger.swift | 4 +- Meshtastic/Helpers/MeshPackets.swift | 40 +++--- .../Helpers/Mqtt/MqttClientProxyManager.swift | 8 +- Meshtastic/MeshtasticAppDelegate.swift | 2 +- Meshtastic/Persistence/Persistence.swift | 29 ++-- Meshtastic/Views/Bluetooth/Connect.swift | 9 +- Meshtastic/Views/Settings/AppData.swift | 41 +++--- Meshtastic/Views/Settings/AppLog.swift | 7 +- Meshtastic/Views/Settings/AppSettings.swift | 6 +- .../Settings/Config/BluetoothConfig.swift | 1 - .../Views/Settings/Logs/AppLogFilter.swift | 16 +-- .../Views/Settings/Logs/LogDetail.swift | 4 - 20 files changed, 158 insertions(+), 181 deletions(-) diff --git a/Meshtastic/Extensions/FileManager.swift b/Meshtastic/Extensions/FileManager.swift index 5323b71b..36706563 100644 --- a/Meshtastic/Extensions/FileManager.swift +++ b/Meshtastic/Extensions/FileManager.swift @@ -53,12 +53,12 @@ public extension FileManager { do { accumulatedSize += try contentItemURL.regularFileAllocatedSize() } catch { - Logger.services.error("💥 File Manager Error: \(error.localizedDescription)") + Logger.services.error("💥 File Manager Error: \(error.localizedDescription, privacy: .public)") } } if let error = enumeratorError { - Logger.services.error("💥 AllocatedSizeOfDirectory enumeratorError = \(error.localizedDescription)") + Logger.services.error("💥 AllocatedSizeOfDirectory enumeratorError = \(error.localizedDescription, privacy: .public)") } return Double(accumulatedSize).toBytes diff --git a/Meshtastic/Extensions/Logger.swift b/Meshtastic/Extensions/Logger.swift index fbc68ea7..10637343 100644 --- a/Meshtastic/Extensions/Logger.swift +++ b/Meshtastic/Extensions/Logger.swift @@ -11,7 +11,7 @@ extension Logger { /// The logger's subsystem. private static var subsystem = Bundle.main.bundleIdentifier! - + /// All admin messages static let admin = Logger(subsystem: subsystem, category: "🏛 Admin") @@ -20,28 +20,27 @@ extension Logger { /// All logs related to the mesh static let mesh = Logger(subsystem: subsystem, category: "🕸️ Mesh") - + /// All logs related to MQTT static let mqtt = Logger(subsystem: subsystem, category: "📱 MQTT") - + /// All detailed logs originating from the device (radio). static let radio = Logger(subsystem: subsystem, category: "📟 Radio") - + /// All logs related to services such as network calls, location, etc. static let services = Logger(subsystem: subsystem, category: "🍏 Services") /// All logs related to tracking and analytics. static let statistics = Logger(subsystem: subsystem, category: "📊 Stats") - /// Fetch from the logstore static public func fetch(predicateFormat: String) async throws -> [OSLogEntryLog] { let store = try OSLogStore(scope: .currentProcessIdentifier) let position = store.position(timeIntervalSinceLatestBoot: 0) - //let calendar = Calendar.current - //let dayAgo = calendar.date(byAdding: .day, value: -1, to: Date.now) - //let position = store.position(date: dayAgo!) + // let calendar = Calendar.current + // let dayAgo = calendar.date(byAdding: .day, value: -1, to: Date.now) + // let position = store.position(date: dayAgo!) let predicate = NSPredicate(format: predicateFormat) let entries = try store.getEntries(at: position, matching: predicate) diff --git a/Meshtastic/Extensions/Url.swift b/Meshtastic/Extensions/Url.swift index b890e498..150bab42 100644 --- a/Meshtastic/Extensions/Url.swift +++ b/Meshtastic/Extensions/Url.swift @@ -6,6 +6,7 @@ // import Foundation +import OSLog extension URL { @@ -34,7 +35,7 @@ extension URL { do { return try FileManager.default.attributesOfItem(atPath: path) } catch let error as NSError { - print("FileAttribute error: \(error)") + Logger.services.error("FileAttribute error: \(error, privacy: . public)") } return nil } diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index cf37fd3a..7a4544e8 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -65,7 +65,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate func startScanning() { if isSwitchedOn { centralManager.scanForPeripherals(withServices: [meshtasticServiceCBUUID], options: [CBCentralManagerScanOptionAllowDuplicatesKey: false]) - Logger.services.info("✅ Scanning Started") + Logger.services.info("✅ [BLE] Scanning Started") } } @@ -73,7 +73,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate func stopScanning() { if centralManager.isScanning { centralManager.stopScan() - Logger.services.info("🛑 Stopped Scanning") + Logger.services.info("🛑 [BLE] Stopped Scanning") } } @@ -106,7 +106,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate self.timeoutTimerCount = 0 self.startScanning() } else { - Logger.services.info("🚨 BLE Connecting 2 Second Timeout Timer Fired \(self.timeoutTimerCount) Time(s): \(name)") + Logger.services.info("🚨 [BLE] Connecting 2 Second Timeout Timer Fired \(self.timeoutTimerCount, privacy: .public) Time(s): \(name, privacy: .public)") } } @@ -119,7 +119,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate self.automaticallyReconnect = true } if connectedPeripheral != nil { - Logger.services.info("ℹ️ BLE Disconnecting from: \(self.connectedPeripheral.name) to connect to \(peripheral.name ?? "Unknown")") + Logger.services.info("ℹ️ [BLE] Disconnecting from: \(self.connectedPeripheral.name, privacy: .public) to connect to \(peripheral.name ?? "Unknown", privacy: .public)") disconnectPeripheral() } @@ -133,7 +133,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate let context = ["name": "\(peripheral.name ?? "Unknown")"] timeoutTimer = Timer.scheduledTimer(timeInterval: 1.5, target: self, selector: #selector(timeoutTimerFired), userInfo: context, repeats: true) RunLoop.current.add(timeoutTimer!, forMode: .common) - Logger.services.info("ℹ️ BLE Connecting: \(peripheral.name ?? "Unknown")") + Logger.services.info("ℹ️ BLE Connecting: \(peripheral.name ?? "Unknown", privacy: .public)") } // Disconnect Connected Peripheral @@ -203,13 +203,13 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } // Discover Services peripheral.discoverServices([meshtasticServiceCBUUID]) - Logger.services.info("✅ BLE Connected: \(peripheral.name ?? "Unknown")") + Logger.services.info("✅ [BLE] Connected: \(peripheral.name ?? "Unknown", privacy: .public)") } // Called when a Peripheral fails to connect func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) { cancelPeripheralConnection() - Logger.services.error("🚫 BLE Failed to Connect: \(peripheral.name ?? "Unknown")") + Logger.services.error("🚫 [BLE] Failed to Connect: \(peripheral.name ?? "Unknown", privacy: .public)") } // Disconnect Peripheral Event @@ -225,7 +225,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate if errorCode == 6 { // CBError.Code.connectionTimeout The connection has timed out unexpectedly. // Happens when device is manually reset / powered off lastConnectionError = "🚨" + String.localizedStringWithFormat("ble.errorcode.6 %@".localized, e.localizedDescription) - Logger.services.error("🚨 BLE Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode) Error: \(e.localizedDescription)") + Logger.services.error("🚨 [BLE] Disconnected: \(peripheral.name ?? "Unknown", privacy: .public) Error Code: \(errorCode, privacy: .public) Error: \(e.localizedDescription, privacy: .public)") } else if errorCode == 7 { // CBError.Code.peripheralDisconnected The specified device has disconnected from us. // Seems to be what is received when a tbeam sleeps, immediately recconnecting does not work. if UserDefaults.preferredPeripheralId == peripheral.identifier.uuidString { @@ -242,11 +242,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate manager.schedule() } lastConnectionError = "🚨 \(e.localizedDescription)" - Logger.services.error("🚨 BLE Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode) Error: \(e.localizedDescription)") + Logger.services.error("🚨 [BLE] Disconnected: \(peripheral.name ?? "Unknown", privacy: .public) Error Code: \(errorCode, privacy: .public) Error: \(e.localizedDescription, privacy: .public)") } else if errorCode == 14 { // Peer removed pairing information // Forgetting and reconnecting seems to be necessary so we need to show the user an error telling them to do that lastConnectionError = "🚨 " + String.localizedStringWithFormat("ble.errorcode.14 %@".localized, e.localizedDescription) - Logger.services.error("🚨 BLE Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode) Error: \(self.lastConnectionError)") + Logger.services.error("🚨 [BLE] Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode, privacy: .public) Error: \(self.lastConnectionError, privacy: .public)") } else { if UserDefaults.preferredPeripheralId == peripheral.identifier.uuidString { manager.notifications = [ @@ -262,12 +262,12 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate manager.schedule() } lastConnectionError = "🚨 \(e.localizedDescription)" - Logger.services.error("🚨 BLE Disconnected: \(peripheral.name ?? "Unknown") Error Code: \(errorCode) Error: \(e.localizedDescription)") + Logger.services.error("🚨 [BLE] Disconnected: \(peripheral.name ?? "Unknown", privacy: .public) Error Code: \(errorCode, privacy: .public) Error: \(e.localizedDescription, privacy: .public)") } } else { // Disconnected without error which indicates user intent to disconnect // Happens when swiping to disconnect - Logger.services.info("ℹ️ BLE Disconnected: \(peripheral.name ?? "Unknown"): User Initiated Disconnect") + Logger.services.info("ℹ️ [BLE] Disconnected: \(peripheral.name ?? "Unknown", privacy: .public): User Initiated Disconnect") } // Start a scan so the disconnected peripheral is moved to the peripherals[] if it is awake self.startScanning() @@ -276,12 +276,12 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate // MARK: Peripheral Services functions func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) { if let error { - Logger.services.error("🚫 Discover Services error \(error.localizedDescription)") + Logger.services.error("🚫 [BLE] Discover Services error \(error.localizedDescription, privacy: .public)") } guard let services = peripheral.services else { return } for service in services where service.uuid == meshtasticServiceCBUUID { peripheral.discoverCharacteristics([TORADIO_UUID, FROMRADIO_UUID, FROMNUM_UUID, LOGRADIO_UUID], for: service) - Logger.services.info("✅ BLE Service for Meshtastic discovered by \(peripheral.name ?? "Unknown")") + Logger.services.info("✅ [BLE] Service for Meshtastic discovered by \(peripheral.name ?? "Unknown", privacy: .public)") } } @@ -289,7 +289,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) { if let error { - Logger.services.error("🚫 BLE Discover Characteristics error for \(peripheral.name ?? "Unknown") \(error.localizedDescription) disconnecting device") + Logger.services.error("🚫 [BLE] Discover Characteristics error for \(peripheral.name ?? "Unknown", privacy: .public) \(error.localizedDescription, privacy: .public) disconnecting device") // Try and stop crashes when this error occurs disconnectPeripheral() return @@ -313,7 +313,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.services.info("✅ [BLE] did discover FROMNUM (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown", privacy: .public)") FROMNUM_characteristic = characteristic peripheral.setNotifyValue(true, for: characteristic) - + case LOGRADIO_UUID: Logger.services.info("✅ [BLE] did discover LOGRADIO (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown", privacy: .public)") LOGRADIO_characteristic = characteristic @@ -341,7 +341,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate func onMqttDisconnected() { mqttProxyConnected = false - Logger.services.info("MQTT Disconnected") + Logger.services.info("📲 MQTT Disconnected") } func onMqttMessageReceived(message: CocoaMQTTMessage) { @@ -456,14 +456,14 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } do { try context!.save() - Logger.data.info("💾 Saved TraceRoute sent to node: \(String(receivingNode?.user?.longName ?? "unknown".localized))") + Logger.data.info("💾 Saved TraceRoute sent to node: \(String(receivingNode?.user?.longName ?? "unknown".localized), privacy: .public)") } catch { context!.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data BluetoothConfigEntity: \(nsError)") + Logger.data.error("Error Updating Core Data BluetoothConfigEntity: \(nsError, privacy: .public)") } - let logString = String.localizedStringWithFormat("mesh.log.traceroute.sent %@".localized, String(destNum)) + let logString = String.localizedStringWithFormat("mesh.log.traceroute.sent %@".localized, destNum.toHex()) MeshLogger.log("🪧 \(logString)") } catch { @@ -512,14 +512,14 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate if let error { - Logger.services.error("🚫 didUpdateValueFor Characteristic error \(error.localizedDescription)") + Logger.services.error("🚫 [BLE] didUpdateValueFor Characteristic error \(error.localizedDescription, privacy: .public)") let errorCode = (error as NSError).code if errorCode == 5 || errorCode == 15 { // BLE PIN connection errors // 5 CBATTErrorDomain Code=5 "Authentication is insufficient." // 15 CBATTErrorDomain Code=15 "Encryption is insufficient." lastConnectionError = "🚨" + String.localizedStringWithFormat("ble.errorcode.pin %@".localized, error.localizedDescription) - Logger.services.error("\(error.localizedDescription) Please try connecting again and check the PIN carefully.") + Logger.services.error("\(error.localizedDescription, privacy: .public) Please try connecting again and check the PIN carefully.") self.disconnectPeripheral(reconnect: false) } return @@ -527,7 +527,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate switch characteristic.uuid { case LOGRADIO_UUID: - if (characteristic.value == nil || characteristic.value!.isEmpty) { + if characteristic.value == nil || characteristic.value!.isEmpty { return } let coordsSearch = Regex { @@ -547,32 +547,30 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } .anchorsMatchLineEndings() if var log = String(data: characteristic.value!, encoding: .utf8) { - /// Debug Log Level - if (log.starts(with: "DEBUG |")) { + if log.starts(with: "DEBUG |") { do { let logString = log if let coordsMatch = try coordsSearch.firstMatch(in: logString) { log = "\(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces))" log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.debug("🛰️ \(log.prefix(upTo: coordsMatch.range.lowerBound), privacy: .public) \(coordsMatch.0.replacingOccurrences(of: "[,]", with: "", options: .regularExpression), privacy: .private) \(log.suffix(from: coordsMatch.range.upperBound), privacy: .public)") - }else { + } else { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } - } catch { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } - } else if (log.starts(with: "INFO |")) { + } else if log.starts(with: "INFO |") { do { let logString = log if let coordsMatch = try coordsSearch.firstMatch(in: logString) { log = "\(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces))" log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.info("🛰️ \(log.prefix(upTo: coordsMatch.range.lowerBound), privacy: .public) \(coordsMatch.0.replacingOccurrences(of: "[,]", with: "", options: .regularExpression), privacy: .private) \(log.suffix(from: coordsMatch.range.upperBound), privacy: .public)") - } else { + } else { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } @@ -580,18 +578,18 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.info("✅ \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } - } else if (log.starts(with: "WARN |")) { + } else if log.starts(with: "WARN |") { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.warning("⚠️ \(log.replacingOccurrences(of: "WARN |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") - } else if (log.starts(with: "ERROR |")) { + } else if log.starts(with: "ERROR |") { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.error("💥 \(log.replacingOccurrences(of: "ERROR |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") - } else if (log.starts(with: "CRIT |")) { + } else if log.starts(with: "CRIT |") { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.critical("💥 \(log.replacingOccurrences(of: "CRIT |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } else { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) - Logger.radio.debug("📟 \(log)") + Logger.radio.debug("📟 \(log, privacy: .public)") } } @@ -606,7 +604,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate decodedInfo = try FromRadio(serializedData: characteristic.value!) } catch { - Logger.services.error("\(error.localizedDescription) \(characteristic.value!)") + Logger.services.error("💥 \(error.localizedDescription, privacy: .public) \(characteristic.value!, privacy: .public)") } // Publish mqttClientProxyMessages received on the from radio @@ -651,9 +649,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate UserDefaults.preferredPeripheralNum = Int(myInfo?.myNodeNum ?? 0) context!.reset() connectTo(peripheral: peripheral) - Logger.data.notice("🗂️ Restored Core data for /\(UserDefaults.preferredPeripheralNum)") + Logger.data.notice("🗂️ Restored Core data for /\(UserDefaults.preferredPeripheralNum, privacy: .public)") } catch { - Logger.data.error("Copy error: \(error)") + Logger.data.error("🗂️ Restore Core data copy error: \(error, privacy: .public)") } } } @@ -823,7 +821,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } catch { context!.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data TraceRouteHOp: \(nsError)") + Logger.data.error("Error Updating Core Data TraceRouteHOp: \(nsError, privacy: .public)") } let logString = String.localizedStringWithFormat("mesh.log.traceroute.received.route %@".localized, routeString) MeshLogger.log("🪧 \(logString)") @@ -850,7 +848,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate invalidVersion = false lastConnectionError = "" isSubscribed = true - Logger.mesh.info("🤜 Want Config Complete. ID:\(decodedInfo.configCompleteID)") + Logger.mesh.info("[BLE] 🤜 Want Config Complete. ID:\(decodedInfo.configCompleteID)") peripherals.removeAll(where: { $0.peripheral.state == CBPeripheralState.disconnected }) // Config conplete returns so we don't read the characteristic again @@ -904,9 +902,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } case FROMNUM_UUID: - Logger.services.info("🗞️ BLE (Notify) characteristic, value will be read next") + Logger.services.info("🗞️ [BLE] (Notify) characteristic, value will be read next") default: - Logger.services.error("Unhandled Characteristic UUID: \(characteristic.uuid)") + Logger.services.error("🚫 Unhandled Characteristic UUID: \(characteristic.uuid, privacy: .public)") } if FROMRADIO_characteristic != nil { // Either Read the config complete value or from num notify value @@ -1010,18 +1008,18 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } if connectedPeripheral?.peripheral.state ?? CBPeripheralState.disconnected == CBPeripheralState.connected { connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse) - let logString = String.localizedStringWithFormat("mesh.log.textmessage.sent %@ %@ %@".localized, String(newMessage.messageId), String(fromUserNum), String(toUserNum)) + let logString = String.localizedStringWithFormat("mesh.log.textmessage.sent %@ %@ %@".localized, String(newMessage.messageId), fromUserNum.toHex(), toUserNum.toHex()) MeshLogger.log("💬 \(logString)") do { try context!.save() - Logger.data.info("💾 Saved a new sent message from \(self.connectedPeripheral.num) to \(toUserNum)") + Logger.data.info("💾 Saved a new sent message from \(self.connectedPeripheral.num.toHex(), privacy: .public) to \(toUserNum.toHex(), privacy: .public)") success = true } catch { context!.rollback() let nsError = error as NSError - Logger.data.error("Unresolved Core Data error in Send Message Function your database is corrupted running a node db reset should clean up the data. Error: \(nsError)") + Logger.data.error("Unresolved Core Data error in Send Message Function your database is corrupted running a node db reset should clean up the data. Error: \(nsError, privacy: .public)") } } } @@ -1088,11 +1086,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } do { try context!.save() - Logger.data.info("💾 Updated Waypoint from Waypoint App Packet From: \(fromNodeNum)") + Logger.data.info("💾 Updated Waypoint from Waypoint App Packet From: \(fromNodeNum.toHex(), privacy: .public)") } catch { context!.rollback() let nsError = error as NSError - Logger.data.error("Error Saving NodeInfoEntity from WAYPOINT_APP \(nsError)") + Logger.data.error("Error Saving NodeInfoEntity from WAYPOINT_APP \(nsError, privacy: .public)") } } return success @@ -2950,7 +2948,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } if connectedPeripheral?.peripheral.state ?? CBPeripheralState.disconnected == CBPeripheralState.connected { connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse) - Logger.mesh.debug("📮 Sent a request for a Store & Forward Client History to \(toUser.num) for the last \(120) minutes.") + Logger.mesh.debug("📮 Sent a request for a Store & Forward Client History to \(toUser.num.toHex(), privacy: .public) for the last \(120, privacy: .public) minutes.") return true } return false @@ -2961,9 +2959,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate // Handle each of the store and forward request / response messages switch storeAndForwardMessage.rr { case .unset: - MeshLogger.log("📮 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("📮 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerError: - MeshLogger.log("☠️ Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("☠️ Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerHeartbeat: /// When we get a router heartbeat we know there is a store and forward node on the network /// Check if it is the primary S&F Router and save the timestamp of the last heartbeat so that we can show the request message history menu item on node long press if the router has been seen recently @@ -2991,13 +2989,13 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.data.error("Save Store and Forward Router Error") } } - MeshLogger.log("💓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("💓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerPing: - MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerPong: - MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerBusy: - MeshLogger.log("🐝 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("🐝 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerHistory: /// Set the Router History Last Request Value guard let routerNode = getNodeInfo(id: Int64(packet.from), context: context) else { @@ -3017,28 +3015,28 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate context.rollback() Logger.data.error("Save Store and Forward Router Error") } - MeshLogger.log("📜 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("📜 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerStats: - MeshLogger.log("📊 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("📊 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .clientError: - MeshLogger.log("☠️ Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("☠️ Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .clientHistory: - MeshLogger.log("📜 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("📜 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .clientStats: - MeshLogger.log("📊 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("📊 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .clientPing: - MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .clientPong: - MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("🏓 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .clientAbort: - MeshLogger.log("🛑 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("🛑 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .UNRECOGNIZED: - MeshLogger.log("📮 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("📮 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") case .routerTextDirect: - MeshLogger.log("💬 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("💬 Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") textMessageAppPacket(packet: packet, wantRangeTestPackets: false, connectedNode: connectedNodeNum, storeForward: true, context: context) case .routerTextBroadcast: - MeshLogger.log("✉️ Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from)") + MeshLogger.log("✉️ Store and Forward \(storeAndForwardMessage.rr) message received from \(packet.from.toHex())") textMessageAppPacket(packet: packet, wantRangeTestPackets: false, connectedNode: connectedNodeNum, storeForward: true, context: context) } } @@ -3058,11 +3056,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate do { try context!.save() } catch { - Logger.data.error("Failed to clear existing channels from local app database: \(error.localizedDescription)") + Logger.data.error("Failed to clear existing channels from local app database: \(error.localizedDescription, privacy: .public)") } } } catch { - Logger.data.error("Failed to find a node MyInfo to save these channels to: \(error.localizedDescription)") + Logger.data.error("Failed to find a node MyInfo to save these channels to: \(error.localizedDescription, privacy: .public)") } } } @@ -3098,7 +3096,7 @@ extension BLEManager: CBCentralManagerDelegate { default: status = "default" } - Logger.services.debug("📜 BLEManager status: \(status)") + Logger.services.debug("📜 [BLE] Bluetooth status: \(status)") } // Called each time a peripheral is discovered @@ -3106,7 +3104,7 @@ extension BLEManager: CBCentralManagerDelegate { if self.automaticallyReconnect && peripheral.identifier.uuidString == UserDefaults.standard.object(forKey: "preferredPeripheralId") as? String ?? "" { self.connectTo(peripheral: peripheral) - Logger.services.info("BLE Reconnecting to prefered peripheral: \(peripheral.name ?? "Unknown")") + Logger.services.info("✅ [BLE] Reconnecting to prefered peripheral: \(peripheral.name ?? "Unknown", privacy: .public)") } let name = advertisementData[CBAdvertisementDataLocalNameKey] as? String let device = Peripheral(id: peripheral.identifier.uuidString, num: 0, name: name ?? "Unknown", shortName: "?", longName: name ?? "Unknown", firmwareVersion: "Unknown", rssi: RSSI.intValue, lastUpdate: Date(), peripheral: peripheral) diff --git a/Meshtastic/Helpers/LocalNotificationManager.swift b/Meshtastic/Helpers/LocalNotificationManager.swift index baee82de..d9ff996a 100644 --- a/Meshtastic/Helpers/LocalNotificationManager.swift +++ b/Meshtastic/Helpers/LocalNotificationManager.swift @@ -61,7 +61,7 @@ class LocalNotificationManager { UNUserNotificationCenter.current().getPendingNotificationRequests { notifications in for notification in notifications { - Logger.services.debug("\(notification)") + Logger.services.debug("\(notification, privacy: .public)") } } } diff --git a/Meshtastic/Helpers/LocationHelper.swift b/Meshtastic/Helpers/LocationHelper.swift index 270e6d2c..978ae5a8 100644 --- a/Meshtastic/Helpers/LocationHelper.swift +++ b/Meshtastic/Helpers/LocationHelper.swift @@ -71,6 +71,6 @@ class LocationHelper: NSObject, ObservableObject, CLLocationManagerDelegate { } func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { - Logger.services.error("Location manager error: \(error.localizedDescription)") + Logger.services.error("Location manager error: \(error.localizedDescription, privacy: .public)") } } diff --git a/Meshtastic/Helpers/LocationsHandler.swift b/Meshtastic/Helpers/LocationsHandler.swift index 32fc88d9..9b16e3de 100644 --- a/Meshtastic/Helpers/LocationsHandler.swift +++ b/Meshtastic/Helpers/LocationsHandler.swift @@ -50,7 +50,7 @@ import OSLog if self.manager.authorizationStatus == .notDetermined { self.manager.requestWhenInUseAuthorization() } - Logger.services.info("📍 Starting location updates") + Logger.services.info("📍 [App] Starting location updates") Task { do { self.updatesStarted = true @@ -70,14 +70,14 @@ import OSLog } } } catch { - Logger.services.error("💥 Could not start location updates: \(error.localizedDescription)") + Logger.services.error("💥 [App] Could not start location updates: \(error.localizedDescription)") } return } } func stopLocationUpdates() { - Logger.services.info("🛑 Stopping location updates") + Logger.services.info("🛑 [App] Stopping location updates") self.updatesStarted = false } @@ -85,15 +85,15 @@ import OSLog if smartPostion { let age = -location.timestamp.timeIntervalSinceNow if age > 10 { - Logger.services.warning("📍 Bad Location \(self.count): Too Old \(age) seconds ago \(location)") + Logger.services.warning("📍 [App] Bad Location \(self.count, privacy: .public): Too Old \(age, privacy: .public) seconds ago \(location, privacy: .private)") return false } if location.horizontalAccuracy < 0 { - Logger.services.warning("📍 Bad Location \(self.count): Horizontal Accuracy: \(location.horizontalAccuracy) \(location)") + Logger.services.warning("📍 [App] Bad Location \(self.count, privacy: .public): Horizontal Accuracy: \(location.horizontalAccuracy) \(location, privacy: .private)") return false } if location.horizontalAccuracy > 5 { - Logger.services.warning("📍 Bad Location \(self.count): Horizontal Accuracy: \(location.horizontalAccuracy) \(location)") + Logger.services.warning("📍 [App] Bad Location \(self.count, privacy: .public): Horizontal Accuracy: \(location.horizontalAccuracy) \(location, privacy: .private)") return false } } diff --git a/Meshtastic/Helpers/Map/OfflineTileManager.swift b/Meshtastic/Helpers/Map/OfflineTileManager.swift index 89e9bc16..dceb09cc 100644 --- a/Meshtastic/Helpers/Map/OfflineTileManager.swift +++ b/Meshtastic/Helpers/Map/OfflineTileManager.swift @@ -21,7 +21,7 @@ class OfflineTileManager: ObservableObject { } init() { - Logger.services.debug("Documents Directory = \(self.documentsDirectory.absoluteString)") + Logger.services.debug("Documents Directory = \(self.documentsDirectory.absoluteString, privacy: .public)") createDirectoriesIfNecessary() } diff --git a/Meshtastic/Helpers/MeshLogger.swift b/Meshtastic/Helpers/MeshLogger.swift index 25dbc8f1..fe579191 100644 --- a/Meshtastic/Helpers/MeshLogger.swift +++ b/Meshtastic/Helpers/MeshLogger.swift @@ -33,10 +33,10 @@ class MeshLogger { } else { try data.write(to: logFile, options: .atomicWrite) let log = String(data: data, encoding: .utf8) ?? "unknown".localized - Logger.mesh.notice("\(log)") + Logger.mesh.notice("\(log, privacy: .public)") } } catch { - Logger.mesh.error("Error writing mesh log data: \(error.localizedDescription)") + Logger.mesh.error("Error writing mesh log data: \(error.localizedDescription, privacy: .public)") } } } diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index e81fee1d..d10d5cb0 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -112,12 +112,12 @@ func myInfoPacket (myInfo: MyNodeInfo, peripheralId: String, context: NSManagedO myInfoEntity.rebootCount = Int32(myInfo.rebootCount) do { try context.save() - Logger.data.info("💾 Saved a new myInfo for node number: \(String(myInfo.myNodeNum))") + Logger.data.info("💾 Saved a new myInfo for node: \(myInfo.myNodeNum.toHex(), privacy: .public)") return myInfoEntity } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Inserting New Core Data MyInfoEntity: \(nsError)") + Logger.data.error("💥 Error Inserting New Core Data MyInfoEntity: \(nsError, privacy: .public)") } } else { @@ -127,16 +127,16 @@ func myInfoPacket (myInfo: MyNodeInfo, peripheralId: String, context: NSManagedO do { try context.save() - Logger.data.info("💾 Updated myInfo for node number: \(String(myInfo.myNodeNum))") + Logger.data.info("💾 Updated myInfo for node: \(myInfo.myNodeNum.toHex(), privacy: .public)") return fetchedMyInfo[0] } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data MyInfoEntity: \(nsError)") + Logger.data.error("💥 Error Updating Core Data MyInfoEntity: \(nsError, privacy: .public)") } } } catch { - Logger.data.error("Fetch MyInfo Error") + Logger.data.error("💥 Fetch MyInfo Error") } return nil } @@ -185,16 +185,16 @@ func channelPacket (channel: Channel, fromNum: Int64, context: NSManagedObjectCo do { try context.save() } catch { - Logger.data.error("Failed to save channel: \(error.localizedDescription)") + Logger.data.error("💥 Failed to save channel: \(error.localizedDescription, privacy: .public)") } Logger.data.info("💾 Updated MyInfo channel \(channel.index) from Channel App Packet For: \(fetchedMyInfo[0].myNodeNum)") } else if channel.role.rawValue > 0 { - Logger.data.error("Trying to save a channel to a MyInfo that does not exist: \(fromNum)") + Logger.data.error("💥Trying to save a channel to a MyInfo that does not exist: \(fromNum.toHex(), privacy: .public)") } } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Saving MyInfo Channel from ADMIN_APP \(nsError)") + Logger.data.error("💥 Error Saving MyInfo Channel from ADMIN_APP \(nsError, privacy: .public)") } } } @@ -202,7 +202,7 @@ func channelPacket (channel: Channel, fromNum: Int64, context: NSManagedObjectCo func deviceMetadataPacket (metadata: DeviceMetadata, fromNum: Int64, context: NSManagedObjectContext) { if metadata.isInitialized { - let logString = String.localizedStringWithFormat("mesh.log.device.metadata.received %@".localized, String(fromNum)) + let logString = String.localizedStringWithFormat("mesh.log.device.metadata.received %@".localized, fromNum.toHex()) MeshLogger.log("🏷️ \(logString)") let fetchedNodeRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") @@ -238,13 +238,13 @@ func deviceMetadataPacket (metadata: DeviceMetadata, fromNum: Int64, context: NS do { try context.save() } catch { - Logger.data.error("Failed to save device metadata: \(error.localizedDescription)") + Logger.data.error("💥 Failed to save device metadata: \(error.localizedDescription, privacy: .public)") } - Logger.data.info("💾 Updated Device Metadata from Admin App Packet For: \(fromNum)") + Logger.data.info("💾 Updated Device Metadata from Admin App Packet For: \(fromNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Saving MyInfo Channel from ADMIN_APP \(nsError)") + Logger.data.error("Error Saving MyInfo Channel from ADMIN_APP \(nsError, privacy: .public)") } } } @@ -415,19 +415,19 @@ func nodeInfoPacket (nodeInfo: NodeInfo, channel: UInt32, context: NSManagedObje } do { try context.save() - Logger.data.info("💾 NodeInfo saved for \(nodeInfo.num)") + Logger.data.info("💾 [NodeInfo] saved for \(nodeInfo.num.toHex(), privacy: .public)") return fetchedNode[0] } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Saving Core Data NodeInfoEntity: \(nsError)") + Logger.data.error("💥 Error Saving Core Data NodeInfoEntity: \(nsError, privacy: .public)") } } catch { - Logger.data.error("Fetch MyInfo Error") + Logger.data.error("💥 Fetch MyInfo Error") } } } catch { - Logger.data.error("Fetch NodeInfoEntity Error") + Logger.data.error("💥 Fetch NodeInfoEntity Error") } return nil } @@ -442,7 +442,7 @@ func adminAppPacket (packet: MeshPacket, context: NSManagedObjectContext) { if !cmmc.messages.isEmpty { - let logString = String.localizedStringWithFormat("mesh.log.cannedmessages.messages.received %@".localized, String(packet.from)) + let logString = String.localizedStringWithFormat("mesh.log.cannedmessages.messages.received %@".localized, packet.from.toHex()) MeshLogger.log("🥫 \(logString)") let fetchNodeRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") @@ -460,15 +460,15 @@ func adminAppPacket (packet: MeshPacket, context: NSManagedObjectContext) { fetchedNode[0].cannedMessageConfig?.messages = messages do { try context.save() - Logger.data.info("💾 Updated Canned Messages Messages For: \(fetchedNode[0].num)") + Logger.data.info("💾 Updated Canned Messages Messages For: \(fetchedNode[0].num.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Saving NodeInfoEntity from POSITION_APP \(nsError)") + Logger.data.error("💥 Error Saving NodeInfoEntity from POSITION_APP \(nsError, privacy: .public)") } } } catch { - Logger.data.error("Error Deserializing ADMIN_APP packet.") + Logger.data.error("💥 Error Deserializing ADMIN_APP packet.") } } } diff --git a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift index 277735a5..77cd1088 100644 --- a/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift +++ b/Meshtastic/Helpers/Mqtt/MqttClientProxyManager.swift @@ -102,7 +102,7 @@ class MqttClientProxyManager { extension MqttClientProxyManager: CocoaMQTTDelegate { func mqtt(_ mqtt: CocoaMQTT, didConnectAck ack: CocoaMQTTConnAck) { - Logger.mqtt.info("📲 MQTT Client Proxy didConnectAck: \(ack)") + Logger.mqtt.info("📲 [MQTT Client Proxy] didConnectAck: \(ack, privacy: .public)") if ack == .accept { delegate?.onMqttConnected() } else { @@ -112,7 +112,7 @@ extension MqttClientProxyManager: CocoaMQTTDelegate { case .accept: errorDescription = "No Error" case .unacceptableProtocolVersion: - errorDescription = "Proto ver" + errorDescription = "Unacceptable Protocol version" case .identifierRejected: errorDescription = "Invalid Id" case .serverUnavailable: @@ -124,13 +124,13 @@ extension MqttClientProxyManager: CocoaMQTTDelegate { default: errorDescription = "Unknown Error" } - Logger.services.error("\(errorDescription)") + Logger.services.error("📲 [MQTT Client Proxy] \(errorDescription, privacy: .public)") delegate?.onMqttError(message: errorDescription) self.disconnect() } } func mqttDidDisconnect(_ mqtt: CocoaMQTT, withError err: Error?) { - Logger.mqtt.debug("📲 [MQTT Client Proxy] disconnected: \(err?.localizedDescription ?? "")") + Logger.mqtt.debug("📲 [MQTT Client Proxy] disconnected: \(err?.localizedDescription ?? "", privacy: .public)") if let error = err { delegate?.onMqttError(message: error.localizedDescription) } diff --git a/Meshtastic/MeshtasticAppDelegate.swift b/Meshtastic/MeshtasticAppDelegate.swift index 1bfa73ed..71f01d81 100644 --- a/Meshtastic/MeshtasticAppDelegate.swift +++ b/Meshtastic/MeshtasticAppDelegate.swift @@ -10,7 +10,7 @@ import OSLog class MeshtasticAppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, ObservableObject { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { - Logger.services.info("🚀 Meshtstic Apple App launched!") + Logger.services.info("🚀 [App] Meshtstic Apple App launched!") // Default User Default Values UserDefaults.standard.register(defaults: ["meshMapRecentering": true]) UserDefaults.standard.register(defaults: ["meshMapShowNodeHistory": true]) diff --git a/Meshtastic/Persistence/Persistence.swift b/Meshtastic/Persistence/Persistence.swift index 92a2e381..f085b5d7 100644 --- a/Meshtastic/Persistence/Persistence.swift +++ b/Meshtastic/Persistence/Persistence.swift @@ -90,13 +90,11 @@ extension NSManagedObjectContext { } } - // Created by Tom Harrington on 5/12/20. // Copyright © 2020 Atomic Bird LLC. All rights reserved. // Gist from https://atomicbird.com/blog/core-data-back-up-store/ // extension NSPersistentContainer { - enum CopyPersistentStoreErrors: Error { case invalidDestination(String) case destinationError(String) @@ -104,9 +102,8 @@ extension NSPersistentContainer { case copyStoreError(String) case invalidSource(String) } - + /// Restore a persistent store for a URL `backupURL`. - /// /// **Be very careful with this**. To restore a persistent store, the current persistent store must be removed from the container. When that happens, **all currently loaded Core Data objects** will become invalid. Using them after restoring will cause your app to crash. When calling this method you **must** ensure that you do not continue to use any previously fetched managed objects or existing fetched results controllers. **If this method does not throw, that does not mean your app is safe.** You need to take extra steps to prevent crashes. The details vary depending on the nature of your app. /// - Parameter backupURL: A file URL containing backup copies of all currently loaded persistent stores. /// - Throws: `CopyPersistentStoreError` in various situations. @@ -115,7 +112,7 @@ extension NSPersistentContainer { guard backupURL.isFileURL else { throw CopyPersistentStoreErrors.invalidSource("Backup URL must be a file URL") } - + for persistentStoreDescription in persistentStoreDescriptions { guard let loadedStoreURL = persistentStoreDescription.url else { continue @@ -127,7 +124,7 @@ extension NSPersistentContainer { let storeOptions = persistentStoreDescription.options let configurationName = persistentStoreDescription.configuration let storeType = persistentStoreDescription.type - + // Replace the current store with the backup copy. This has a side effect of removing the current store from the Core Data stack. // When restoring, it's necessary to use the current persistent store coordinator. try persistentStoreCoordinator.replacePersistentStore(at: loadedStoreURL, destinationOptions: storeOptions, withPersistentStoreFrom: backupURL, sourceOptions: storeOptions, ofType: storeType) @@ -138,7 +135,7 @@ extension NSPersistentContainer { } } } - + /// Copy all loaded persistent stores to a new directory. Each currently loaded file-based persistent store will be copied (including journal files, external binary storage, and anything else Core Data needs) into the destination directory to a persistent store with the same name and type as the existing store. In-memory stores, if any, are skipped. /// - Parameters: /// - destinationURL: Destination for new persistent store files. Must be a file URL. If `overwriting` is `false` and `destinationURL` exists, it must be a directory. @@ -146,15 +143,15 @@ extension NSPersistentContainer { /// - Throws: `CopyPersistentStoreError` /// - Returns: Nothing. If no errors are thrown, all loaded persistent stores will be copied to the destination directory. func copyPersistentStores(to destinationURL: URL, overwriting: Bool = false) throws -> Void { - print(destinationURL) + guard !destinationURL.relativeString.contains("/0/") else { throw CopyPersistentStoreErrors.invalidDestination("Invalid 0 Node Id") } - + guard destinationURL.isFileURL else { throw CopyPersistentStoreErrors.invalidDestination("Destination URL must be a file URL") } - + // If the destination exists and we aren't overwriting it, then it must be a directory. (If we are overwriting, we'll remove it anyway, so it doesn't matter whether it's a directory). var isDirectory: ObjCBool = false if !overwriting && FileManager.default.fileExists(atPath: destinationURL.path, isDirectory: &isDirectory) { @@ -171,14 +168,14 @@ extension NSPersistentContainer { throw CopyPersistentStoreErrors.destinationNotRemoved("Can't overwrite destination at \(destinationURL)") } } - + // Create the destination directory do { try FileManager.default.createDirectory(at: destinationURL, withIntermediateDirectories: true, attributes: nil) } catch { throw CopyPersistentStoreErrors.destinationError("Could not create destination directory at \(destinationURL)") } - + for persistentStoreDescription in persistentStoreDescriptions { guard let storeURL = persistentStoreDescription.url else { continue @@ -195,7 +192,7 @@ extension NSPersistentContainer { do { let newStore = try temporaryPSC.addPersistentStore(ofType: persistentStoreDescription.type, configurationName: persistentStoreDescription.configuration, at: persistentStoreDescription.url, options: persistentStoreDescription.options) let _ = try temporaryPSC.migratePersistentStore(newStore, to: destinationStoreURL, options: persistentStoreDescription.options, withType: persistentStoreDescription.type) - + /// Cleanup extra files let directory = destinationStoreURL.deletingLastPathComponent() /// Delete -wal file @@ -205,13 +202,13 @@ extension NSPersistentContainer { do { try FileManager.default.removeItem(at: directory.appendingPathComponent("Meshtastic.sqlite-shm")) } catch { - print(error) + Logger.services.error("Error Deleting Meshtastic.sqlite-shm file \(error, privacy: .public)") } } catch { - print(error) + Logger.services.error("Error Deleting Meshtastic.sqlite-wal file \(error, privacy: .public)") } - } catch { + Logger.services.error("Error Deleting Meshtastic.sqlite file \(error, privacy: .public)") throw CopyPersistentStoreErrors.copyStoreError("\(error.localizedDescription)") } } diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index a7d8ca71..b831c544 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -122,7 +122,7 @@ struct Connect: View { Text("Short Name: \(node?.user?.shortName ?? "?")") Text("Long Name: \(node?.user?.longName ?? "unknown".localized)") Text("BLE RSSI: \(connectedPeripheral.rssi)") - + Button { if !bleManager.sendShutdown(fromUser: node!.user!, toUser: node!.user!, adminIndex: node!.myInfo!.adminIndex) { Logger.mesh.error("Shutdown Failed") @@ -214,18 +214,17 @@ struct Connect: View { if let connectedPeripheral = bleManager.connectedPeripheral, connectedPeripheral.peripheral.state == CBPeripheralState.connected { bleManager.disconnectPeripheral() } - //clearCoreDataDatabase(context: context, includeRoutes: false) - let container = NSPersistentContainer(name : "Meshtastic") + // clearCoreDataDatabase(context: context, includeRoutes: false) + let container = NSPersistentContainer(name: "Meshtastic") guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { Logger.data.error("nil File path for back") return } do { try container.copyPersistentStores(to: url.appendingPathComponent("backup").appendingPathComponent("\(UserDefaults.preferredPeripheralNum)"), overwriting: true) - Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") } catch { - print("Copy error: \(error)") + Logger.data.error("🗂️ Core data backup copy error: \(error, privacy: .public)") } UserDefaults.preferredPeripheralId = selectedPeripherialId let radio = bleManager.peripherals.first(where: { $0.peripheral.identifier.uuidString == selectedPeripherialId }) diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift index 631cccf4..ae0e395a 100644 --- a/Meshtastic/Views/Settings/AppData.swift +++ b/Meshtastic/Views/Settings/AppData.swift @@ -11,7 +11,7 @@ import CoreData import Foundation struct AppData: View { - + @Environment(\.managedObjectContext) var context @EnvironmentObject var bleManager: BLEManager @State private var files = [URL]() @@ -19,10 +19,9 @@ struct AppData: View { var body: some View { - VStack { Button(action: { - let container = NSPersistentContainer(name : "Meshtastic") + let container = NSPersistentContainer(name: "Meshtastic") guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { Logger.data.error("nil File path for back") return @@ -32,9 +31,8 @@ struct AppData: View { loadFiles() Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") } catch { - print("Copy error: \(error)") + Logger.data.error("🗂️ Core data backup copy error: \(error, privacy: .public)") } - }) { Label { Text("Backup Database") @@ -49,26 +47,25 @@ struct AppData: View { .buttonStyle(.bordered) .buttonBorderShape(.capsule) .controlSize(.large) - } List(files, id: \.self) { file in HStack { - VStack (alignment: .leading ) { - if file.pathExtension.contains("sqlite") { //} == "sqlite" { + VStack(alignment: .leading ) { + if file.pathExtension.contains("sqlite") { Label { Text("Node Core Data Backup \(file.pathComponents[9])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") .swipeActions { Button(role: .none) { bleManager.disconnectPeripheral(reconnect: false) - let container = NSPersistentContainer(name : "Meshtastic") + let container = NSPersistentContainer(name: "Meshtastic") do { context.reset() try container.restorePersistentStore(from: file.absoluteURL) UserDefaults.preferredPeripheralId = "" UserDefaults.preferredPeripheralNum = Int(file.pathComponents[10]) ?? 0 - Logger.data.notice("🗂️ Restored a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") + Logger.data.notice("🗂️ Restored a core data backup to backup/\(UserDefaults.preferredPeripheralNum, privacy: .public)") } catch { - print("Copy error: \(error)") + Logger.data.error("🗂️ Core data restore copy error: \(error, privacy: .public)") } } label: { Label("restore", systemImage: "arrow.counterclockwise") @@ -77,7 +74,7 @@ struct AppData: View { do { try FileManager.default.removeItem(at: file) } catch { - print(error) + Logger.services.error("🗑️ Delete file error: \(error, privacy: .public)") } } label: { Label("delete", systemImage: "trash") @@ -89,8 +86,7 @@ struct AppData: View { .font(idiom == .phone ? .callout : .title) .frame(width: 35) } - } - else { + } else { Label { Text("\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") .swipeActions { @@ -98,13 +94,12 @@ struct AppData: View { do { try FileManager.default.removeItem(at: file) } catch { - print(error) + Logger.services.error("🗑️ Delete file error: \(error, privacy: .public)") } } label: { Label("delete", systemImage: "trash") } } - } icon: { Image(systemName: "doc.text") .symbolRenderingMode(.hierarchical) @@ -115,13 +110,13 @@ struct AppData: View { } #if targetEnvironment(macCatalyst) Spacer() - VStack (alignment: .trailing) { - Button() { + VStack(alignment: .trailing) { + Button { do { try FileManager.default.removeItem(at: file) loadFiles() } catch { - print(error) + Logger.services.error("🗑️ Delete file error: \(error, privacy: .public)") } } label: { Label("", systemImage: "trash") @@ -136,7 +131,7 @@ struct AppData: View { }) .listStyle(.inset) } - + private func loadFiles() { files = [] guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { @@ -146,11 +141,13 @@ struct AppData: View { if let enumerator = FileManager.default.enumerator(at: url, includingPropertiesForKeys: [.isRegularFileKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]) { for case let fileURL as URL in enumerator { do { - let fileAttributes = try fileURL.resourceValues(forKeys:[.isRegularFileKey]) + let fileAttributes = try fileURL.resourceValues(forKeys: [.isRegularFileKey]) if fileAttributes.isRegularFile! { files.append(fileURL) } - } catch { print(error, fileURL) } + } catch { + Logger.services.error("📁 Load file: \(fileURL, privacy: .public) error: \(error, privacy: .public)") + } } } } diff --git a/Meshtastic/Views/Settings/AppLog.swift b/Meshtastic/Views/Settings/AppLog.swift index 45652edf..c1872802 100644 --- a/Meshtastic/Views/Settings/AppLog.swift +++ b/Meshtastic/Views/Settings/AppLog.swift @@ -23,7 +23,7 @@ struct AppLog: View { @State var isExporting = false @State var exportString = "" @State var isEditingFilters = false - + private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } private let dateFormatStyle = Date.FormatStyle() .hour(.twoDigits(amPM: .omitted)) @@ -45,7 +45,6 @@ struct AppLog: View { Text(value.level.description) } .width(min: 75, max: 100) - } TableColumn("log.message", value: \.composedMessage) { value in Text(value.composedMessage) @@ -167,7 +166,6 @@ struct AppLog: View { } } } - func didDismiss() { selection = nil selectedLog = nil @@ -200,7 +198,6 @@ extension AppLog { let levelPredicate = NSPredicate(format: "messageType == %@", LogLevels(rawValue: level)?.level ?? "info") predicates.append(levelPredicate) } - if predicates.count > 0 || !searchText.isEmpty { if !searchText.isEmpty { let filterPredicates = NSCompoundPredicate(type: .and, subpredicates: predicates) @@ -214,10 +211,8 @@ extension AppLog { } } else { let logs = try await Logger.fetch(predicateFormat: subsystemPredicate.predicateFormat) - return logs } - } catch { return [] } diff --git a/Meshtastic/Views/Settings/AppSettings.swift b/Meshtastic/Views/Settings/AppSettings.swift index 528843af..c8bbf301 100644 --- a/Meshtastic/Views/Settings/AppSettings.swift +++ b/Meshtastic/Views/Settings/AppSettings.swift @@ -87,13 +87,13 @@ struct AppSettings: View { do { try FileManager.default.removeItem(at: url.appendingPathComponent("Meshtastic.sqlite-shm")) } catch { - Logger.services.error("Error Deleting Meshtastic.sqlite-shm file \(error)") + Logger.services.error("Error Deleting Meshtastic.sqlite-shm file \(error, privacy: .public)") } } catch { - Logger.services.error("Error Deleting Meshtastic.sqlite-wal file \(error)") + Logger.services.error("Error Deleting Meshtastic.sqlite-wal file \(error, privacy: .public)") } } catch { - Logger.services.error("Error Deleting Meshtastic.sqlite file \(error)") + Logger.services.error("Error Deleting Meshtastic.sqlite file \(error, privacy: .public)") } } clearCoreDataDatabase(context: context, includeRoutes: true) diff --git a/Meshtastic/Views/Settings/Config/BluetoothConfig.swift b/Meshtastic/Views/Settings/Config/BluetoothConfig.swift index 980ed8f4..c4ad97df 100644 --- a/Meshtastic/Views/Settings/Config/BluetoothConfig.swift +++ b/Meshtastic/Views/Settings/Config/BluetoothConfig.swift @@ -69,7 +69,6 @@ struct BluetoothConfig: View { .foregroundColor(.red) } } - Toggle(isOn: $deviceLoggingEnabled) { Label("Device Logging Enabled", systemImage: "ladybug") } diff --git a/Meshtastic/Views/Settings/Logs/AppLogFilter.swift b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift index 39e5e113..78dbc215 100644 --- a/Meshtastic/Views/Settings/Logs/AppLogFilter.swift +++ b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift @@ -18,7 +18,7 @@ enum LogCategories: Int, CaseIterable, Identifiable { case radio = 4 case services = 5 case stats = 6 - + var id: Int { self.rawValue } var description: String { switch self { @@ -81,16 +81,15 @@ enum LogLevels: Int, CaseIterable, Identifiable { } struct AppLogFilter: View { - + @Environment(\.dismiss) private var dismiss /// Filters var filterTitle = "App Log Filters" - //@Binding @Binding var category: Int @Binding var level: Int - + var body: some View { - + NavigationStack { Form { Section(header: Text(filterTitle)) { @@ -100,13 +99,12 @@ struct AppLogFilter: View { Text("All Categories") .tag(-1) ForEach(LogCategories.allCases) { lc in - Text("\(lc.description)") - + Text("\(lc.description)") } } .pickerStyle(DefaultPickerStyle()) } - + HStack { Label("Level", systemImage: "stairs") Picker("", selection: $level) { @@ -114,8 +112,6 @@ struct AppLogFilter: View { .tag(-1) ForEach(LogLevels.allCases) { ll in Text("\(ll.description)") - //.tag(ll.rawValue) - } } .pickerStyle(DefaultPickerStyle()) diff --git a/Meshtastic/Views/Settings/Logs/LogDetail.swift b/Meshtastic/Views/Settings/Logs/LogDetail.swift index 7308da5b..c05d4b83 100644 --- a/Meshtastic/Views/Settings/Logs/LogDetail.swift +++ b/Meshtastic/Views/Settings/Logs/LogDetail.swift @@ -9,14 +9,12 @@ import SwiftUI import MapKit import OSLog -//@available(iOS 17.0, macOS 14.0, *) struct LogDetail: View { @Environment(\.dismiss) private var dismiss private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } var log: OSLogEntryLog var font: Font = .title2 - private let dateFormatStyle = Date.FormatStyle() .day(.defaultDigits) .month(.defaultDigits) @@ -122,7 +120,6 @@ struct LogDetail: View { .textSelection(.enabled) .font(idiom == .phone ? .body : .title) .padding(.bottom, 5) - } icon: { Image(systemName: "text.bubble") .symbolRenderingMode(.hierarchical) @@ -133,7 +130,6 @@ struct LogDetail: View { } .listStyle(.plain) - } Spacer() } From f3ab6a396844cdc5235968a041fbca224ac36c33 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 17:23:57 -0700 Subject: [PATCH 12/29] Comment out broken load tile method --- .../MapKitMap/Custom/LocalMBTileOverlay.swift | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Meshtastic/Views/MapKitMap/Custom/LocalMBTileOverlay.swift b/Meshtastic/Views/MapKitMap/Custom/LocalMBTileOverlay.swift index 6f534baa..091f4a9c 100644 --- a/Meshtastic/Views/MapKitMap/Custom/LocalMBTileOverlay.swift +++ b/Meshtastic/Views/MapKitMap/Custom/LocalMBTileOverlay.swift @@ -89,25 +89,25 @@ class LocalMBTileOverlay: MKTileOverlay { } } - override func loadTile(at path: MKTileOverlayPath, result: @escaping (Data?, Error?) -> Void) { - - let tileX = Int64(path.x) - let tileY = Int64(path.y) - let tileZ = Int64(path.z) - let tileData = Expression("tile_data") - let zoomLevel = Expression("zoom_level") - let tileColumn = Expression("tile_column") - let tileRow = Expression("tile_row") - - if let dataQuery = try? self.mb.pluck(Table("tiles").select(tileData).filter(zoomLevel == tileZ).filter(tileColumn == tileX).filter(tileRow == tileY)) { - let data = Data(bytes: dataQuery[tileData].bytes, count: dataQuery[tileData].bytes.count)// dataQuery![tileData].bytes - result(data, nil) - } else { - Logger.services.error("No tile here: x:\(tileX) y:\(tileY) z:\(tileZ)") - let error = NSError(domain: "LocalMBTileOverlay", code: 1, userInfo: ["reason": "no_tile"]) - result(nil, error) - } - } +// override func loadTile(at path: MKTileOverlayPath, result: @escaping (Data?, Error?) -> Void) { +// +// let tileX = Int64(path.x) +// let tileY = Int64(path.y) +// let tileZ = Int64(path.z) +// let tileData = Expression("tile_data") +// let zoomLevel = Expression("zoom_level") +// let tileColumn = Expression("tile_column") +// let tileRow = Expression("tile_row") +// +// if let dataQuery = try? self.mb.pluck(Table("tiles").select(tileData).filter(zoomLevel == tileZ).filter(tileColumn == tileX).filter(tileRow == tileY)) { +// let data = Data(bytes: dataQuery[tileData].bytes, count: dataQuery[tileData].bytes.count)// dataQuery![tileData].bytes +// result(data, nil) +// } else { +// Logger.services.error("No tile here: x:\(tileX) y:\(tileY) z:\(tileZ)") +// let error = NSError(domain: "LocalMBTileOverlay", code: 1, userInfo: ["reason": "no_tile"]) +// result(nil, error) +// } +// } } // public class CustomMapOverlaySource: MKTileOverlay { From a4546247a97c46a29f2810358ab1b7184c4f199e Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 18:25:22 -0700 Subject: [PATCH 13/29] Clean up logs with privacy --- Meshtastic.xcodeproj/project.pbxproj | 4 +- Meshtastic/Helpers/BLEManager.swift | 2 +- Meshtastic/Persistence/UpdateCoreData.swift | 174 ++++++++++---------- 3 files changed, 88 insertions(+), 92 deletions(-) diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index 371531fe..4ab04b19 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -1611,7 +1611,7 @@ INFOPLIST_FILE = Meshtastic/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Meshtastic; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - IPHONEOS_DEPLOYMENT_TARGET = 16.4; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1645,7 +1645,7 @@ INFOPLIST_FILE = Meshtastic/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Meshtastic; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - IPHONEOS_DEPLOYMENT_TARGET = 16.4; + IPHONEOS_DEPLOYMENT_TARGET = 16.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 7a4544e8..9b0b8bf9 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -902,7 +902,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate } case FROMNUM_UUID: - Logger.services.info("🗞️ [BLE] (Notify) characteristic, value will be read next") + Logger.services.info("🗞️ [BLE] (Notify) characteristic value will be read next") default: Logger.services.error("🚫 Unhandled Characteristic UUID: \(characteristic.uuid, privacy: .public)") } diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index 3479a538..c5be865b 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -27,7 +27,7 @@ public func clearPax(destNum: Int64, context: NSManagedObjectContext) -> Bool { return false } } catch { - Logger.data.error("Fetch NodeInfoEntity Error") + Logger.data.error("💥 [NodeInfoEntity] fetch data error") return false } } @@ -52,7 +52,7 @@ public func clearPositions(destNum: Int64, context: NSManagedObjectContext) -> B return false } } catch { - Logger.data.error("Fetch NodeInfoEntity Error") + Logger.data.error("💥 [NodeInfoEntity] fetch data error") return false } } @@ -77,7 +77,7 @@ public func clearTelemetry(destNum: Int64, metricsType: Int32, context: NSManage return false } } catch { - Logger.data.error("Fetch NodeInfoEntity Error") + Logger.data.error("💥 [NodeInfoEntity] fetch data error") return false } } @@ -213,11 +213,11 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext) myInfoEntity.rebootCount = 0 do { try context.save() - Logger.data.info("💾 Saved a new myInfo for node number: \(String(packet.from))") + Logger.data.info("💾 [MyInfoEntity] Saved a new myInfo for node number: \(packet.from.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Inserting New Core Data MyInfoEntity: \(nsError)") + Logger.data.error("💥 [MyInfoEntity] Error Inserting New Core Data: \(nsError, privacy: .public)") } newNode.myInfo = myInfoEntity @@ -270,15 +270,15 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext) } do { try context.save() - Logger.data.info("💾 Updated NodeInfo from Node Info App Packet For: \(fetchedNode[0].num)") + Logger.data.info("💾 [NodeInfoEntity] Updated from Node Info App Packet For: \(fetchedNode[0].num.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Saving NodeInfoEntity from NODEINFO_APP \(nsError)") + Logger.data.error("💥 [NodeInfoEntity] Error Saving from NODEINFO_APP \(nsError, privacy: .public)") } } } catch { - Logger.data.error("Error Fetching NodeInfoEntity for NODEINFO_APP") + Logger.data.error("💥 [NodeInfoEntity] fetch data error for NODEINFO_APP") } } @@ -362,11 +362,11 @@ func upsertPositionPacket (packet: MeshPacket, context: NSManagedObjectContext) do { try context.save() - Logger.data.info("💾 Updated Node Position Coordinates, SNR and Time from Position App Packet For: \(fetchedNode[0].num)") + Logger.data.info("💾 Updated Node Position Coordinates from Position App Packet For: \(fetchedNode[0].num.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Saving NodeInfoEntity from POSITION_APP \(nsError)") + Logger.data.error("💥 Error Saving NodeInfoEntity from POSITION_APP \(nsError, privacy: .public)") } } } else { @@ -374,12 +374,12 @@ func upsertPositionPacket (packet: MeshPacket, context: NSManagedObjectContext) if (try? NodeInfo(serializedData: packet.decoded.payload)) != nil { upsertNodeInfoPacket(packet: packet, context: context) } else { - Logger.data.error("Empty POSITION_APP Packet: \((try? packet.jsonString()) ?? "JSON Decode Failure")") + Logger.data.error("💥 Empty POSITION_APP Packet: \((try? packet.jsonString()) ?? "JSON Decode Failure", privacy: .public)") } } } } catch { - Logger.data.error("Error Deserializing POSITION_APP packet.") + Logger.data.error("💥 Error Deserializing POSITION_APP packet.") } } @@ -410,18 +410,18 @@ func upsertBluetoothConfigPacket(config: Config.BluetoothConfig, nodeNum: Int64, } do { try context.save() - Logger.data.info("💾 Updated Bluetooth Config for node: \(nodeNum.toHex(), privacy: .public)") + Logger.data.info("💾 [BluetoothConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("💥 Error Updating Core Data BluetoothConfigEntity: \(nsError, privacy: .public)") + Logger.data.error("💥 [BluetoothConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("💥 No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Bluetooth Config") + Logger.data.error("💥 [BluetoothConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Bluetooth Config") } } catch { let nsError = error as NSError - Logger.data.error("💥 Fetching node for core data BluetoothConfigEntity failed: \(nsError, privacy: .public)") + Logger.data.error("💥 [BluetoothConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -467,22 +467,22 @@ func upsertDeviceConfigPacket(config: Meshtastic.Config.DeviceConfig, nodeNum: I } do { try context.save() - Logger.data.info("💾 Updated Device Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [DeviceConfigEntity] Updated Device Config for node number: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data DeviceConfigEntity: \(nsError)") + Logger.data.error("💥 [DeviceConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data DeviceConfigEntity failed: \(nsError)") + Logger.data.error("💥 [DeviceConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } func upsertDisplayConfigPacket(config: Meshtastic.Config.DisplayConfig, nodeNum: Int64, context: NSManagedObjectContext) { - let logString = String.localizedStringWithFormat("mesh.log.display.config %@".localized, String(nodeNum)) + let logString = String.localizedStringWithFormat("mesh.log.display.config %@".localized, nodeNum.toHex()) MeshLogger.log("🖥️ \(logString)") let fetchNodeInfoRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") @@ -525,30 +525,30 @@ func upsertDisplayConfigPacket(config: Meshtastic.Config.DisplayConfig, nodeNum: do { try context.save() - Logger.data.info("💾 Updated Display Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [DisplayConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data DisplayConfigEntity: \(nsError)") + Logger.data.error("💥 [DisplayConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Display Config") + Logger.data.error("💥 [DisplayConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex()) unable to save Display Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data DisplayConfigEntity failed: \(nsError)") + Logger.data.error("💥 [DisplayConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } func upsertLoRaConfigPacket(config: Meshtastic.Config.LoRaConfig, nodeNum: Int64, context: NSManagedObjectContext) { - let logString = String.localizedStringWithFormat("mesh.log.lora.config %@".localized, String(nodeNum)) + let logString = String.localizedStringWithFormat("mesh.log.lora.config %@".localized, nodeNum.toHex()) MeshLogger.log("📻 \(logString)") let fetchNodeInfoRequest: NSFetchRequest = NSFetchRequest.init(entityName: "NodeInfoEntity") @@ -598,18 +598,18 @@ func upsertLoRaConfigPacket(config: Meshtastic.Config.LoRaConfig, nodeNum: Int64 } do { try context.save() - Logger.data.info("💾 Updated LoRa Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [LoRaConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data LoRaConfigEntity: \(nsError)") + Logger.data.error("💥 [LoRaConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Lora Config") + Logger.data.error("💥 [LoRaConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Lora Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data LoRaConfigEntity failed: \(nsError)") + Logger.data.error("💥 [LoRaConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -644,19 +644,19 @@ func upsertNetworkConfigPacket(config: Meshtastic.Config.NetworkConfig, nodeNum: do { try context.save() - Logger.data.info("💾 Updated Network Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [NetworkConfigEntity] Updated Network Config for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data WiFiConfigEntity: \(nsError)") + Logger.data.error("💥 [NetworkConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Network Config") + Logger.data.error("💥 [NetworkConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Network Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data NetworkConfigEntity failed: \(nsError)") + Logger.data.error("💥 [NetworkConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -708,18 +708,18 @@ func upsertPositionConfigPacket(config: Meshtastic.Config.PositionConfig, nodeNu } do { try context.save() - Logger.data.info("💾 Updated Position Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [PositionConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data PositionConfigEntity: \(nsError)") + Logger.data.error("💥 [PositionConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Position Config") + Logger.data.error("💥 [PositionConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Position Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data PositionConfigEntity failed: \(nsError)") + Logger.data.error("💥 [PositionConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -757,18 +757,18 @@ func upsertPowerConfigPacket(config: Meshtastic.Config.PowerConfig, nodeNum: Int } do { try context.save() - Logger.data.info("💾 Updated Power Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [PowerConfigEntity] Updated Power Config for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data PowerConfigEntity: \(nsError)") + Logger.data.error("💥 [PowerConfigEntity] Error Updating Core Data PowerConfigEntity: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Power Config") + Logger.data.error("💥 [PowerConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Power Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data PowerConfigEntity failed: \(nsError)") + Logger.data.error("💥 [PowerConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -813,18 +813,18 @@ func upsertAmbientLightingModuleConfigPacket(config: Meshtastic.ModuleConfig.Amb do { try context.save() - Logger.data.info("💾 Updated Ambient Lighting Module Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [AmbientLightingConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data AmbientLightingConfigEntity: \(nsError)") + Logger.data.error("💥 [AmbientLightingConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Ambient Lighting Module Config") + Logger.data.error("💥 [AmbientLightingConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Ambient Lighting Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data AmbientLightingConfigEntity failed: \(nsError)") + Logger.data.error("💥 [AmbientLightingConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -877,18 +877,18 @@ func upsertCannedMessagesModuleConfigPacket(config: Meshtastic.ModuleConfig.Cann do { try context.save() - Logger.data.info("💾 Updated Canned Message Module Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [CannedMessageConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data CannedMessageConfigEntity: \(nsError)") + Logger.data.error("💥 [CannedMessageConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Canned Message Module Config") + Logger.data.error("💥 [CannedMessageConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Canned Message Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data CannedMessageConfigEntity failed: \(nsError)") + Logger.data.error("💥 [CannedMessageConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -935,21 +935,21 @@ func upsertDetectionSensorModuleConfigPacket(config: Meshtastic.ModuleConfig.Det do { try context.save() - Logger.data.info("💾 Updated Detection Sensor Module Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [DetectionSensorConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data DetectionSensorConfigEntity: \(nsError)") + Logger.data.error("💥 [DetectionSensorConfigEntity] Error Updating Core Data : \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Detection Sensor Module Config") + Logger.data.error("💥 [DetectionSensorConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Detection Sensor Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data DetectionSensorConfigEntity failed: \(nsError)") + Logger.data.error("💥 [DetectionSensorConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1008,18 +1008,18 @@ func upsertExternalNotificationModuleConfigPacket(config: Meshtastic.ModuleConfi do { try context.save() - Logger.data.info("💾 Updated External Notification Module Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [ExternalNotificationConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data ExternalNotificationConfigEntity: \(nsError)") + Logger.data.error("💥 [ExternalNotificationConfigEntity] Error Updating Core Data : \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save External Notification Module Config") + Logger.data.error("💥 [ExternalNotificationConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save External Notification Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data ExternalNotificationConfigEntity failed: \(nsError)") + Logger.data.error("💥 [ExternalNotificationConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1053,18 +1053,18 @@ func upsertPaxCounterModuleConfigPacket(config: Meshtastic.ModuleConfig.Paxcount do { try context.save() - Logger.data.info("💾 Updated PAX Counter Module Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [PaxCounterConfigEntity] Updated for node number: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data ExternalNotificationConfigEntity: \(nsError)") + Logger.data.error("💥 [PaxCounterConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save PAX Counter Module Config") + Logger.data.error("💥 [PaxCounterConfigEntity] No Nodes found in local database matching node number \(nodeNum.toHex(), privacy: .public) unable to save PAX Counter Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data PaxCounterConfigEntity failed: \(nsError)") + Logger.data.error("💥 [PaxCounterConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1092,18 +1092,18 @@ func upsertRtttlConfigPacket(ringtone: String, nodeNum: Int64, context: NSManage } do { try context.save() - Logger.data.info("💾 Updated RTTTL Ringtone Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [RtttlConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data RtttlConfigEntity: \(nsError)") + Logger.data.error("💥 [RtttlConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save RTTTL Ringtone Config") + Logger.data.error("💥 [RtttlConfigEntity] No nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save RTTTL Ringtone Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data RtttlConfigEntity failed: \(nsError)") + Logger.data.error("💥 [RtttlConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1154,18 +1154,18 @@ func upsertMqttModuleConfigPacket(config: Meshtastic.ModuleConfig.MQTTConfig, no } do { try context.save() - Logger.data.info("💾 Updated MQTT Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [MQTTConfigEntity] Updated for node number: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data MQTTConfigEntity: \(nsError)") + Logger.data.error("💥 [MQTTConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save MQTT Module Config") + Logger.data.error("💥 [MQTTConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save MQTT Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data MQTTConfigEntity failed: \(nsError)") + Logger.data.error("💥 [MQTTConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1197,18 +1197,18 @@ func upsertRangeTestModuleConfigPacket(config: Meshtastic.ModuleConfig.RangeTest } do { try context.save() - Logger.data.info("💾 Updated Range Test Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [RangeTestConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data RangeTestConfigEntity: \(nsError)") + Logger.data.error("💥 [RangeTestConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Range Test Module Config") + Logger.data.error("💥 [RangeTestConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Range Test Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data RangeTestConfigEntity failed: \(nsError)") + Logger.data.error("💥 [RangeTestConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1253,25 +1253,21 @@ func upsertSerialModuleConfigPacket(config: Meshtastic.ModuleConfig.SerialConfig do { try context.save() - Logger.data.info("💾 Updated Serial Module Config for node number: \(String(nodeNum))") - + Logger.data.info("💾 [SerialConfigEntity]Updated Serial Module Config for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data SerialConfigEntity: \(nsError)") + Logger.data.error("💥 [SerialConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } - } else { - - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Serial Module Config") + Logger.data.error("💥 [SerialConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Serial Module Config") } - } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data SerialConfigEntity failed: \(nsError)") + Logger.data.error("💥 [SerialConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1310,18 +1306,18 @@ func upsertStoreForwardModuleConfigPacket(config: Meshtastic.ModuleConfig.StoreF } do { try context.save() - Logger.data.info("💾 Updated Store & Forward Module Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [StoreForwardConfigEntity] Updated for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data StoreForwardConfigEntity: \(nsError)") + Logger.data.error("💥 [StoreForwardConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Store & Forward Module Config") + Logger.data.error("💥 [StoreForwardConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Store & Forward Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data DetectionSensorConfigEntity failed: \(nsError)") + Logger.data.error("💥 [StoreForwardConfigEntity] Fetching node for core data failed: \(nsError, privacy: .public)") } } @@ -1367,20 +1363,20 @@ func upsertTelemetryModuleConfigPacket(config: Meshtastic.ModuleConfig.Telemetry do { try context.save() - Logger.data.info("💾 Updated Telemetry Module Config for node number: \(String(nodeNum))") + Logger.data.info("💾 [TelemetryConfigEntity] Updated Telemetry Module Config for node: \(nodeNum.toHex(), privacy: .public)") } catch { context.rollback() let nsError = error as NSError - Logger.data.error("Error Updating Core Data TelemetryConfigEntity: \(nsError)") + Logger.data.error("💥 [TelemetryConfigEntity] Error Updating Core Data: \(nsError, privacy: .public)") } } else { - Logger.data.error("No Nodes found in local database matching node number \(nodeNum) unable to save Telemetry Module Config") + Logger.data.error("💥 [TelemetryConfigEntity] No Nodes found in local database matching node \(nodeNum.toHex(), privacy: .public) unable to save Telemetry Module Config") } } catch { let nsError = error as NSError - Logger.data.error("Fetching node for core data TelemetryConfigEntity failed: \(nsError)") + Logger.data.error("💥 [TelemetryConfigEntity] Fetching node for core data TelemetryConfigEntity failed: \(nsError, privacy: .public)") } } From 57cc118ce3865903238fe3f08c4a4df544022902 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 18:43:43 -0700 Subject: [PATCH 14/29] Try and use old version --- Meshtastic.xcodeproj/project.pbxproj | 8 ++++---- Meshtastic/Info.plist | 4 ++-- Meshtastic/Views/Settings/AppData.swift | 2 +- Meshtastic/Views/Settings/MeshLog.swift | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index 4ab04b19..782719df 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -1616,7 +1616,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.3.12; + MARKETING_VERSION = 2.3.11; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -1650,7 +1650,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.3.12; + MARKETING_VERSION = 2.3.11; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -1723,7 +1723,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.3.10; + MARKETING_VERSION = 2.3.11; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1756,7 +1756,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.3.10; + MARKETING_VERSION = 2.3.11; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Meshtastic/Info.plist b/Meshtastic/Info.plist index 2e319241..dfbd9ce4 100644 --- a/Meshtastic/Info.plist +++ b/Meshtastic/Info.plist @@ -67,7 +67,7 @@ NSBluetoothAlwaysUsageDescription We use bluetooth to connect to nearby Meshtastic Devices NSBluetoothPeripheralUsageDescription - Bluetooth is used to connect an iPhone to a user's meshtastic device to allow text messaging and location data for the mesh network. + Bluetooth is used to connect an iPhone to a user's meshtastic device to allow text messaging and location data for the mesh network. NSCameraUsageDescription We use the camera to share channels using a QR Code NSLocationAlwaysAndWhenInUseUsageDescription @@ -116,7 +116,7 @@ UIInterfaceOrientationLandscapeRight UISupportsDocumentBrowser - + UTImportedTypeDeclarations diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift index ae0e395a..237fc197 100644 --- a/Meshtastic/Views/Settings/AppData.swift +++ b/Meshtastic/Views/Settings/AppData.swift @@ -1,5 +1,5 @@ // -// BackupData.swift +// AppData.swift // Meshtastic // // Copyright(c) Garth Vander Houwen 6/8/24. diff --git a/Meshtastic/Views/Settings/MeshLog.swift b/Meshtastic/Views/Settings/MeshLog.swift index beb5153a..da2b5014 100644 --- a/Meshtastic/Views/Settings/MeshLog.swift +++ b/Meshtastic/Views/Settings/MeshLog.swift @@ -18,7 +18,7 @@ struct MeshLog: View { let url = logFile! logs.removeAll() var lineCount = 0 - let lineLimit = 5000 + let lineLimit = 1000 // Get the number of lines for try await _ in url.lines { lineCount += 1 From 5b092710e51f8d6fa7ac42f8a0ac654479c1000a Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 19:17:55 -0700 Subject: [PATCH 15/29] Emoji --- Meshtastic/Helpers/BLEManager.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 9b0b8bf9..a3db70ab 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -557,11 +557,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.radio.debug("🛰️ \(log.prefix(upTo: coordsMatch.range.lowerBound), privacy: .public) \(coordsMatch.0.replacingOccurrences(of: "[,]", with: "", options: .regularExpression), privacy: .private) \(log.suffix(from: coordsMatch.range.upperBound), privacy: .public)") } else { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) - Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + Logger.radio.debug("🕵🏻‍♂️ \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } } catch { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) - Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + Logger.radio.debug("🕵🏻‍♂️ \(log.replacingOccurrences(of: "DEBUG |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } } else if log.starts(with: "INFO |") { do { @@ -572,7 +572,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.radio.info("🛰️ \(log.prefix(upTo: coordsMatch.range.lowerBound), privacy: .public) \(coordsMatch.0.replacingOccurrences(of: "[,]", with: "", options: .regularExpression), privacy: .private) \(log.suffix(from: coordsMatch.range.upperBound), privacy: .public)") } else { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) - Logger.radio.debug("🐞 \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + Logger.radio.info("✅ \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } } catch { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) @@ -586,7 +586,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.radio.error("💥 \(log.replacingOccurrences(of: "ERROR |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } else if log.starts(with: "CRIT |") { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) - Logger.radio.critical("💥 \(log.replacingOccurrences(of: "CRIT |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + Logger.radio.critical("🧨 \(log.replacingOccurrences(of: "CRIT |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } else { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) Logger.radio.debug("📟 \(log, privacy: .public)") From 2b0cb11ee5031d1cd187fdf3a4ab86d369b2624c Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 23 Jun 2024 19:28:12 -0700 Subject: [PATCH 16/29] Better emoji for dark mode --- Meshtastic/Extensions/Logger.swift | 2 +- Meshtastic/Helpers/BLEManager.swift | 4 ++-- Meshtastic/Views/Settings/Logs/AppLogFilter.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Meshtastic/Extensions/Logger.swift b/Meshtastic/Extensions/Logger.swift index 10637343..9dc12a88 100644 --- a/Meshtastic/Extensions/Logger.swift +++ b/Meshtastic/Extensions/Logger.swift @@ -63,7 +63,7 @@ extension OSLogEntryLog.Level { var description: String { switch self { case .undefined: "undefined" - case .debug: "🩺 Debug" + case .debug: "🪲 Debug" case .info: "ℹ️ Info" case .notice: "⚠️ Notice" case .error: "🚨 Error" diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index a3db70ab..bf4959f8 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -572,11 +572,11 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate Logger.radio.info("🛰️ \(log.prefix(upTo: coordsMatch.range.lowerBound), privacy: .public) \(coordsMatch.0.replacingOccurrences(of: "[,]", with: "", options: .regularExpression), privacy: .private) \(log.suffix(from: coordsMatch.range.upperBound), privacy: .public)") } else { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) - Logger.radio.info("✅ \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + Logger.radio.info("📢 \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } } catch { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) - Logger.radio.info("✅ \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") + Logger.radio.info("📢 \(log.replacingOccurrences(of: "INFO |", with: "").trimmingCharacters(in: .whitespaces), privacy: .public)") } } else if log.starts(with: "WARN |") { log = log.replacingOccurrences(of: "[,]", with: "", options: .regularExpression) diff --git a/Meshtastic/Views/Settings/Logs/AppLogFilter.swift b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift index 78dbc215..b3dbcdad 100644 --- a/Meshtastic/Views/Settings/Logs/AppLogFilter.swift +++ b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift @@ -67,7 +67,7 @@ enum LogLevels: Int, CaseIterable, Identifiable { var description: String { switch self { case .debug: - return "🩺 Debug" + return "🪲 Debug" case .info: return "ℹ️ Info" case .notice: From fb7ba12fc0b01a26a5bd95b73905433f41f70eec Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 24 Jun 2024 06:31:45 -0700 Subject: [PATCH 17/29] More logs cleanup --- Meshtastic/Helpers/BLEManager.swift | 5 +++-- Meshtastic/MeshtasticApp.swift | 12 ++++++------ Meshtastic/Views/Settings/AppData.swift | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index bf4959f8..a1fbb017 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -645,6 +645,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate if FileManager.default.fileExists(atPath: databasePath.path) { do { disconnectPeripheral(reconnect: false) + clearCoreDataDatabase(context: context!, includeRoutes: true) try container.restorePersistentStore(from: databasePath) UserDefaults.preferredPeripheralNum = Int(myInfo?.myNodeNum ?? 0) context!.reset() @@ -3071,7 +3072,7 @@ extension BLEManager: CBCentralManagerDelegate { // MARK: Bluetooth enabled/disabled func centralManagerDidUpdateState(_ central: CBCentralManager) { if central.state == CBManagerState.poweredOn { - Logger.services.debug("🔌 BLE powered on") + Logger.services.info("✅ [BLE] powered on") isSwitchedOn = true startScanning() } else { @@ -3096,7 +3097,7 @@ extension BLEManager: CBCentralManagerDelegate { default: status = "default" } - Logger.services.debug("📜 [BLE] Bluetooth status: \(status)") + Logger.services.info("📜 [BLE] Bluetooth status: \(status)") } // Called each time a peripheral is discovered diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index da3383d2..b00fab92 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -140,22 +140,22 @@ struct MeshtasticAppleApp: App { .onChange(of: scenePhase) { (newScenePhase) in switch newScenePhase { case .background: - Logger.services.info("🍏 Scene is in the background") + Logger.services.info("🎬 [App] Scene is in the background") do { try persistenceController.container.viewContext.save() - Logger.services.info("💾 Saved CoreData ViewContext when the app went to the background.") + Logger.services.info("💾 [App] Saved CoreData ViewContext when the app went to the background.") } catch { - Logger.services.error("💥 Failed to save viewContext when the app goes to the background.") + Logger.services.error("💥 [App] Failed to save viewContext when the app goes to the background.") } case .inactive: - Logger.services.info("🍏 Scene is inactive") + Logger.services.info("🎬 [App] Scene is inactive") case .active: - Logger.services.info("🍏 Scene is active") + Logger.services.info("🎬 [App] Scene is active") @unknown default: - Logger.services.error("🍎 Apple must have changed something") + Logger.services.error("🍎 [App] Apple must have changed something") } } } diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift index 237fc197..74f718d8 100644 --- a/Meshtastic/Views/Settings/AppData.swift +++ b/Meshtastic/Views/Settings/AppData.swift @@ -53,7 +53,7 @@ struct AppData: View { VStack(alignment: .leading ) { if file.pathExtension.contains("sqlite") { Label { - Text("Node Core Data Backup \(file.pathComponents[9])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") + Text("Node Core Data Backup \(file.pathComponents[10])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") .swipeActions { Button(role: .none) { bleManager.disconnectPeripheral(reconnect: false) From df87fb538d39b6061b427c630edf2dd0c0d027c9 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 24 Jun 2024 07:24:24 -0700 Subject: [PATCH 18/29] log updates --- Meshtastic/Views/Messages/ChannelMessageList.swift | 2 +- Meshtastic/Views/Messages/UserMessageList.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift index 312a9ab3..0fbdcf94 100644 --- a/Meshtastic/Views/Messages/ChannelMessageList.swift +++ b/Meshtastic/Views/Messages/ChannelMessageList.swift @@ -115,7 +115,7 @@ struct ChannelMessageList: View { message.read = true do { try context.save() - Logger.data.info("📖 Read message \(message.messageId) ") + Logger.data.info("📖 [App] Read message \(message.messageId) ") appState.unreadChannelMessages = myInfo.unreadMessages UIApplication.shared.applicationIconBadgeNumber = appState.unreadChannelMessages + appState.unreadDirectMessages context.refresh(myInfo, mergeChanges: true) diff --git a/Meshtastic/Views/Messages/UserMessageList.swift b/Meshtastic/Views/Messages/UserMessageList.swift index dd635c5f..41c83f51 100644 --- a/Meshtastic/Views/Messages/UserMessageList.swift +++ b/Meshtastic/Views/Messages/UserMessageList.swift @@ -100,7 +100,7 @@ struct UserMessageList: View { message.read = true do { try context.save() - Logger.data.info("📖 Read message \(message.messageId) ") + Logger.data.info("📖 [App] Read message \(message.messageId) ") appState.unreadDirectMessages = user.unreadMessages UIApplication.shared.applicationIconBadgeNumber = appState.unreadChannelMessages + appState.unreadDirectMessages From 7cd1e897a77a0c9a23f57dda160e236ee3c82603 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 25 Jun 2024 08:29:26 -0700 Subject: [PATCH 19/29] Logging updates --- Meshtastic/Helpers/BLEManager.swift | 8 ++++---- Meshtastic/Views/Settings/AppData.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index a1fbb017..f9577c0d 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -197,7 +197,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate connectedPeripheral.peripheral.delegate = self } else { // we are null just disconnect and start over - lastConnectionError = "Bluetooth connection error, please try again." + lastConnectionError = "🚫 [BLE] Bluetooth connection error, please try again." disconnectPeripheral() return } @@ -501,9 +501,9 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) { if let error { - Logger.services.error("💥 BLE didUpdateNotificationStateFor error: \(characteristic.uuid, privacy: .public) \(error.localizedDescription, privacy: .public)") + Logger.services.error("💥 [BLE] didUpdateNotificationStateFor error: \(characteristic.uuid, privacy: .public) \(error.localizedDescription, privacy: .public)") } else { - Logger.services.info("ℹ️ peripheral didUpdateNotificationStateFor \(characteristic.uuid, privacy: .public)") + Logger.services.info("ℹ️ [BLE] peripheral didUpdateNotificationStateFor \(characteristic.uuid, privacy: .public)") } } @@ -519,7 +519,7 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate // 5 CBATTErrorDomain Code=5 "Authentication is insufficient." // 15 CBATTErrorDomain Code=15 "Encryption is insufficient." lastConnectionError = "🚨" + String.localizedStringWithFormat("ble.errorcode.pin %@".localized, error.localizedDescription) - Logger.services.error("\(error.localizedDescription, privacy: .public) Please try connecting again and check the PIN carefully.") + Logger.services.error("🚫 [BLE] \(error.localizedDescription, privacy: .public) Please try connecting again and check the PIN carefully.") self.disconnectPeripheral(reconnect: false) } return diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift index 74f718d8..237fc197 100644 --- a/Meshtastic/Views/Settings/AppData.swift +++ b/Meshtastic/Views/Settings/AppData.swift @@ -53,7 +53,7 @@ struct AppData: View { VStack(alignment: .leading ) { if file.pathExtension.contains("sqlite") { Label { - Text("Node Core Data Backup \(file.pathComponents[10])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") + Text("Node Core Data Backup \(file.pathComponents[9])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") .swipeActions { Button(role: .none) { bleManager.disconnectPeripheral(reconnect: false) From a18161a871b5a753357c84ede7f76af0fce29513 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 25 Jun 2024 17:36:43 -0700 Subject: [PATCH 20/29] Multi select app log filters --- Meshtastic/Views/Settings/AppLog.swift | 37 ++++++++++------ .../Views/Settings/Logs/AppLogFilter.swift | 43 +++++++++---------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/Meshtastic/Views/Settings/AppLog.swift b/Meshtastic/Views/Settings/AppLog.swift index c1872802..d9bc4ccb 100644 --- a/Meshtastic/Views/Settings/AppLog.swift +++ b/Meshtastic/Views/Settings/AppLog.swift @@ -15,11 +15,12 @@ struct AppLog: View { @State private var logs: [OSLogEntryLog] = [] @State private var sortOrder = [KeyPathComparator(\OSLogEntryLog.date, order: .reverse)] @State private var selection: OSLogEntry.ID? + @State private var selectedLog: OSLogEntryLog? @State private var presentingErrorDetails: Bool = false @State private var searchText = "" - @State private var category: Int = -1 - @State private var level: Int = -1 + @State private var categories: Set = [0, 1, 2, 3, 4, 5, 6] + @State private var levels: Set = [0, 1, 2, 3, 4] @State var isExporting = false @State var exportString = "" @State var isEditingFilters = false @@ -54,7 +55,7 @@ struct AppLog: View { } .monospaced() .sheet(isPresented: $isEditingFilters) { - AppLogFilter(category: $category, level: $level) + AppLogFilter(categories: $categories, levels: $levels) } .safeAreaInset(edge: .bottom, alignment: .trailing) { HStack { @@ -98,13 +99,13 @@ struct AppLog: View { logs.sort(using: sortOrder) } } - .onChange(of: category) { _ in + .onChange(of: [categories]) { _ in Task { await logs = searchAppLogs() logs.sort(using: sortOrder) } } - .onChange(of: level) { _ in + .onChange(of: [levels]) { _ in Task { await logs = searchAppLogs() logs.sort(using: sortOrder) @@ -188,15 +189,25 @@ extension AppLog { /// Subsystem Predicate let subsystemPredicate = NSPredicate(format: "subsystem IN %@", ["com.apple.SwiftUI", "com.apple.coredata", "gvh.MeshtasticClient"]) predicates.append(subsystemPredicate) - /// Category - if category > -1 { - let categoryPredicate = NSPredicate(format: "category == %@", LogCategories(rawValue: category)!.description) - predicates.append(categoryPredicate) + /// Categories + if categories.count > 0 { + var categoriesArray: [NSPredicate] = [] + for c in categories { + let categoriesPredicate = NSPredicate(format: "category == %@", LogCategories(rawValue: c)?.description ?? "services") + categoriesArray.append(categoriesPredicate) + } + let compoundPredicate = NSCompoundPredicate(type: .or, subpredicates: categoriesArray) + predicates.append(compoundPredicate) } - /// Log Level - if level > -1 { - let levelPredicate = NSPredicate(format: "messageType == %@", LogLevels(rawValue: level)?.level ?? "info") - predicates.append(levelPredicate) + /// Log Levels + if levels.count > 0 { + var levelsArray: [NSPredicate] = [] + for l in levels { + let levelsPredicate = NSPredicate(format: "messageType == %@", LogLevels(rawValue: l)?.level ?? "info") + levelsArray.append(levelsPredicate) + } + let compoundPredicate = NSCompoundPredicate(type: .or, subpredicates: levelsArray) + predicates.append(compoundPredicate) } if predicates.count > 0 || !searchText.isEmpty { if !searchText.isEmpty { diff --git a/Meshtastic/Views/Settings/Logs/AppLogFilter.swift b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift index b3dbcdad..fa3a41e6 100644 --- a/Meshtastic/Views/Settings/Logs/AppLogFilter.swift +++ b/Meshtastic/Views/Settings/Logs/AppLogFilter.swift @@ -85,39 +85,36 @@ struct AppLogFilter: View { @Environment(\.dismiss) private var dismiss /// Filters var filterTitle = "App Log Filters" - @Binding var category: Int - @Binding var level: Int + @Binding var categories: Set + @Binding var levels: Set + @State var editMode = EditMode.active /// the edit mode var body: some View { NavigationStack { Form { - Section(header: Text(filterTitle)) { - HStack { - Label("Category", systemImage: "square.grid.2x2") - Picker("", selection: $category) { - Text("All Categories") - .tag(-1) - ForEach(LogCategories.allCases) { lc in - Text("\(lc.description)") - } + Section(header: Text("Categories")) { + VStack { + List(LogCategories.allCases, selection: $categories) { cat in + Text(cat.description) } - .pickerStyle(DefaultPickerStyle()) + .listStyle(.plain) + .environment(\.editMode, $editMode) /// bind it here! + .frame(minHeight: 300, maxHeight: .infinity) } - - HStack { - Label("Level", systemImage: "stairs") - Picker("", selection: $level) { - Text("All Levels") - .tag(-1) - ForEach(LogLevels.allCases) { ll in - Text("\(ll.description)") - } + } + Section(header: Text("Log Levels")) { + VStack { + List(LogLevels.allCases, selection: $levels) { level in + Text(level.description) } - .pickerStyle(DefaultPickerStyle()) + .listStyle(.plain) + .environment(\.editMode, $editMode) /// bind it here! + .frame(minHeight: 210, maxHeight: .infinity) } } } + #if targetEnvironment(macCatalyst) Spacer() Button { @@ -131,7 +128,7 @@ struct AppLogFilter: View { .padding(.bottom) #endif } - .presentationDetents([.fraction(0.6), .fraction(0.75)]) + .presentationDetents([.fraction(1.0)]) .presentationDragIndicator(.visible) } } From 91dfe0a4e77609c3eb68c73b9aa732975ba41fc5 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 25 Jun 2024 17:55:32 -0700 Subject: [PATCH 21/29] Move sheet outside refreshable --- Meshtastic/Views/Settings/AppLog.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Meshtastic/Views/Settings/AppLog.swift b/Meshtastic/Views/Settings/AppLog.swift index d9bc4ccb..3348a62d 100644 --- a/Meshtastic/Views/Settings/AppLog.swift +++ b/Meshtastic/Views/Settings/AppLog.swift @@ -54,9 +54,7 @@ struct AppLog: View { .width(ideal: 200, max: .infinity) } .monospaced() - .sheet(isPresented: $isEditingFilters) { - AppLogFilter(categories: $categories, levels: $levels) - } + .safeAreaInset(edge: .bottom, alignment: .trailing) { HStack { Button(action: { @@ -118,6 +116,9 @@ struct AppLog: View { } selectedLog = log } + .sheet(isPresented: $isEditingFilters) { + AppLogFilter(categories: $categories, levels: $levels) + } .sheet(item: $selectedLog, onDismiss: didDismiss) { log in LogDetail(log: log) .padding() From 4b42bc257dfeefd3cb5f4aa62c95cd3174cbda8f Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 25 Jun 2024 18:55:43 -0700 Subject: [PATCH 22/29] Connect view cleanup --- Meshtastic/Views/Bluetooth/Connect.swift | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index b831c544..9da6f8f2 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -214,7 +214,6 @@ struct Connect: View { if let connectedPeripheral = bleManager.connectedPeripheral, connectedPeripheral.peripheral.state == CBPeripheralState.connected { bleManager.disconnectPeripheral() } - // clearCoreDataDatabase(context: context, includeRoutes: false) let container = NSPersistentContainer(name: "Meshtastic") guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { Logger.data.error("nil File path for back") @@ -223,17 +222,13 @@ struct Connect: View { do { try container.copyPersistentStores(to: url.appendingPathComponent("backup").appendingPathComponent("\(UserDefaults.preferredPeripheralNum)"), overwriting: true) Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") + clearCoreDataDatabase(context: context, includeRoutes: true) } catch { Logger.data.error("🗂️ Core data backup copy error: \(error, privacy: .public)") } - UserDefaults.preferredPeripheralId = selectedPeripherialId - let radio = bleManager.peripherals.first(where: { $0.peripheral.identifier.uuidString == selectedPeripherialId }) - if radio != nil { - bleManager.connectTo(peripheral: radio!.peripheral) - } - } else { - self.bleManager.connectTo(peripheral: peripheral.peripheral) } + UserDefaults.preferredPeripheralId = selectedPeripherialId + self.bleManager.connectTo(peripheral: peripheral.peripheral) }) { Text(peripheral.name).font(.callout) } From 9d964f161490892e38c2a70a5812816853b90179 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 25 Jun 2024 21:44:11 -0700 Subject: [PATCH 23/29] Backup and restore database --- Meshtastic/Helpers/BLEManager.swift | 2 -- Meshtastic/Views/Bluetooth/Connect.swift | 3 ++- Meshtastic/Views/Settings/AppData.swift | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index f9577c0d..07afc59f 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -645,10 +645,8 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate if FileManager.default.fileExists(atPath: databasePath.path) { do { disconnectPeripheral(reconnect: false) - clearCoreDataDatabase(context: context!, includeRoutes: true) try container.restorePersistentStore(from: databasePath) UserDefaults.preferredPeripheralNum = Int(myInfo?.myNodeNum ?? 0) - context!.reset() connectTo(peripheral: peripheral) Logger.data.notice("🗂️ Restored Core data for /\(UserDefaults.preferredPeripheralNum, privacy: .public)") } catch { diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 9da6f8f2..673e6a8d 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -221,8 +221,9 @@ struct Connect: View { } do { try container.copyPersistentStores(to: url.appendingPathComponent("backup").appendingPathComponent("\(UserDefaults.preferredPeripheralNum)"), overwriting: true) - Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") clearCoreDataDatabase(context: context, includeRoutes: true) + Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") + } catch { Logger.data.error("🗂️ Core data backup copy error: \(error, privacy: .public)") } diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift index 237fc197..9aa3f2ec 100644 --- a/Meshtastic/Views/Settings/AppData.swift +++ b/Meshtastic/Views/Settings/AppData.swift @@ -53,14 +53,15 @@ struct AppData: View { VStack(alignment: .leading ) { if file.pathExtension.contains("sqlite") { Label { - Text("Node Core Data Backup \(file.pathComponents[9])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") + Text("Node Core Data Backup \(file.pathComponents[10])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") .swipeActions { Button(role: .none) { bleManager.disconnectPeripheral(reconnect: false) let container = NSPersistentContainer(name: "Meshtastic") do { - context.reset() + clearCoreDataDatabase(context: context, includeRoutes: true) try container.restorePersistentStore(from: file.absoluteURL) + context.reset() UserDefaults.preferredPeripheralId = "" UserDefaults.preferredPeripheralNum = Int(file.pathComponents[10]) ?? 0 Logger.data.notice("🗂️ Restored a core data backup to backup/\(UserDefaults.preferredPeripheralNum, privacy: .public)") From 72cd6a8d019911e40b4ad18e8f518eeeb416d4dc Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 25 Jun 2024 22:34:58 -0700 Subject: [PATCH 24/29] Default app log fiters to not selected --- Meshtastic/Views/Settings/AppLog.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Meshtastic/Views/Settings/AppLog.swift b/Meshtastic/Views/Settings/AppLog.swift index 3348a62d..a3dcd59d 100644 --- a/Meshtastic/Views/Settings/AppLog.swift +++ b/Meshtastic/Views/Settings/AppLog.swift @@ -19,8 +19,8 @@ struct AppLog: View { @State private var selectedLog: OSLogEntryLog? @State private var presentingErrorDetails: Bool = false @State private var searchText = "" - @State private var categories: Set = [0, 1, 2, 3, 4, 5, 6] - @State private var levels: Set = [0, 1, 2, 3, 4] + @State private var categories: Set = [] + @State private var levels: Set = [] @State var isExporting = false @State var exportString = "" @State var isEditingFilters = false From fd90d26acdecb40f6a1667388121aae65d52f1b3 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 26 Jun 2024 09:31:37 -0700 Subject: [PATCH 25/29] use replace instead of migrate --- Meshtastic/Persistence/Persistence.swift | 108 ++++++++++++++++------- Meshtastic/Views/Bluetooth/Connect.swift | 1 - Meshtastic/Views/Settings/AppData.swift | 2 +- 3 files changed, 76 insertions(+), 35 deletions(-) diff --git a/Meshtastic/Persistence/Persistence.swift b/Meshtastic/Persistence/Persistence.swift index f085b5d7..b00f00a9 100644 --- a/Meshtastic/Persistence/Persistence.swift +++ b/Meshtastic/Persistence/Persistence.swift @@ -108,33 +108,76 @@ extension NSPersistentContainer { /// - Parameter backupURL: A file URL containing backup copies of all currently loaded persistent stores. /// - Throws: `CopyPersistentStoreError` in various situations. /// - Returns: Nothing. If no errors are thrown, the restore is complete. - func restorePersistentStore(from backupURL: URL) throws -> Void { - guard backupURL.isFileURL else { - throw CopyPersistentStoreErrors.invalidSource("Backup URL must be a file URL") - } +// func restorePersistentStore(from backupURL: URL) throws -> Void { +// guard backupURL.isFileURL else { +// throw CopyPersistentStoreErrors.invalidSource("Backup URL must be a file URL") +// } +// +// for persistentStoreDescription in persistentStoreDescriptions { +// guard let loadedStoreURL = persistentStoreDescription.url else { +// continue +// } +// guard FileManager.default.fileExists(atPath: backupURL.path) else { +// throw CopyPersistentStoreErrors.invalidSource("Missing backup store for \(backupURL)") +// } +// do { +// let storeOptions = persistentStoreDescription.options +// let configurationName = persistentStoreDescription.configuration +// let storeType = persistentStoreDescription.type +// +// // Replace the current store with the backup copy. This has a side effect of removing the current store from the Core Data stack. +// // When restoring, it's necessary to use the current persistent store coordinator. +// try persistentStoreCoordinator.replacePersistentStore(at: loadedStoreURL, destinationOptions: storeOptions, withPersistentStoreFrom: backupURL, sourceOptions: storeOptions, ofType: storeType) +// // Add the persistent store at the same location we've been using, because it was removed in the previous step. +// try persistentStoreCoordinator.addPersistentStore(ofType: storeType, configurationName: configurationName, at: loadedStoreURL, options: storeOptions) +// } catch { +// throw CopyPersistentStoreErrors.copyStoreError("Could not restore: \(error.localizedDescription)") +// } +// } +// } +// + /// Restore backup persistent stores located in the directory referenced by `backupURL`. + /// + /// **Be very careful with this**. To restore a persistent store, the current persistent store must be removed from the container. When that happens, **all currently loaded Core Data objects** will become invalid. Using them after restoring will cause your app to crash. When calling this method you **must** ensure that you do not continue to use any previously fetched managed objects or existing fetched results controllers. **If this method does not throw, that does not mean your app is safe.** You need to take extra steps to prevent crashes. The details vary depending on the nature of your app. + /// - Parameter backupURL: A file URL containing backup copies of all currently loaded persistent stores. + /// - Throws: `CopyPersistentStoreError` in various situations. + /// - Returns: Nothing. If no errors are thrown, the restore is complete. + func restorePersistentStore(from backupURL: URL) throws -> Void { + guard backupURL.isFileURL else { + throw CopyPersistentStoreErrors.invalidSource("Backup URL must be a file URL") + } + + var isDirectory: ObjCBool = false + if FileManager.default.fileExists(atPath: backupURL.path, isDirectory: &isDirectory) { + if !isDirectory.boolValue { + throw CopyPersistentStoreErrors.invalidSource("Source URL must be a directory") + } + } else { + throw CopyPersistentStoreErrors.invalidSource("Source URL must exist") + } - for persistentStoreDescription in persistentStoreDescriptions { - guard let loadedStoreURL = persistentStoreDescription.url else { - continue - } - guard FileManager.default.fileExists(atPath: backupURL.path) else { - throw CopyPersistentStoreErrors.invalidSource("Missing backup store for \(backupURL)") - } - do { - let storeOptions = persistentStoreDescription.options - let configurationName = persistentStoreDescription.configuration - let storeType = persistentStoreDescription.type - - // Replace the current store with the backup copy. This has a side effect of removing the current store from the Core Data stack. - // When restoring, it's necessary to use the current persistent store coordinator. - try persistentStoreCoordinator.replacePersistentStore(at: loadedStoreURL, destinationOptions: storeOptions, withPersistentStoreFrom: backupURL, sourceOptions: storeOptions, ofType: storeType) - // Add the persistent store at the same location we've been using, because it was removed in the previous step. - try persistentStoreCoordinator.addPersistentStore(ofType: storeType, configurationName: configurationName, at: loadedStoreURL, options: storeOptions) - } catch { - throw CopyPersistentStoreErrors.copyStoreError("Could not restore: \(error.localizedDescription)") - } - } - } + for persistentStoreDescription in persistentStoreDescriptions { + guard let loadedStoreURL = persistentStoreDescription.url else { + continue + } + let backupStoreURL = backupURL.appendingPathComponent(loadedStoreURL.lastPathComponent) + guard FileManager.default.fileExists(atPath: backupStoreURL.path) else { + throw CopyPersistentStoreErrors.invalidSource("Missing backup store for \(backupStoreURL)") + } + do { + let storeOptions = persistentStoreDescription.options + let configurationName = persistentStoreDescription.configuration + let storeType = persistentStoreDescription.type + // Replace the current store with the backup copy. This has a side effect of removing the current store from the Core Data stack. + // When restoring, it's necessary to use the current persistent store coordinator. + try persistentStoreCoordinator.replacePersistentStore(at: loadedStoreURL, destinationOptions: storeOptions, withPersistentStoreFrom: backupStoreURL, sourceOptions: storeOptions, ofType: storeType) + // Add the persistent store at the same location we've been using, because it was removed in the previous step. + try persistentStoreCoordinator.addPersistentStore(ofType: storeType, configurationName: configurationName, at: loadedStoreURL, options: storeOptions) + } catch { + throw CopyPersistentStoreErrors.copyStoreError("Could not restore: \(error.localizedDescription)") + } + } + } /// Copy all loaded persistent stores to a new directory. Each currently loaded file-based persistent store will be copied (including journal files, external binary storage, and anything else Core Data needs) into the destination directory to a persistent store with the same name and type as the existing store. In-memory stores, if any, are skipped. /// - Parameters: @@ -151,7 +194,6 @@ extension NSPersistentContainer { guard destinationURL.isFileURL else { throw CopyPersistentStoreErrors.invalidDestination("Destination URL must be a file URL") } - // If the destination exists and we aren't overwriting it, then it must be a directory. (If we are overwriting, we'll remove it anyway, so it doesn't matter whether it's a directory). var isDirectory: ObjCBool = false if !overwriting && FileManager.default.fileExists(atPath: destinationURL.path, isDirectory: &isDirectory) { @@ -168,7 +210,6 @@ extension NSPersistentContainer { throw CopyPersistentStoreErrors.destinationNotRemoved("Can't overwrite destination at \(destinationURL)") } } - // Create the destination directory do { try FileManager.default.createDirectory(at: destinationURL, withIntermediateDirectories: true, attributes: nil) @@ -183,16 +224,17 @@ extension NSPersistentContainer { guard persistentStoreDescription.type != NSInMemoryStoreType else { continue } - let temporaryPSC = NSPersistentStoreCoordinator(managedObjectModel: persistentStoreCoordinator.managedObjectModel) let destinationStoreURL = destinationURL.appendingPathComponent(storeURL.lastPathComponent) + if !overwriting && FileManager.default.fileExists(atPath: destinationStoreURL.path) { - // If the destination exists, the migratePersistentStore call will update it in place. That's fine unless we're not overwriting. + // If the destination exists, the replacePersistentStore call will update it in place. That's fine unless we're not overwriting. throw CopyPersistentStoreErrors.destinationError("Destination already exists at \(destinationStoreURL)") } do { - let newStore = try temporaryPSC.addPersistentStore(ofType: persistentStoreDescription.type, configurationName: persistentStoreDescription.configuration, at: persistentStoreDescription.url, options: persistentStoreDescription.options) - let _ = try temporaryPSC.migratePersistentStore(newStore, to: destinationStoreURL, options: persistentStoreDescription.options, withType: persistentStoreDescription.type) - + // Replace an existing backup, if any, with a new one with the same options and type. This doesn't affect the current Core Data stack. + // The function name says "replace", but it works if there's nothing at the destination yet. In that case it creates a new persistent store. + // Note that for backup, it doesn't matter if the persistent store coordinator is the one currently in use or a different one. It could be a class function, for this use. + try persistentStoreCoordinator.replacePersistentStore(at: destinationStoreURL, destinationOptions: persistentStoreDescription.options, withPersistentStoreFrom: storeURL, sourceOptions: persistentStoreDescription.options, ofType: persistentStoreDescription.type) /// Cleanup extra files let directory = destinationStoreURL.deletingLastPathComponent() /// Delete -wal file diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 673e6a8d..9405ad2d 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -221,7 +221,6 @@ struct Connect: View { } do { try container.copyPersistentStores(to: url.appendingPathComponent("backup").appendingPathComponent("\(UserDefaults.preferredPeripheralNum)"), overwriting: true) - clearCoreDataDatabase(context: context, includeRoutes: true) Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") } catch { diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift index 9aa3f2ec..e2fb4d66 100644 --- a/Meshtastic/Views/Settings/AppData.swift +++ b/Meshtastic/Views/Settings/AppData.swift @@ -53,7 +53,7 @@ struct AppData: View { VStack(alignment: .leading ) { if file.pathExtension.contains("sqlite") { Label { - Text("Node Core Data Backup \(file.pathComponents[10])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") + Text("Node Core Data Backup \(file.pathComponents[9])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") .swipeActions { Button(role: .none) { bleManager.disconnectPeripheral(reconnect: false) From 512f6b8c9e23461feee23b1fad76036d8650f77f Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Wed, 26 Jun 2024 15:12:24 -0700 Subject: [PATCH 26/29] assorted backup fixes --- Meshtastic/Helpers/BLEManager.swift | 2 ++ Meshtastic/Persistence/UpdateCoreData.swift | 2 +- Meshtastic/Views/Bluetooth/Connect.swift | 1 + Meshtastic/Views/Settings/AppData.swift | 7 ++++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index 07afc59f..a5dec13b 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -646,6 +646,8 @@ class BLEManager: NSObject, CBPeripheralDelegate, MqttClientProxyManagerDelegate do { disconnectPeripheral(reconnect: false) try container.restorePersistentStore(from: databasePath) + let request = MyInfoEntity.fetchRequest() + try context?.fetch(request) UserDefaults.preferredPeripheralNum = Int(myInfo?.myNodeNum ?? 0) connectTo(peripheral: peripheral) Logger.data.notice("🗂️ Restored Core data for /\(UserDefaults.preferredPeripheralNum, privacy: .public)") diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index c5be865b..db6d4cf4 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -200,7 +200,7 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext) } else { if packet.from > Int16.max { let newUser = createUser(num: Int64(packet.from), context: context) - fetchedNode[0].user = newUser + newNode.user = newUser } } diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index 9405ad2d..673e6a8d 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -221,6 +221,7 @@ struct Connect: View { } do { try container.copyPersistentStores(to: url.appendingPathComponent("backup").appendingPathComponent("\(UserDefaults.preferredPeripheralNum)"), overwriting: true) + clearCoreDataDatabase(context: context, includeRoutes: true) Logger.data.notice("🗂️ Made a core data backup to backup/\(UserDefaults.preferredPeripheralNum)") } catch { diff --git a/Meshtastic/Views/Settings/AppData.swift b/Meshtastic/Views/Settings/AppData.swift index e2fb4d66..dee18d9f 100644 --- a/Meshtastic/Views/Settings/AppData.swift +++ b/Meshtastic/Views/Settings/AppData.swift @@ -53,7 +53,7 @@ struct AppData: View { VStack(alignment: .leading ) { if file.pathExtension.contains("sqlite") { Label { - Text("Node Core Data Backup \(file.pathComponents[9])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") + Text("Node Core Data Backup \(file.pathComponents[(idiom == .phone || idiom == .pad) ? 9 : 10])/\(file.lastPathComponent) - \(file.creationDate?.formatted() ?? "") - \(file.fileSizeString)") .swipeActions { Button(role: .none) { bleManager.disconnectPeripheral(reconnect: false) @@ -61,9 +61,10 @@ struct AppData: View { do { clearCoreDataDatabase(context: context, includeRoutes: true) try container.restorePersistentStore(from: file.absoluteURL) - context.reset() + let request = MyInfoEntity.fetchRequest() + try context.fetch(request) UserDefaults.preferredPeripheralId = "" - UserDefaults.preferredPeripheralNum = Int(file.pathComponents[10]) ?? 0 + UserDefaults.preferredPeripheralNum = Int(file.pathComponents[(idiom == .phone || idiom == .pad) ? 9 : 10]) ?? 0 Logger.data.notice("🗂️ Restored a core data backup to backup/\(UserDefaults.preferredPeripheralNum, privacy: .public)") } catch { Logger.data.error("🗂️ Core data restore copy error: \(error, privacy: .public)") From 2795c4cf69e0e71626e186309ac742eb41f8d7bf Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Thu, 27 Jun 2024 07:40:31 -0700 Subject: [PATCH 27/29] Only allow 6 characters for call sign --- Meshtastic/Views/Settings/UserConfig.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meshtastic/Views/Settings/UserConfig.swift b/Meshtastic/Views/Settings/UserConfig.swift index e58d4c83..3db4665a 100644 --- a/Meshtastic/Views/Settings/UserConfig.swift +++ b/Meshtastic/Views/Settings/UserConfig.swift @@ -51,7 +51,7 @@ struct UserConfig: View { .onChange(of: longName, perform: { _ in let totalBytes = longName.utf8.count // Only mess with the value if it is too big - if totalBytes > (isLicensed ? 8 : 36) { + if totalBytes > (isLicensed ? 6 : 36) { longName = String(longName.dropLast()) } }) From 58da532d32a17bfad96c95c18abc1e637ced8af4 Mon Sep 17 00:00:00 2001 From: Blake McAnally Date: Fri, 7 Jun 2024 22:09:20 -0500 Subject: [PATCH 28/29] Extract the generated protobufs into its own Swift package This change modifies the process for generating and integrating the Meshtastic protobufs into the client application. * The generated Swift code is now in a local SPM package `MeshtasticProtobufs` * An Xcode Workspace file `Meshtastic.xcworkspace` was created to more easily manage the new build targets. * The code generation script for the protos was modified to generate the Swift code into the new location. * The README.md was updated to reflect these changes. NOTE: After merging this PR, do not open the project file `Meshtastic.xcodeproj`. You must use the workspace `Meshtastic.xcworkspace` Extracting out the generated protobuf code into its own library enables several opportunities for the project. This is just a first step, but with some more modularization, a standalone Apple Watch app or other targets starts to become a little bit more achievable to implement. After extracting the protobufs into a Swift package, I validate these changes by building and running the Meshtastic app to an iPhone 15 Pro Max, and tried changing some settings on a local node. I then messaged back and forth using two local nodes connected to two different iOS devices. --- .swiftlint.yml | 2 +- Meshtastic.xcodeproj/project.pbxproj | 307 +------ .../xcshareddata/swiftpm/Package.resolved | 6 +- .../xcschemes/WidgetsExtension.xcscheme | 1 - .../contents.xcworkspacedata | 13 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/swiftpm/Package.resolved | 51 ++ Meshtastic/Enums/BluetoothModes.swift | 1 + .../Enums/CannedMessagesConfigEnums.swift | 1 + Meshtastic/Enums/ChannelRoles.swift | 1 + Meshtastic/Enums/DeviceEnums.swift | 1 + Meshtastic/Enums/DisplayEnums.swift | 1 + Meshtastic/Enums/EthernetModes.swift | 1 + Meshtastic/Enums/LoraConfigEnums.swift | 1 + Meshtastic/Enums/PositionConfigEnums.swift | 1 + Meshtastic/Enums/RoutingError.swift | 1 + Meshtastic/Enums/SerialConfigEnums.swift | 1 + .../CoreData/ChannelEntityExtension.swift | 2 + .../DeviceMetadataEntityExtension.swift | 25 + ...nalNotificationConfigEntityExtension.swift | 44 + .../CoreData/MQTTConfigEntityExtension.swift | 38 + .../CoreData/PositionEntityExtension.swift | 1 + .../RangeTestConfigEntityExtension.swift | 20 + .../SerialConfigEntityExtension.swift | 28 + .../StoreForwardConfigEntityExtension.swift | 24 + .../CoreData/UserEntityExtension.swift | 1 + .../Protobufs/NodeInfoExtensions.swift | 12 + Meshtastic/Helpers/BLEManager.swift | 1 + Meshtastic/Helpers/Logger.swift | 19 + Meshtastic/Helpers/MeshPackets.swift | 1 + Meshtastic/Helpers/NetworkManager.swift | 28 - Meshtastic/Persistence/UpdateCoreData.swift | 33 +- .../Views/MapKitMap/WaypointFormMapKit.swift | 3 +- .../Views/Messages/ChannelMessageList.swift | 3 +- Meshtastic/Views/Messages/MessageText.swift | 3 +- .../Views/Nodes/DetectionSensorLog.swift | 1 + .../Nodes/Helpers/Map/WaypointForm.swift | 5 +- Meshtastic/Views/Settings/Channels.swift | 3 +- .../Settings/Config/BluetoothConfig.swift | 1 + .../Views/Settings/Config/DeviceConfig.swift | 4 +- .../Views/Settings/Config/DisplayConfig.swift | 3 +- .../Views/Settings/Config/LoRaConfig.swift | 1 + .../Config/Module/AmbientLightingConfig.swift | 3 +- .../Config/Module/CannedMessagesConfig.swift | 3 +- .../Config/Module/DetectionSensorConfig.swift | 3 +- .../Module/ExternalNotificationConfig.swift | 3 +- .../Settings/Config/Module/MQTTConfig.swift | 3 +- .../Config/Module/PaxCounterConfig.swift | 1 + .../Config/Module/RangeTestConfig.swift | 3 +- .../Settings/Config/Module/SerialConfig.swift | 3 +- .../Config/Module/StoreForwardConfig.swift | 4 +- .../Config/Module/TelemetryConfig.swift | 3 +- .../Views/Settings/Config/NetworkConfig.swift | 4 +- .../Settings/Config/PositionConfig.swift | 1 + .../Views/Settings/Config/PowerConfig.swift | 1 + Meshtastic/Views/Settings/ShareChannels.swift | 2 + Meshtastic/Views/Settings/UserConfig.swift | 3 +- MeshtasticProtobufs/.gitignore | 8 + MeshtasticProtobufs/Package.swift | 24 + .../Sources}/meshtastic/admin.pb.swift | 174 ++-- .../Sources}/meshtastic/apponly.pb.swift | 24 +- .../Sources}/meshtastic/atak.pb.swift | 188 ++-- .../meshtastic/cannedmessages.pb.swift | 18 +- .../Sources}/meshtastic/channel.pb.swift | 94 +- .../Sources}/meshtastic/clientonly.pb.swift | 46 +- .../Sources}/meshtastic/config.pb.swift | 507 ++++++----- .../meshtastic/connection_status.pb.swift | 154 ++-- .../Sources}/meshtastic/deviceonly.pb.swift | 200 ++--- .../Sources}/meshtastic/localonly.pb.swift | 156 ++-- .../Sources}/meshtastic/mesh.pb.swift | 828 +++++++++--------- .../meshtastic/module_config.pb.swift | 556 ++++++------ .../Sources}/meshtastic/mqtt.pb.swift | 68 +- .../Sources}/meshtastic/paxcount.pb.swift | 22 +- .../Sources}/meshtastic/portnums.pb.swift | 14 +- .../Sources}/meshtastic/powermon.pb.swift | 0 .../meshtastic/remote_hardware.pb.swift | 36 +- .../Sources}/meshtastic/rtttl.pb.swift | 18 +- .../Sources}/meshtastic/storeforward.pb.swift | 122 +-- .../Sources}/meshtastic/telemetry.pb.swift | 216 ++--- .../Sources}/meshtastic/xmodem.pb.swift | 38 +- MeshtasticTests/Info.plist | 22 - MeshtasticTests/MeshtasticTests.swift | 37 - MeshtasticUITests/Info.plist | 22 - MeshtasticUITests/MeshtasticUITests.swift | 42 - README.md | 52 +- gen_protos.sh => scripts/gen_protos.sh | 2 +- thebenternify.sh => scripts/thebenternify.sh | 0 .../unthebenternify.sh | 0 88 files changed, 2218 insertions(+), 2212 deletions(-) create mode 100644 Meshtastic.xcworkspace/contents.xcworkspacedata create mode 100644 Meshtastic.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Meshtastic.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 Meshtastic/Extensions/CoreData/DeviceMetadataEntityExtension.swift create mode 100644 Meshtastic/Extensions/CoreData/ExternalNotificationConfigEntityExtension.swift create mode 100644 Meshtastic/Extensions/CoreData/MQTTConfigEntityExtension.swift create mode 100644 Meshtastic/Extensions/CoreData/RangeTestConfigEntityExtension.swift create mode 100644 Meshtastic/Extensions/CoreData/SerialConfigEntityExtension.swift create mode 100644 Meshtastic/Extensions/CoreData/StoreForwardConfigEntityExtension.swift create mode 100644 Meshtastic/Extensions/Protobufs/NodeInfoExtensions.swift create mode 100644 Meshtastic/Helpers/Logger.swift delete mode 100644 Meshtastic/Helpers/NetworkManager.swift create mode 100644 MeshtasticProtobufs/.gitignore create mode 100644 MeshtasticProtobufs/Package.swift rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/admin.pb.swift (93%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/apponly.pb.swift (87%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/atak.pb.swift (81%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/cannedmessages.pb.swift (80%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/channel.pb.swift (85%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/clientonly.pb.swift (80%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/config.pb.swift (86%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/connection_status.pb.swift (76%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/deviceonly.pb.swift (84%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/localonly.pb.swift (82%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/mesh.pb.swift (88%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/module_config.pb.swift (83%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/mqtt.pb.swift (84%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/paxcount.pb.swift (83%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/portnums.pb.swift (97%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/powermon.pb.swift (100%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/remote_hardware.pb.swift (86%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/rtttl.pb.swift (81%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/storeforward.pb.swift (85%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/telemetry.pb.swift (85%) rename {Meshtastic/Protobufs => MeshtasticProtobufs/Sources}/meshtastic/xmodem.pb.swift (83%) delete mode 100644 MeshtasticTests/Info.plist delete mode 100644 MeshtasticTests/MeshtasticTests.swift delete mode 100644 MeshtasticUITests/Info.plist delete mode 100644 MeshtasticUITests/MeshtasticUITests.swift rename gen_protos.sh => scripts/gen_protos.sh (76%) rename thebenternify.sh => scripts/thebenternify.sh (100%) rename unthebenternify.sh => scripts/unthebenternify.sh (100%) diff --git a/.swiftlint.yml b/.swiftlint.yml index f5682e26..9471fd63 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,6 +1,6 @@ # Exclude automatically generated Swift files excluded: - - Meshtastic/Protobufs + - MeshtasticProtobufs line_length: 400 diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index 782719df..a068f0c9 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -3,10 +3,16 @@ archiveVersion = 1; classes = { }; - objectVersion = 55; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ + 259792252C2F114500AD1659 /* ChannelEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD58C5F12919AD3C00D5BEFB /* ChannelEntityExtension.swift */; }; + 259792262C2F114500AD1659 /* PositionEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5394FD276BA0EF00AD86B1 /* PositionEntityExtension.swift */; }; + 259792272C2F114500AD1659 /* TraceRouteEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDE5B4052B227E3200FCDD05 /* TraceRouteEntityExtension.swift */; }; + 259792282C2F114500AD1659 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25183D452C0A6D97001E31D5 /* Logger.swift */; }; + 25A978BA2C13F8ED0003AAE7 /* MeshtasticProtobufs in Frameworks */ = {isa = PBXBuildFile; productRef = 25A978B92C13F8ED0003AAE7 /* MeshtasticProtobufs */; }; + 25A978BC2C13F90D0003AAE7 /* MeshtasticProtobufs in Frameworks */ = {isa = PBXBuildFile; productRef = 25A978BB2C13F90D0003AAE7 /* MeshtasticProtobufs */; }; 6DA39D8E2A92DC52007E311C /* MeshtasticAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DA39D8D2A92DC52007E311C /* MeshtasticAppDelegate.swift */; }; 6DEDA55A2A957B8E00321D2E /* DetectionSensorLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DEDA5592A957B8E00321D2E /* DetectionSensorLog.swift */; }; 6DEDA55C2A9592F900321D2E /* MessageEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DEDA55B2A9592F900321D2E /* MessageEntityExtension.swift */; }; @@ -28,9 +34,6 @@ DD007BAE2AA4E91200F5FA12 /* MyInfoEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD007BAD2AA4E91200F5FA12 /* MyInfoEntityExtension.swift */; }; DD007BB02AA5981000F5FA12 /* NodeInfoEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD007BAF2AA5981000F5FA12 /* NodeInfoEntityExtension.swift */; }; DD0D3D222A55CEB10066DB71 /* CocoaMQTT in Frameworks */ = {isa = PBXBuildFile; productRef = DD0D3D212A55CEB10066DB71 /* CocoaMQTT */; }; - DD0E20FC2B87090400F2D100 /* atak.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20F92B87090400F2D100 /* atak.pb.swift */; }; - DD0E20FD2B87090400F2D100 /* clientonly.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20FA2B87090400F2D100 /* clientonly.pb.swift */; }; - DD0E20FE2B87090400F2D100 /* paxcount.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0E20FB2B87090400F2D100 /* paxcount.pb.swift */; }; DD0E21012B8A6F1300F2D100 /* DeviceHardware.json in Resources */ = {isa = PBXBuildFile; fileRef = DD0E21002B8A6BC500F2D100 /* DeviceHardware.json */; }; DD13AA492AB73BF400BA0C98 /* PositionPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD13AA482AB73BF400BA0C98 /* PositionPopover.swift */; }; DD15E4F32B8BA56E00654F61 /* PaxCounterConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD15E4F22B8BA56E00654F61 /* PaxCounterConfig.swift */; }; @@ -66,27 +69,7 @@ DD4975A52B147BA90026544E /* AmbientLightingConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4975A42B147BA90026544E /* AmbientLightingConfig.swift */; }; DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4A911D2708C65400501B7E /* AppSettings.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 */; }; - 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 */; }; - 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 */; }; DD5E523F298F5A9E00D21B61 /* AirQualityIndex.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5E523E298F5A9E00D21B61 /* AirQualityIndex.swift */; }; DD6193752862F6E600E59241 /* ExternalNotificationConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193742862F6E600E59241 /* ExternalNotificationConfig.swift */; }; DD6193772862F90F00E59241 /* CannedMessagesConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193762862F90F00E59241 /* CannedMessagesConfig.swift */; }; @@ -154,7 +137,6 @@ DDC2E15826CE248E0042C5E4 /* MeshtasticApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC2E15726CE248E0042C5E4 /* MeshtasticApp.swift */; }; DDC2E15C26CE248F0042C5E4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDC2E15B26CE248F0042C5E4 /* Assets.xcassets */; }; DDC2E15F26CE248F0042C5E4 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDC2E15E26CE248F0042C5E4 /* Preview Assets.xcassets */; }; - DDC2E17A26CE248F0042C5E4 /* MeshtasticUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC2E17926CE248F0042C5E4 /* MeshtasticUITests.swift */; }; DDC2E18F26CE25FE0042C5E4 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC2E18E26CE25FE0042C5E4 /* ContentView.swift */; }; DDC2E1A726CEB3400042C5E4 /* LocationHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC2E1A626CEB3400042C5E4 /* LocationHelper.swift */; }; DDC3B274283F411B00AC321C /* LastHeardText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC3B273283F411B00AC321C /* LastHeardText.swift */; }; @@ -180,7 +162,6 @@ DDDB26462AACC0B7003AFCB7 /* NodeInfoItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB26452AACC0B7003AFCB7 /* NodeInfoItem.swift */; }; DDDB26482AACD6D1003AFCB7 /* NodeMapMapkit.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB26472AACD6D1003AFCB7 /* NodeMapMapkit.swift */; }; DDDB443629F6287000EE2349 /* MapButtons.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB443529F6287000EE2349 /* MapButtons.swift */; }; - DDDB443D29F6592F00EE2349 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB443C29F6592F00EE2349 /* NetworkManager.swift */; }; DDDB444029F79AB000EE2349 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB443F29F79AB000EE2349 /* UserDefaults.swift */; }; DDDB444229F8A88700EE2349 /* Double.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB444129F8A88700EE2349 /* Double.swift */; }; DDDB444429F8A8DD00EE2349 /* Float.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDB444329F8A8DD00EE2349 /* Float.swift */; }; @@ -206,7 +187,6 @@ DDDE5A1429AFEAB900490C6C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDDE5A1229AFEAB900490C6C /* Assets.xcassets */; }; DDE0F7C5295F77B700B8AAB3 /* AppSettingsEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDE0F7C4295F77B700B8AAB3 /* AppSettingsEnums.swift */; }; DDE5B4042B2279A700FCDD05 /* TraceRouteLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDE5B4032B2279A700FCDD05 /* TraceRouteLog.swift */; }; - DDE5B4062B227E3200FCDD05 /* TraceRouteEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDE5B4052B227E3200FCDD05 /* TraceRouteEntityExtension.swift */; }; DDE9659C2B1C3B6A00531070 /* RouteRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDE9659B2B1C3B6A00531070 /* RouteRecorder.swift */; }; DDF45C342BC1A48E005ED5F2 /* MQTTIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDF45C332BC1A48E005ED5F2 /* MQTTIcon.swift */; }; DDF45C372BC46A5A005ED5F2 /* TimeZone.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDF45C362BC46A5A005ED5F2 /* TimeZone.swift */; }; @@ -217,13 +197,6 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - DDC2E17626CE248F0042C5E4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DDC2E14C26CE248E0042C5E4 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DDC2E15326CE248E0042C5E4; - remoteInfo = MeshtasticClient; - }; DDDE5A0129AF163E00490C6C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DDC2E14C26CE248E0042C5E4 /* Project object */; @@ -270,9 +243,6 @@ DD007BAD2AA4E91200F5FA12 /* MyInfoEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyInfoEntityExtension.swift; sourceTree = ""; }; DD007BAF2AA5981000F5FA12 /* NodeInfoEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeInfoEntityExtension.swift; sourceTree = ""; }; DD05296F2B77F454008E44CD /* MeshtasticDataModelV 26.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 26.xcdatamodel"; sourceTree = ""; }; - DD0E20F92B87090400F2D100 /* atak.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = atak.pb.swift; sourceTree = ""; }; - DD0E20FA2B87090400F2D100 /* clientonly.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = clientonly.pb.swift; sourceTree = ""; }; - DD0E20FB2B87090400F2D100 /* paxcount.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = paxcount.pb.swift; sourceTree = ""; }; DD0E20FF2B892E1300F2D100 /* MeshtasticDataModelV 28.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 28.xcdatamodel"; sourceTree = ""; }; DD0E21002B8A6BC500F2D100 /* DeviceHardware.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = DeviceHardware.json; sourceTree = ""; }; DD0E9C222A30CE3A00580CBB /* MeshtasticDataModelV14.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV14.xcdatamodel; sourceTree = ""; }; @@ -328,23 +298,6 @@ 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 = ""; }; - 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 = ""; }; DD5E523E298F5A9E00D21B61 /* AirQualityIndex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AirQualityIndex.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 = ""; }; @@ -423,10 +376,6 @@ DDC2E15B26CE248F0042C5E4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../Assets.xcassets; sourceTree = ""; }; DDC2E15E26CE248F0042C5E4 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; DDC2E16526CE248F0042C5E4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DDC2E17026CE248F0042C5E4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DDC2E17526CE248F0042C5E4 /* MeshtasticUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MeshtasticUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - DDC2E17926CE248F0042C5E4 /* MeshtasticUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshtasticUITests.swift; sourceTree = ""; }; - DDC2E17B26CE248F0042C5E4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DDC2E18E26CE25FE0042C5E4 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; DDC2E1A626CEB3400042C5E4 /* LocationHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationHelper.swift; sourceTree = ""; }; DDC3B273283F411B00AC321C /* LastHeardText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LastHeardText.swift; sourceTree = ""; }; @@ -442,7 +391,6 @@ DDCE4E2B2869F92900BE9F8F /* UserConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserConfig.swift; sourceTree = ""; }; DDD28D362C0CCCD10063CFA3 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Localizable.strings"; sourceTree = ""; }; DDD28D372C0CD2670063CFA3 /* MeshtasticDataModelV 37.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModelV 37.xcdatamodel"; sourceTree = ""; }; - DDD3BBD4292D763200D609B3 /* MeshtasticTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeshtasticTests.swift; sourceTree = ""; }; DDD43FE22A78C8900083A3E9 /* MqttClientProxyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MqttClientProxyManager.swift; sourceTree = ""; }; DDD5BB082C285DDC007E03CA /* AppLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLog.swift; sourceTree = ""; }; DDD5BB0A2C285E45007E03CA /* LogDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogDetail.swift; sourceTree = ""; }; @@ -460,7 +408,6 @@ DDDB26472AACD6D1003AFCB7 /* NodeMapMapkit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodeMapMapkit.swift; sourceTree = ""; }; DDDB26492AAD743E003AFCB7 /* MeshtasticDataModelV18.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticDataModelV18.xcdatamodel; sourceTree = ""; }; DDDB443529F6287000EE2349 /* MapButtons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapButtons.swift; sourceTree = ""; }; - DDDB443C29F6592F00EE2349 /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; DDDB443F29F79AB000EE2349 /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = ""; }; DDDB444129F8A88700EE2349 /* Double.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Double.swift; sourceTree = ""; }; DDDB444329F8A8DD00EE2349 /* Float.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Float.swift; sourceTree = ""; }; @@ -510,16 +457,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 25A978BA2C13F8ED0003AAE7 /* MeshtasticProtobufs in Frameworks */, C9697FA527933B8C00250207 /* SQLite in Frameworks */, DD0D3D222A55CEB10066DB71 /* CocoaMQTT in Frameworks */, - DD5394FC276993AD00AD86B1 /* SwiftProtobuf in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DDC2E17226CE248F0042C5E4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( ); runOnlyForDeploymentPostprocessing = 0; }; @@ -529,6 +469,7 @@ files = ( DDDE59F629AF163D00490C6C /* SwiftUI.framework in Frameworks */, DDDE59F529AF163D00490C6C /* WidgetKit.framework in Frameworks */, + 25A978BC2C13F90D0003AAE7 /* MeshtasticProtobufs in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -635,33 +576,6 @@ path = Settings; sourceTree = ""; }; - DD5E51EF298EE33B00D21B61 /* meshtastic */ = { - isa = PBXGroup; - children = ( - DD0E20F92B87090400F2D100 /* atak.pb.swift */, - DD0E20FA2B87090400F2D100 /* clientonly.pb.swift */, - DD0E20FB2B87090400F2D100 /* paxcount.pb.swift */, - 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 */, - 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 = ""; - }; DD5E523D298F5A7D00D21B61 /* Weather */ = { isa = PBXGroup; children = ( @@ -783,14 +697,6 @@ path = Map; sourceTree = ""; }; - DDAF8C5626ED07740058C060 /* Protobufs */ = { - isa = PBXGroup; - children = ( - DD5E51EF298EE33B00D21B61 /* meshtastic */, - ); - path = Protobufs; - sourceTree = ""; - }; DDB75A122A0593CD006ED576 /* Map */ = { isa = PBXGroup; children = ( @@ -807,8 +713,6 @@ DDCDC6CD29481FCC004C1DDA /* Localizable.strings */, DD3CC6BA28E366DF00FA9159 /* Meshtastic.xcdatamodeld */, DDC2E15626CE248E0042C5E4 /* Meshtastic */, - DDC2E16D26CE248F0042C5E4 /* MeshtasticTests */, - DDC2E17826CE248F0042C5E4 /* MeshtasticUITests */, DDDE59F729AF163D00490C6C /* Widgets */, DDC2E15526CE248E0042C5E4 /* Products */, DD8EDE9226F97A2B00A5A10B /* Frameworks */, @@ -820,7 +724,6 @@ isa = PBXGroup; children = ( DDC2E15426CE248E0042C5E4 /* Meshtastic.app */, - DDC2E17526CE248F0042C5E4 /* MeshtasticUITests.xctest */, DDDE59F429AF163D00490C6C /* WidgetsExtension.appex */, ); name = Products; @@ -837,7 +740,6 @@ DDC2E1A526CEB32B0042C5E4 /* Helpers */, DDC2E18826CE24EE0042C5E4 /* Model */, DDC4D5662754996200A4208E /* Persistence */, - DDAF8C5626ED07740058C060 /* Protobufs */, DDC2E18926CE24F70042C5E4 /* Resources */, DDC2E18726CE24E40042C5E4 /* Views */, DDC2E15726CE248E0042C5E4 /* MeshtasticApp.swift */, @@ -856,24 +758,6 @@ path = "Preview Content"; sourceTree = ""; }; - DDC2E16D26CE248F0042C5E4 /* MeshtasticTests */ = { - isa = PBXGroup; - children = ( - DDD3BBD4292D763200D609B3 /* MeshtasticTests.swift */, - DDC2E17026CE248F0042C5E4 /* Info.plist */, - ); - path = MeshtasticTests; - sourceTree = ""; - }; - DDC2E17826CE248F0042C5E4 /* MeshtasticUITests */ = { - isa = PBXGroup; - children = ( - DDC2E17926CE248F0042C5E4 /* MeshtasticUITests.swift */, - DDC2E17B26CE248F0042C5E4 /* Info.plist */, - ); - path = MeshtasticUITests; - sourceTree = ""; - }; DDC2E18726CE24E40042C5E4 /* Views */ = { isa = PBXGroup; children = ( @@ -954,7 +838,6 @@ DD8169F8271F1A6100F4AB02 /* MeshLogger.swift */, DDA6B2E828419CF2003E8C16 /* MeshPackets.swift */, DD964FBC296E6B01007C176F /* EmojiOnlyTextField.swift */, - DDDB443C29F6592F00EE2349 /* NetworkManager.swift */, DD3619142B1EF9F900C41C8C /* LocationsHandler.swift */, ); path = Helpers; @@ -1068,32 +951,14 @@ ); name = Meshtastic; packageProductDependencies = ( - DD5394FB276993AD00AD86B1 /* SwiftProtobuf */, C9697FA427933B8C00250207 /* SQLite */, DD0D3D212A55CEB10066DB71 /* CocoaMQTT */, + 25A978B92C13F8ED0003AAE7 /* MeshtasticProtobufs */, ); productName = MeshtasticClient; productReference = DDC2E15426CE248E0042C5E4 /* Meshtastic.app */; productType = "com.apple.product-type.application"; }; - DDC2E17426CE248F0042C5E4 /* MeshtasticUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = DDC2E18426CE248F0042C5E4 /* Build configuration list for PBXNativeTarget "MeshtasticUITests" */; - buildPhases = ( - DDC2E17126CE248F0042C5E4 /* Sources */, - DDC2E17226CE248F0042C5E4 /* Frameworks */, - DDC2E17326CE248F0042C5E4 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DDC2E17726CE248F0042C5E4 /* PBXTargetDependency */, - ); - name = MeshtasticUITests; - productName = MeshtasticClientUITests; - productReference = DDC2E17526CE248F0042C5E4 /* MeshtasticUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; DDDE59F329AF163D00490C6C /* WidgetsExtension */ = { isa = PBXNativeTarget; buildConfigurationList = DDDE5A0529AF163F00490C6C /* Build configuration list for PBXNativeTarget "WidgetsExtension" */; @@ -1107,6 +972,9 @@ dependencies = ( ); name = WidgetsExtension; + packageProductDependencies = ( + 25A978BB2C13F90D0003AAE7 /* MeshtasticProtobufs */, + ); productName = WidgetsExtension; productReference = DDDE59F429AF163D00490C6C /* WidgetsExtension.appex */; productType = "com.apple.product-type.app-extension"; @@ -1125,10 +993,6 @@ CreatedOnToolsVersion = 12.5.1; LastSwiftMigration = 1340; }; - DDC2E17426CE248F0042C5E4 = { - CreatedOnToolsVersion = 12.5.1; - TestTargetID = DDC2E15326CE248E0042C5E4; - }; DDDE59F329AF163D00490C6C = { CreatedOnToolsVersion = 14.2; }; @@ -1152,16 +1016,16 @@ ); mainGroup = DDC2E14B26CE248E0042C5E4; packageReferences = ( - DD5394FA276993AD00AD86B1 /* XCRemoteSwiftPackageReference "swift-protobuf" */, C9697FA327933B8C00250207 /* XCRemoteSwiftPackageReference "SQLite.swift" */, DD0D3D202A55CEB10066DB71 /* XCRemoteSwiftPackageReference "CocoaMQTT" */, + 25A978B82C13F8ED0003AAE7 /* XCLocalSwiftPackageReference "MeshtasticProtobufs" */, + 259792242C2F10B600AD1659 /* XCRemoteSwiftPackageReference "swift-protobuf" */, ); productRefGroup = DDC2E15526CE248E0042C5E4 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( DDC2E15326CE248E0042C5E4 /* Meshtastic */, - DDC2E17426CE248F0042C5E4 /* MeshtasticUITests */, DDDE59F329AF163D00490C6C /* WidgetsExtension */, ); }; @@ -1182,13 +1046,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - DDC2E17326CE248F0042C5E4 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; DDDE59F229AF163D00490C6C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1225,14 +1082,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 259792252C2F114500AD1659 /* ChannelEntityExtension.swift in Sources */, + 259792262C2F114500AD1659 /* PositionEntityExtension.swift in Sources */, + 259792272C2F114500AD1659 /* TraceRouteEntityExtension.swift in Sources */, + 259792282C2F114500AD1659 /* Logger.swift in Sources */, DDDB444829F8A9C900EE2349 /* String.swift in Sources */, DDFFA7472B3A7F3C004730DB /* Bundle.swift in Sources */, - DD5E520C298EE33B00D21B61 /* portnums.pb.swift in Sources */, DD457188293C7E63000C49FB /* BLESignalStrengthIndicator.swift in Sources */, DDA9515C2BC6631200CEA535 /* TelemetryEnums.swift in Sources */, DDFEB3BB29900C1200EE7472 /* CurrentConditionsCompact.swift in Sources */, DD836AE726F6B38600ABCC23 /* Connect.swift in Sources */, - DD0E20FD2B87090400F2D100 /* clientonly.pb.swift in Sources */, D93069082B81DF040066FBC8 /* SaveConfigButton.swift in Sources */, DD5E523F298F5A9E00D21B61 /* AirQualityIndex.swift in Sources */, DD964FBF296E76EF007C176F /* WaypointFormMapKit.swift in Sources */, @@ -1241,10 +1100,8 @@ DDDB443629F6287000EE2349 /* MapButtons.swift in Sources */, DD5D0A9C2931B9F200F7EA61 /* EthernetModes.swift in Sources */, 6DEDA55A2A957B8E00321D2E /* DetectionSensorLog.swift in Sources */, - DD5E5203298EE33B00D21B61 /* config.pb.swift in Sources */, DD798B072915928D005217CD /* ChannelMessageList.swift in Sources */, DDC2E1A726CEB3400042C5E4 /* LocationHelper.swift in Sources */, - DD5394FE276BA0EF00AD86B1 /* PositionEntityExtension.swift in Sources */, DD77093D2AA1AFA3007A8BF0 /* ChannelTips.swift in Sources */, DD913639270DFF4C00D7ACF3 /* LocalNotificationManager.swift in Sources */, DDDB444C29F8AAA600EE2349 /* Color.swift in Sources */, @@ -1274,10 +1131,7 @@ DDDB445429F8AD1600EE2349 /* Data.swift in Sources */, DDDB26462AACC0B7003AFCB7 /* NodeInfoItem.swift in Sources */, DD2AD8A8296D2DF9001FF0E7 /* MapViewSwiftUI.swift in Sources */, - DD5E5213298EE33B00D21B61 /* deviceonly.pb.swift in Sources */, DDE5B4042B2279A700FCDD05 /* TraceRouteLog.swift in Sources */, - DD5E5208298EE33B00D21B61 /* rtttl.pb.swift in Sources */, - DDD5BB0D2C285F00007E03CA /* Logger.swift in Sources */, DD6193792863875F00E59241 /* SerialConfig.swift in Sources */, DDDB263F2AABEE20003AFCB7 /* NodeList.swift in Sources */, DDD5BB0B2C285E45007E03CA /* LogDetail.swift in Sources */, @@ -1287,12 +1141,10 @@ DDB8F4102A9EE5B400230ECE /* Messages.swift in Sources */, DDDB26482AACD6D1003AFCB7 /* NodeMapMapkit.swift in Sources */, DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */, - DD5E5209298EE33B00D21B61 /* module_config.pb.swift in Sources */, DD2160AF28C5552500C17253 /* MQTTConfig.swift in Sources */, DD13AA492AB73BF400BA0C98 /* PositionPopover.swift in Sources */, 6DEDA55C2A9592F900321D2E /* MessageEntityExtension.swift in Sources */, DDDB444229F8A88700EE2349 /* Double.swift in Sources */, - DD5E520F298EE33B00D21B61 /* cannedmessages.pb.swift in Sources */, DDF45C342BC1A48E005ED5F2 /* MQTTIcon.swift in Sources */, DDA9515A2BC6624100CEA535 /* TelemetryWeather.swift in Sources */, DDB75A232A13CDA9006ED576 /* BatteryLevelCompact.swift in Sources */, @@ -1308,7 +1160,6 @@ DD33DB622B3D27C7003E1EA0 /* FirmwareApi.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 */, @@ -1316,19 +1167,14 @@ DDD43FE32A78C8900083A3E9 /* MqttClientProxyManager.swift in Sources */, DD007BB02AA5981000F5FA12 /* NodeInfoEntityExtension.swift in Sources */, DDDB26422AABF655003AFCB7 /* NodeListItem.swift in Sources */, - DD0E20FC2B87090400F2D100 /* atak.pb.swift in Sources */, DDDB444629F8A96500EE2349 /* Character.swift in Sources */, DD23A50F26FD1B4400D9B90C /* PeripheralModel.swift in Sources */, DDB6ABDB28B0AC6000384BA1 /* DistanceText.swift in Sources */, - DD5E520D298EE33B00D21B61 /* storeforward.pb.swift in Sources */, - DDD5BB162C28B1E4007E03CA /* AppData.swift in Sources */, DD94B7402ACCE3BE00DCD1D1 /* MapSettingsForm.swift in Sources */, DD964FC2297272AE007C176F /* WaypointEntityExtension.swift in Sources */, 6DA39D8E2A92DC52007E311C /* MeshtasticAppDelegate.swift in Sources */, D93068DB2B81C85E0066FBC8 /* PowerConfig.swift in Sources */, D93068D32B8129510066FBC8 /* MessageContextMenuItems.swift in Sources */, - DD0E20FE2B87090400F2D100 /* paxcount.pb.swift in Sources */, - DD5E520A298EE33B00D21B61 /* channel.pb.swift in Sources */, DD8EBF43285058FA00426DCA /* DisplayConfig.swift in Sources */, DD964FC42974767D007C176F /* MapViewFitExtension.swift in Sources */, DD47E3D626F17ED900029299 /* CircleText.swift in Sources */, @@ -1346,7 +1192,6 @@ D9BC22DB2B7DE8E2006A37D5 /* TileDownloadStatus.swift in Sources */, DDD5BB092C285DDC007E03CA /* AppLog.swift in Sources */, DD8ED9C8289CE4B900B3B0AB /* RoutingError.swift in Sources */, - DD5E5202298EE33B00D21B61 /* admin.pb.swift in Sources */, DDC1B81A2AB5377B00C71E39 /* MessagesTips.swift in Sources */, DD964FC62975DBFD007C176F /* QueryCoreData.swift in Sources */, DDB75A112A059258006ED576 /* Url.swift in Sources */, @@ -1373,33 +1218,26 @@ D93068D92B81509C0066FBC8 /* TapbackResponses.swift in Sources */, DD86D40A287F04F100BAEB7A /* InvalidVersion.swift in Sources */, DDD94A502845C8F5004A87A0 /* DateTimeText.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 */, DDDCD5702BB26F5C00BE6B60 /* NodeListFilter.swift in Sources */, DD1933762B0835D500771CD5 /* PositionAltitudeChart.swift in Sources */, DD415828285859C4009B0E59 /* TelemetryConfig.swift in Sources */, - DDDB443D29F6592F00EE2349 /* NetworkManager.swift in Sources */, DDB6CCFB2AAF805100945AF6 /* NodeMapSwiftUI.swift in Sources */, DD73FD1128750779000852D6 /* PositionLog.swift in Sources */, - DD5E5206298EE33B00D21B61 /* localonly.pb.swift in Sources */, DD15E4F52B8BFC8E00654F61 /* PaxCounterLog.swift in Sources */, DD3CC6C028E7A60700FA9159 /* MessagingEnums.swift in Sources */, DD97E96628EFD9820056DDA4 /* MeshtasticLogo.swift in Sources */, DDAB580D2B0DAA9E00147258 /* Routes.swift in Sources */, C9697F9D279336B700250207 /* LocalMBTileOverlay.swift in Sources */, D93068D52B812B700066FBC8 /* MessageDestination.swift in Sources */, - DD58C5F22919AD3C00D5BEFB /* ChannelEntityExtension.swift in Sources */, DDA9515E2BC6F56F00CEA535 /* IndoorAirQuality.swift in Sources */, DDDB444E29F8AB0E00EE2349 /* Int.swift in Sources */, DD3CC6BC28E366DF00FA9159 /* Meshtastic.xcdatamodeld in Sources */, DDC4C9FF2A8D982900CE201C /* DetectionSensorConfig.swift in Sources */, D9C983A22B79D1A600BDBE6A /* RequestPositionButton.swift in Sources */, DDDB26442AAC0206003AFCB7 /* NodeDetail.swift in Sources */, - DD5E5210298EE33B00D21B61 /* telemetry.pb.swift in Sources */, DD77093F2AA1B146007A8BF0 /* UIColor.swift in Sources */, - DD5E5205298EE33B00D21B61 /* mesh.pb.swift in Sources */, DDF6B2482A9AEBF500BA6931 /* StoreForwardConfig.swift in Sources */, DD8169F9271F1A6100F4AB02 /* MeshLogger.swift in Sources */, DD93800B2BA3F968008BEC06 /* NodeMapContent.swift in Sources */, @@ -1408,22 +1246,11 @@ DDDB444429F8A8DD00EE2349 /* Float.swift in Sources */, DDAB580F2B0DAFBC00147258 /* LocationEntityExtension.swift in Sources */, B3E905B12B71F7F300654D07 /* TextMessageField.swift in Sources */, - DD5E5211298EE33B00D21B61 /* remote_hardware.pb.swift in Sources */, D93068D72B8146690066FBC8 /* MessageText.swift in Sources */, - DD5E5204298EE33B00D21B61 /* xmodem.pb.swift in Sources */, - DDE5B4062B227E3200FCDD05 /* TraceRouteEntityExtension.swift in Sources */, DDC2E15826CE248E0042C5E4 /* MeshtasticApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - DDC2E17126CE248F0042C5E4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DDC2E17A26CE248F0042C5E4 /* MeshtasticUITests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; DDDE59F029AF163D00490C6C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1438,11 +1265,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - DDC2E17726CE248F0042C5E4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DDC2E15326CE248E0042C5E4 /* Meshtastic */; - targetProxy = DDC2E17626CE248F0042C5E4 /* PBXContainerItemProxy */; - }; DDDE5A0229AF163E00490C6C /* PBXTargetDependency */ = { isa = PBXTargetDependency; platformFilter = ios; @@ -1645,12 +1467,12 @@ INFOPLIST_FILE = Meshtastic/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Meshtastic; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - IPHONEOS_DEPLOYMENT_TARGET = 16.6; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.3.11; + MARKETING_VERSION = 2.3.12; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -1660,48 +1482,6 @@ }; name = Release; }; - DDC2E18526CE248F0042C5E4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = GCH7VS5Y9R; - INFOPLIST_FILE = MeshtasticUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = Meshtastic; - }; - name = Debug; - }; - DDC2E18626CE248F0042C5E4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = GCH7VS5Y9R; - INFOPLIST_FILE = MeshtasticUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.2; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticUITests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = Meshtastic; - }; - name = Release; - }; DDDE5A0629AF163F00490C6C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1789,15 +1569,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - DDC2E18426CE248F0042C5E4 /* Build configuration list for PBXNativeTarget "MeshtasticUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DDC2E18526CE248F0042C5E4 /* Debug */, - DDC2E18626CE248F0042C5E4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; DDDE5A0529AF163F00490C6C /* Build configuration list for PBXNativeTarget "WidgetsExtension" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1809,7 +1580,22 @@ }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 25A978B82C13F8ED0003AAE7 /* XCLocalSwiftPackageReference "MeshtasticProtobufs" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = MeshtasticProtobufs; + }; +/* End XCLocalSwiftPackageReference section */ + /* Begin XCRemoteSwiftPackageReference section */ + 259792242C2F10B600AD1659 /* XCRemoteSwiftPackageReference "swift-protobuf" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/apple/swift-protobuf.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 1.26.0; + }; + }; C9697FA327933B8C00250207 /* XCRemoteSwiftPackageReference "SQLite.swift" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/stephencelis/SQLite.swift.git"; @@ -1826,17 +1612,17 @@ minimumVersion = 2.0.0; }; }; - DD5394FA276993AD00AD86B1 /* XCRemoteSwiftPackageReference "swift-protobuf" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/apple/swift-protobuf.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 1.19.0; - }; - }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + 25A978B92C13F8ED0003AAE7 /* MeshtasticProtobufs */ = { + isa = XCSwiftPackageProductDependency; + productName = MeshtasticProtobufs; + }; + 25A978BB2C13F90D0003AAE7 /* MeshtasticProtobufs */ = { + isa = XCSwiftPackageProductDependency; + productName = MeshtasticProtobufs; + }; C9697FA427933B8C00250207 /* SQLite */ = { isa = XCSwiftPackageProductDependency; package = C9697FA327933B8C00250207 /* XCRemoteSwiftPackageReference "SQLite.swift" */; @@ -1847,11 +1633,6 @@ package = DD0D3D202A55CEB10066DB71 /* XCRemoteSwiftPackageReference "CocoaMQTT" */; productName = CocoaMQTT; }; - DD5394FB276993AD00AD86B1 /* SwiftProtobuf */ = { - isa = XCSwiftPackageProductDependency; - package = DD5394FA276993AD00AD86B1 /* XCRemoteSwiftPackageReference "swift-protobuf" */; - productName = SwiftProtobuf; - }; /* End XCSwiftPackageProductDependency section */ /* Begin XCVersionGroup section */ diff --git a/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a62998be..d528f985 100644 --- a/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Meshtastic.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "e9855e3a299c14a10f11ee0b8f29e4170b09548533939361223a0f50e7caac8c", + "originHash" : "2d0b85469585b0d6079eac292d63864096062c24848a49380b9d9727f0ceb96c", "pins" : [ { "identity" : "cocoamqtt", @@ -42,8 +42,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "ce20dc083ee485524b802669890291c0d8090170", - "version" : "1.22.1" + "revision" : "9f0c76544701845ad98716f3f6a774a892152bcb", + "version" : "1.26.0" } } ], diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/WidgetsExtension.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/WidgetsExtension.xcscheme index decd8381..880339bc 100644 --- a/Meshtastic.xcodeproj/xcshareddata/xcschemes/WidgetsExtension.xcscheme +++ b/Meshtastic.xcodeproj/xcshareddata/xcschemes/WidgetsExtension.xcscheme @@ -89,7 +89,6 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES" - askForAppToLaunch = "Yes" launchAutomaticallySubstyle = "2"> diff --git a/Meshtastic.xcworkspace/contents.xcworkspacedata b/Meshtastic.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..3ffc9ac6 --- /dev/null +++ b/Meshtastic.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/Meshtastic.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Meshtastic.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Meshtastic.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Meshtastic.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Meshtastic.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 00000000..de090023 --- /dev/null +++ b/Meshtastic.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,51 @@ +{ + "originHash" : "a8b652cbdc560223dff5bdd094d446cf377b06bd42ce7a7bc4c008a659f0097d", + "pins" : [ + { + "identity" : "cocoamqtt", + "kind" : "remoteSourceControl", + "location" : "https://github.com/emqx/CocoaMQTT", + "state" : { + "revision" : "aff43422925cc30b9af319f4c4dce4f52859baf4", + "version" : "2.1.8" + } + }, + { + "identity" : "mqttcocoaasyncsocket", + "kind" : "remoteSourceControl", + "location" : "https://github.com/leeway1208/MqttCocoaAsyncSocket", + "state" : { + "revision" : "ce3e18607fd01079495f86ff6195d8a3ca469f73", + "version" : "1.0.8" + } + }, + { + "identity" : "sqlite.swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stephencelis/SQLite.swift.git", + "state" : { + "revision" : "a95fc6df17d108bd99210db5e8a9bac90fe984b8", + "version" : "0.15.3" + } + }, + { + "identity" : "starscream", + "kind" : "remoteSourceControl", + "location" : "https://github.com/daltoniam/Starscream.git", + "state" : { + "revision" : "c6bfd1af48efcc9a9ad203665db12375ba6b145a", + "version" : "4.0.8" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "9f0c76544701845ad98716f3f6a774a892152bcb", + "version" : "1.26.0" + } + } + ], + "version" : 3 +} diff --git a/Meshtastic/Enums/BluetoothModes.swift b/Meshtastic/Enums/BluetoothModes.swift index d8d7bdf2..c4bdad40 100644 --- a/Meshtastic/Enums/BluetoothModes.swift +++ b/Meshtastic/Enums/BluetoothModes.swift @@ -5,6 +5,7 @@ // Copyright(c) Garth Vander Houwen 8/19/22. // import Foundation +import MeshtasticProtobufs enum BluetoothModes: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/CannedMessagesConfigEnums.swift b/Meshtastic/Enums/CannedMessagesConfigEnums.swift index cb32f06d..f197eced 100644 --- a/Meshtastic/Enums/CannedMessagesConfigEnums.swift +++ b/Meshtastic/Enums/CannedMessagesConfigEnums.swift @@ -5,6 +5,7 @@ // Copyright(c) Garth Vander Houwen 9/10/22. // import Foundation +import MeshtasticProtobufs // Default of 0 is unset enum ConfigPresets: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/ChannelRoles.swift b/Meshtastic/Enums/ChannelRoles.swift index 0a1e349e..186cff0b 100644 --- a/Meshtastic/Enums/ChannelRoles.swift +++ b/Meshtastic/Enums/ChannelRoles.swift @@ -5,6 +5,7 @@ // Copyright(c) Garth Vander Houwen 9/21/22. // import Foundation +import MeshtasticProtobufs // Default of 0 is Client enum ChannelRoles: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/DeviceEnums.swift b/Meshtastic/Enums/DeviceEnums.swift index a17144fa..5c980da0 100644 --- a/Meshtastic/Enums/DeviceEnums.swift +++ b/Meshtastic/Enums/DeviceEnums.swift @@ -6,6 +6,7 @@ // import Foundation +import MeshtasticProtobufs // Default of 0 is Client enum DeviceRoles: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/DisplayEnums.swift b/Meshtastic/Enums/DisplayEnums.swift index afecb6ec..a540a9d2 100644 --- a/Meshtastic/Enums/DisplayEnums.swift +++ b/Meshtastic/Enums/DisplayEnums.swift @@ -6,6 +6,7 @@ // import Foundation +import MeshtasticProtobufs enum ScreenUnits: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/EthernetModes.swift b/Meshtastic/Enums/EthernetModes.swift index beff9ea0..9d5207ab 100644 --- a/Meshtastic/Enums/EthernetModes.swift +++ b/Meshtastic/Enums/EthernetModes.swift @@ -6,6 +6,7 @@ // import Foundation +import MeshtasticProtobufs enum EthernetMode: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/LoraConfigEnums.swift b/Meshtastic/Enums/LoraConfigEnums.swift index 6954dfac..7da6268e 100644 --- a/Meshtastic/Enums/LoraConfigEnums.swift +++ b/Meshtastic/Enums/LoraConfigEnums.swift @@ -6,6 +6,7 @@ // import Foundation +import MeshtasticProtobufs enum RegionCodes: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/PositionConfigEnums.swift b/Meshtastic/Enums/PositionConfigEnums.swift index 71b6727f..4853d050 100644 --- a/Meshtastic/Enums/PositionConfigEnums.swift +++ b/Meshtastic/Enums/PositionConfigEnums.swift @@ -6,6 +6,7 @@ // import Foundation +import MeshtasticProtobufs enum GpsFormats: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/RoutingError.swift b/Meshtastic/Enums/RoutingError.swift index 9659d8e1..0773265b 100644 --- a/Meshtastic/Enums/RoutingError.swift +++ b/Meshtastic/Enums/RoutingError.swift @@ -5,6 +5,7 @@ // Copyright(c) Garth Vander Houwen 8/4/22. // import Foundation +import MeshtasticProtobufs enum RoutingError: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Enums/SerialConfigEnums.swift b/Meshtastic/Enums/SerialConfigEnums.swift index 046860f9..ff937207 100644 --- a/Meshtastic/Enums/SerialConfigEnums.swift +++ b/Meshtastic/Enums/SerialConfigEnums.swift @@ -5,6 +5,7 @@ // Copyright(c) Garth Vander Houwen 9/10/22. // import Foundation +import MeshtasticProtobufs enum SerialBaudRates: Int, CaseIterable, Identifiable { diff --git a/Meshtastic/Extensions/CoreData/ChannelEntityExtension.swift b/Meshtastic/Extensions/CoreData/ChannelEntityExtension.swift index 2568943a..62f7eff0 100644 --- a/Meshtastic/Extensions/CoreData/ChannelEntityExtension.swift +++ b/Meshtastic/Extensions/CoreData/ChannelEntityExtension.swift @@ -5,6 +5,8 @@ // Copyright(c) Garth Vander Houwen 11/7/22. // import Foundation +import CoreData +import MeshtasticProtobufs extension ChannelEntity { diff --git a/Meshtastic/Extensions/CoreData/DeviceMetadataEntityExtension.swift b/Meshtastic/Extensions/CoreData/DeviceMetadataEntityExtension.swift new file mode 100644 index 00000000..d505c4d9 --- /dev/null +++ b/Meshtastic/Extensions/CoreData/DeviceMetadataEntityExtension.swift @@ -0,0 +1,25 @@ +import Foundation +import CoreData +import MeshtasticProtobufs + +extension DeviceMetadataEntity { + convenience init( + context: NSManagedObjectContext, + metadata: DeviceMetadata + ) { + self.init(context: context) + self.time = Date() + self.deviceStateVersion = Int32(metadata.deviceStateVersion) + self.canShutdown = metadata.canShutdown + self.hasWifi = metadata.hasWifi_p + self.hasBluetooth = metadata.hasBluetooth_p + self.hasEthernet = metadata.hasEthernet_p + self.role = Int32(metadata.role.rawValue) + self.positionFlags = Int32(metadata.positionFlags) + // Swift does strings weird, this does work to get the version without the github hash + let lastDotIndex = metadata.firmwareVersion.lastIndex(of: ".") + var version = metadata.firmwareVersion[...(lastDotIndex ?? String.Index(utf16Offset: 6, in: metadata.firmwareVersion))] + version = version.dropLast() + self.firmwareVersion = String(version) + } +} diff --git a/Meshtastic/Extensions/CoreData/ExternalNotificationConfigEntityExtension.swift b/Meshtastic/Extensions/CoreData/ExternalNotificationConfigEntityExtension.swift new file mode 100644 index 00000000..72853b43 --- /dev/null +++ b/Meshtastic/Extensions/CoreData/ExternalNotificationConfigEntityExtension.swift @@ -0,0 +1,44 @@ +import CoreData +import MeshtasticProtobufs + +extension ExternalNotificationConfigEntity { + convenience init( + context: NSManagedObjectContext, + config: ModuleConfig.ExternalNotificationConfig + ) { + self.init(context: context) + self.enabled = config.enabled + self.usePWM = config.usePwm + self.alertBell = config.alertBell + self.alertBellBuzzer = config.alertBellBuzzer + self.alertBellVibra = config.alertBellVibra + self.alertMessage = config.alertMessage + self.alertMessageBuzzer = config.alertMessageBuzzer + self.alertMessageVibra = config.alertMessageVibra + self.active = config.active + self.output = Int32(config.output) + self.outputBuzzer = Int32(config.outputBuzzer) + self.outputVibra = Int32(config.outputVibra) + self.outputMilliseconds = Int32(config.outputMs) + self.nagTimeout = Int32(config.nagTimeout) + self.useI2SAsBuzzer = config.useI2SAsBuzzer + } + + func update(with config: ModuleConfig.ExternalNotificationConfig) { + enabled = config.enabled + usePWM = config.usePwm + alertBell = config.alertBell + alertBellBuzzer = config.alertBellBuzzer + alertBellVibra = config.alertBellVibra + alertMessage = config.alertMessage + alertMessageBuzzer = config.alertMessageBuzzer + alertMessageVibra = config.alertMessageVibra + active = config.active + output = Int32(config.output) + outputBuzzer = Int32(config.outputBuzzer) + outputVibra = Int32(config.outputVibra) + outputMilliseconds = Int32(config.outputMs) + nagTimeout = Int32(config.nagTimeout) + useI2SAsBuzzer = config.useI2SAsBuzzer + } +} diff --git a/Meshtastic/Extensions/CoreData/MQTTConfigEntityExtension.swift b/Meshtastic/Extensions/CoreData/MQTTConfigEntityExtension.swift new file mode 100644 index 00000000..ca01ba91 --- /dev/null +++ b/Meshtastic/Extensions/CoreData/MQTTConfigEntityExtension.swift @@ -0,0 +1,38 @@ +import CoreData +import MeshtasticProtobufs + +extension MQTTConfigEntity { + convenience init( + context: NSManagedObjectContext, + config: ModuleConfig.MQTTConfig + ) { + self.init(context: context) + self.enabled = config.enabled + self.proxyToClientEnabled = config.proxyToClientEnabled + self.address = config.address + self.username = config.username + self.password = config.password + self.root = config.root + self.encryptionEnabled = config.encryptionEnabled + self.jsonEnabled = config.jsonEnabled + self.tlsEnabled = config.tlsEnabled + self.mapReportingEnabled = config.mapReportingEnabled + self.mapPositionPrecision = Int32(config.mapReportSettings.positionPrecision) + self.mapPublishIntervalSecs = Int32(config.mapReportSettings.publishIntervalSecs) + } + + func update(with config: ModuleConfig.MQTTConfig) { + enabled = config.enabled + proxyToClientEnabled = config.proxyToClientEnabled + address = config.address + username = config.username + password = config.password + root = config.root + encryptionEnabled = config.encryptionEnabled + jsonEnabled = config.jsonEnabled + tlsEnabled = config.tlsEnabled + mapReportingEnabled = config.mapReportingEnabled + mapPositionPrecision = Int32(config.mapReportSettings.positionPrecision) + mapPublishIntervalSecs = Int32(config.mapReportSettings.publishIntervalSecs) + } +} diff --git a/Meshtastic/Extensions/CoreData/PositionEntityExtension.swift b/Meshtastic/Extensions/CoreData/PositionEntityExtension.swift index 0c634779..90b15b5e 100644 --- a/Meshtastic/Extensions/CoreData/PositionEntityExtension.swift +++ b/Meshtastic/Extensions/CoreData/PositionEntityExtension.swift @@ -8,6 +8,7 @@ import CoreData import CoreLocation import MapKit +import MeshtasticProtobufs import SwiftUI extension PositionEntity { diff --git a/Meshtastic/Extensions/CoreData/RangeTestConfigEntityExtension.swift b/Meshtastic/Extensions/CoreData/RangeTestConfigEntityExtension.swift new file mode 100644 index 00000000..d85a6ab8 --- /dev/null +++ b/Meshtastic/Extensions/CoreData/RangeTestConfigEntityExtension.swift @@ -0,0 +1,20 @@ +import CoreData +import MeshtasticProtobufs + +extension RangeTestConfigEntity { + convenience init( + context: NSManagedObjectContext, + config: ModuleConfig.RangeTestConfig + ) { + self.init(context: context) + self.sender = Int32(config.sender) + self.enabled = config.enabled + self.save = config.save + } + + func update(with config: ModuleConfig.RangeTestConfig) { + sender = Int32(config.sender) + enabled = config.enabled + save = config.save + } +} diff --git a/Meshtastic/Extensions/CoreData/SerialConfigEntityExtension.swift b/Meshtastic/Extensions/CoreData/SerialConfigEntityExtension.swift new file mode 100644 index 00000000..da48dde2 --- /dev/null +++ b/Meshtastic/Extensions/CoreData/SerialConfigEntityExtension.swift @@ -0,0 +1,28 @@ +import CoreData +import MeshtasticProtobufs + +extension SerialConfigEntity { + convenience init( + context: NSManagedObjectContext, + config: ModuleConfig.SerialConfig + ) { + self.init(context: context) + self.enabled = config.enabled + self.echo = config.echo + self.rxd = Int32(config.rxd) + self.txd = Int32(config.txd) + self.baudRate = Int32(config.baud.rawValue) + self.timeout = Int32(config.timeout) + self.mode = Int32(config.mode.rawValue) + } + + func update(with config: ModuleConfig.SerialConfig) { + enabled = config.enabled + echo = config.echo + rxd = Int32(config.rxd) + txd = Int32(config.txd) + baudRate = Int32(config.baud.rawValue) + timeout = Int32(config.timeout) + mode = Int32(config.mode.rawValue) + } +} diff --git a/Meshtastic/Extensions/CoreData/StoreForwardConfigEntityExtension.swift b/Meshtastic/Extensions/CoreData/StoreForwardConfigEntityExtension.swift new file mode 100644 index 00000000..c44de4f7 --- /dev/null +++ b/Meshtastic/Extensions/CoreData/StoreForwardConfigEntityExtension.swift @@ -0,0 +1,24 @@ +import CoreData +import MeshtasticProtobufs + +extension StoreForwardConfigEntity { + convenience init( + context: NSManagedObjectContext, + config: ModuleConfig.StoreForwardConfig + ) { + self.init(context: context) + self.enabled = config.enabled + self.heartbeat = config.heartbeat + self.records = Int32(config.records) + self.historyReturnMax = Int32(config.historyReturnMax) + self.historyReturnWindow = Int32(config.historyReturnWindow) + } + + func update(with config: ModuleConfig.StoreForwardConfig) { + enabled = config.enabled + heartbeat = config.heartbeat + records = Int32(config.records) + historyReturnMax = Int32(config.historyReturnMax) + historyReturnWindow = Int32(config.historyReturnWindow) + } +} diff --git a/Meshtastic/Extensions/CoreData/UserEntityExtension.swift b/Meshtastic/Extensions/CoreData/UserEntityExtension.swift index 0128cf93..0595e752 100644 --- a/Meshtastic/Extensions/CoreData/UserEntityExtension.swift +++ b/Meshtastic/Extensions/CoreData/UserEntityExtension.swift @@ -7,6 +7,7 @@ import Foundation import CoreData +import MeshtasticProtobufs extension UserEntity { diff --git a/Meshtastic/Extensions/Protobufs/NodeInfoExtensions.swift b/Meshtastic/Extensions/Protobufs/NodeInfoExtensions.swift new file mode 100644 index 00000000..6b00fbd2 --- /dev/null +++ b/Meshtastic/Extensions/Protobufs/NodeInfoExtensions.swift @@ -0,0 +1,12 @@ +import Foundation +import MeshtasticProtobufs + +extension NodeInfo { + var isValidPosition: Bool { + hasPosition && + position.longitudeI != 0 && + position.latitudeI != 0 && + position.latitudeI != 373346000 && + position.longitudeI != -1220090000 + } +} diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift index a5dec13b..08f99339 100644 --- a/Meshtastic/Helpers/BLEManager.swift +++ b/Meshtastic/Helpers/BLEManager.swift @@ -3,6 +3,7 @@ import CoreData import CoreBluetooth import SwiftUI import MapKit +import MeshtasticProtobufs import CocoaMQTT import OSLog import RegexBuilder diff --git a/Meshtastic/Helpers/Logger.swift b/Meshtastic/Helpers/Logger.swift new file mode 100644 index 00000000..35ee7337 --- /dev/null +++ b/Meshtastic/Helpers/Logger.swift @@ -0,0 +1,19 @@ +import OSLog + +extension Logger { + + /// The logger's subsystem. + private static var subsystem = Bundle.main.bundleIdentifier! + + /// All logs related to data such as decoding error, parsing issues, etc. + public static let data = Logger(subsystem: subsystem, category: "🗄️ Data") + + /// All logs related to the mesh + public static let mesh = Logger(subsystem: subsystem, category: "🕸️ Mesh") + + /// All logs related to services such as network calls, location, etc. + public static let services = Logger(subsystem: subsystem, category: "🍏 Services") + + /// All logs related to tracking and analytics. + public static let statistics = Logger(subsystem: subsystem, category: "📈 Stats") +} diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index d10d5cb0..16046a16 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -7,6 +7,7 @@ import Foundation import CoreData +import MeshtasticProtobufs import SwiftUI import RegexBuilder import OSLog diff --git a/Meshtastic/Helpers/NetworkManager.swift b/Meshtastic/Helpers/NetworkManager.swift deleted file mode 100644 index 39a66b1d..00000000 --- a/Meshtastic/Helpers/NetworkManager.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// NetworkManager.swift -// Meshtastic -// -// Copyright(c) Garth Vander Houwen on 4/23/23. -// - -import Foundation -import Network -import OSLog - -class NetworkManager { - static let shared = NetworkManager() - // MARK: Public methods - func runIfNetwork(completion: @escaping () -> Void ) { - let pathMonitor = NWPathMonitor() - pathMonitor.pathUpdateHandler = { - guard $0.status == .satisfied else { - // No network available - Logger.services.info("Network Not available") - return pathMonitor.cancel() - } - pathMonitor.cancel() - completion() - } - pathMonitor.start(queue: DispatchQueue.global(qos: .background)) - } -} diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index db6d4cf4..58cd2cf5 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -5,6 +5,7 @@ // Copyright(c) Garth Vander Houwen 10/3/22. import CoreData +import MeshtasticProtobufs import OSLog public func clearPax(destNum: Int64, context: NSManagedObjectContext) -> Bool { @@ -425,7 +426,7 @@ func upsertBluetoothConfigPacket(config: Config.BluetoothConfig, nodeNum: Int64, } } -func upsertDeviceConfigPacket(config: Meshtastic.Config.DeviceConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertDeviceConfigPacket(config: Config.DeviceConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.device.config %@".localized, String(nodeNum)) MeshLogger.log("📟 \(logString)") @@ -480,7 +481,7 @@ func upsertDeviceConfigPacket(config: Meshtastic.Config.DeviceConfig, nodeNum: I } } -func upsertDisplayConfigPacket(config: Meshtastic.Config.DisplayConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertDisplayConfigPacket(config: Config.DisplayConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.display.config %@".localized, nodeNum.toHex()) MeshLogger.log("🖥️ \(logString)") @@ -546,7 +547,7 @@ func upsertDisplayConfigPacket(config: Meshtastic.Config.DisplayConfig, nodeNum: } } -func upsertLoRaConfigPacket(config: Meshtastic.Config.LoRaConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertLoRaConfigPacket(config: Config.LoRaConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.lora.config %@".localized, nodeNum.toHex()) MeshLogger.log("📻 \(logString)") @@ -613,7 +614,7 @@ func upsertLoRaConfigPacket(config: Meshtastic.Config.LoRaConfig, nodeNum: Int64 } } -func upsertNetworkConfigPacket(config: Meshtastic.Config.NetworkConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertNetworkConfigPacket(config: Config.NetworkConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.network.config %@".localized, String(nodeNum)) MeshLogger.log("🌐 \(logString)") @@ -660,7 +661,7 @@ func upsertNetworkConfigPacket(config: Meshtastic.Config.NetworkConfig, nodeNum: } } -func upsertPositionConfigPacket(config: Meshtastic.Config.PositionConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertPositionConfigPacket(config: Config.PositionConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.position.config %@".localized, String(nodeNum)) MeshLogger.log("🗺️ \(logString)") @@ -723,7 +724,7 @@ func upsertPositionConfigPacket(config: Meshtastic.Config.PositionConfig, nodeNu } } -func upsertPowerConfigPacket(config: Meshtastic.Config.PowerConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertPowerConfigPacket(config: Config.PowerConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.power.config %@".localized, String(nodeNum)) MeshLogger.log("🗺️ \(logString)") @@ -772,7 +773,7 @@ func upsertPowerConfigPacket(config: Meshtastic.Config.PowerConfig, nodeNum: Int } } -func upsertAmbientLightingModuleConfigPacket(config: Meshtastic.ModuleConfig.AmbientLightingConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertAmbientLightingModuleConfigPacket(config: ModuleConfig.AmbientLightingConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.ambientlighting.config %@".localized, String(nodeNum)) MeshLogger.log("🏮 \(logString)") @@ -828,7 +829,7 @@ func upsertAmbientLightingModuleConfigPacket(config: Meshtastic.ModuleConfig.Amb } } -func upsertCannedMessagesModuleConfigPacket(config: Meshtastic.ModuleConfig.CannedMessageConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertCannedMessagesModuleConfigPacket(config: ModuleConfig.CannedMessageConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.cannedmessage.config %@".localized, String(nodeNum)) MeshLogger.log("🥫 \(logString)") @@ -892,7 +893,7 @@ func upsertCannedMessagesModuleConfigPacket(config: Meshtastic.ModuleConfig.Cann } } -func upsertDetectionSensorModuleConfigPacket(config: Meshtastic.ModuleConfig.DetectionSensorConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertDetectionSensorModuleConfigPacket(config: ModuleConfig.DetectionSensorConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.detectionsensor.config %@".localized, String(nodeNum)) MeshLogger.log("🕵️ \(logString)") @@ -953,7 +954,7 @@ func upsertDetectionSensorModuleConfigPacket(config: Meshtastic.ModuleConfig.Det } } -func upsertExternalNotificationModuleConfigPacket(config: Meshtastic.ModuleConfig.ExternalNotificationConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertExternalNotificationModuleConfigPacket(config: ModuleConfig.ExternalNotificationConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.externalnotification.config %@".localized, String(nodeNum)) MeshLogger.log("📣 \(logString)") @@ -1023,7 +1024,7 @@ func upsertExternalNotificationModuleConfigPacket(config: Meshtastic.ModuleConfi } } -func upsertPaxCounterModuleConfigPacket(config: Meshtastic.ModuleConfig.PaxcounterConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertPaxCounterModuleConfigPacket(config: ModuleConfig.PaxcounterConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.paxcounter.config %@".localized, String(nodeNum)) MeshLogger.log("🧑‍🤝‍🧑 \(logString)") @@ -1107,7 +1108,7 @@ func upsertRtttlConfigPacket(ringtone: String, nodeNum: Int64, context: NSManage } } -func upsertMqttModuleConfigPacket(config: Meshtastic.ModuleConfig.MQTTConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertMqttModuleConfigPacket(config: ModuleConfig.MQTTConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.mqtt.config %@".localized, String(nodeNum)) MeshLogger.log("🌉 \(logString)") @@ -1169,7 +1170,7 @@ func upsertMqttModuleConfigPacket(config: Meshtastic.ModuleConfig.MQTTConfig, no } } -func upsertRangeTestModuleConfigPacket(config: Meshtastic.ModuleConfig.RangeTestConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertRangeTestModuleConfigPacket(config: ModuleConfig.RangeTestConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.rangetest.config %@".localized, String(nodeNum)) MeshLogger.log("⛰️ \(logString)") @@ -1212,7 +1213,7 @@ func upsertRangeTestModuleConfigPacket(config: Meshtastic.ModuleConfig.RangeTest } } -func upsertSerialModuleConfigPacket(config: Meshtastic.ModuleConfig.SerialConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertSerialModuleConfigPacket(config: ModuleConfig.SerialConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.serial.config %@".localized, String(nodeNum)) MeshLogger.log("🤖 \(logString)") @@ -1271,7 +1272,7 @@ func upsertSerialModuleConfigPacket(config: Meshtastic.ModuleConfig.SerialConfig } } -func upsertStoreForwardModuleConfigPacket(config: Meshtastic.ModuleConfig.StoreForwardConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertStoreForwardModuleConfigPacket(config: ModuleConfig.StoreForwardConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.storeforward.config %@".localized, String(nodeNum)) MeshLogger.log("📬 \(logString)") @@ -1321,7 +1322,7 @@ func upsertStoreForwardModuleConfigPacket(config: Meshtastic.ModuleConfig.StoreF } } -func upsertTelemetryModuleConfigPacket(config: Meshtastic.ModuleConfig.TelemetryConfig, nodeNum: Int64, context: NSManagedObjectContext) { +func upsertTelemetryModuleConfigPacket(config: ModuleConfig.TelemetryConfig, nodeNum: Int64, context: NSManagedObjectContext) { let logString = String.localizedStringWithFormat("mesh.log.telemetry.config %@".localized, String(nodeNum)) MeshLogger.log("📈 \(logString)") diff --git a/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift b/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift index dce0df4a..8217af2d 100644 --- a/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift +++ b/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift @@ -5,9 +5,10 @@ // Copyright Garth Vander Houwen 1/10/23. // -import SwiftUI import CoreLocation +import MeshtasticProtobufs import OSLog +import SwiftUI struct WaypointFormMapKit: View { diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift index 0fbdcf94..882dad07 100644 --- a/Meshtastic/Views/Messages/ChannelMessageList.swift +++ b/Meshtastic/Views/Messages/ChannelMessageList.swift @@ -5,9 +5,10 @@ // Created by Garth Vander Houwen on 12/24/21. // -import SwiftUI import CoreData +import MeshtasticProtobufs import OSLog +import SwiftUI struct ChannelMessageList: View { @StateObject var appState = AppState.shared diff --git a/Meshtastic/Views/Messages/MessageText.swift b/Meshtastic/Views/Messages/MessageText.swift index 31fa2dec..0cdd4be8 100644 --- a/Meshtastic/Views/Messages/MessageText.swift +++ b/Meshtastic/Views/Messages/MessageText.swift @@ -1,5 +1,6 @@ -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct MessageText: View { static let linkBlue = Color(red: 0.4627, green: 0.8392, blue: 1) /* #76d6ff */ diff --git a/Meshtastic/Views/Nodes/DetectionSensorLog.swift b/Meshtastic/Views/Nodes/DetectionSensorLog.swift index 54395c99..da2e4e09 100644 --- a/Meshtastic/Views/Nodes/DetectionSensorLog.swift +++ b/Meshtastic/Views/Nodes/DetectionSensorLog.swift @@ -7,6 +7,7 @@ import SwiftUI import Charts +import MeshtasticProtobufs import OSLog struct DetectionSensorLog: View { diff --git a/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift b/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift index 31138855..8d4f79b4 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift @@ -5,10 +5,11 @@ // Copyright Garth Vander Houwen 1/10/23. // -import SwiftUI -import MapKit import CoreLocation +import MapKit +import MeshtasticProtobufs import OSLog +import SwiftUI struct WaypointForm: View { diff --git a/Meshtastic/Views/Settings/Channels.swift b/Meshtastic/Views/Settings/Channels.swift index 689a009e..dee46209 100644 --- a/Meshtastic/Views/Settings/Channels.swift +++ b/Meshtastic/Views/Settings/Channels.swift @@ -5,10 +5,11 @@ // Copyright(c) Garth Vander Houwen 4/8/22. // -import SwiftUI import CoreData import MapKit +import MeshtasticProtobufs import OSLog +import SwiftUI #if canImport(TipKit) import TipKit #endif diff --git a/Meshtastic/Views/Settings/Config/BluetoothConfig.swift b/Meshtastic/Views/Settings/Config/BluetoothConfig.swift index c4ad97df..8b4033db 100644 --- a/Meshtastic/Views/Settings/Config/BluetoothConfig.swift +++ b/Meshtastic/Views/Settings/Config/BluetoothConfig.swift @@ -5,6 +5,7 @@ // Copyright (c) Garth Vander Houwen 8/18/22. // +import MeshtasticProtobufs import OSLog import SwiftUI diff --git a/Meshtastic/Views/Settings/Config/DeviceConfig.swift b/Meshtastic/Views/Settings/Config/DeviceConfig.swift index 020f9710..1a872269 100644 --- a/Meshtastic/Views/Settings/Config/DeviceConfig.swift +++ b/Meshtastic/Views/Settings/Config/DeviceConfig.swift @@ -4,8 +4,10 @@ // // Copyright (c) Garth Vander Houwen 6/13/22. // -import SwiftUI + +import MeshtasticProtobufs import OSLog +import SwiftUI struct DeviceConfig: View { diff --git a/Meshtastic/Views/Settings/Config/DisplayConfig.swift b/Meshtastic/Views/Settings/Config/DisplayConfig.swift index 9a78ade8..867f616d 100644 --- a/Meshtastic/Views/Settings/Config/DisplayConfig.swift +++ b/Meshtastic/Views/Settings/Config/DisplayConfig.swift @@ -5,8 +5,9 @@ // Copyright (c) Garth Vander Houwen 6/7/22. // -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct DisplayConfig: View { diff --git a/Meshtastic/Views/Settings/Config/LoRaConfig.swift b/Meshtastic/Views/Settings/Config/LoRaConfig.swift index f1a1df7b..210675b2 100644 --- a/Meshtastic/Views/Settings/Config/LoRaConfig.swift +++ b/Meshtastic/Views/Settings/Config/LoRaConfig.swift @@ -7,6 +7,7 @@ import SwiftUI import CoreData +import MeshtasticProtobufs import OSLog struct LoRaConfig: View { diff --git a/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift b/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift index a6ad64c1..3d3d3586 100644 --- a/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift @@ -4,8 +4,9 @@ // // Copyright(c) Garth Vander Houwen 11/26/23 // - +import MeshtasticProtobufs import SwiftUI + @available(iOS 17.0, macOS 14.0, *) struct AmbientLightingConfig: View { @Environment(\.self) var environment diff --git a/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift b/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift index 51424da0..37e16f93 100644 --- a/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift @@ -4,8 +4,9 @@ // // Copyright (c) Garth Vander Houwen 6/22/22. // -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct CannedMessagesConfig: View { @Environment(\.managedObjectContext) var context diff --git a/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift b/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift index fbb2c5bd..2e8f715b 100644 --- a/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift @@ -4,8 +4,9 @@ // // Copyright(c) Garth Vander Houwen 8/16/23. // -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI enum DetectionSensorRole: String, CaseIterable, Equatable, Decodable { case sensor diff --git a/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift b/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift index b8b94bf0..a2adc9b6 100644 --- a/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/ExternalNotificationConfig.swift @@ -4,8 +4,9 @@ // // Copyright (c) Garth Vander Houwen 6/22/22. // -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct ExternalNotificationConfig: View { diff --git a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift index 29c31e32..7eb5a945 100644 --- a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift @@ -4,9 +4,10 @@ // // Copyright (c) Garth Vander Houwen 9/4/22. // -import SwiftUI import CoreLocation +import MeshtasticProtobufs import OSLog +import SwiftUI struct MQTTConfig: View { diff --git a/Meshtastic/Views/Settings/Config/Module/PaxCounterConfig.swift b/Meshtastic/Views/Settings/Config/Module/PaxCounterConfig.swift index d3582e15..90a0e195a 100644 --- a/Meshtastic/Views/Settings/Config/Module/PaxCounterConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/PaxCounterConfig.swift @@ -5,6 +5,7 @@ // Copyright Garth Vander Houwen 2/25/24. // +import MeshtasticProtobufs import SwiftUI struct PaxCounterConfig: View { diff --git a/Meshtastic/Views/Settings/Config/Module/RangeTestConfig.swift b/Meshtastic/Views/Settings/Config/Module/RangeTestConfig.swift index 912a8be7..2af3b5fd 100644 --- a/Meshtastic/Views/Settings/Config/Module/RangeTestConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/RangeTestConfig.swift @@ -4,8 +4,9 @@ // // Copyright (c) Garth Vander Houwen 6/13/22. // -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct RangeTestConfig: View { diff --git a/Meshtastic/Views/Settings/Config/Module/SerialConfig.swift b/Meshtastic/Views/Settings/Config/Module/SerialConfig.swift index e1500ec8..c4f27c6d 100644 --- a/Meshtastic/Views/Settings/Config/Module/SerialConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/SerialConfig.swift @@ -4,8 +4,9 @@ // // Copyright (c) Garth Vander Houwen 6/22/22. // -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct SerialConfig: View { diff --git a/Meshtastic/Views/Settings/Config/Module/StoreForwardConfig.swift b/Meshtastic/Views/Settings/Config/Module/StoreForwardConfig.swift index cf3a89e0..d5aba9cb 100644 --- a/Meshtastic/Views/Settings/Config/Module/StoreForwardConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/StoreForwardConfig.swift @@ -4,9 +4,9 @@ // // Copyright(c) Garth Vander Houwen 8/26/23. // - -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct StoreForwardConfig: View { diff --git a/Meshtastic/Views/Settings/Config/Module/TelemetryConfig.swift b/Meshtastic/Views/Settings/Config/Module/TelemetryConfig.swift index 6271cd24..05b631b1 100644 --- a/Meshtastic/Views/Settings/Config/Module/TelemetryConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/TelemetryConfig.swift @@ -4,8 +4,9 @@ // // Copyright (c) Garth Vander Houwen 6/13/22. // -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct TelemetryConfig: View { diff --git a/Meshtastic/Views/Settings/Config/NetworkConfig.swift b/Meshtastic/Views/Settings/Config/NetworkConfig.swift index 7571107d..0dedaeed 100644 --- a/Meshtastic/Views/Settings/Config/NetworkConfig.swift +++ b/Meshtastic/Views/Settings/Config/NetworkConfig.swift @@ -4,9 +4,9 @@ // // Copyright (c) Garth Vander Houwen 8/1/2022 // - -import SwiftUI +import MeshtasticProtobufs import OSLog +import SwiftUI struct NetworkConfig: View { diff --git a/Meshtastic/Views/Settings/Config/PositionConfig.swift b/Meshtastic/Views/Settings/Config/PositionConfig.swift index b723935b..a0d4ac97 100644 --- a/Meshtastic/Views/Settings/Config/PositionConfig.swift +++ b/Meshtastic/Views/Settings/Config/PositionConfig.swift @@ -6,6 +6,7 @@ // import SwiftUI +import MeshtasticProtobufs import OSLog struct PositionFlags: OptionSet { diff --git a/Meshtastic/Views/Settings/Config/PowerConfig.swift b/Meshtastic/Views/Settings/Config/PowerConfig.swift index 155d9a5f..15b7e44d 100644 --- a/Meshtastic/Views/Settings/Config/PowerConfig.swift +++ b/Meshtastic/Views/Settings/Config/PowerConfig.swift @@ -1,4 +1,5 @@ import SwiftUI +import MeshtasticProtobufs struct PowerConfig: View { @Environment(\.managedObjectContext) private var context diff --git a/Meshtastic/Views/Settings/ShareChannels.swift b/Meshtastic/Views/Settings/ShareChannels.swift index 627bc5e5..1eeebb7c 100644 --- a/Meshtastic/Views/Settings/ShareChannels.swift +++ b/Meshtastic/Views/Settings/ShareChannels.swift @@ -7,6 +7,8 @@ import SwiftUI import CoreData import CoreImage.CIFilterBuiltins +import MeshtasticProtobufs + #if canImport(TipKit) import TipKit #endif diff --git a/Meshtastic/Views/Settings/UserConfig.swift b/Meshtastic/Views/Settings/UserConfig.swift index 3db4665a..c67c70bf 100644 --- a/Meshtastic/Views/Settings/UserConfig.swift +++ b/Meshtastic/Views/Settings/UserConfig.swift @@ -4,8 +4,9 @@ // // Copyright (c) Garth Vander Houwen 6/27/22. // -import SwiftUI import CoreData +import MeshtasticProtobufs +import SwiftUI struct UserConfig: View { diff --git a/MeshtasticProtobufs/.gitignore b/MeshtasticProtobufs/.gitignore new file mode 100644 index 00000000..0023a534 --- /dev/null +++ b/MeshtasticProtobufs/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +/.build +/Packages +xcuserdata/ +DerivedData/ +.swiftpm/configuration/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/MeshtasticProtobufs/Package.swift b/MeshtasticProtobufs/Package.swift new file mode 100644 index 00000000..d329c439 --- /dev/null +++ b/MeshtasticProtobufs/Package.swift @@ -0,0 +1,24 @@ +// swift-tools-version: 5.10 + +import PackageDescription + +let package = Package( + name: "MeshtasticProtobufs", + products: [ + .library( + name: "MeshtasticProtobufs", + targets: ["MeshtasticProtobufs"] + ), + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.19.0"), + ], + targets: [ + .target( + name: "MeshtasticProtobufs", + dependencies: [ + .product(name: "SwiftProtobuf", package: "swift-protobuf") + ] + ) + ] +) diff --git a/Meshtastic/Protobufs/meshtastic/admin.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/admin.pb.swift similarity index 93% rename from Meshtastic/Protobufs/meshtastic/admin.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/admin.pb.swift index c3f1c12f..ba263709 100644 --- a/Meshtastic/Protobufs/meshtastic/admin.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/admin.pb.swift @@ -24,19 +24,19 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 { +public 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 + public 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 { + public var getChannelRequest: UInt32 { get { if case .getChannelRequest(let v)? = payloadVariant {return v} return 0 @@ -46,7 +46,7 @@ struct AdminMessage { /// /// TODO: REPLACE - var getChannelResponse: Channel { + public var getChannelResponse: Channel { get { if case .getChannelResponse(let v)? = payloadVariant {return v} return Channel() @@ -56,7 +56,7 @@ struct AdminMessage { /// /// Send the current owner data in the response to this message. - var getOwnerRequest: Bool { + public var getOwnerRequest: Bool { get { if case .getOwnerRequest(let v)? = payloadVariant {return v} return false @@ -66,7 +66,7 @@ struct AdminMessage { /// /// TODO: REPLACE - var getOwnerResponse: User { + public var getOwnerResponse: User { get { if case .getOwnerResponse(let v)? = payloadVariant {return v} return User() @@ -76,7 +76,7 @@ struct AdminMessage { /// /// Ask for the following config data to be sent - var getConfigRequest: AdminMessage.ConfigType { + public var getConfigRequest: AdminMessage.ConfigType { get { if case .getConfigRequest(let v)? = payloadVariant {return v} return .deviceConfig @@ -86,7 +86,7 @@ struct AdminMessage { /// /// Send the current Config in the response to this message. - var getConfigResponse: Config { + public var getConfigResponse: Config { get { if case .getConfigResponse(let v)? = payloadVariant {return v} return Config() @@ -96,7 +96,7 @@ struct AdminMessage { /// /// Ask for the following config data to be sent - var getModuleConfigRequest: AdminMessage.ModuleConfigType { + public var getModuleConfigRequest: AdminMessage.ModuleConfigType { get { if case .getModuleConfigRequest(let v)? = payloadVariant {return v} return .mqttConfig @@ -106,7 +106,7 @@ struct AdminMessage { /// /// Send the current Config in the response to this message. - var getModuleConfigResponse: ModuleConfig { + public var getModuleConfigResponse: ModuleConfig { get { if case .getModuleConfigResponse(let v)? = payloadVariant {return v} return ModuleConfig() @@ -116,7 +116,7 @@ struct AdminMessage { /// /// Get the Canned Message Module messages in the response to this message. - var getCannedMessageModuleMessagesRequest: Bool { + public var getCannedMessageModuleMessagesRequest: Bool { get { if case .getCannedMessageModuleMessagesRequest(let v)? = payloadVariant {return v} return false @@ -126,7 +126,7 @@ struct AdminMessage { /// /// Get the Canned Message Module messages in the response to this message. - var getCannedMessageModuleMessagesResponse: String { + public var getCannedMessageModuleMessagesResponse: String { get { if case .getCannedMessageModuleMessagesResponse(let v)? = payloadVariant {return v} return String() @@ -136,7 +136,7 @@ struct AdminMessage { /// /// Request the node to send device metadata (firmware, protobuf version, etc) - var getDeviceMetadataRequest: Bool { + public var getDeviceMetadataRequest: Bool { get { if case .getDeviceMetadataRequest(let v)? = payloadVariant {return v} return false @@ -146,7 +146,7 @@ struct AdminMessage { /// /// Device metadata response - var getDeviceMetadataResponse: DeviceMetadata { + public var getDeviceMetadataResponse: DeviceMetadata { get { if case .getDeviceMetadataResponse(let v)? = payloadVariant {return v} return DeviceMetadata() @@ -156,7 +156,7 @@ struct AdminMessage { /// /// Get the Ringtone in the response to this message. - var getRingtoneRequest: Bool { + public var getRingtoneRequest: Bool { get { if case .getRingtoneRequest(let v)? = payloadVariant {return v} return false @@ -166,7 +166,7 @@ struct AdminMessage { /// /// Get the Ringtone in the response to this message. - var getRingtoneResponse: String { + public var getRingtoneResponse: String { get { if case .getRingtoneResponse(let v)? = payloadVariant {return v} return String() @@ -176,7 +176,7 @@ struct AdminMessage { /// /// Request the node to send it's connection status - var getDeviceConnectionStatusRequest: Bool { + public var getDeviceConnectionStatusRequest: Bool { get { if case .getDeviceConnectionStatusRequest(let v)? = payloadVariant {return v} return false @@ -186,7 +186,7 @@ struct AdminMessage { /// /// Device connection status response - var getDeviceConnectionStatusResponse: DeviceConnectionStatus { + public var getDeviceConnectionStatusResponse: DeviceConnectionStatus { get { if case .getDeviceConnectionStatusResponse(let v)? = payloadVariant {return v} return DeviceConnectionStatus() @@ -196,7 +196,7 @@ struct AdminMessage { /// /// Setup a node for licensed amateur (ham) radio operation - var setHamMode: HamParameters { + public var setHamMode: HamParameters { get { if case .setHamMode(let v)? = payloadVariant {return v} return HamParameters() @@ -206,7 +206,7 @@ struct AdminMessage { /// /// Get the mesh's nodes with their available gpio pins for RemoteHardware module use - var getNodeRemoteHardwarePinsRequest: Bool { + public var getNodeRemoteHardwarePinsRequest: Bool { get { if case .getNodeRemoteHardwarePinsRequest(let v)? = payloadVariant {return v} return false @@ -216,7 +216,7 @@ struct AdminMessage { /// /// Respond with the mesh's nodes with their available gpio pins for RemoteHardware module use - var getNodeRemoteHardwarePinsResponse: NodeRemoteHardwarePinsResponse { + public var getNodeRemoteHardwarePinsResponse: NodeRemoteHardwarePinsResponse { get { if case .getNodeRemoteHardwarePinsResponse(let v)? = payloadVariant {return v} return NodeRemoteHardwarePinsResponse() @@ -227,7 +227,7 @@ struct AdminMessage { /// /// Enter (UF2) DFU mode /// Only implemented on NRF52 currently - var enterDfuModeRequest: Bool { + public var enterDfuModeRequest: Bool { get { if case .enterDfuModeRequest(let v)? = payloadVariant {return v} return false @@ -237,7 +237,7 @@ struct AdminMessage { /// /// Delete the file by the specified path from the device - var deleteFileRequest: String { + public var deleteFileRequest: String { get { if case .deleteFileRequest(let v)? = payloadVariant {return v} return String() @@ -247,7 +247,7 @@ struct AdminMessage { /// /// Set zero and offset for scale chips - var setScale: UInt32 { + public var setScale: UInt32 { get { if case .setScale(let v)? = payloadVariant {return v} return 0 @@ -257,7 +257,7 @@ struct AdminMessage { /// /// Set the owner for this node - var setOwner: User { + public var setOwner: User { get { if case .setOwner(let v)? = payloadVariant {return v} return User() @@ -271,7 +271,7 @@ struct AdminMessage { /// 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 { + public var setChannel: Channel { get { if case .setChannel(let v)? = payloadVariant {return v} return Channel() @@ -281,7 +281,7 @@ struct AdminMessage { /// /// Set the current Config - var setConfig: Config { + public var setConfig: Config { get { if case .setConfig(let v)? = payloadVariant {return v} return Config() @@ -291,7 +291,7 @@ struct AdminMessage { /// /// Set the current Config - var setModuleConfig: ModuleConfig { + public var setModuleConfig: ModuleConfig { get { if case .setModuleConfig(let v)? = payloadVariant {return v} return ModuleConfig() @@ -301,7 +301,7 @@ struct AdminMessage { /// /// Set the Canned Message Module messages text. - var setCannedMessageModuleMessages: String { + public var setCannedMessageModuleMessages: String { get { if case .setCannedMessageModuleMessages(let v)? = payloadVariant {return v} return String() @@ -311,7 +311,7 @@ struct AdminMessage { /// /// Set the ringtone for ExternalNotification. - var setRingtoneMessage: String { + public var setRingtoneMessage: String { get { if case .setRingtoneMessage(let v)? = payloadVariant {return v} return String() @@ -321,7 +321,7 @@ struct AdminMessage { /// /// Remove the node by the specified node-num from the NodeDB on the device - var removeByNodenum: UInt32 { + public var removeByNodenum: UInt32 { get { if case .removeByNodenum(let v)? = payloadVariant {return v} return 0 @@ -331,7 +331,7 @@ struct AdminMessage { /// /// Set specified node-num to be favorited on the NodeDB on the device - var setFavoriteNode: UInt32 { + public var setFavoriteNode: UInt32 { get { if case .setFavoriteNode(let v)? = payloadVariant {return v} return 0 @@ -341,7 +341,7 @@ struct AdminMessage { /// /// Set specified node-num to be un-favorited on the NodeDB on the device - var removeFavoriteNode: UInt32 { + public var removeFavoriteNode: UInt32 { get { if case .removeFavoriteNode(let v)? = payloadVariant {return v} return 0 @@ -351,7 +351,7 @@ struct AdminMessage { /// /// Set fixed position data on the node and then set the position.fixed_position = true - var setFixedPosition: Position { + public var setFixedPosition: Position { get { if case .setFixedPosition(let v)? = payloadVariant {return v} return Position() @@ -361,7 +361,7 @@ struct AdminMessage { /// /// Clear fixed position coordinates and then set position.fixed_position = false - var removeFixedPosition: Bool { + public var removeFixedPosition: Bool { get { if case .removeFixedPosition(let v)? = payloadVariant {return v} return false @@ -372,7 +372,7 @@ struct AdminMessage { /// /// 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 { + public var beginEditSettings: Bool { get { if case .beginEditSettings(let v)? = payloadVariant {return v} return false @@ -382,7 +382,7 @@ struct AdminMessage { /// /// Commits an open transaction for any edits made to config, module config, owner, and channel settings - var commitEditSettings: Bool { + public var commitEditSettings: Bool { get { if case .commitEditSettings(let v)? = payloadVariant {return v} return false @@ -393,7 +393,7 @@ struct AdminMessage { /// /// 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 { + public var rebootOtaSeconds: Int32 { get { if case .rebootOtaSeconds(let v)? = payloadVariant {return v} return 0 @@ -404,7 +404,7 @@ struct AdminMessage { /// /// This message is only supported for the simulator Portduino build. /// If received the simulator will exit successfully. - var exitSimulator: Bool { + public var exitSimulator: Bool { get { if case .exitSimulator(let v)? = payloadVariant {return v} return false @@ -414,7 +414,7 @@ struct AdminMessage { /// /// Tell the node to reboot in this many seconds (or <0 to cancel reboot) - var rebootSeconds: Int32 { + public var rebootSeconds: Int32 { get { if case .rebootSeconds(let v)? = payloadVariant {return v} return 0 @@ -424,7 +424,7 @@ struct AdminMessage { /// /// Tell the node to shutdown in this many seconds (or <0 to cancel shutdown) - var shutdownSeconds: Int32 { + public var shutdownSeconds: Int32 { get { if case .shutdownSeconds(let v)? = payloadVariant {return v} return 0 @@ -434,7 +434,7 @@ struct AdminMessage { /// /// Tell the node to factory reset, all device settings will be returned to factory defaults. - var factoryReset: Int32 { + public var factoryReset: Int32 { get { if case .factoryReset(let v)? = payloadVariant {return v} return 0 @@ -444,7 +444,7 @@ struct AdminMessage { /// /// Tell the node to reset the nodedb. - var nodedbReset: Int32 { + public var nodedbReset: Int32 { get { if case .nodedbReset(let v)? = payloadVariant {return v} return 0 @@ -452,11 +452,11 @@ struct AdminMessage { set {payloadVariant = .nodedbReset(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// TODO: REPLACE - enum OneOf_PayloadVariant: Equatable { + public 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) @@ -591,7 +591,7 @@ struct AdminMessage { case nodedbReset(Int32) #if !swift(>=4.1) - static func ==(lhs: AdminMessage.OneOf_PayloadVariant, rhs: AdminMessage.OneOf_PayloadVariant) -> Bool { + public 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 @@ -768,8 +768,8 @@ struct AdminMessage { /// /// TODO: REPLACE - enum ConfigType: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum ConfigType: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -800,11 +800,11 @@ struct AdminMessage { case bluetoothConfig // = 6 case UNRECOGNIZED(Int) - init() { + public init() { self = .deviceConfig } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .deviceConfig case 1: self = .positionConfig @@ -817,7 +817,7 @@ struct AdminMessage { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .deviceConfig: return 0 case .positionConfig: return 1 @@ -834,8 +834,8 @@ struct AdminMessage { /// /// TODO: REPLACE - enum ModuleConfigType: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum ModuleConfigType: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -890,11 +890,11 @@ struct AdminMessage { case paxcounterConfig // = 12 case UNRECOGNIZED(Int) - init() { + public init() { self = .mqttConfig } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .mqttConfig case 1: self = .serialConfig @@ -913,7 +913,7 @@ struct AdminMessage { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .mqttConfig: return 0 case .serialConfig: return 1 @@ -934,14 +934,14 @@ struct AdminMessage { } - init() {} + public init() {} } #if swift(>=4.2) extension AdminMessage.ConfigType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [AdminMessage.ConfigType] = [ + public static let allCases: [AdminMessage.ConfigType] = [ .deviceConfig, .positionConfig, .powerConfig, @@ -954,7 +954,7 @@ extension AdminMessage.ConfigType: CaseIterable { extension AdminMessage.ModuleConfigType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [AdminMessage.ModuleConfigType] = [ + public static let allCases: [AdminMessage.ModuleConfigType] = [ .mqttConfig, .serialConfig, .extnotifConfig, @@ -975,48 +975,48 @@ extension AdminMessage.ModuleConfigType: CaseIterable { /// /// Parameters for setting up Meshtastic for ameteur radio usage -struct HamParameters { +public struct HamParameters { // 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. /// /// Amateur radio call sign, eg. KD2ABC - var callSign: String = String() + public var callSign: String = String() /// /// Transmit power in dBm at the LoRA transceiver, not including any amplification - var txPower: Int32 = 0 + public var txPower: Int32 = 0 /// /// The selected frequency of LoRA operation /// Please respect your local laws, regulations, and band plans. /// Ensure your radio is capable of operating of the selected frequency before setting this. - var frequency: Float = 0 + public var frequency: Float = 0 /// /// Optional short name of user - var shortName: String = String() + public var shortName: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Response envelope for node_remote_hardware_pins -struct NodeRemoteHardwarePinsResponse { +public struct NodeRemoteHardwarePinsResponse { // 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. /// /// Nodes and their respective remote hardware GPIO pins - var nodeRemoteHardwarePins: [NodeRemoteHardwarePin] = [] + public var nodeRemoteHardwarePins: [NodeRemoteHardwarePin] = [] - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -1033,8 +1033,8 @@ extension NodeRemoteHardwarePinsResponse: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".AdminMessage" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".AdminMessage" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "get_channel_request"), 2: .standard(proto: "get_channel_response"), 3: .standard(proto: "get_owner_request"), @@ -1078,7 +1078,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 100: .standard(proto: "nodedb_reset"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1482,7 +1482,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -1657,7 +1657,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: AdminMessage, rhs: AdminMessage) -> Bool { + public static func ==(lhs: AdminMessage, rhs: AdminMessage) -> Bool { if lhs.payloadVariant != rhs.payloadVariant {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -1665,7 +1665,7 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } extension AdminMessage.ConfigType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DEVICE_CONFIG"), 1: .same(proto: "POSITION_CONFIG"), 2: .same(proto: "POWER_CONFIG"), @@ -1677,7 +1677,7 @@ extension AdminMessage.ConfigType: SwiftProtobuf._ProtoNameProviding { } extension AdminMessage.ModuleConfigType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "MQTT_CONFIG"), 1: .same(proto: "SERIAL_CONFIG"), 2: .same(proto: "EXTNOTIF_CONFIG"), @@ -1695,15 +1695,15 @@ extension AdminMessage.ModuleConfigType: SwiftProtobuf._ProtoNameProviding { } extension HamParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".HamParameters" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".HamParameters" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "call_sign"), 2: .standard(proto: "tx_power"), 3: .same(proto: "frequency"), 4: .standard(proto: "short_name"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1718,7 +1718,7 @@ extension HamParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.callSign.isEmpty { try visitor.visitSingularStringField(value: self.callSign, fieldNumber: 1) } @@ -1734,7 +1734,7 @@ extension HamParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: HamParameters, rhs: HamParameters) -> Bool { + public static func ==(lhs: HamParameters, rhs: HamParameters) -> Bool { if lhs.callSign != rhs.callSign {return false} if lhs.txPower != rhs.txPower {return false} if lhs.frequency != rhs.frequency {return false} @@ -1745,12 +1745,12 @@ extension HamParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } extension NodeRemoteHardwarePinsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".NodeRemoteHardwarePinsResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".NodeRemoteHardwarePinsResponse" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "node_remote_hardware_pins"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1762,14 +1762,14 @@ extension NodeRemoteHardwarePinsResponse: SwiftProtobuf.Message, SwiftProtobuf._ } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.nodeRemoteHardwarePins.isEmpty { try visitor.visitRepeatedMessageField(value: self.nodeRemoteHardwarePins, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: NodeRemoteHardwarePinsResponse, rhs: NodeRemoteHardwarePinsResponse) -> Bool { + public static func ==(lhs: NodeRemoteHardwarePinsResponse, rhs: NodeRemoteHardwarePinsResponse) -> Bool { if lhs.nodeRemoteHardwarePins != rhs.nodeRemoteHardwarePins {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true diff --git a/Meshtastic/Protobufs/meshtastic/apponly.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/apponly.pb.swift similarity index 87% rename from Meshtastic/Protobufs/meshtastic/apponly.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/apponly.pb.swift index 11abf7af..d1533d59 100644 --- a/Meshtastic/Protobufs/meshtastic/apponly.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/apponly.pb.swift @@ -26,32 +26,32 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 { +public 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] { + public var settings: [ChannelSettings] { get {return _storage._settings} set {_uniqueStorage()._settings = newValue} } /// /// LoRa config - var loraConfig: Config.LoRaConfig { + public var loraConfig: Config.LoRaConfig { get {return _storage._loraConfig ?? Config.LoRaConfig()} set {_uniqueStorage()._loraConfig = newValue} } /// Returns true if `loraConfig` has been explicitly set. - var hasLoraConfig: Bool {return _storage._loraConfig != nil} + public var hasLoraConfig: Bool {return _storage._loraConfig != nil} /// Clears the value of `loraConfig`. Subsequent reads from it will return its default value. - mutating func clearLoraConfig() {_uniqueStorage()._loraConfig = nil} + public mutating func clearLoraConfig() {_uniqueStorage()._loraConfig = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -65,8 +65,8 @@ extension ChannelSet: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension ChannelSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ChannelSet" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ChannelSet" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "settings"), 2: .standard(proto: "lora_config"), ] @@ -100,7 +100,7 @@ extension ChannelSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -116,7 +116,7 @@ extension ChannelSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio } } - func traverse(visitor: inout V) throws { + public 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 @@ -132,7 +132,7 @@ extension ChannelSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ChannelSet, rhs: ChannelSet) -> Bool { + public static func ==(lhs: ChannelSet, rhs: ChannelSet) -> Bool { if lhs._storage !== rhs._storage { let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 diff --git a/Meshtastic/Protobufs/meshtastic/atak.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/atak.pb.swift similarity index 81% rename from Meshtastic/Protobufs/meshtastic/atak.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/atak.pb.swift index 49229221..4406deb3 100644 --- a/Meshtastic/Protobufs/meshtastic/atak.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/atak.pb.swift @@ -20,8 +20,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -enum Team: SwiftProtobuf.Enum { - typealias RawValue = Int +public enum Team: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Unspecifed @@ -84,11 +84,11 @@ enum Team: SwiftProtobuf.Enum { case brown // = 14 case UNRECOGNIZED(Int) - init() { + public init() { self = .unspecifedColor } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unspecifedColor case 1: self = .white @@ -109,7 +109,7 @@ enum Team: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unspecifedColor: return 0 case .white: return 1 @@ -136,7 +136,7 @@ enum Team: SwiftProtobuf.Enum { extension Team: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Team] = [ + public static let allCases: [Team] = [ .unspecifedColor, .white, .yellow, @@ -159,8 +159,8 @@ extension Team: CaseIterable { /// /// Role of the group member -enum MemberRole: SwiftProtobuf.Enum { - typealias RawValue = Int +public enum MemberRole: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Unspecifed @@ -199,11 +199,11 @@ enum MemberRole: SwiftProtobuf.Enum { case k9 // = 8 case UNRECOGNIZED(Int) - init() { + public init() { self = .unspecifed } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unspecifed case 1: self = .teamMember @@ -218,7 +218,7 @@ enum MemberRole: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unspecifed: return 0 case .teamMember: return 1 @@ -239,7 +239,7 @@ enum MemberRole: SwiftProtobuf.Enum { extension MemberRole: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [MemberRole] = [ + public static let allCases: [MemberRole] = [ .unspecifed, .teamMember, .teamLead, @@ -256,55 +256,55 @@ extension MemberRole: CaseIterable { /// /// Packets for the official ATAK Plugin -struct TAKPacket { +public struct TAKPacket { // 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. /// /// Are the payloads strings compressed for LoRA transport? - var isCompressed: Bool = false + public var isCompressed: Bool = false /// /// The contact / callsign for ATAK user - var contact: Contact { + public var contact: Contact { get {return _contact ?? Contact()} set {_contact = newValue} } /// Returns true if `contact` has been explicitly set. - var hasContact: Bool {return self._contact != nil} + public var hasContact: Bool {return self._contact != nil} /// Clears the value of `contact`. Subsequent reads from it will return its default value. - mutating func clearContact() {self._contact = nil} + public mutating func clearContact() {self._contact = nil} /// /// The group for ATAK user - var group: Group { + public var group: Group { get {return _group ?? Group()} set {_group = newValue} } /// Returns true if `group` has been explicitly set. - var hasGroup: Bool {return self._group != nil} + public var hasGroup: Bool {return self._group != nil} /// Clears the value of `group`. Subsequent reads from it will return its default value. - mutating func clearGroup() {self._group = nil} + public mutating func clearGroup() {self._group = nil} /// /// The status of the ATAK EUD - var status: Status { + public var status: Status { get {return _status ?? Status()} set {_status = newValue} } /// Returns true if `status` has been explicitly set. - var hasStatus: Bool {return self._status != nil} + public var hasStatus: Bool {return self._status != nil} /// Clears the value of `status`. Subsequent reads from it will return its default value. - mutating func clearStatus() {self._status = nil} + public mutating func clearStatus() {self._status = nil} /// /// The payload of the packet - var payloadVariant: TAKPacket.OneOf_PayloadVariant? = nil + public var payloadVariant: TAKPacket.OneOf_PayloadVariant? = nil /// /// TAK position report - var pli: PLI { + public var pli: PLI { get { if case .pli(let v)? = payloadVariant {return v} return PLI() @@ -314,7 +314,7 @@ struct TAKPacket { /// /// ATAK GeoChat message - var chat: GeoChat { + public var chat: GeoChat { get { if case .chat(let v)? = payloadVariant {return v} return GeoChat() @@ -322,11 +322,11 @@ struct TAKPacket { set {payloadVariant = .chat(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// The payload of the packet - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { /// /// TAK position report case pli(PLI) @@ -335,7 +335,7 @@ struct TAKPacket { case chat(GeoChat) #if !swift(>=4.1) - static func ==(lhs: TAKPacket.OneOf_PayloadVariant, rhs: TAKPacket.OneOf_PayloadVariant) -> Bool { + public static func ==(lhs: TAKPacket.OneOf_PayloadVariant, rhs: TAKPacket.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 @@ -354,7 +354,7 @@ struct TAKPacket { #endif } - init() {} + public init() {} fileprivate var _contact: Contact? = nil fileprivate var _group: Group? = nil @@ -363,40 +363,40 @@ struct TAKPacket { /// /// ATAK GeoChat message -struct GeoChat { +public struct GeoChat { // 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 text message - var message: String = String() + public var message: String = String() /// /// Uid recipient of the message - var to: String { + public var to: String { get {return _to ?? String()} set {_to = newValue} } /// Returns true if `to` has been explicitly set. - var hasTo: Bool {return self._to != nil} + public var hasTo: Bool {return self._to != nil} /// Clears the value of `to`. Subsequent reads from it will return its default value. - mutating func clearTo() {self._to = nil} + public mutating func clearTo() {self._to = nil} /// /// Callsign of the recipient for the message - var toCallsign: String { + public var toCallsign: String { get {return _toCallsign ?? String()} set {_toCallsign = newValue} } /// Returns true if `toCallsign` has been explicitly set. - var hasToCallsign: Bool {return self._toCallsign != nil} + public var hasToCallsign: Bool {return self._toCallsign != nil} /// Clears the value of `toCallsign`. Subsequent reads from it will return its default value. - mutating func clearToCallsign() {self._toCallsign = nil} + public mutating func clearToCallsign() {self._toCallsign = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _to: String? = nil fileprivate var _toCallsign: String? = nil @@ -405,66 +405,66 @@ struct GeoChat { /// /// ATAK Group /// <__group role='Team Member' name='Cyan'/> -struct Group { +public struct Group { // 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. /// /// Role of the group member - var role: MemberRole = .unspecifed + public var role: MemberRole = .unspecifed /// /// Team (color) /// Default Cyan - var team: Team = .unspecifedColor + public var team: Team = .unspecifedColor - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// ATAK EUD Status /// -struct Status { +public struct Status { // 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. /// /// Battery level - var battery: UInt32 = 0 + public var battery: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// ATAK Contact /// -struct Contact { +public struct Contact { // 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. /// /// Callsign - var callsign: String = String() + public var callsign: String = String() /// /// Device callsign - var deviceCallsign: String = String() + public var deviceCallsign: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Position Location Information from ATAK -struct PLI { +public struct PLI { // 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. @@ -472,28 +472,28 @@ struct PLI { /// /// The new preferred location encoding, multiply by 1e-7 to get degrees /// in floating point - var latitudeI: Int32 = 0 + public var latitudeI: Int32 = 0 /// /// The new preferred location encoding, multiply by 1e-7 to get degrees /// in floating point - var longitudeI: Int32 = 0 + public var longitudeI: Int32 = 0 /// /// Altitude (ATAK prefers HAE) - var altitude: Int32 = 0 + public var altitude: Int32 = 0 /// /// Speed - var speed: UInt32 = 0 + public var speed: UInt32 = 0 /// /// Course in degrees - var course: UInt32 = 0 + public var course: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -513,7 +513,7 @@ extension PLI: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension Team: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "Unspecifed_Color"), 1: .same(proto: "White"), 2: .same(proto: "Yellow"), @@ -533,7 +533,7 @@ extension Team: SwiftProtobuf._ProtoNameProviding { } extension MemberRole: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "Unspecifed"), 1: .same(proto: "TeamMember"), 2: .same(proto: "TeamLead"), @@ -547,8 +547,8 @@ extension MemberRole: SwiftProtobuf._ProtoNameProviding { } extension TAKPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".TAKPacket" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".TAKPacket" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "is_compressed"), 2: .same(proto: "contact"), 3: .same(proto: "group"), @@ -557,7 +557,7 @@ extension TAKPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation 6: .same(proto: "chat"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -598,7 +598,7 @@ extension TAKPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -629,7 +629,7 @@ extension TAKPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: TAKPacket, rhs: TAKPacket) -> Bool { + public static func ==(lhs: TAKPacket, rhs: TAKPacket) -> Bool { if lhs.isCompressed != rhs.isCompressed {return false} if lhs._contact != rhs._contact {return false} if lhs._group != rhs._group {return false} @@ -641,14 +641,14 @@ extension TAKPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } extension GeoChat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GeoChat" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".GeoChat" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "message"), 2: .same(proto: "to"), 3: .standard(proto: "to_callsign"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -662,7 +662,7 @@ extension GeoChat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -679,7 +679,7 @@ extension GeoChat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: GeoChat, rhs: GeoChat) -> Bool { + public static func ==(lhs: GeoChat, rhs: GeoChat) -> Bool { if lhs.message != rhs.message {return false} if lhs._to != rhs._to {return false} if lhs._toCallsign != rhs._toCallsign {return false} @@ -689,13 +689,13 @@ extension GeoChat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } extension Group: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Group" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Group" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "role"), 2: .same(proto: "team"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -708,7 +708,7 @@ extension Group: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.role != .unspecifed { try visitor.visitSingularEnumField(value: self.role, fieldNumber: 1) } @@ -718,7 +718,7 @@ extension Group: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Group, rhs: Group) -> Bool { + public static func ==(lhs: Group, rhs: Group) -> Bool { if lhs.role != rhs.role {return false} if lhs.team != rhs.team {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -727,12 +727,12 @@ extension Group: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase } extension Status: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Status" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Status" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "battery"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -744,14 +744,14 @@ extension Status: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.battery != 0 { try visitor.visitSingularUInt32Field(value: self.battery, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Status, rhs: Status) -> Bool { + public static func ==(lhs: Status, rhs: Status) -> Bool { if lhs.battery != rhs.battery {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -759,13 +759,13 @@ extension Status: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas } extension Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Contact" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Contact" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "callsign"), 2: .standard(proto: "device_callsign"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -778,7 +778,7 @@ extension Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.callsign.isEmpty { try visitor.visitSingularStringField(value: self.callsign, fieldNumber: 1) } @@ -788,7 +788,7 @@ extension Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Contact, rhs: Contact) -> Bool { + public static func ==(lhs: Contact, rhs: Contact) -> Bool { if lhs.callsign != rhs.callsign {return false} if lhs.deviceCallsign != rhs.deviceCallsign {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -797,8 +797,8 @@ extension Contact: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } extension PLI: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".PLI" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".PLI" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "latitude_i"), 2: .standard(proto: "longitude_i"), 3: .same(proto: "altitude"), @@ -806,7 +806,7 @@ extension PLI: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, 5: .same(proto: "course"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -822,7 +822,7 @@ extension PLI: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.latitudeI != 0 { try visitor.visitSingularSFixed32Field(value: self.latitudeI, fieldNumber: 1) } @@ -841,7 +841,7 @@ extension PLI: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: PLI, rhs: PLI) -> Bool { + public static func ==(lhs: PLI, rhs: PLI) -> Bool { if lhs.latitudeI != rhs.latitudeI {return false} if lhs.longitudeI != rhs.longitudeI {return false} if lhs.altitude != rhs.altitude {return false} diff --git a/Meshtastic/Protobufs/meshtastic/cannedmessages.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/cannedmessages.pb.swift similarity index 80% rename from Meshtastic/Protobufs/meshtastic/cannedmessages.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/cannedmessages.pb.swift index 7d70da3b..1b8c84de 100644 --- a/Meshtastic/Protobufs/meshtastic/cannedmessages.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/cannedmessages.pb.swift @@ -22,18 +22,18 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// Canned message module configuration. -struct CannedMessageModuleConfig { +public 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() + public var messages: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -45,12 +45,12 @@ extension CannedMessageModuleConfig: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension CannedMessageModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".CannedMessageModuleConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".CannedMessageModuleConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "messages"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -62,14 +62,14 @@ extension CannedMessageModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._Messa } } - func traverse(visitor: inout V) throws { + public 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 { + public 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/meshtastic/channel.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/channel.pb.swift similarity index 85% rename from Meshtastic/Protobufs/meshtastic/channel.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/channel.pb.swift index f2f4da72..5b9c7e49 100644 --- a/Meshtastic/Protobufs/meshtastic/channel.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/channel.pb.swift @@ -36,14 +36,14 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 { +public 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 + public var channelNum: UInt32 = 0 /// /// A simple pre-shared key for now for crypto. @@ -56,7 +56,7 @@ struct ChannelSettings { /// `1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0x01} /// `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() + public var psk: Data = Data() /// /// A SHORT name that will be packed into the URL. @@ -67,7 +67,7 @@ struct ChannelSettings { /// 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() + public var name: String = String() /// /// Used to construct a globally unique channel ID. @@ -81,58 +81,58 @@ struct ChannelSettings { /// 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 + public 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 + public var uplinkEnabled: Bool = false /// /// If true, messages seen on the internet will be forwarded to the local mesh. - var downlinkEnabled: Bool = false + public var downlinkEnabled: Bool = false /// /// Per-channel module settings. - var moduleSettings: ModuleSettings { + public var moduleSettings: ModuleSettings { get {return _moduleSettings ?? ModuleSettings()} set {_moduleSettings = newValue} } /// Returns true if `moduleSettings` has been explicitly set. - var hasModuleSettings: Bool {return self._moduleSettings != nil} + public var hasModuleSettings: Bool {return self._moduleSettings != nil} /// Clears the value of `moduleSettings`. Subsequent reads from it will return its default value. - mutating func clearModuleSettings() {self._moduleSettings = nil} + public mutating func clearModuleSettings() {self._moduleSettings = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _moduleSettings: ModuleSettings? = nil } /// /// This message is specifically for modules to store per-channel configuration data. -struct ModuleSettings { +public struct ModuleSettings { // 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. /// /// Bits of precision for the location sent in position packets. - var positionPrecision: UInt32 = 0 + public var positionPrecision: UInt32 = 0 /// /// Controls whether or not the phone / clients should mute the current channel /// Useful for noisy public channels you don't necessarily want to disable - var isClientMuted: Bool = false + public var isClientMuted: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// A pair of a channel number, mode and the (sharable) settings for that channel -struct Channel { +public 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. @@ -141,24 +141,24 @@ struct Channel { /// 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 + public var index: Int32 = 0 /// /// The new settings, or NULL to disable that channel - var settings: ChannelSettings { + public 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} + public 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} + public mutating func clearSettings() {self._settings = nil} /// /// TODO: REPLACE - var role: Channel.Role = .disabled + public var role: Channel.Role = .disabled - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// How this channel is being used (or not). @@ -170,8 +170,8 @@ struct Channel { /// 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 + public enum Role: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// This channel is not in use right now @@ -187,11 +187,11 @@ struct Channel { case secondary // = 2 case UNRECOGNIZED(Int) - init() { + public init() { self = .disabled } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .disabled case 1: self = .primary @@ -200,7 +200,7 @@ struct Channel { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .disabled: return 0 case .primary: return 1 @@ -211,7 +211,7 @@ struct Channel { } - init() {} + public init() {} fileprivate var _settings: ChannelSettings? = nil } @@ -220,7 +220,7 @@ struct Channel { extension Channel.Role: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Channel.Role] = [ + public static let allCases: [Channel.Role] = [ .disabled, .primary, .secondary, @@ -241,8 +241,8 @@ extension Channel.Role: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ChannelSettings" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ChannelSettings" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "channel_num"), 2: .same(proto: "psk"), 3: .same(proto: "name"), @@ -252,7 +252,7 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen 7: .standard(proto: "module_settings"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -270,7 +270,7 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -299,7 +299,7 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ChannelSettings, rhs: ChannelSettings) -> Bool { + public 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} @@ -313,13 +313,13 @@ extension ChannelSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } extension ModuleSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ModuleSettings" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ModuleSettings" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "position_precision"), 2: .standard(proto: "is_client_muted"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -332,7 +332,7 @@ extension ModuleSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.positionPrecision != 0 { try visitor.visitSingularUInt32Field(value: self.positionPrecision, fieldNumber: 1) } @@ -342,7 +342,7 @@ extension ModuleSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleSettings, rhs: ModuleSettings) -> Bool { + public static func ==(lhs: ModuleSettings, rhs: ModuleSettings) -> Bool { if lhs.positionPrecision != rhs.positionPrecision {return false} if lhs.isClientMuted != rhs.isClientMuted {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -351,14 +351,14 @@ extension ModuleSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Channel" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Channel" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -372,7 +372,7 @@ extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -389,7 +389,7 @@ extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Channel, rhs: Channel) -> Bool { + public 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} @@ -399,7 +399,7 @@ extension Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } extension Channel.Role: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DISABLED"), 1: .same(proto: "PRIMARY"), 2: .same(proto: "SECONDARY"), diff --git a/Meshtastic/Protobufs/meshtastic/clientonly.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/clientonly.pb.swift similarity index 80% rename from Meshtastic/Protobufs/meshtastic/clientonly.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/clientonly.pb.swift index 050c719d..c3d93bf7 100644 --- a/Meshtastic/Protobufs/meshtastic/clientonly.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/clientonly.pb.swift @@ -23,69 +23,69 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// This abstraction is used to contain any configuration for provisioning a node on any client. /// It is useful for importing and exporting configurations. -struct DeviceProfile { +public struct DeviceProfile { // 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. /// /// Long name for the node - var longName: String { + public var longName: String { get {return _longName ?? String()} set {_longName = newValue} } /// Returns true if `longName` has been explicitly set. - var hasLongName: Bool {return self._longName != nil} + public var hasLongName: Bool {return self._longName != nil} /// Clears the value of `longName`. Subsequent reads from it will return its default value. - mutating func clearLongName() {self._longName = nil} + public mutating func clearLongName() {self._longName = nil} /// /// Short name of the node - var shortName: String { + public var shortName: String { get {return _shortName ?? String()} set {_shortName = newValue} } /// Returns true if `shortName` has been explicitly set. - var hasShortName: Bool {return self._shortName != nil} + public var hasShortName: Bool {return self._shortName != nil} /// Clears the value of `shortName`. Subsequent reads from it will return its default value. - mutating func clearShortName() {self._shortName = nil} + public mutating func clearShortName() {self._shortName = nil} /// /// The url of the channels from our node - var channelURL: String { + public var channelURL: String { get {return _channelURL ?? String()} set {_channelURL = newValue} } /// Returns true if `channelURL` has been explicitly set. - var hasChannelURL: Bool {return self._channelURL != nil} + public var hasChannelURL: Bool {return self._channelURL != nil} /// Clears the value of `channelURL`. Subsequent reads from it will return its default value. - mutating func clearChannelURL() {self._channelURL = nil} + public mutating func clearChannelURL() {self._channelURL = nil} /// /// The Config of the node - var config: LocalConfig { + public var config: LocalConfig { get {return _config ?? LocalConfig()} set {_config = newValue} } /// Returns true if `config` has been explicitly set. - var hasConfig: Bool {return self._config != nil} + public var hasConfig: Bool {return self._config != nil} /// Clears the value of `config`. Subsequent reads from it will return its default value. - mutating func clearConfig() {self._config = nil} + public mutating func clearConfig() {self._config = nil} /// /// The ModuleConfig of the node - var moduleConfig: LocalModuleConfig { + public var moduleConfig: LocalModuleConfig { get {return _moduleConfig ?? LocalModuleConfig()} set {_moduleConfig = newValue} } /// Returns true if `moduleConfig` has been explicitly set. - var hasModuleConfig: Bool {return self._moduleConfig != nil} + public var hasModuleConfig: Bool {return self._moduleConfig != nil} /// Clears the value of `moduleConfig`. Subsequent reads from it will return its default value. - mutating func clearModuleConfig() {self._moduleConfig = nil} + public mutating func clearModuleConfig() {self._moduleConfig = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _longName: String? = nil fileprivate var _shortName: String? = nil @@ -103,8 +103,8 @@ extension DeviceProfile: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension DeviceProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".DeviceProfile" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".DeviceProfile" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "long_name"), 2: .standard(proto: "short_name"), 3: .standard(proto: "channel_url"), @@ -112,7 +112,7 @@ extension DeviceProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa 5: .standard(proto: "module_config"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -128,7 +128,7 @@ extension DeviceProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -151,7 +151,7 @@ extension DeviceProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: DeviceProfile, rhs: DeviceProfile) -> Bool { + public static func ==(lhs: DeviceProfile, rhs: DeviceProfile) -> Bool { if lhs._longName != rhs._longName {return false} if lhs._shortName != rhs._shortName {return false} if lhs._channelURL != rhs._channelURL {return false} diff --git a/Meshtastic/Protobufs/meshtastic/config.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift similarity index 86% rename from Meshtastic/Protobufs/meshtastic/config.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/config.pb.swift index 11453fa7..e7571efd 100644 --- a/Meshtastic/Protobufs/meshtastic/config.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift @@ -20,16 +20,16 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct Config { +public 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 + public var payloadVariant: Config.OneOf_PayloadVariant? = nil - var device: Config.DeviceConfig { + public var device: Config.DeviceConfig { get { if case .device(let v)? = payloadVariant {return v} return Config.DeviceConfig() @@ -37,7 +37,7 @@ struct Config { set {payloadVariant = .device(newValue)} } - var position: Config.PositionConfig { + public var position: Config.PositionConfig { get { if case .position(let v)? = payloadVariant {return v} return Config.PositionConfig() @@ -45,7 +45,7 @@ struct Config { set {payloadVariant = .position(newValue)} } - var power: Config.PowerConfig { + public var power: Config.PowerConfig { get { if case .power(let v)? = payloadVariant {return v} return Config.PowerConfig() @@ -53,7 +53,7 @@ struct Config { set {payloadVariant = .power(newValue)} } - var network: Config.NetworkConfig { + public var network: Config.NetworkConfig { get { if case .network(let v)? = payloadVariant {return v} return Config.NetworkConfig() @@ -61,7 +61,7 @@ struct Config { set {payloadVariant = .network(newValue)} } - var display: Config.DisplayConfig { + public var display: Config.DisplayConfig { get { if case .display(let v)? = payloadVariant {return v} return Config.DisplayConfig() @@ -69,7 +69,7 @@ struct Config { set {payloadVariant = .display(newValue)} } - var lora: Config.LoRaConfig { + public var lora: Config.LoRaConfig { get { if case .lora(let v)? = payloadVariant {return v} return Config.LoRaConfig() @@ -77,7 +77,7 @@ struct Config { set {payloadVariant = .lora(newValue)} } - var bluetooth: Config.BluetoothConfig { + public var bluetooth: Config.BluetoothConfig { get { if case .bluetooth(let v)? = payloadVariant {return v} return Config.BluetoothConfig() @@ -85,11 +85,11 @@ struct Config { set {payloadVariant = .bluetooth(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// Payload Variant - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { case device(Config.DeviceConfig) case position(Config.PositionConfig) case power(Config.PowerConfig) @@ -99,7 +99,7 @@ struct Config { case bluetooth(Config.BluetoothConfig) #if !swift(>=4.1) - static func ==(lhs: Config.OneOf_PayloadVariant, rhs: Config.OneOf_PayloadVariant) -> Bool { + public 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 @@ -140,70 +140,70 @@ struct Config { /// /// Configuration - struct DeviceConfig { + public 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 + public var role: Config.DeviceConfig.Role = .client /// /// Disabling this will disable the SerialConsole by not initilizing the StreamAPI - var serialEnabled: Bool = false + public 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 + public 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 + public 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 + public var buzzerGpio: UInt32 = 0 /// /// Sets the role of node - var rebroadcastMode: Config.DeviceConfig.RebroadcastMode = .all + public var rebroadcastMode: Config.DeviceConfig.RebroadcastMode = .all /// /// Send our nodeinfo this often /// Defaults to 900 Seconds (15 minutes) - var nodeInfoBroadcastSecs: UInt32 = 0 + public var nodeInfoBroadcastSecs: UInt32 = 0 /// /// Treat double tap interrupt on supported accelerometers as a button press if set to true - var doubleTapAsButtonPress: Bool = false + public var doubleTapAsButtonPress: Bool = false /// /// If true, device is considered to be "managed" by a mesh administrator /// Clients should then limit available configuration and administrative options inside the user interface - var isManaged: Bool = false + public var isManaged: Bool = false /// /// Disables the triple-press of user button to enable or disable GPS - var disableTripleClick: Bool = false + public var disableTripleClick: Bool = false /// /// POSIX Timezone definition string from https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv. - var tzdef: String = String() + public var tzdef: String = String() /// /// If true, disable the default blinking LED (LED_PIN) behavior on the device - var ledHeartbeatDisabled: Bool = false + public var ledHeartbeatDisabled: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// Defines the device's role on the Mesh network - enum Role: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum Role: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Description: App connected or stand alone messaging device. @@ -275,11 +275,11 @@ struct Config { case takTracker // = 10 case UNRECOGNIZED(Int) - init() { + public init() { self = .client } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .client case 1: self = .clientMute @@ -296,7 +296,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .client: return 0 case .clientMute: return 1 @@ -317,8 +317,8 @@ struct Config { /// /// Defines the device's behavior for how messages are rebroadcast - enum RebroadcastMode: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum RebroadcastMode: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Default behavior. @@ -341,11 +341,11 @@ struct Config { case knownOnly // = 3 case UNRECOGNIZED(Int) - init() { + public init() { self = .all } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .all case 1: self = .allSkipDecoding @@ -355,7 +355,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .all: return 0 case .allSkipDecoding: return 1 @@ -367,12 +367,12 @@ struct Config { } - init() {} + public init() {} } /// /// Position Config - struct PositionConfig { + public 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. @@ -380,62 +380,62 @@ struct Config { /// /// We should send our position this often (but only if it has changed significantly) /// Defaults to 15 minutes - var positionBroadcastSecs: UInt32 = 0 + public var positionBroadcastSecs: UInt32 = 0 /// /// Adaptive position braoadcast, which is now the default. - var positionBroadcastSmartEnabled: Bool = false + public 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 + public var fixedPosition: Bool = false /// /// Is GPS enabled for this node? - var gpsEnabled: Bool = false + public 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 + public var gpsUpdateInterval: UInt32 = 0 /// /// Deprecated in favor of using smart / regular broadcast intervals as implicit attempt time - var gpsAttemptTime: UInt32 = 0 + public var gpsAttemptTime: UInt32 = 0 /// /// Bit field of boolean configuration options for POSITION messages /// (bitwise OR of PositionFlags) - var positionFlags: UInt32 = 0 + public var positionFlags: UInt32 = 0 /// /// (Re)define GPS_RX_PIN for your board. - var rxGpio: UInt32 = 0 + public var rxGpio: UInt32 = 0 /// /// (Re)define GPS_TX_PIN for your board. - var txGpio: UInt32 = 0 + public var txGpio: UInt32 = 0 /// /// The minimum distance in meters traveled (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled - var broadcastSmartMinimumDistance: UInt32 = 0 + public var broadcastSmartMinimumDistance: UInt32 = 0 /// /// The minimum number of seconds (since the last send) before we can send a position to the mesh if position_broadcast_smart_enabled - var broadcastSmartMinimumIntervalSecs: UInt32 = 0 + public var broadcastSmartMinimumIntervalSecs: UInt32 = 0 /// /// (Re)define PIN_GPS_EN for your board. - var gpsEnGpio: UInt32 = 0 + public var gpsEnGpio: UInt32 = 0 /// /// Set where GPS is enabled, disabled, or not present - var gpsMode: Config.PositionConfig.GpsMode = .disabled + public var gpsMode: Config.PositionConfig.GpsMode = .disabled - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// Bit field of boolean configuration options, indicating which optional @@ -444,8 +444,8 @@ struct Config { /// 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 + public enum PositionFlags: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Required for compilation @@ -496,11 +496,11 @@ struct Config { case speed // = 512 case UNRECOGNIZED(Int) - init() { + public init() { self = .unset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unset case 1: self = .altitude @@ -517,7 +517,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unset: return 0 case .altitude: return 1 @@ -536,8 +536,8 @@ struct Config { } - enum GpsMode: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum GpsMode: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// GPS is present but disabled @@ -552,11 +552,11 @@ struct Config { case notPresent // = 2 case UNRECOGNIZED(Int) - init() { + public init() { self = .disabled } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .disabled case 1: self = .enabled @@ -565,7 +565,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .disabled: return 0 case .enabled: return 1 @@ -576,13 +576,13 @@ struct Config { } - init() {} + public init() {} } /// /// Power Config\ /// See [Power Config](/docs/settings/config/power) for additional power config details. - struct PowerConfig { + public 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. @@ -591,106 +591,101 @@ struct Config { /// Description: Will sleep everything as much as possible, for the tracker and sensor role this will also include the lora radio. /// Don't use this setting if you want to use your device with the phone apps or are using a device without a user button. /// Technical Details: Works for ESP32 devices and NRF52 devices in the Sensor or Tracker roles - var isPowerSaving: Bool = false + public var isPowerSaving: Bool = false /// /// Description: If non-zero, the device will fully power off this many seconds after external power is removed. - var onBatteryShutdownAfterSecs: UInt32 = 0 + public 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. /// https://meshtastic.org/docs/configuration/radio/power/#adc-multiplier-override /// Should be set to floating point value between 2 and 6 - var adcMultiplierOverride: Float = 0 + public var adcMultiplierOverride: Float = 0 /// /// Description: The number of seconds for to wait before turning off BLE in No Bluetooth states /// Technical Details: ESP32 Only 0 for default of 1 minute - var waitBluetoothSecs: UInt32 = 0 + public var waitBluetoothSecs: 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 + public var sdsSecs: UInt32 = 0 /// /// Description: In light sleep the CPU is suspended, LoRa radio is on, BLE is off an GPS is on /// Technical Details: ESP32 Only 0 for default of 300 - var lsSecs: UInt32 = 0 + public var lsSecs: UInt32 = 0 /// /// Description: 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 /// Technical Details: ESP32 Only 0 for default of 10 seconds - var minWakeSecs: UInt32 = 0 + public var minWakeSecs: UInt32 = 0 /// /// I2C address of INA_2XX to use for reading device battery voltage - var deviceBatteryInaAddress: UInt32 = 0 + public var deviceBatteryInaAddress: UInt32 = 0 - /// - /// If non-zero, we want powermon log outputs. With the particular (bitfield) sources enabled. - /// Note: we picked an ID of 32 so that lower more efficient IDs can be used for more frequently used options. - var powermonEnables: UInt64 = 0 + public var unknownFields = SwiftProtobuf.UnknownStorage() - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} + public init() {} } /// /// Network Config - struct NetworkConfig { + public 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 + public 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() + public var wifiSsid: String = String() /// /// If set, will be use to authenticate to the named wifi - var wifiPsk: String = String() + public var wifiPsk: String = String() /// /// NTP server to use if WiFi is conneced, defaults to `0.pool.ntp.org` - var ntpServer: String = String() + public var ntpServer: String = String() /// /// Enable Ethernet - var ethEnabled: Bool = false + public var ethEnabled: Bool = false /// /// acquire an address via DHCP or assign static - var addressMode: Config.NetworkConfig.AddressMode = .dhcp + public var addressMode: Config.NetworkConfig.AddressMode = .dhcp /// /// struct to keep static address - var ipv4Config: Config.NetworkConfig.IpV4Config { + public 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} + public 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} + public mutating func clearIpv4Config() {self._ipv4Config = nil} /// /// rsyslog Server and Port - var rsyslogServer: String = String() + public var rsyslogServer: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum AddressMode: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum AddressMode: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// obtain ip address via DHCP @@ -701,11 +696,11 @@ struct Config { case `static` // = 1 case UNRECOGNIZED(Int) - init() { + public init() { self = .dhcp } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .dhcp case 1: self = .static @@ -713,7 +708,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .dhcp: return 0 case .static: return 1 @@ -723,40 +718,40 @@ struct Config { } - struct IpV4Config { + public 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 + public var ip: UInt32 = 0 /// /// Static gateway address - var gateway: UInt32 = 0 + public var gateway: UInt32 = 0 /// /// Static subnet mask - var subnet: UInt32 = 0 + public var subnet: UInt32 = 0 /// /// Static DNS server address - var dns: UInt32 = 0 + public var dns: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } - init() {} + public init() {} fileprivate var _ipv4Config: Config.NetworkConfig.IpV4Config? = nil } /// /// Display Config - struct DisplayConfig { + public 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. @@ -764,56 +759,56 @@ struct Config { /// /// 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 + public var screenOnSecs: UInt32 = 0 /// /// How the GPS coordinates are formatted on the OLED screen. - var gpsFormat: Config.DisplayConfig.GpsCoordinateFormat = .dec + public 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 + public 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 + public var compassNorthTop: Bool = false /// /// Flip screen vertically, for cases that mount the screen upside down - var flipScreen: Bool = false + public var flipScreen: Bool = false /// /// Perferred display units - var units: Config.DisplayConfig.DisplayUnits = .metric + public var units: Config.DisplayConfig.DisplayUnits = .metric /// /// Override auto-detect in screen - var oled: Config.DisplayConfig.OledType = .oledAuto + public var oled: Config.DisplayConfig.OledType = .oledAuto /// /// Display Mode - var displaymode: Config.DisplayConfig.DisplayMode = .default + public var displaymode: Config.DisplayConfig.DisplayMode = .default /// /// Print first line in pseudo-bold? FALSE is original style, TRUE is bold - var headingBold: Bool = false + public var headingBold: Bool = false /// /// Should we wake the screen up on accelerometer detected motion or tap - var wakeOnTapOrMotion: Bool = false + public var wakeOnTapOrMotion: Bool = false /// /// Indicates how to rotate or invert the compass output to accurate display on the display. - var compassOrientation: Config.DisplayConfig.CompassOrientation = .degrees0 + public var compassOrientation: Config.DisplayConfig.CompassOrientation = .degrees0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// How the GPS coordinates are displayed on the OLED screen. - enum GpsCoordinateFormat: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum GpsCoordinateFormat: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// GPS coordinates are displayed in the normal decimal degrees format: @@ -847,11 +842,11 @@ struct Config { case osgr // = 5 case UNRECOGNIZED(Int) - init() { + public init() { self = .dec } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .dec case 1: self = .dms @@ -863,7 +858,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .dec: return 0 case .dms: return 1 @@ -879,8 +874,8 @@ struct Config { /// /// Unit display preference - enum DisplayUnits: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum DisplayUnits: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Metric (Default) @@ -891,11 +886,11 @@ struct Config { case imperial // = 1 case UNRECOGNIZED(Int) - init() { + public init() { self = .metric } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .metric case 1: self = .imperial @@ -903,7 +898,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .metric: return 0 case .imperial: return 1 @@ -915,8 +910,8 @@ struct Config { /// /// Override OLED outo detect with this if it fails. - enum OledType: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum OledType: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Default / Auto @@ -935,11 +930,11 @@ struct Config { case oledSh1107 // = 3 case UNRECOGNIZED(Int) - init() { + public init() { self = .oledAuto } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .oledAuto case 1: self = .oledSsd1306 @@ -949,7 +944,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .oledAuto: return 0 case .oledSsd1306: return 1 @@ -961,8 +956,8 @@ struct Config { } - enum DisplayMode: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum DisplayMode: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Default. The old style for the 128x64 OLED screen @@ -981,11 +976,11 @@ struct Config { case color // = 3 case UNRECOGNIZED(Int) - init() { + public init() { self = .default } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .default case 1: self = .twocolor @@ -995,7 +990,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .default: return 0 case .twocolor: return 1 @@ -1007,8 +1002,8 @@ struct Config { } - enum CompassOrientation: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum CompassOrientation: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// The compass and the display are in the same orientation. @@ -1043,11 +1038,11 @@ struct Config { case degrees270Inverted // = 7 case UNRECOGNIZED(Int) - init() { + public init() { self = .degrees0 } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .degrees0 case 1: self = .degrees90 @@ -1061,7 +1056,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .degrees0: return 0 case .degrees90: return 1 @@ -1077,12 +1072,12 @@ struct Config { } - init() {} + public init() {} } /// /// Lora Config - struct LoRaConfig { + public 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. @@ -1090,7 +1085,7 @@ struct Config { /// /// When enabled, the `modem_preset` fields will be adhered to, else the `bandwidth`/`spread_factor`/`coding_rate` /// will be taked from their respective manually defined fields - var usePreset: Bool = false + public var usePreset: Bool = false /// /// Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH. @@ -1098,51 +1093,51 @@ struct 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 + public 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 + public var bandwidth: UInt32 = 0 /// /// A number from 7 to 12. /// Indicates number of chirps per symbol as 1< 7 results in the default - var hopLimit: UInt32 = 0 + public var hopLimit: UInt32 = 0 /// /// Disable TX from the LoRa radio. Useful for hot-swapping antennas and other tests. /// Defaults to false - var txEnabled: Bool = false + public var txEnabled: Bool = false /// /// If zero, then use default max legal continuous power (ie. something that won't /// burn out the radio hardware) /// In most cases you should use zero here. /// Units are in dBm. - var txPower: Int32 = 0 + public var txPower: Int32 = 0 /// /// This controls the actual hardware frequency the radio transmits on. @@ -1152,17 +1147,17 @@ struct Config { /// algorithm to derive the channel number") /// If using the hash algorithm the channel number will be: hash(channel_name) % /// NUM_CHANNELS (Where num channels depends on the regulatory region). - var channelNum: UInt32 = 0 + public var channelNum: UInt32 = 0 /// /// If true, duty cycle limits will be exceeded and thus you're possibly not following /// the local regulations if you're not a HAM. /// Has no effect if the duty cycle of the used region is 100%. - var overrideDutyCycle: Bool = false + public var overrideDutyCycle: Bool = false /// /// If true, sets RX boosted gain mode on SX126X based radios - var sx126XRxBoostedGain: Bool = false + public var sx126XRxBoostedGain: Bool = false /// /// This parameter is for advanced users and licensed HAM radio operators. @@ -1170,22 +1165,22 @@ struct Config { /// will still be applied. This will allow you to use out-of-band frequencies. /// Please respect your local laws and regulations. If you are a HAM, make sure you /// enable HAM mode and turn off encryption. - var overrideFrequency: Float = 0 + public var overrideFrequency: Float = 0 /// /// For testing it is useful sometimes to force a node to never listen to /// particular other nodes (simulating radio out of range). All nodenums listed /// in ignore_incoming will have packets they send dropped on receive (by router.cpp) - var ignoreIncoming: [UInt32] = [] + public var ignoreIncoming: [UInt32] = [] /// /// If true, the device will not process any packets received via LoRa that passed via MQTT anywhere on the path towards it. - var ignoreMqtt: Bool = false + public var ignoreMqtt: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum RegionCode: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum RegionCode: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Region is not set @@ -1264,11 +1259,11 @@ struct Config { case sg923 // = 18 case UNRECOGNIZED(Int) - init() { + public init() { self = .unset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unset case 1: self = .us @@ -1293,7 +1288,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unset: return 0 case .us: return 1 @@ -1323,8 +1318,8 @@ struct Config { /// /// Standard predefined channel settings /// Note: these mappings must match ModemPreset Choice in the device code. - enum ModemPreset: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum ModemPreset: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Long Range - Fast @@ -1359,11 +1354,11 @@ struct Config { case longModerate // = 7 case UNRECOGNIZED(Int) - init() { + public init() { self = .longFast } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .longFast case 1: self = .longSlow @@ -1377,7 +1372,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .longFast: return 0 case .longSlow: return 1 @@ -1393,34 +1388,34 @@ struct Config { } - init() {} + public init() {} } - struct BluetoothConfig { + public struct BluetoothConfig { // 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 Bluetooth on the device - var enabled: Bool = false + public var enabled: Bool = false /// /// Determines the pairing strategy for the device - var mode: Config.BluetoothConfig.PairingMode = .randomPin + public var mode: Config.BluetoothConfig.PairingMode = .randomPin /// /// Specified PIN for PairingMode.FixedPin - var fixedPin: UInt32 = 0 + public var fixedPin: UInt32 = 0 /// /// Enables device (serial style logs) over Bluetooth - var deviceLoggingEnabled: Bool = false + public var deviceLoggingEnabled: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum PairingMode: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum PairingMode: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Device generates a random PIN that will be shown on the screen of the device for pairing @@ -1435,11 +1430,11 @@ struct Config { case noPin // = 2 case UNRECOGNIZED(Int) - init() { + public init() { self = .randomPin } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .randomPin case 1: self = .fixedPin @@ -1448,7 +1443,7 @@ struct Config { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .randomPin: return 0 case .fixedPin: return 1 @@ -1459,17 +1454,17 @@ struct Config { } - init() {} + public init() {} } - init() {} + public init() {} } #if swift(>=4.2) extension Config.DeviceConfig.Role: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.DeviceConfig.Role] = [ + public static let allCases: [Config.DeviceConfig.Role] = [ .client, .clientMute, .router, @@ -1486,7 +1481,7 @@ extension Config.DeviceConfig.Role: CaseIterable { extension Config.DeviceConfig.RebroadcastMode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.DeviceConfig.RebroadcastMode] = [ + public static let allCases: [Config.DeviceConfig.RebroadcastMode] = [ .all, .allSkipDecoding, .localOnly, @@ -1496,7 +1491,7 @@ extension Config.DeviceConfig.RebroadcastMode: CaseIterable { extension Config.PositionConfig.PositionFlags: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.PositionConfig.PositionFlags] = [ + public static let allCases: [Config.PositionConfig.PositionFlags] = [ .unset, .altitude, .altitudeMsl, @@ -1513,7 +1508,7 @@ extension Config.PositionConfig.PositionFlags: CaseIterable { extension Config.PositionConfig.GpsMode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.PositionConfig.GpsMode] = [ + public static let allCases: [Config.PositionConfig.GpsMode] = [ .disabled, .enabled, .notPresent, @@ -1522,7 +1517,7 @@ extension Config.PositionConfig.GpsMode: CaseIterable { extension Config.NetworkConfig.AddressMode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.NetworkConfig.AddressMode] = [ + public static let allCases: [Config.NetworkConfig.AddressMode] = [ .dhcp, .static, ] @@ -1530,7 +1525,7 @@ extension Config.NetworkConfig.AddressMode: CaseIterable { extension Config.DisplayConfig.GpsCoordinateFormat: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.DisplayConfig.GpsCoordinateFormat] = [ + public static let allCases: [Config.DisplayConfig.GpsCoordinateFormat] = [ .dec, .dms, .utm, @@ -1542,7 +1537,7 @@ extension Config.DisplayConfig.GpsCoordinateFormat: CaseIterable { extension Config.DisplayConfig.DisplayUnits: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.DisplayConfig.DisplayUnits] = [ + public static let allCases: [Config.DisplayConfig.DisplayUnits] = [ .metric, .imperial, ] @@ -1550,7 +1545,7 @@ extension Config.DisplayConfig.DisplayUnits: CaseIterable { extension Config.DisplayConfig.OledType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.DisplayConfig.OledType] = [ + public static let allCases: [Config.DisplayConfig.OledType] = [ .oledAuto, .oledSsd1306, .oledSh1106, @@ -1560,7 +1555,7 @@ extension Config.DisplayConfig.OledType: CaseIterable { extension Config.DisplayConfig.DisplayMode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.DisplayConfig.DisplayMode] = [ + public static let allCases: [Config.DisplayConfig.DisplayMode] = [ .default, .twocolor, .inverted, @@ -1570,7 +1565,7 @@ extension Config.DisplayConfig.DisplayMode: CaseIterable { extension Config.DisplayConfig.CompassOrientation: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.DisplayConfig.CompassOrientation] = [ + public static let allCases: [Config.DisplayConfig.CompassOrientation] = [ .degrees0, .degrees90, .degrees180, @@ -1584,7 +1579,7 @@ extension Config.DisplayConfig.CompassOrientation: CaseIterable { extension Config.LoRaConfig.RegionCode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.LoRaConfig.RegionCode] = [ + public static let allCases: [Config.LoRaConfig.RegionCode] = [ .unset, .us, .eu433, @@ -1609,7 +1604,7 @@ extension Config.LoRaConfig.RegionCode: CaseIterable { extension Config.LoRaConfig.ModemPreset: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.LoRaConfig.ModemPreset] = [ + public static let allCases: [Config.LoRaConfig.ModemPreset] = [ .longFast, .longSlow, .veryLongSlow, @@ -1623,7 +1618,7 @@ extension Config.LoRaConfig.ModemPreset: CaseIterable { extension Config.BluetoothConfig.PairingMode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Config.BluetoothConfig.PairingMode] = [ + public static let allCases: [Config.BluetoothConfig.PairingMode] = [ .randomPin, .fixedPin, .noPin, @@ -1663,8 +1658,8 @@ extension Config.BluetoothConfig.PairingMode: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Config" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Config" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "device"), 2: .same(proto: "position"), 3: .same(proto: "power"), @@ -1674,7 +1669,7 @@ extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas 7: .same(proto: "bluetooth"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1776,7 +1771,7 @@ extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -1815,7 +1810,7 @@ extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config, rhs: Config) -> Bool { + public static func ==(lhs: Config, rhs: Config) -> Bool { if lhs.payloadVariant != rhs.payloadVariant {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -1823,8 +1818,8 @@ extension Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas } extension Config.DeviceConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".DeviceConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = Config.protoMessageName + ".DeviceConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "role"), 2: .standard(proto: "serial_enabled"), 3: .standard(proto: "debug_log_enabled"), @@ -1839,7 +1834,7 @@ extension Config.DeviceConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl 12: .standard(proto: "led_heartbeat_disabled"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1862,7 +1857,7 @@ extension Config.DeviceConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.role != .client { try visitor.visitSingularEnumField(value: self.role, fieldNumber: 1) } @@ -1902,7 +1897,7 @@ extension Config.DeviceConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.DeviceConfig, rhs: Config.DeviceConfig) -> Bool { + public 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} @@ -1921,7 +1916,7 @@ extension Config.DeviceConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl } extension Config.DeviceConfig.Role: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "CLIENT"), 1: .same(proto: "CLIENT_MUTE"), 2: .same(proto: "ROUTER"), @@ -1937,7 +1932,7 @@ extension Config.DeviceConfig.Role: SwiftProtobuf._ProtoNameProviding { } extension Config.DeviceConfig.RebroadcastMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "ALL"), 1: .same(proto: "ALL_SKIP_DECODING"), 2: .same(proto: "LOCAL_ONLY"), @@ -1946,8 +1941,8 @@ extension Config.DeviceConfig.RebroadcastMode: SwiftProtobuf._ProtoNameProviding } extension Config.PositionConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".PositionConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = Config.protoMessageName + ".PositionConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "position_broadcast_secs"), 2: .standard(proto: "position_broadcast_smart_enabled"), 3: .standard(proto: "fixed_position"), @@ -1963,7 +1958,7 @@ extension Config.PositionConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageIm 13: .standard(proto: "gps_mode"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1987,7 +1982,7 @@ extension Config.PositionConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageIm } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.positionBroadcastSecs != 0 { try visitor.visitSingularUInt32Field(value: self.positionBroadcastSecs, fieldNumber: 1) } @@ -2030,7 +2025,7 @@ extension Config.PositionConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageIm try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.PositionConfig, rhs: Config.PositionConfig) -> Bool { + public 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} @@ -2050,7 +2045,7 @@ extension Config.PositionConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageIm } extension Config.PositionConfig.PositionFlags: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNSET"), 1: .same(proto: "ALTITUDE"), 2: .same(proto: "ALTITUDE_MSL"), @@ -2066,7 +2061,7 @@ extension Config.PositionConfig.PositionFlags: SwiftProtobuf._ProtoNameProviding } extension Config.PositionConfig.GpsMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DISABLED"), 1: .same(proto: "ENABLED"), 2: .same(proto: "NOT_PRESENT"), @@ -2074,8 +2069,8 @@ extension Config.PositionConfig.GpsMode: SwiftProtobuf._ProtoNameProviding { } extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".PowerConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = Config.protoMessageName + ".PowerConfig" + public 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"), @@ -2087,7 +2082,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 32: .standard(proto: "powermon_enables"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2107,7 +2102,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.isPowerSaving != false { try visitor.visitSingularBoolField(value: self.isPowerSaving, fieldNumber: 1) } @@ -2138,7 +2133,7 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.PowerConfig, rhs: Config.PowerConfig) -> Bool { + public 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} @@ -2154,8 +2149,8 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple } extension Config.NetworkConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".NetworkConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = Config.protoMessageName + ".NetworkConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "wifi_enabled"), 3: .standard(proto: "wifi_ssid"), 4: .standard(proto: "wifi_psk"), @@ -2166,7 +2161,7 @@ extension Config.NetworkConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 9: .standard(proto: "rsyslog_server"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2185,7 +2180,7 @@ extension Config.NetworkConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -2217,7 +2212,7 @@ extension Config.NetworkConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.NetworkConfig, rhs: Config.NetworkConfig) -> Bool { + public 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} @@ -2232,22 +2227,22 @@ extension Config.NetworkConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } extension Config.NetworkConfig.AddressMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public 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 = [ + public static let protoMessageName: String = Config.NetworkConfig.protoMessageName + ".IpV4Config" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2262,7 +2257,7 @@ extension Config.NetworkConfig.IpV4Config: SwiftProtobuf.Message, SwiftProtobuf. } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.ip != 0 { try visitor.visitSingularFixed32Field(value: self.ip, fieldNumber: 1) } @@ -2278,7 +2273,7 @@ extension Config.NetworkConfig.IpV4Config: SwiftProtobuf.Message, SwiftProtobuf. try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.NetworkConfig.IpV4Config, rhs: Config.NetworkConfig.IpV4Config) -> Bool { + public 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} @@ -2289,8 +2284,8 @@ extension Config.NetworkConfig.IpV4Config: SwiftProtobuf.Message, SwiftProtobuf. } extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".DisplayConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = Config.protoMessageName + ".DisplayConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "screen_on_secs"), 2: .standard(proto: "gps_format"), 3: .standard(proto: "auto_screen_carousel_secs"), @@ -2304,7 +2299,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 11: .standard(proto: "compass_orientation"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2326,7 +2321,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.screenOnSecs != 0 { try visitor.visitSingularUInt32Field(value: self.screenOnSecs, fieldNumber: 1) } @@ -2363,7 +2358,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.DisplayConfig, rhs: Config.DisplayConfig) -> Bool { + public 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} @@ -2381,7 +2376,7 @@ extension Config.DisplayConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } extension Config.DisplayConfig.GpsCoordinateFormat: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DEC"), 1: .same(proto: "DMS"), 2: .same(proto: "UTM"), @@ -2392,14 +2387,14 @@ extension Config.DisplayConfig.GpsCoordinateFormat: SwiftProtobuf._ProtoNameProv } extension Config.DisplayConfig.DisplayUnits: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public 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 = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "OLED_AUTO"), 1: .same(proto: "OLED_SSD1306"), 2: .same(proto: "OLED_SH1106"), @@ -2408,7 +2403,7 @@ extension Config.DisplayConfig.OledType: SwiftProtobuf._ProtoNameProviding { } extension Config.DisplayConfig.DisplayMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DEFAULT"), 1: .same(proto: "TWOCOLOR"), 2: .same(proto: "INVERTED"), @@ -2417,7 +2412,7 @@ extension Config.DisplayConfig.DisplayMode: SwiftProtobuf._ProtoNameProviding { } extension Config.DisplayConfig.CompassOrientation: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DEGREES_0"), 1: .same(proto: "DEGREES_90"), 2: .same(proto: "DEGREES_180"), @@ -2430,8 +2425,8 @@ extension Config.DisplayConfig.CompassOrientation: SwiftProtobuf._ProtoNameProvi } extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".LoRaConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = Config.protoMessageName + ".LoRaConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "use_preset"), 2: .standard(proto: "modem_preset"), 3: .same(proto: "bandwidth"), @@ -2450,7 +2445,7 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem 104: .standard(proto: "ignore_mqtt"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2477,7 +2472,7 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.usePreset != false { try visitor.visitSingularBoolField(value: self.usePreset, fieldNumber: 1) } @@ -2529,7 +2524,7 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.LoRaConfig, rhs: Config.LoRaConfig) -> Bool { + public 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} @@ -2552,7 +2547,7 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem } extension Config.LoRaConfig.RegionCode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNSET"), 1: .same(proto: "US"), 2: .same(proto: "EU_433"), @@ -2576,7 +2571,7 @@ extension Config.LoRaConfig.RegionCode: SwiftProtobuf._ProtoNameProviding { } extension Config.LoRaConfig.ModemPreset: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "LONG_FAST"), 1: .same(proto: "LONG_SLOW"), 2: .same(proto: "VERY_LONG_SLOW"), @@ -2589,15 +2584,15 @@ extension Config.LoRaConfig.ModemPreset: SwiftProtobuf._ProtoNameProviding { } extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Config.protoMessageName + ".BluetoothConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = Config.protoMessageName + ".BluetoothConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .same(proto: "mode"), 3: .standard(proto: "fixed_pin"), 4: .standard(proto: "device_logging_enabled"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2612,7 +2607,7 @@ extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -2628,7 +2623,7 @@ extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Config.BluetoothConfig, rhs: Config.BluetoothConfig) -> Bool { + public 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} @@ -2639,7 +2634,7 @@ extension Config.BluetoothConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageI } extension Config.BluetoothConfig.PairingMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public 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/meshtastic/connection_status.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/connection_status.pb.swift similarity index 76% rename from Meshtastic/Protobufs/meshtastic/connection_status.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/connection_status.pb.swift index 7092c3b3..a2ec180e 100644 --- a/Meshtastic/Protobufs/meshtastic/connection_status.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/connection_status.pb.swift @@ -20,58 +20,58 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct DeviceConnectionStatus { +public struct DeviceConnectionStatus { // 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. /// /// WiFi Status - var wifi: WifiConnectionStatus { + public var wifi: WifiConnectionStatus { get {return _wifi ?? WifiConnectionStatus()} set {_wifi = newValue} } /// Returns true if `wifi` has been explicitly set. - var hasWifi: Bool {return self._wifi != nil} + public var hasWifi: Bool {return self._wifi != nil} /// Clears the value of `wifi`. Subsequent reads from it will return its default value. - mutating func clearWifi() {self._wifi = nil} + public mutating func clearWifi() {self._wifi = nil} /// /// WiFi Status - var ethernet: EthernetConnectionStatus { + public var ethernet: EthernetConnectionStatus { get {return _ethernet ?? EthernetConnectionStatus()} set {_ethernet = newValue} } /// Returns true if `ethernet` has been explicitly set. - var hasEthernet: Bool {return self._ethernet != nil} + public var hasEthernet: Bool {return self._ethernet != nil} /// Clears the value of `ethernet`. Subsequent reads from it will return its default value. - mutating func clearEthernet() {self._ethernet = nil} + public mutating func clearEthernet() {self._ethernet = nil} /// /// Bluetooth Status - var bluetooth: BluetoothConnectionStatus { + public var bluetooth: BluetoothConnectionStatus { get {return _bluetooth ?? BluetoothConnectionStatus()} set {_bluetooth = newValue} } /// Returns true if `bluetooth` has been explicitly set. - var hasBluetooth: Bool {return self._bluetooth != nil} + public var hasBluetooth: Bool {return self._bluetooth != nil} /// Clears the value of `bluetooth`. Subsequent reads from it will return its default value. - mutating func clearBluetooth() {self._bluetooth = nil} + public mutating func clearBluetooth() {self._bluetooth = nil} /// /// Serial Status - var serial: SerialConnectionStatus { + public var serial: SerialConnectionStatus { get {return _serial ?? SerialConnectionStatus()} set {_serial = newValue} } /// Returns true if `serial` has been explicitly set. - var hasSerial: Bool {return self._serial != nil} + public var hasSerial: Bool {return self._serial != nil} /// Clears the value of `serial`. Subsequent reads from it will return its default value. - mutating func clearSerial() {self._serial = nil} + public mutating func clearSerial() {self._serial = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _wifi: WifiConnectionStatus? = nil fileprivate var _ethernet: EthernetConnectionStatus? = nil @@ -81,132 +81,132 @@ struct DeviceConnectionStatus { /// /// WiFi connection status -struct WifiConnectionStatus { +public struct WifiConnectionStatus { // 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. /// /// Connection status - var status: NetworkConnectionStatus { + public var status: NetworkConnectionStatus { get {return _status ?? NetworkConnectionStatus()} set {_status = newValue} } /// Returns true if `status` has been explicitly set. - var hasStatus: Bool {return self._status != nil} + public var hasStatus: Bool {return self._status != nil} /// Clears the value of `status`. Subsequent reads from it will return its default value. - mutating func clearStatus() {self._status = nil} + public mutating func clearStatus() {self._status = nil} /// /// WiFi access point SSID - var ssid: String = String() + public var ssid: String = String() /// /// RSSI of wireless connection - var rssi: Int32 = 0 + public var rssi: Int32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _status: NetworkConnectionStatus? = nil } /// /// Ethernet connection status -struct EthernetConnectionStatus { +public struct EthernetConnectionStatus { // 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. /// /// Connection status - var status: NetworkConnectionStatus { + public var status: NetworkConnectionStatus { get {return _status ?? NetworkConnectionStatus()} set {_status = newValue} } /// Returns true if `status` has been explicitly set. - var hasStatus: Bool {return self._status != nil} + public var hasStatus: Bool {return self._status != nil} /// Clears the value of `status`. Subsequent reads from it will return its default value. - mutating func clearStatus() {self._status = nil} + public mutating func clearStatus() {self._status = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _status: NetworkConnectionStatus? = nil } /// /// Ethernet or WiFi connection status -struct NetworkConnectionStatus { +public struct NetworkConnectionStatus { // 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. /// /// IP address of device - var ipAddress: UInt32 = 0 + public var ipAddress: UInt32 = 0 /// /// Whether the device has an active connection or not - var isConnected: Bool = false + public var isConnected: Bool = false /// /// Whether the device has an active connection to an MQTT broker or not - var isMqttConnected: Bool = false + public var isMqttConnected: Bool = false /// /// Whether the device is actively remote syslogging or not - var isSyslogConnected: Bool = false + public var isSyslogConnected: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Bluetooth connection status -struct BluetoothConnectionStatus { +public struct BluetoothConnectionStatus { // 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 pairing PIN for bluetooth - var pin: UInt32 = 0 + public var pin: UInt32 = 0 /// /// RSSI of bluetooth connection - var rssi: Int32 = 0 + public var rssi: Int32 = 0 /// /// Whether the device has an active connection or not - var isConnected: Bool = false + public var isConnected: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Serial connection status -struct SerialConnectionStatus { +public struct SerialConnectionStatus { // 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. /// /// Serial baud rate - var baud: UInt32 = 0 + public var baud: UInt32 = 0 /// /// Whether the device has an active connection or not - var isConnected: Bool = false + public var isConnected: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -223,15 +223,15 @@ extension SerialConnectionStatus: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension DeviceConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".DeviceConnectionStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".DeviceConnectionStatus" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "wifi"), 2: .same(proto: "ethernet"), 3: .same(proto: "bluetooth"), 4: .same(proto: "serial"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -246,7 +246,7 @@ extension DeviceConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -266,7 +266,7 @@ extension DeviceConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: DeviceConnectionStatus, rhs: DeviceConnectionStatus) -> Bool { + public static func ==(lhs: DeviceConnectionStatus, rhs: DeviceConnectionStatus) -> Bool { if lhs._wifi != rhs._wifi {return false} if lhs._ethernet != rhs._ethernet {return false} if lhs._bluetooth != rhs._bluetooth {return false} @@ -277,14 +277,14 @@ extension DeviceConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageI } extension WifiConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".WifiConnectionStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".WifiConnectionStatus" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "status"), 2: .same(proto: "ssid"), 3: .same(proto: "rssi"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -298,7 +298,7 @@ extension WifiConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -315,7 +315,7 @@ extension WifiConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImp try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: WifiConnectionStatus, rhs: WifiConnectionStatus) -> Bool { + public static func ==(lhs: WifiConnectionStatus, rhs: WifiConnectionStatus) -> Bool { if lhs._status != rhs._status {return false} if lhs.ssid != rhs.ssid {return false} if lhs.rssi != rhs.rssi {return false} @@ -325,12 +325,12 @@ extension WifiConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImp } extension EthernetConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".EthernetConnectionStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".EthernetConnectionStatus" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "status"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -342,7 +342,7 @@ extension EthernetConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Messag } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -353,7 +353,7 @@ extension EthernetConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Messag try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: EthernetConnectionStatus, rhs: EthernetConnectionStatus) -> Bool { + public static func ==(lhs: EthernetConnectionStatus, rhs: EthernetConnectionStatus) -> Bool { if lhs._status != rhs._status {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -361,15 +361,15 @@ extension EthernetConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Messag } extension NetworkConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".NetworkConnectionStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".NetworkConnectionStatus" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "ip_address"), 2: .standard(proto: "is_connected"), 3: .standard(proto: "is_mqtt_connected"), 4: .standard(proto: "is_syslog_connected"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -384,7 +384,7 @@ extension NetworkConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Message } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.ipAddress != 0 { try visitor.visitSingularFixed32Field(value: self.ipAddress, fieldNumber: 1) } @@ -400,7 +400,7 @@ extension NetworkConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: NetworkConnectionStatus, rhs: NetworkConnectionStatus) -> Bool { + public static func ==(lhs: NetworkConnectionStatus, rhs: NetworkConnectionStatus) -> Bool { if lhs.ipAddress != rhs.ipAddress {return false} if lhs.isConnected != rhs.isConnected {return false} if lhs.isMqttConnected != rhs.isMqttConnected {return false} @@ -411,14 +411,14 @@ extension NetworkConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Message } extension BluetoothConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".BluetoothConnectionStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".BluetoothConnectionStatus" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pin"), 2: .same(proto: "rssi"), 3: .standard(proto: "is_connected"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -432,7 +432,7 @@ extension BluetoothConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Messa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.pin != 0 { try visitor.visitSingularUInt32Field(value: self.pin, fieldNumber: 1) } @@ -445,7 +445,7 @@ extension BluetoothConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: BluetoothConnectionStatus, rhs: BluetoothConnectionStatus) -> Bool { + public static func ==(lhs: BluetoothConnectionStatus, rhs: BluetoothConnectionStatus) -> Bool { if lhs.pin != rhs.pin {return false} if lhs.rssi != rhs.rssi {return false} if lhs.isConnected != rhs.isConnected {return false} @@ -455,13 +455,13 @@ extension BluetoothConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._Messa } extension SerialConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".SerialConnectionStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".SerialConnectionStatus" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "baud"), 2: .standard(proto: "is_connected"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -474,7 +474,7 @@ extension SerialConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.baud != 0 { try visitor.visitSingularUInt32Field(value: self.baud, fieldNumber: 1) } @@ -484,7 +484,7 @@ extension SerialConnectionStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: SerialConnectionStatus, rhs: SerialConnectionStatus) -> Bool { + public static func ==(lhs: SerialConnectionStatus, rhs: SerialConnectionStatus) -> Bool { if lhs.baud != rhs.baud {return false} if lhs.isConnected != rhs.isConnected {return false} if lhs.unknownFields != rhs.unknownFields {return false} diff --git a/Meshtastic/Protobufs/meshtastic/deviceonly.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/deviceonly.pb.swift similarity index 84% rename from Meshtastic/Protobufs/meshtastic/deviceonly.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/deviceonly.pb.swift index ebd5e3f7..10b9af2b 100644 --- a/Meshtastic/Protobufs/meshtastic/deviceonly.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/deviceonly.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// Font sizes for the device screen -enum ScreenFonts: SwiftProtobuf.Enum { - typealias RawValue = Int +public enum ScreenFonts: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -38,11 +38,11 @@ enum ScreenFonts: SwiftProtobuf.Enum { case fontLarge // = 2 case UNRECOGNIZED(Int) - init() { + public init() { self = .fontSmall } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .fontSmall case 1: self = .fontMedium @@ -51,7 +51,7 @@ enum ScreenFonts: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .fontSmall: return 0 case .fontMedium: return 1 @@ -66,7 +66,7 @@ enum ScreenFonts: SwiftProtobuf.Enum { extension ScreenFonts: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [ScreenFonts] = [ + public static let allCases: [ScreenFonts] = [ .fontSmall, .fontMedium, .fontLarge, @@ -77,7 +77,7 @@ extension ScreenFonts: CaseIterable { /// /// Position with static location information only for NodeDBLite -struct PositionLite { +public struct PositionLite { // 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. @@ -85,15 +85,15 @@ struct PositionLite { /// /// The new preferred location encoding, multiply by 1e-7 to get degrees /// in floating point - var latitudeI: Int32 = 0 + public var latitudeI: Int32 = 0 /// /// TODO: REPLACE - var longitudeI: Int32 = 0 + public var longitudeI: Int32 = 0 /// /// In meters above MSL (but see issue #359) - var altitude: Int32 = 0 + public var altitude: Int32 = 0 /// /// This is usually not sent over the mesh (to save space), but it is sent @@ -101,95 +101,95 @@ struct PositionLite { /// 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 = 0 + public var time: UInt32 = 0 /// /// TODO: REPLACE - var locationSource: Position.LocSource = .locUnset + public var locationSource: Position.LocSource = .locUnset - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } -struct NodeInfoLite { +public struct NodeInfoLite { // 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 { + public var num: UInt32 { get {return _storage._num} set {_uniqueStorage()._num = newValue} } /// /// The user info for this node - var user: User { + public var user: User { get {return _storage._user ?? User()} set {_uniqueStorage()._user = newValue} } /// Returns true if `user` has been explicitly set. - var hasUser: Bool {return _storage._user != nil} + public var hasUser: Bool {return _storage._user != nil} /// Clears the value of `user`. Subsequent reads from it will return its default value. - mutating func clearUser() {_uniqueStorage()._user = nil} + public mutating func clearUser() {_uniqueStorage()._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: PositionLite { + public var position: PositionLite { get {return _storage._position ?? PositionLite()} set {_uniqueStorage()._position = newValue} } /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return _storage._position != nil} + public 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} + public mutating func clearPosition() {_uniqueStorage()._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 { + public var snr: Float { get {return _storage._snr} set {_uniqueStorage()._snr = newValue} } /// /// Set to indicate the last time we received a packet from this node - var lastHeard: UInt32 { + public var lastHeard: UInt32 { get {return _storage._lastHeard} set {_uniqueStorage()._lastHeard = newValue} } /// /// The latest device metrics for the node. - var deviceMetrics: DeviceMetrics { + public var deviceMetrics: DeviceMetrics { get {return _storage._deviceMetrics ?? DeviceMetrics()} set {_uniqueStorage()._deviceMetrics = newValue} } /// Returns true if `deviceMetrics` has been explicitly set. - var hasDeviceMetrics: Bool {return _storage._deviceMetrics != nil} + public var hasDeviceMetrics: Bool {return _storage._deviceMetrics != nil} /// Clears the value of `deviceMetrics`. Subsequent reads from it will return its default value. - mutating func clearDeviceMetrics() {_uniqueStorage()._deviceMetrics = nil} + public mutating func clearDeviceMetrics() {_uniqueStorage()._deviceMetrics = nil} /// /// local channel index we heard that node on. Only populated if its not the default channel. - var channel: UInt32 { + public var channel: UInt32 { get {return _storage._channel} set {_uniqueStorage()._channel = newValue} } /// /// True if we witnessed the node over MQTT instead of LoRA transport - var viaMqtt: Bool { + public var viaMqtt: Bool { get {return _storage._viaMqtt} set {_uniqueStorage()._viaMqtt = newValue} } /// /// Number of hops away from us this node is (0 if adjacent) - var hopsAway: UInt32 { + public var hopsAway: UInt32 { get {return _storage._hopsAway} set {_uniqueStorage()._hopsAway = newValue} } @@ -197,14 +197,14 @@ struct NodeInfoLite { /// /// True if node is in our favorites list /// Persists between NodeDB internal clean ups - var isFavorite: Bool { + public var isFavorite: Bool { get {return _storage._isFavorite} set {_uniqueStorage()._isFavorite = newValue} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -215,36 +215,36 @@ struct NodeInfoLite { /// 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 { +public 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 { + public 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} + public 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} + public mutating func clearMyNode() {_uniqueStorage()._myNode = nil} /// /// My owner info - var owner: User { + public 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} + public 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} + public mutating func clearOwner() {_uniqueStorage()._owner = nil} /// /// Received packets saved for delivery to the phone - var receiveQueue: [MeshPacket] { + public var receiveQueue: [MeshPacket] { get {return _storage._receiveQueue} set {_uniqueStorage()._receiveQueue = newValue} } @@ -253,7 +253,7 @@ struct DeviceState { /// 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 { + public var version: UInt32 { get {return _storage._version} set {_uniqueStorage()._version = newValue} } @@ -262,27 +262,27 @@ struct DeviceState { /// 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 { + public 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} + public 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} + public mutating func clearRxTextMessage() {_uniqueStorage()._rxTextMessage = nil} /// /// Used only during development. /// Indicates developer is testing and changes should never be saved to flash. /// Deprecated in 2.3.1 - var noSave: Bool { + public var noSave: Bool { get {return _storage._noSave} set {_uniqueStorage()._noSave = newValue} } /// /// Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. - var didGpsReset: Bool { + public var didGpsReset: Bool { get {return _storage._didGpsReset} set {_uniqueStorage()._didGpsReset = newValue} } @@ -291,115 +291,115 @@ struct DeviceState { /// We keep the last received waypoint stored in the device flash, /// so we can show it on the screen. /// Might be null - var rxWaypoint: MeshPacket { + public var rxWaypoint: MeshPacket { get {return _storage._rxWaypoint ?? MeshPacket()} set {_uniqueStorage()._rxWaypoint = newValue} } /// Returns true if `rxWaypoint` has been explicitly set. - var hasRxWaypoint: Bool {return _storage._rxWaypoint != nil} + public var hasRxWaypoint: Bool {return _storage._rxWaypoint != nil} /// Clears the value of `rxWaypoint`. Subsequent reads from it will return its default value. - mutating func clearRxWaypoint() {_uniqueStorage()._rxWaypoint = nil} + public mutating func clearRxWaypoint() {_uniqueStorage()._rxWaypoint = nil} /// /// The mesh's nodes with their available gpio pins for RemoteHardware module - var nodeRemoteHardwarePins: [NodeRemoteHardwarePin] { + public var nodeRemoteHardwarePins: [NodeRemoteHardwarePin] { get {return _storage._nodeRemoteHardwarePins} set {_uniqueStorage()._nodeRemoteHardwarePins = newValue} } /// /// New lite version of NodeDB to decrease memory footprint - var nodeDbLite: [NodeInfoLite] { + public var nodeDbLite: [NodeInfoLite] { get {return _storage._nodeDbLite} set {_uniqueStorage()._nodeDbLite = newValue} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } /// /// The on-disk saved channels -struct ChannelFile { +public 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] = [] + public 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 + public var version: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// This can be used for customizing the firmware distribution. If populated, /// show a secondary bootup screen with custom logo and text for 2.5 seconds. -struct OEMStore { +public 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 + public var oemIconWidth: UInt32 = 0 /// /// The Logo height in Px - var oemIconHeight: UInt32 = 0 + public var oemIconHeight: UInt32 = 0 /// /// The Logo in XBM bytechar format - var oemIconBits: Data = Data() + public var oemIconBits: Data = Data() /// /// Use this font for the OEM text. - var oemFont: ScreenFonts = .fontSmall + public var oemFont: ScreenFonts = .fontSmall /// /// Use this font for the OEM text. - var oemText: String = String() + public var oemText: String = String() /// /// The default device encryption key, 16 or 32 byte - var oemAesKey: Data = Data() + public var oemAesKey: Data = Data() /// /// A Preset LocalConfig to apply during factory reset - var oemLocalConfig: LocalConfig { + public 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} + public 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} + public mutating func clearOemLocalConfig() {self._oemLocalConfig = nil} /// /// A Preset LocalModuleConfig to apply during factory reset - var oemLocalModuleConfig: LocalModuleConfig { + public 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} + public 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} + public mutating func clearOemLocalModuleConfig() {self._oemLocalModuleConfig = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _oemLocalConfig: LocalConfig? = nil fileprivate var _oemLocalModuleConfig: LocalModuleConfig? = nil @@ -419,7 +419,7 @@ extension OEMStore: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension ScreenFonts: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "FONT_SMALL"), 1: .same(proto: "FONT_MEDIUM"), 2: .same(proto: "FONT_LARGE"), @@ -427,8 +427,8 @@ extension ScreenFonts: SwiftProtobuf._ProtoNameProviding { } extension PositionLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".PositionLite" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".PositionLite" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "latitude_i"), 2: .standard(proto: "longitude_i"), 3: .same(proto: "altitude"), @@ -436,7 +436,7 @@ extension PositionLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 5: .standard(proto: "location_source"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -452,7 +452,7 @@ extension PositionLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.latitudeI != 0 { try visitor.visitSingularSFixed32Field(value: self.latitudeI, fieldNumber: 1) } @@ -471,7 +471,7 @@ extension PositionLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: PositionLite, rhs: PositionLite) -> Bool { + public static func ==(lhs: PositionLite, rhs: PositionLite) -> Bool { if lhs.latitudeI != rhs.latitudeI {return false} if lhs.longitudeI != rhs.longitudeI {return false} if lhs.altitude != rhs.altitude {return false} @@ -483,8 +483,8 @@ extension PositionLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } extension NodeInfoLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".NodeInfoLite" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".NodeInfoLite" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "num"), 2: .same(proto: "user"), 3: .same(proto: "position"), @@ -542,7 +542,7 @@ extension NodeInfoLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -566,7 +566,7 @@ extension NodeInfoLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } } - func traverse(visitor: inout V) throws { + public 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 @@ -606,7 +606,7 @@ extension NodeInfoLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: NodeInfoLite, rhs: NodeInfoLite) -> Bool { + public static func ==(lhs: NodeInfoLite, rhs: NodeInfoLite) -> Bool { if lhs._storage !== rhs._storage { let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -631,8 +631,8 @@ extension NodeInfoLite: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".DeviceState" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".DeviceState" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 2: .standard(proto: "my_node"), 3: .same(proto: "owner"), 5: .standard(proto: "receive_queue"), @@ -690,7 +690,7 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -714,7 +714,7 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } } - func traverse(visitor: inout V) throws { + public 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 @@ -754,7 +754,7 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: DeviceState, rhs: DeviceState) -> Bool { + public 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 @@ -779,13 +779,13 @@ extension DeviceState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ChannelFile" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ChannelFile" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "channels"), 2: .same(proto: "version"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -798,7 +798,7 @@ extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.channels.isEmpty { try visitor.visitRepeatedMessageField(value: self.channels, fieldNumber: 1) } @@ -808,7 +808,7 @@ extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ChannelFile, rhs: ChannelFile) -> Bool { + public 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} @@ -817,8 +817,8 @@ extension ChannelFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".OEMStore" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".OEMStore" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "oem_icon_width"), 2: .standard(proto: "oem_icon_height"), 3: .standard(proto: "oem_icon_bits"), @@ -829,7 +829,7 @@ extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB 8: .standard(proto: "oem_local_module_config"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -848,7 +848,7 @@ extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -880,7 +880,7 @@ extension OEMStore: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: OEMStore, rhs: OEMStore) -> Bool { + public 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} diff --git a/Meshtastic/Protobufs/meshtastic/localonly.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/localonly.pb.swift similarity index 82% rename from Meshtastic/Protobufs/meshtastic/localonly.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/localonly.pb.swift index 0778e962..5e30d1cd 100644 --- a/Meshtastic/Protobufs/meshtastic/localonly.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/localonly.pb.swift @@ -20,264 +20,264 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct LocalConfig { +public 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 { + public 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} + public 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} + public mutating func clearDevice() {_uniqueStorage()._device = nil} /// /// The part of the config that is specific to the GPS Position - var position: Config.PositionConfig { + public 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} + public 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} + public mutating func clearPosition() {_uniqueStorage()._position = nil} /// /// The part of the config that is specific to the Power settings - var power: Config.PowerConfig { + public 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} + public 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} + public mutating func clearPower() {_uniqueStorage()._power = nil} /// /// The part of the config that is specific to the Wifi Settings - var network: Config.NetworkConfig { + public 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} + public 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} + public mutating func clearNetwork() {_uniqueStorage()._network = nil} /// /// The part of the config that is specific to the Display - var display: Config.DisplayConfig { + public 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} + public 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} + public mutating func clearDisplay() {_uniqueStorage()._display = nil} /// /// The part of the config that is specific to the Lora Radio - var lora: Config.LoRaConfig { + public 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} + public 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} + public mutating func clearLora() {_uniqueStorage()._lora = nil} /// /// The part of the config that is specific to the Bluetooth settings - var bluetooth: Config.BluetoothConfig { + public 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} + public 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} + public 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 { + public var version: UInt32 { get {return _storage._version} set {_uniqueStorage()._version = newValue} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } -struct LocalModuleConfig { +public 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 { + public 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} + public 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} + public mutating func clearMqtt() {_uniqueStorage()._mqtt = nil} /// /// The part of the config that is specific to the Serial module - var serial: ModuleConfig.SerialConfig { + public 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} + public 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} + public mutating func clearSerial() {_uniqueStorage()._serial = nil} /// /// The part of the config that is specific to the ExternalNotification module - var externalNotification: ModuleConfig.ExternalNotificationConfig { + public 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} + public 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} + public mutating func clearExternalNotification() {_uniqueStorage()._externalNotification = nil} /// /// The part of the config that is specific to the Store & Forward module - var storeForward: ModuleConfig.StoreForwardConfig { + public 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} + public 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} + public mutating func clearStoreForward() {_uniqueStorage()._storeForward = nil} /// /// The part of the config that is specific to the RangeTest module - var rangeTest: ModuleConfig.RangeTestConfig { + public 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} + public 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} + public mutating func clearRangeTest() {_uniqueStorage()._rangeTest = nil} /// /// The part of the config that is specific to the Telemetry module - var telemetry: ModuleConfig.TelemetryConfig { + public 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} + public 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} + public mutating func clearTelemetry() {_uniqueStorage()._telemetry = nil} /// /// The part of the config that is specific to the Canned Message module - var cannedMessage: ModuleConfig.CannedMessageConfig { + public 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} + public 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} + public mutating func clearCannedMessage() {_uniqueStorage()._cannedMessage = nil} /// /// The part of the config that is specific to the Audio module - var audio: ModuleConfig.AudioConfig { + public 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} + public 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} + public mutating func clearAudio() {_uniqueStorage()._audio = nil} /// /// The part of the config that is specific to the Remote Hardware module - var remoteHardware: ModuleConfig.RemoteHardwareConfig { + public 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} + public 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} + public mutating func clearRemoteHardware() {_uniqueStorage()._remoteHardware = nil} /// /// The part of the config that is specific to the Neighbor Info module - var neighborInfo: ModuleConfig.NeighborInfoConfig { + public var neighborInfo: ModuleConfig.NeighborInfoConfig { get {return _storage._neighborInfo ?? ModuleConfig.NeighborInfoConfig()} set {_uniqueStorage()._neighborInfo = newValue} } /// Returns true if `neighborInfo` has been explicitly set. - var hasNeighborInfo: Bool {return _storage._neighborInfo != nil} + public var hasNeighborInfo: Bool {return _storage._neighborInfo != nil} /// Clears the value of `neighborInfo`. Subsequent reads from it will return its default value. - mutating func clearNeighborInfo() {_uniqueStorage()._neighborInfo = nil} + public mutating func clearNeighborInfo() {_uniqueStorage()._neighborInfo = nil} /// /// The part of the config that is specific to the Ambient Lighting module - var ambientLighting: ModuleConfig.AmbientLightingConfig { + public var ambientLighting: ModuleConfig.AmbientLightingConfig { get {return _storage._ambientLighting ?? ModuleConfig.AmbientLightingConfig()} set {_uniqueStorage()._ambientLighting = newValue} } /// Returns true if `ambientLighting` has been explicitly set. - var hasAmbientLighting: Bool {return _storage._ambientLighting != nil} + public var hasAmbientLighting: Bool {return _storage._ambientLighting != nil} /// Clears the value of `ambientLighting`. Subsequent reads from it will return its default value. - mutating func clearAmbientLighting() {_uniqueStorage()._ambientLighting = nil} + public mutating func clearAmbientLighting() {_uniqueStorage()._ambientLighting = nil} /// /// The part of the config that is specific to the Detection Sensor module - var detectionSensor: ModuleConfig.DetectionSensorConfig { + public var detectionSensor: ModuleConfig.DetectionSensorConfig { get {return _storage._detectionSensor ?? ModuleConfig.DetectionSensorConfig()} set {_uniqueStorage()._detectionSensor = newValue} } /// Returns true if `detectionSensor` has been explicitly set. - var hasDetectionSensor: Bool {return _storage._detectionSensor != nil} + public var hasDetectionSensor: Bool {return _storage._detectionSensor != nil} /// Clears the value of `detectionSensor`. Subsequent reads from it will return its default value. - mutating func clearDetectionSensor() {_uniqueStorage()._detectionSensor = nil} + public mutating func clearDetectionSensor() {_uniqueStorage()._detectionSensor = nil} /// /// Paxcounter Config - var paxcounter: ModuleConfig.PaxcounterConfig { + public var paxcounter: ModuleConfig.PaxcounterConfig { get {return _storage._paxcounter ?? ModuleConfig.PaxcounterConfig()} set {_uniqueStorage()._paxcounter = newValue} } /// Returns true if `paxcounter` has been explicitly set. - var hasPaxcounter: Bool {return _storage._paxcounter != nil} + public var hasPaxcounter: Bool {return _storage._paxcounter != nil} /// Clears the value of `paxcounter`. Subsequent reads from it will return its default value. - mutating func clearPaxcounter() {_uniqueStorage()._paxcounter = nil} + public mutating func clearPaxcounter() {_uniqueStorage()._paxcounter = 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 { + public var version: UInt32 { get {return _storage._version} set {_uniqueStorage()._version = newValue} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -292,8 +292,8 @@ extension LocalModuleConfig: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LocalConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".LocalConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "device"), 2: .same(proto: "position"), 3: .same(proto: "power"), @@ -345,7 +345,7 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -367,7 +367,7 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } } - func traverse(visitor: inout V) throws { + public 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 @@ -401,7 +401,7 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: LocalConfig, rhs: LocalConfig) -> Bool { + public 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 @@ -424,8 +424,8 @@ extension LocalConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LocalModuleConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".LocalModuleConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "mqtt"), 2: .same(proto: "serial"), 3: .standard(proto: "external_notification"), @@ -495,7 +495,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -523,7 +523,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem } } - func traverse(visitor: inout V) throws { + public 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 @@ -575,7 +575,7 @@ extension LocalModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: LocalModuleConfig, rhs: LocalModuleConfig) -> Bool { + public 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 diff --git a/Meshtastic/Protobufs/meshtastic/mesh.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift similarity index 88% rename from Meshtastic/Protobufs/meshtastic/mesh.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift index a8ee777c..c257be0a 100644 --- a/Meshtastic/Protobufs/meshtastic/mesh.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/mesh.pb.swift @@ -25,8 +25,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 +public enum HardwareModel: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -311,11 +311,11 @@ enum HardwareModel: SwiftProtobuf.Enum { case privateHw // = 255 case UNRECOGNIZED(Int) - init() { + public init() { self = .unset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unset case 1: self = .tloraV2 @@ -387,7 +387,7 @@ enum HardwareModel: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unset: return 0 case .tloraV2: return 1 @@ -465,7 +465,7 @@ enum HardwareModel: SwiftProtobuf.Enum { extension HardwareModel: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [HardwareModel] = [ + public static let allCases: [HardwareModel] = [ .unset, .tloraV2, .tloraV1, @@ -539,8 +539,8 @@ extension HardwareModel: CaseIterable { /// /// Shared constants between device and phone -enum Constants: SwiftProtobuf.Enum { - typealias RawValue = Int +public enum Constants: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// First enum must be zero, and we are just using this enum to @@ -554,11 +554,11 @@ enum Constants: SwiftProtobuf.Enum { case dataPayloadLen // = 237 case UNRECOGNIZED(Int) - init() { + public init() { self = .zero } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .zero case 237: self = .dataPayloadLen @@ -566,7 +566,7 @@ enum Constants: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .zero: return 0 case .dataPayloadLen: return 237 @@ -580,7 +580,7 @@ enum Constants: SwiftProtobuf.Enum { extension Constants: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Constants] = [ + public static let allCases: [Constants] = [ .zero, .dataPayloadLen, ] @@ -593,8 +593,8 @@ extension Constants: CaseIterable { /// 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 +public enum CriticalErrorCode: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -647,11 +647,11 @@ enum CriticalErrorCode: SwiftProtobuf.Enum { case radioSpiBug // = 11 case UNRECOGNIZED(Int) - init() { + public init() { self = .none } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .none case 1: self = .txWatchdog @@ -669,7 +669,7 @@ enum CriticalErrorCode: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .none: return 0 case .txWatchdog: return 1 @@ -693,7 +693,7 @@ enum CriticalErrorCode: SwiftProtobuf.Enum { extension CriticalErrorCode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [CriticalErrorCode] = [ + public static let allCases: [CriticalErrorCode] = [ .none, .txWatchdog, .sleepEnterWait, @@ -713,7 +713,7 @@ extension CriticalErrorCode: CaseIterable { /// /// a gps position -struct Position { +public 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. @@ -721,21 +721,21 @@ struct Position { /// /// The new preferred location encoding, multiply by 1e-7 to get degrees /// in floating point - var latitudeI: Int32 { + public var latitudeI: Int32 { get {return _storage._latitudeI} set {_uniqueStorage()._latitudeI = newValue} } /// /// TODO: REPLACE - var longitudeI: Int32 { + public var longitudeI: Int32 { get {return _storage._longitudeI} set {_uniqueStorage()._longitudeI = newValue} } /// /// In meters above MSL (but see issue #359) - var altitude: Int32 { + public var altitude: Int32 { get {return _storage._altitude} set {_uniqueStorage()._altitude = newValue} } @@ -745,49 +745,49 @@ struct Position { /// from the phone so that the local device can set its time if it is sent over /// the mesh (because there are devices on the mesh without GPS or RTC). /// seconds since 1970 - var time: UInt32 { + public var time: UInt32 { get {return _storage._time} set {_uniqueStorage()._time = newValue} } /// /// TODO: REPLACE - var locationSource: Position.LocSource { + public var locationSource: Position.LocSource { get {return _storage._locationSource} set {_uniqueStorage()._locationSource = newValue} } /// /// TODO: REPLACE - var altitudeSource: Position.AltSource { + public 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 { + public var timestamp: UInt32 { get {return _storage._timestamp} set {_uniqueStorage()._timestamp = newValue} } /// /// Pos. timestamp milliseconds adjustment (rarely available or required) - var timestampMillisAdjust: Int32 { + public 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 { + public var altitudeHae: Int32 { get {return _storage._altitudeHae} set {_uniqueStorage()._altitudeHae = newValue} } /// /// Geoidal separation in meters - var altitudeGeoidalSeparation: Int32 { + public var altitudeGeoidalSeparation: Int32 { get {return _storage._altitudeGeoidalSeparation} set {_uniqueStorage()._altitudeGeoidalSeparation = newValue} } @@ -798,21 +798,21 @@ struct Position { /// - 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 { + public var pdop: UInt32 { get {return _storage._pdop} set {_uniqueStorage()._pdop = newValue} } /// /// TODO: REPLACE - var hdop: UInt32 { + public var hdop: UInt32 { get {return _storage._hdop} set {_uniqueStorage()._hdop = newValue} } /// /// TODO: REPLACE - var vdop: UInt32 { + public var vdop: UInt32 { get {return _storage._vdop} set {_uniqueStorage()._vdop = newValue} } @@ -821,7 +821,7 @@ struct Position { /// GPS accuracy (a hardware specific constant) in mm /// multiplied with DOP to calculate positional accuracy /// Default: "'bout three meters-ish" :) - var gpsAccuracy: UInt32 { + public var gpsAccuracy: UInt32 { get {return _storage._gpsAccuracy} set {_uniqueStorage()._gpsAccuracy = newValue} } @@ -833,42 +833,42 @@ struct Position { /// - "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 { + public var groundSpeed: UInt32 { get {return _storage._groundSpeed} set {_uniqueStorage()._groundSpeed = newValue} } /// /// TODO: REPLACE - var groundTrack: UInt32 { + public var groundTrack: UInt32 { get {return _storage._groundTrack} set {_uniqueStorage()._groundTrack = newValue} } /// /// GPS fix quality (from NMEA GxGGA statement or similar) - var fixQuality: UInt32 { + public var fixQuality: UInt32 { get {return _storage._fixQuality} set {_uniqueStorage()._fixQuality = newValue} } /// /// GPS fix type 2D/3D (from NMEA GxGSA statement) - var fixType: UInt32 { + public var fixType: UInt32 { get {return _storage._fixType} set {_uniqueStorage()._fixType = newValue} } /// /// GPS "Satellites in View" number - var satsInView: UInt32 { + public var satsInView: UInt32 { get {return _storage._satsInView} set {_uniqueStorage()._satsInView = newValue} } /// /// Sensor ID - in case multiple positioning sensors are being used - var sensorID: UInt32 { + public var sensorID: UInt32 { get {return _storage._sensorID} set {_uniqueStorage()._sensorID = newValue} } @@ -878,7 +878,7 @@ struct Position { /// - 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 { + public var nextUpdate: UInt32 { get {return _storage._nextUpdate} set {_uniqueStorage()._nextUpdate = newValue} } @@ -886,24 +886,24 @@ struct Position { /// /// A sequence number, incremented with each Position message to help /// detect lost updates if needed - var seqNumber: UInt32 { + public var seqNumber: UInt32 { get {return _storage._seqNumber} set {_uniqueStorage()._seqNumber = newValue} } /// /// Indicates the bits of precision set by the sending node - var precisionBits: UInt32 { + public var precisionBits: UInt32 { get {return _storage._precisionBits} set {_uniqueStorage()._precisionBits = newValue} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// How the location was acquired: manual, onboard GPS, external (EUD) GPS - enum LocSource: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum LocSource: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -922,11 +922,11 @@ struct Position { case locExternal // = 3 case UNRECOGNIZED(Int) - init() { + public init() { self = .locUnset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .locUnset case 1: self = .locManual @@ -936,7 +936,7 @@ struct Position { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .locUnset: return 0 case .locManual: return 1 @@ -951,8 +951,8 @@ struct Position { /// /// How the altitude was acquired: manual, GPS int/ext, etc /// Default: same as location_source if present - enum AltSource: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum AltSource: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -975,11 +975,11 @@ struct Position { case altBarometric // = 4 case UNRECOGNIZED(Int) - init() { + public init() { self = .altUnset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .altUnset case 1: self = .altManual @@ -990,7 +990,7 @@ struct Position { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .altUnset: return 0 case .altManual: return 1 @@ -1003,7 +1003,7 @@ struct Position { } - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -1012,7 +1012,7 @@ struct Position { extension Position.LocSource: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Position.LocSource] = [ + public static let allCases: [Position.LocSource] = [ .locUnset, .locManual, .locInternal, @@ -1022,7 +1022,7 @@ extension Position.LocSource: CaseIterable { extension Position.AltSource: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Position.AltSource] = [ + public static let allCases: [Position.AltSource] = [ .altUnset, .altManual, .altInternal, @@ -1054,7 +1054,7 @@ extension Position.AltSource: CaseIterable { /// A few nodenums are reserved and will never be requested: /// 0xff - broadcast /// 0 through 3 - for future use -struct User { +public 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. @@ -1064,73 +1064,73 @@ struct 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() + public var id: String = String() /// /// A full name for this user, i.e. "Kevin Hester" - var longName: String = String() + public var longName: String = String() /// /// A VERY short name, ideally two characters. /// Suitable for a tiny OLED screen - var shortName: String = String() + public var shortName: String = String() /// /// Deprecated in Meshtastic 2.1.x /// This is the addr of the radio. /// Not populated by the phone, but added by the esp32 when broadcasting - var macaddr: Data = Data() + public 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 + public 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 + public var isLicensed: Bool = false /// /// Indicates that the user's role in the mesh - var role: Config.DeviceConfig.Role = .client + public var role: Config.DeviceConfig.Role = .client - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// A message used in our Dynamic Source Routing protocol (RFC 4728 based) -struct RouteDiscovery { +public 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] = [] + public var route: [UInt32] = [] - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// A Routing control Data packet handled by the routing module -struct Routing { +public 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 + public var variant: Routing.OneOf_Variant? = nil /// /// A route request going from the requester - var routeRequest: RouteDiscovery { + public var routeRequest: RouteDiscovery { get { if case .routeRequest(let v)? = variant {return v} return RouteDiscovery() @@ -1140,7 +1140,7 @@ struct Routing { /// /// A route reply - var routeReply: RouteDiscovery { + public var routeReply: RouteDiscovery { get { if case .routeReply(let v)? = variant {return v} return RouteDiscovery() @@ -1151,7 +1151,7 @@ struct Routing { /// /// 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 { + public var errorReason: Routing.Error { get { if case .errorReason(let v)? = variant {return v} return .none @@ -1159,9 +1159,9 @@ struct Routing { set {variant = .errorReason(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum OneOf_Variant: Equatable { + public enum OneOf_Variant: Equatable { /// /// A route request going from the requester case routeRequest(RouteDiscovery) @@ -1174,7 +1174,7 @@ struct Routing { case errorReason(Routing.Error) #if !swift(>=4.1) - static func ==(lhs: Routing.OneOf_Variant, rhs: Routing.OneOf_Variant) -> Bool { + public 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 @@ -1200,8 +1200,8 @@ struct Routing { /// /// 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 + public enum Error: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// This message is not a failure @@ -1254,11 +1254,11 @@ struct Routing { case notAuthorized // = 33 case UNRECOGNIZED(Int) - init() { + public init() { self = .none } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .none case 1: self = .noRoute @@ -1276,7 +1276,7 @@ struct Routing { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .none: return 0 case .noRoute: return 1 @@ -1296,14 +1296,14 @@ struct Routing { } - init() {} + public init() {} } #if swift(>=4.2) extension Routing.Error: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [Routing.Error] = [ + public static let allCases: [Routing.Error] = [ .none, .noRoute, .gotNak, @@ -1325,24 +1325,24 @@ extension Routing.Error: CaseIterable { /// (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 { +public 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 + public var portnum: PortNum = .unknownApp /// /// TODO: REPLACE - var payload: Data = Data() + public 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 + public var wantResponse: Bool = false /// /// The address of the destination node. @@ -1350,96 +1350,96 @@ struct DataMessage { /// 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 + public 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 + public 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 + public 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 + public 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 + public var emoji: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Waypoint message, used to share arbitrary locations across the mesh -struct Waypoint { +public 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 + public var id: UInt32 = 0 /// /// latitude_i - var latitudeI: Int32 = 0 + public var latitudeI: Int32 = 0 /// /// longitude_i - var longitudeI: Int32 = 0 + public var longitudeI: Int32 = 0 /// /// Time the waypoint is to expire (epoch) - var expire: UInt32 = 0 + public 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 + public var lockedTo: UInt32 = 0 /// /// Name of the waypoint - max 30 chars - var name: String = String() + public var name: String = String() /// /// Description of the waypoint - max 100 chars - var description_p: String = String() + public var description_p: String = String() /// /// Designator icon for the waypoint in the form of a unicode emoji - var icon: UInt32 = 0 + public var icon: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// This message will be proxied over the PhoneAPI for the client to deliver to the MQTT server -struct MqttClientProxyMessage { +public struct MqttClientProxyMessage { // 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 MQTT topic this message will be sent /received on - var topic: String = String() + public var topic: String = String() /// /// The actual service envelope payload or text for mqtt pub / sub - var payloadVariant: MqttClientProxyMessage.OneOf_PayloadVariant? = nil + public var payloadVariant: MqttClientProxyMessage.OneOf_PayloadVariant? = nil /// /// Bytes - var data: Data { + public var data: Data { get { if case .data(let v)? = payloadVariant {return v} return Data() @@ -1449,7 +1449,7 @@ struct MqttClientProxyMessage { /// /// Text - var text: String { + public var text: String { get { if case .text(let v)? = payloadVariant {return v} return String() @@ -1459,13 +1459,13 @@ struct MqttClientProxyMessage { /// /// Whether the message should be retained (or not) - var retained: Bool = false + public var retained: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// The actual service envelope payload or text for mqtt pub / sub - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { /// /// Bytes case data(Data) @@ -1474,7 +1474,7 @@ struct MqttClientProxyMessage { case text(String) #if !swift(>=4.1) - static func ==(lhs: MqttClientProxyMessage.OneOf_PayloadVariant, rhs: MqttClientProxyMessage.OneOf_PayloadVariant) -> Bool { + public static func ==(lhs: MqttClientProxyMessage.OneOf_PayloadVariant, rhs: MqttClientProxyMessage.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 @@ -1493,14 +1493,14 @@ struct MqttClientProxyMessage { #endif } - init() {} + public 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 { +public 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. @@ -1509,14 +1509,14 @@ struct MeshPacket { /// The sending node number. /// Note: Our crypto implementation uses this field as well. /// See [crypto](/docs/overview/encryption) for details. - var from: UInt32 { + public var from: UInt32 { get {return _storage._from} set {_uniqueStorage()._from = newValue} } /// /// The (immediate) destination for this packet - var to: UInt32 { + public var to: UInt32 { get {return _storage._to} set {_uniqueStorage()._to = newValue} } @@ -1529,19 +1529,19 @@ struct MeshPacket { /// 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 { + public var channel: UInt32 { get {return _storage._channel} set {_uniqueStorage()._channel = newValue} } - var payloadVariant: OneOf_PayloadVariant? { + public var payloadVariant: OneOf_PayloadVariant? { get {return _storage._payloadVariant} set {_uniqueStorage()._payloadVariant = newValue} } /// /// TODO: REPLACE - var decoded: DataMessage { + public var decoded: DataMessage { get { if case .decoded(let v)? = _storage._payloadVariant {return v} return DataMessage() @@ -1551,7 +1551,7 @@ struct MeshPacket { /// /// TODO: REPLACE - var encrypted: Data { + public var encrypted: Data { get { if case .encrypted(let v)? = _storage._payloadVariant {return v} return Data() @@ -1568,7 +1568,7 @@ struct MeshPacket { /// 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. - var id: UInt32 { + public var id: UInt32 { get {return _storage._id} set {_uniqueStorage()._id = newValue} } @@ -1578,7 +1578,7 @@ struct MeshPacket { /// 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 { + public var rxTime: UInt32 { get {return _storage._rxTime} set {_uniqueStorage()._rxTime = newValue} } @@ -1587,7 +1587,7 @@ struct MeshPacket { /// *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 { + public var rxSnr: Float { get {return _storage._rxSnr} set {_uniqueStorage()._rxSnr = newValue} } @@ -1597,7 +1597,7 @@ struct MeshPacket { /// 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 { + public var hopLimit: UInt32 { get {return _storage._hopLimit} set {_uniqueStorage()._hopLimit = newValue} } @@ -1612,7 +1612,7 @@ struct MeshPacket { /// 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 { + public var wantAck: Bool { get {return _storage._wantAck} set {_uniqueStorage()._wantAck = newValue} } @@ -1620,28 +1620,28 @@ struct MeshPacket { /// /// The priority of this message for sending. /// See MeshPacket.Priority description for more details. - var priority: MeshPacket.Priority { + public 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 { + public var rxRssi: Int32 { get {return _storage._rxRssi} set {_uniqueStorage()._rxRssi = newValue} } /// /// Describe if this message is delayed - var delayed: MeshPacket.Delayed { + public var delayed: MeshPacket.Delayed { get {return _storage._delayed} set {_uniqueStorage()._delayed = newValue} } /// /// Describes whether this packet passed via MQTT somewhere along the path it currently took. - var viaMqtt: Bool { + public var viaMqtt: Bool { get {return _storage._viaMqtt} set {_uniqueStorage()._viaMqtt = newValue} } @@ -1649,14 +1649,14 @@ struct MeshPacket { /// /// Hop limit with which the original packet started. Sent via LoRa using three bits in the unencrypted header. /// When receiving a packet, the difference between hop_start and hop_limit gives how many hops it traveled. - var hopStart: UInt32 { + public var hopStart: UInt32 { get {return _storage._hopStart} set {_uniqueStorage()._hopStart = newValue} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { /// /// TODO: REPLACE case decoded(DataMessage) @@ -1665,7 +1665,7 @@ struct MeshPacket { case encrypted(Data) #if !swift(>=4.1) - static func ==(lhs: MeshPacket.OneOf_PayloadVariant, rhs: MeshPacket.OneOf_PayloadVariant) -> Bool { + public 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 @@ -1703,8 +1703,8 @@ struct MeshPacket { /// 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 + public enum Priority: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Treated as Priority.DEFAULT @@ -1738,11 +1738,11 @@ struct MeshPacket { case max // = 127 case UNRECOGNIZED(Int) - init() { + public init() { self = .unset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unset case 1: self = .min @@ -1755,7 +1755,7 @@ struct MeshPacket { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unset: return 0 case .min: return 1 @@ -1772,8 +1772,8 @@ struct MeshPacket { /// /// Identify if this is a delayed packet - enum Delayed: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum Delayed: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// If unset, the message is being sent in real time. @@ -1788,11 +1788,11 @@ struct MeshPacket { case direct // = 2 case UNRECOGNIZED(Int) - init() { + public init() { self = .noDelay } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .noDelay case 1: self = .broadcast @@ -1801,7 +1801,7 @@ struct MeshPacket { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .noDelay: return 0 case .broadcast: return 1 @@ -1812,7 +1812,7 @@ struct MeshPacket { } - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -1821,7 +1821,7 @@ struct MeshPacket { extension MeshPacket.Priority: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [MeshPacket.Priority] = [ + public static let allCases: [MeshPacket.Priority] = [ .unset, .min, .background, @@ -1834,7 +1834,7 @@ extension MeshPacket.Priority: CaseIterable { extension MeshPacket.Delayed: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [MeshPacket.Delayed] = [ + public static let allCases: [MeshPacket.Delayed] = [ .noDelay, .broadcast, .direct, @@ -1860,84 +1860,84 @@ extension MeshPacket.Delayed: CaseIterable { /// 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 { +public 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 { + public var num: UInt32 { get {return _storage._num} set {_uniqueStorage()._num = newValue} } /// /// The user info for this node - var user: User { + public var user: User { get {return _storage._user ?? User()} set {_uniqueStorage()._user = newValue} } /// Returns true if `user` has been explicitly set. - var hasUser: Bool {return _storage._user != nil} + public var hasUser: Bool {return _storage._user != nil} /// Clears the value of `user`. Subsequent reads from it will return its default value. - mutating func clearUser() {_uniqueStorage()._user = nil} + public mutating func clearUser() {_uniqueStorage()._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 { + public var position: Position { get {return _storage._position ?? Position()} set {_uniqueStorage()._position = newValue} } /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return _storage._position != nil} + public 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} + public mutating func clearPosition() {_uniqueStorage()._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 { + public var snr: Float { get {return _storage._snr} set {_uniqueStorage()._snr = newValue} } /// /// Set to indicate the last time we received a packet from this node - var lastHeard: UInt32 { + public var lastHeard: UInt32 { get {return _storage._lastHeard} set {_uniqueStorage()._lastHeard = newValue} } /// /// The latest device metrics for the node. - var deviceMetrics: DeviceMetrics { + public var deviceMetrics: DeviceMetrics { get {return _storage._deviceMetrics ?? DeviceMetrics()} set {_uniqueStorage()._deviceMetrics = newValue} } /// Returns true if `deviceMetrics` has been explicitly set. - var hasDeviceMetrics: Bool {return _storage._deviceMetrics != nil} + public var hasDeviceMetrics: Bool {return _storage._deviceMetrics != nil} /// Clears the value of `deviceMetrics`. Subsequent reads from it will return its default value. - mutating func clearDeviceMetrics() {_uniqueStorage()._deviceMetrics = nil} + public mutating func clearDeviceMetrics() {_uniqueStorage()._deviceMetrics = nil} /// /// local channel index we heard that node on. Only populated if its not the default channel. - var channel: UInt32 { + public var channel: UInt32 { get {return _storage._channel} set {_uniqueStorage()._channel = newValue} } /// /// True if we witnessed the node over MQTT instead of LoRA transport - var viaMqtt: Bool { + public var viaMqtt: Bool { get {return _storage._viaMqtt} set {_uniqueStorage()._viaMqtt = newValue} } /// /// Number of hops away from us this node is (0 if adjacent) - var hopsAway: UInt32 { + public var hopsAway: UInt32 { get {return _storage._hopsAway} set {_uniqueStorage()._hopsAway = newValue} } @@ -1945,14 +1945,14 @@ struct NodeInfo { /// /// True if node is in our favorites list /// Persists between NodeDB internal clean ups - var isFavorite: Bool { + public var isFavorite: Bool { get {return _storage._isFavorite} set {_uniqueStorage()._isFavorite = newValue} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -1961,7 +1961,7 @@ struct NodeInfo { /// 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 { +public 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. @@ -1969,21 +1969,21 @@ struct MyNodeInfo { /// /// 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 + public var myNodeNum: UInt32 = 0 /// /// The total number of reboots this node has ever encountered /// (well - since the last time we discarded preferences) - var rebootCount: UInt32 = 0 + public var rebootCount: 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 + public var minAppVersion: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// @@ -1992,33 +1992,33 @@ struct MyNodeInfo { /// 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 { +public 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() + public var message: String = String() /// /// Seconds since 1970 - or 0 for unknown/unset - var time: UInt32 = 0 + public var time: UInt32 = 0 /// /// Usually based on thread name - if known - var source: String = String() + public var source: String = String() /// /// Not yet set - var level: LogRecord.Level = .unset + public var level: LogRecord.Level = .unset - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// Log levels, chosen to match python logging conventions. - enum Level: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum Level: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Log levels, chosen to match python logging conventions. @@ -2049,11 +2049,11 @@ struct LogRecord { case trace // = 5 case UNRECOGNIZED(Int) - init() { + public init() { self = .unset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unset case 5: self = .trace @@ -2066,7 +2066,7 @@ struct LogRecord { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unset: return 0 case .trace: return 5 @@ -2081,14 +2081,14 @@ struct LogRecord { } - init() {} + public init() {} } #if swift(>=4.2) extension LogRecord.Level: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [LogRecord.Level] = [ + public static let allCases: [LogRecord.Level] = [ .unset, .critical, .error, @@ -2101,26 +2101,26 @@ extension LogRecord.Level: CaseIterable { #endif // swift(>=4.2) -struct QueueStatus { +public 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 + public var res: Int32 = 0 /// Free entries in the outgoing queue - var free: UInt32 = 0 + public var free: UInt32 = 0 /// Maximum entries in the outgoing queue - var maxlen: UInt32 = 0 + public var maxlen: UInt32 = 0 /// What was mesh packet id that generated this response? - var meshPacketID: UInt32 = 0 + public var meshPacketID: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// @@ -2128,7 +2128,7 @@ struct QueueStatus { /// 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 { +public 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. @@ -2136,21 +2136,21 @@ struct FromRadio { /// /// The packet id, used to allow the phone to request missing read packets from the FIFO, /// see our bluetooth docs - var id: UInt32 { + public var id: UInt32 { get {return _storage._id} set {_uniqueStorage()._id = newValue} } /// /// Log levels, chosen to match python logging conventions. - var payloadVariant: OneOf_PayloadVariant? { + public var payloadVariant: OneOf_PayloadVariant? { get {return _storage._payloadVariant} set {_uniqueStorage()._payloadVariant = newValue} } /// /// Log levels, chosen to match python logging conventions. - var packet: MeshPacket { + public var packet: MeshPacket { get { if case .packet(let v)? = _storage._payloadVariant {return v} return MeshPacket() @@ -2161,7 +2161,7 @@ struct FromRadio { /// /// 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 { + public var myInfo: MyNodeInfo { get { if case .myInfo(let v)? = _storage._payloadVariant {return v} return MyNodeInfo() @@ -2172,7 +2172,7 @@ struct FromRadio { /// /// One packet is sent for each node in the on radio DB /// starts over with the first node in our DB - var nodeInfo: NodeInfo { + public var nodeInfo: NodeInfo { get { if case .nodeInfo(let v)? = _storage._payloadVariant {return v} return NodeInfo() @@ -2182,7 +2182,7 @@ struct FromRadio { /// /// Include a part of the config (was: RadioConfig radio) - var config: Config { + public var config: Config { get { if case .config(let v)? = _storage._payloadVariant {return v} return Config() @@ -2192,7 +2192,7 @@ struct FromRadio { /// /// Set to send debug console output over our protobuf stream - var logRecord: LogRecord { + public var logRecord: LogRecord { get { if case .logRecord(let v)? = _storage._payloadVariant {return v} return LogRecord() @@ -2205,7 +2205,7 @@ struct FromRadio { /// 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 { + public var configCompleteID: UInt32 { get { if case .configCompleteID(let v)? = _storage._payloadVariant {return v} return 0 @@ -2218,7 +2218,7 @@ struct FromRadio { /// 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 { + public var rebooted: Bool { get { if case .rebooted(let v)? = _storage._payloadVariant {return v} return false @@ -2228,7 +2228,7 @@ struct FromRadio { /// /// Include module config - var moduleConfig: ModuleConfig { + public var moduleConfig: ModuleConfig { get { if case .moduleConfig(let v)? = _storage._payloadVariant {return v} return ModuleConfig() @@ -2238,7 +2238,7 @@ struct FromRadio { /// /// One packet is sent for each channel - var channel: Channel { + public var channel: Channel { get { if case .channel(let v)? = _storage._payloadVariant {return v} return Channel() @@ -2248,7 +2248,7 @@ struct FromRadio { /// /// Queue status info - var queueStatus: QueueStatus { + public var queueStatus: QueueStatus { get { if case .queueStatus(let v)? = _storage._payloadVariant {return v} return QueueStatus() @@ -2258,7 +2258,7 @@ struct FromRadio { /// /// File Transfer Chunk - var xmodemPacket: XModem { + public var xmodemPacket: XModem { get { if case .xmodemPacket(let v)? = _storage._payloadVariant {return v} return XModem() @@ -2268,7 +2268,7 @@ struct FromRadio { /// /// Device metadata message - var metadata: DeviceMetadata { + public var metadata: DeviceMetadata { get { if case .metadata(let v)? = _storage._payloadVariant {return v} return DeviceMetadata() @@ -2278,7 +2278,7 @@ struct FromRadio { /// /// MQTT Client Proxy Message (device sending to client / phone for publishing to MQTT) - var mqttClientProxyMessage: MqttClientProxyMessage { + public var mqttClientProxyMessage: MqttClientProxyMessage { get { if case .mqttClientProxyMessage(let v)? = _storage._payloadVariant {return v} return MqttClientProxyMessage() @@ -2286,11 +2286,11 @@ struct FromRadio { set {_uniqueStorage()._payloadVariant = .mqttClientProxyMessage(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// Log levels, chosen to match python logging conventions. - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { /// /// Log levels, chosen to match python logging conventions. case packet(MeshPacket) @@ -2340,7 +2340,7 @@ struct FromRadio { case mqttClientProxyMessage(MqttClientProxyMessage) #if !swift(>=4.1) - static func ==(lhs: FromRadio.OneOf_PayloadVariant, rhs: FromRadio.OneOf_PayloadVariant) -> Bool { + public 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 @@ -2403,7 +2403,7 @@ struct FromRadio { #endif } - init() {} + public init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -2411,18 +2411,18 @@ struct FromRadio { /// /// 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 { +public 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 + public var payloadVariant: ToRadio.OneOf_PayloadVariant? = nil /// /// Send this packet on the mesh - var packet: MeshPacket { + public var packet: MeshPacket { get { if case .packet(let v)? = payloadVariant {return v} return MeshPacket() @@ -2439,7 +2439,7 @@ struct ToRadio { /// 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 { + public var wantConfigID: UInt32 { get { if case .wantConfigID(let v)? = payloadVariant {return v} return 0 @@ -2451,7 +2451,7 @@ struct ToRadio { /// 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 { + public var disconnect: Bool { get { if case .disconnect(let v)? = payloadVariant {return v} return false @@ -2459,7 +2459,7 @@ struct ToRadio { set {payloadVariant = .disconnect(newValue)} } - var xmodemPacket: XModem { + public var xmodemPacket: XModem { get { if case .xmodemPacket(let v)? = payloadVariant {return v} return XModem() @@ -2469,7 +2469,7 @@ struct ToRadio { /// /// MQTT Client Proxy Message (for client / phone subscribed to MQTT sending to device) - var mqttClientProxyMessage: MqttClientProxyMessage { + public var mqttClientProxyMessage: MqttClientProxyMessage { get { if case .mqttClientProxyMessage(let v)? = payloadVariant {return v} return MqttClientProxyMessage() @@ -2479,7 +2479,7 @@ struct ToRadio { /// /// Heartbeat message (used to keep the device connection awake on serial) - var heartbeat: Heartbeat { + public var heartbeat: Heartbeat { get { if case .heartbeat(let v)? = payloadVariant {return v} return Heartbeat() @@ -2487,11 +2487,11 @@ struct ToRadio { set {payloadVariant = .heartbeat(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// Log levels, chosen to match python logging conventions. - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { /// /// Send this packet on the mesh case packet(MeshPacket) @@ -2519,7 +2519,7 @@ struct ToRadio { case heartbeat(Heartbeat) #if !swift(>=4.1) - static func ==(lhs: ToRadio.OneOf_PayloadVariant, rhs: ToRadio.OneOf_PayloadVariant) -> Bool { + public 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 @@ -2554,237 +2554,237 @@ struct ToRadio { #endif } - init() {} + public init() {} } /// /// Compressed message payload -struct Compressed { +public 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 + public var portnum: PortNum = .unknownApp /// /// Compressed data. - var data: Data = Data() + public var data: Data = Data() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Full info on edges for a single node -struct NeighborInfo { +public struct NeighborInfo { // 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 ID of the node sending info on its neighbors - var nodeID: UInt32 = 0 + public var nodeID: UInt32 = 0 /// /// Field to pass neighbor info for the next sending cycle - var lastSentByID: UInt32 = 0 + public var lastSentByID: UInt32 = 0 /// /// Broadcast interval of the represented node (in seconds) - var nodeBroadcastIntervalSecs: UInt32 = 0 + public var nodeBroadcastIntervalSecs: UInt32 = 0 /// /// The list of out edges from this node - var neighbors: [Neighbor] = [] + public var neighbors: [Neighbor] = [] - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// A single edge in the mesh -struct Neighbor { +public struct Neighbor { // 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. /// /// Node ID of neighbor - var nodeID: UInt32 = 0 + public var nodeID: UInt32 = 0 /// /// SNR of last heard message - var snr: Float = 0 + public var snr: Float = 0 /// /// Reception time (in secs since 1970) of last message that was last sent by this ID. /// Note: this is for local storage only and will not be sent out over the mesh. - var lastRxTime: UInt32 = 0 + public var lastRxTime: UInt32 = 0 /// /// Broadcast interval of this neighbor (in seconds). /// Note: this is for local storage only and will not be sent out over the mesh. - var nodeBroadcastIntervalSecs: UInt32 = 0 + public var nodeBroadcastIntervalSecs: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Device metadata response -struct DeviceMetadata { +public 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() + public var firmwareVersion: String = String() /// /// Device state version - var deviceStateVersion: UInt32 = 0 + public var deviceStateVersion: UInt32 = 0 /// /// Indicates whether the device can shutdown CPU natively or via power management chip - var canShutdown: Bool = false + public var canShutdown: Bool = false /// /// Indicates that the device has native wifi capability - var hasWifi_p: Bool = false + public var hasWifi_p: Bool = false /// /// Indicates that the device has native bluetooth capability - var hasBluetooth_p: Bool = false + public var hasBluetooth_p: Bool = false /// /// Indicates that the device has an ethernet peripheral - var hasEthernet_p: Bool = false + public var hasEthernet_p: Bool = false /// /// Indicates that the device's role in the mesh - var role: Config.DeviceConfig.Role = .client + public var role: Config.DeviceConfig.Role = .client /// /// Indicates the device's current enabled position flags - var positionFlags: UInt32 = 0 + public var positionFlags: UInt32 = 0 /// /// Device hardware model - var hwModel: HardwareModel = .unset + public var hwModel: HardwareModel = .unset /// /// Has Remote Hardware enabled - var hasRemoteHardware_p: Bool = false + public var hasRemoteHardware_p: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// A heartbeat message is sent to the node from the client to keep the connection alive. /// This is currently only needed to keep serial connections alive, but can be used by any PhoneAPI. -struct Heartbeat { +public 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. - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// RemoteHardwarePins associated with a node -struct NodeRemoteHardwarePin { +public struct NodeRemoteHardwarePin { // 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_num exposing the available gpio pin - var nodeNum: UInt32 = 0 + public var nodeNum: UInt32 = 0 /// /// The the available gpio pin for usage with RemoteHardware module - var pin: RemoteHardwarePin { + public var pin: RemoteHardwarePin { get {return _pin ?? RemoteHardwarePin()} set {_pin = newValue} } /// Returns true if `pin` has been explicitly set. - var hasPin: Bool {return self._pin != nil} + public var hasPin: Bool {return self._pin != nil} /// Clears the value of `pin`. Subsequent reads from it will return its default value. - mutating func clearPin() {self._pin = nil} + public mutating func clearPin() {self._pin = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _pin: RemoteHardwarePin? = nil } -struct ChunkedPayload { +public struct ChunkedPayload { // 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 ID of the entire payload - var payloadID: UInt32 = 0 + public var payloadID: UInt32 = 0 /// /// The total number of chunks in the payload - var chunkCount: UInt32 = 0 + public var chunkCount: UInt32 = 0 /// /// The current chunk index in the total - var chunkIndex: UInt32 = 0 + public var chunkIndex: UInt32 = 0 /// /// The binary data of the current chunk - var payloadChunk: Data = Data() + public var payloadChunk: Data = Data() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Wrapper message for broken repeated oneof support -struct resend_chunks { +public struct resend_chunks { // 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 chunks: [UInt32] = [] + public var chunks: [UInt32] = [] - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Responses to a ChunkedPayload request -struct ChunkedPayloadResponse { +public struct ChunkedPayloadResponse { // 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 ID of the entire payload - var payloadID: UInt32 = 0 + public var payloadID: UInt32 = 0 - var payloadVariant: ChunkedPayloadResponse.OneOf_PayloadVariant? = nil + public var payloadVariant: ChunkedPayloadResponse.OneOf_PayloadVariant? = nil /// /// Request to transfer chunked payload - var requestTransfer: Bool { + public var requestTransfer: Bool { get { if case .requestTransfer(let v)? = payloadVariant {return v} return false @@ -2794,7 +2794,7 @@ struct ChunkedPayloadResponse { /// /// Accept the transfer chunked payload - var acceptTransfer: Bool { + public var acceptTransfer: Bool { get { if case .acceptTransfer(let v)? = payloadVariant {return v} return false @@ -2804,7 +2804,7 @@ struct ChunkedPayloadResponse { /// /// Request missing indexes in the chunked payload - var resendChunks: resend_chunks { + public var resendChunks: resend_chunks { get { if case .resendChunks(let v)? = payloadVariant {return v} return resend_chunks() @@ -2812,9 +2812,9 @@ struct ChunkedPayloadResponse { set {payloadVariant = .resendChunks(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { /// /// Request to transfer chunked payload case requestTransfer(Bool) @@ -2826,7 +2826,7 @@ struct ChunkedPayloadResponse { case resendChunks(resend_chunks) #if !swift(>=4.1) - static func ==(lhs: ChunkedPayloadResponse.OneOf_PayloadVariant, rhs: ChunkedPayloadResponse.OneOf_PayloadVariant) -> Bool { + public static func ==(lhs: ChunkedPayloadResponse.OneOf_PayloadVariant, rhs: ChunkedPayloadResponse.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 @@ -2849,7 +2849,7 @@ struct ChunkedPayloadResponse { #endif } - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -2898,7 +2898,7 @@ extension ChunkedPayloadResponse.OneOf_PayloadVariant: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension HardwareModel: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNSET"), 1: .same(proto: "TLORA_V2"), 2: .same(proto: "TLORA_V1"), @@ -2969,14 +2969,14 @@ extension HardwareModel: SwiftProtobuf._ProtoNameProviding { } extension Constants: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public 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 = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NONE"), 1: .same(proto: "TX_WATCHDOG"), 2: .same(proto: "SLEEP_ENTER_WAIT"), @@ -2993,8 +2993,8 @@ extension CriticalErrorCode: SwiftProtobuf._ProtoNameProviding { } extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Position" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Position" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "latitude_i"), 2: .standard(proto: "longitude_i"), 3: .same(proto: "altitude"), @@ -3091,7 +3091,7 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -3128,7 +3128,7 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in if _storage._latitudeI != 0 { try visitor.visitSingularSFixed32Field(value: _storage._latitudeI, fieldNumber: 1) @@ -3203,7 +3203,7 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Position, rhs: Position) -> Bool { + public 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 @@ -3241,7 +3241,7 @@ extension Position: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } extension Position.LocSource: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "LOC_UNSET"), 1: .same(proto: "LOC_MANUAL"), 2: .same(proto: "LOC_INTERNAL"), @@ -3250,7 +3250,7 @@ extension Position.LocSource: SwiftProtobuf._ProtoNameProviding { } extension Position.AltSource: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "ALT_UNSET"), 1: .same(proto: "ALT_MANUAL"), 2: .same(proto: "ALT_INTERNAL"), @@ -3260,8 +3260,8 @@ extension Position.AltSource: SwiftProtobuf._ProtoNameProviding { } extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".User" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".User" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .standard(proto: "long_name"), 3: .standard(proto: "short_name"), @@ -3271,7 +3271,7 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, 7: .same(proto: "role"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -3289,7 +3289,7 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.id.isEmpty { try visitor.visitSingularStringField(value: self.id, fieldNumber: 1) } @@ -3314,7 +3314,7 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: User, rhs: User) -> Bool { + public 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} @@ -3328,12 +3328,12 @@ extension User: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, } extension RouteDiscovery: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".RouteDiscovery" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".RouteDiscovery" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "route"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -3345,14 +3345,14 @@ extension RouteDiscovery: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } } - func traverse(visitor: inout V) throws { + public 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 { + public static func ==(lhs: RouteDiscovery, rhs: RouteDiscovery) -> Bool { if lhs.route != rhs.route {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -3360,14 +3360,14 @@ extension RouteDiscovery: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } extension Routing: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Routing" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Routing" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -3412,7 +3412,7 @@ extension Routing: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -3435,7 +3435,7 @@ extension Routing: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Routing, rhs: Routing) -> Bool { + public static func ==(lhs: Routing, rhs: Routing) -> Bool { if lhs.variant != rhs.variant {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -3443,7 +3443,7 @@ extension Routing: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } extension Routing.Error: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NONE"), 1: .same(proto: "NO_ROUTE"), 2: .same(proto: "GOT_NAK"), @@ -3460,8 +3460,8 @@ extension Routing.Error: SwiftProtobuf._ProtoNameProviding { } extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Data" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Data" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "portnum"), 2: .same(proto: "payload"), 3: .standard(proto: "want_response"), @@ -3472,7 +3472,7 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati 8: .same(proto: "emoji"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -3491,7 +3491,7 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.portnum != .unknownApp { try visitor.visitSingularEnumField(value: self.portnum, fieldNumber: 1) } @@ -3519,7 +3519,7 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: DataMessage, rhs: DataMessage) -> Bool { + public 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} @@ -3534,8 +3534,8 @@ extension DataMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } extension Waypoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Waypoint" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Waypoint" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .standard(proto: "latitude_i"), 3: .standard(proto: "longitude_i"), @@ -3546,7 +3546,7 @@ extension Waypoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB 8: .same(proto: "icon"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -3565,7 +3565,7 @@ extension Waypoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.id != 0 { try visitor.visitSingularUInt32Field(value: self.id, fieldNumber: 1) } @@ -3593,7 +3593,7 @@ extension Waypoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Waypoint, rhs: Waypoint) -> Bool { + public 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} @@ -3608,15 +3608,15 @@ extension Waypoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } extension MqttClientProxyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".MqttClientProxyMessage" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".MqttClientProxyMessage" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "topic"), 2: .same(proto: "data"), 3: .same(proto: "text"), 4: .same(proto: "retained"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -3645,7 +3645,7 @@ extension MqttClientProxyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -3670,7 +3670,7 @@ extension MqttClientProxyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: MqttClientProxyMessage, rhs: MqttClientProxyMessage) -> Bool { + public static func ==(lhs: MqttClientProxyMessage, rhs: MqttClientProxyMessage) -> Bool { if lhs.topic != rhs.topic {return false} if lhs.payloadVariant != rhs.payloadVariant {return false} if lhs.retained != rhs.retained {return false} @@ -3680,8 +3680,8 @@ extension MqttClientProxyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageI } extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".MeshPacket" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".MeshPacket" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "from"), 2: .same(proto: "to"), 3: .same(proto: "channel"), @@ -3752,7 +3752,7 @@ extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -3800,7 +3800,7 @@ extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio } } - func traverse(visitor: inout V) throws { + public 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 @@ -3860,7 +3860,7 @@ extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: MeshPacket, rhs: MeshPacket) -> Bool { + public 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 @@ -3889,7 +3889,7 @@ extension MeshPacket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio } extension MeshPacket.Priority: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNSET"), 1: .same(proto: "MIN"), 10: .same(proto: "BACKGROUND"), @@ -3901,7 +3901,7 @@ extension MeshPacket.Priority: SwiftProtobuf._ProtoNameProviding { } extension MeshPacket.Delayed: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NO_DELAY"), 1: .same(proto: "DELAYED_BROADCAST"), 2: .same(proto: "DELAYED_DIRECT"), @@ -3909,8 +3909,8 @@ extension MeshPacket.Delayed: SwiftProtobuf._ProtoNameProviding { } extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".NodeInfo" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".NodeInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "num"), 2: .same(proto: "user"), 3: .same(proto: "position"), @@ -3968,7 +3968,7 @@ extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -3992,7 +3992,7 @@ extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } } - func traverse(visitor: inout V) throws { + public 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 @@ -4032,7 +4032,7 @@ extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: NodeInfo, rhs: NodeInfo) -> Bool { + public static func ==(lhs: NodeInfo, rhs: NodeInfo) -> Bool { if lhs._storage !== rhs._storage { let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 @@ -4057,14 +4057,14 @@ extension NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".MyNodeInfo" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".MyNodeInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "my_node_num"), 8: .standard(proto: "reboot_count"), 11: .standard(proto: "min_app_version"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4078,7 +4078,7 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.myNodeNum != 0 { try visitor.visitSingularUInt32Field(value: self.myNodeNum, fieldNumber: 1) } @@ -4091,7 +4091,7 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: MyNodeInfo, rhs: MyNodeInfo) -> Bool { + public static func ==(lhs: MyNodeInfo, rhs: MyNodeInfo) -> Bool { if lhs.myNodeNum != rhs.myNodeNum {return false} if lhs.rebootCount != rhs.rebootCount {return false} if lhs.minAppVersion != rhs.minAppVersion {return false} @@ -4101,15 +4101,15 @@ extension MyNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio } extension LogRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LogRecord" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".LogRecord" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4124,7 +4124,7 @@ extension LogRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.message.isEmpty { try visitor.visitSingularStringField(value: self.message, fieldNumber: 1) } @@ -4140,7 +4140,7 @@ extension LogRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: LogRecord, rhs: LogRecord) -> Bool { + public 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} @@ -4151,7 +4151,7 @@ extension LogRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } extension LogRecord.Level: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNSET"), 5: .same(proto: "TRACE"), 10: .same(proto: "DEBUG"), @@ -4163,15 +4163,15 @@ extension LogRecord.Level: SwiftProtobuf._ProtoNameProviding { } extension QueueStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".QueueStatus" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".QueueStatus" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4186,7 +4186,7 @@ extension QueueStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.res != 0 { try visitor.visitSingularInt32Field(value: self.res, fieldNumber: 1) } @@ -4202,7 +4202,7 @@ extension QueueStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: QueueStatus, rhs: QueueStatus) -> Bool { + public 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} @@ -4213,8 +4213,8 @@ extension QueueStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".FromRadio" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".FromRadio" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "id"), 2: .same(proto: "packet"), 3: .standard(proto: "my_info"), @@ -4260,7 +4260,7 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation return _storage } - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -4434,7 +4434,7 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } } - func traverse(visitor: inout V) throws { + public 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 @@ -4502,7 +4502,7 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: FromRadio, rhs: FromRadio) -> Bool { + public 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 @@ -4519,8 +4519,8 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ToRadio" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ToRadio" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "packet"), 3: .standard(proto: "want_config_id"), 4: .same(proto: "disconnect"), @@ -4529,7 +4529,7 @@ extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa 7: .same(proto: "heartbeat"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4608,7 +4608,7 @@ extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -4643,7 +4643,7 @@ extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ToRadio, rhs: ToRadio) -> Bool { + public static func ==(lhs: ToRadio, rhs: ToRadio) -> Bool { if lhs.payloadVariant != rhs.payloadVariant {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -4651,13 +4651,13 @@ extension ToRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa } extension Compressed: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Compressed" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Compressed" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "portnum"), 2: .same(proto: "data"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4670,7 +4670,7 @@ extension Compressed: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.portnum != .unknownApp { try visitor.visitSingularEnumField(value: self.portnum, fieldNumber: 1) } @@ -4680,7 +4680,7 @@ extension Compressed: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Compressed, rhs: Compressed) -> Bool { + public 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} @@ -4689,15 +4689,15 @@ extension Compressed: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementatio } extension NeighborInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".NeighborInfo" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".NeighborInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "node_id"), 2: .standard(proto: "last_sent_by_id"), 3: .standard(proto: "node_broadcast_interval_secs"), 4: .same(proto: "neighbors"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4712,7 +4712,7 @@ extension NeighborInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.nodeID != 0 { try visitor.visitSingularUInt32Field(value: self.nodeID, fieldNumber: 1) } @@ -4728,7 +4728,7 @@ extension NeighborInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: NeighborInfo, rhs: NeighborInfo) -> Bool { + public static func ==(lhs: NeighborInfo, rhs: NeighborInfo) -> Bool { if lhs.nodeID != rhs.nodeID {return false} if lhs.lastSentByID != rhs.lastSentByID {return false} if lhs.nodeBroadcastIntervalSecs != rhs.nodeBroadcastIntervalSecs {return false} @@ -4739,15 +4739,15 @@ extension NeighborInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } extension Neighbor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Neighbor" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Neighbor" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "node_id"), 2: .same(proto: "snr"), 3: .standard(proto: "last_rx_time"), 4: .standard(proto: "node_broadcast_interval_secs"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4762,7 +4762,7 @@ extension Neighbor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.nodeID != 0 { try visitor.visitSingularUInt32Field(value: self.nodeID, fieldNumber: 1) } @@ -4778,7 +4778,7 @@ extension Neighbor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Neighbor, rhs: Neighbor) -> Bool { + public static func ==(lhs: Neighbor, rhs: Neighbor) -> Bool { if lhs.nodeID != rhs.nodeID {return false} if lhs.snr != rhs.snr {return false} if lhs.lastRxTime != rhs.lastRxTime {return false} @@ -4789,8 +4789,8 @@ extension Neighbor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } extension DeviceMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".DeviceMetadata" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".DeviceMetadata" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "firmware_version"), 2: .standard(proto: "device_state_version"), 3: .same(proto: "canShutdown"), @@ -4803,7 +4803,7 @@ extension DeviceMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement 10: .same(proto: "hasRemoteHardware"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4824,7 +4824,7 @@ extension DeviceMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.firmwareVersion.isEmpty { try visitor.visitSingularStringField(value: self.firmwareVersion, fieldNumber: 1) } @@ -4858,7 +4858,7 @@ extension DeviceMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: DeviceMetadata, rhs: DeviceMetadata) -> Bool { + public 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} @@ -4875,32 +4875,32 @@ extension DeviceMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } extension Heartbeat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Heartbeat" - static let _protobuf_nameMap = SwiftProtobuf._NameMap() + public static let protoMessageName: String = _protobuf_package + ".Heartbeat" + public static let _protobuf_nameMap = SwiftProtobuf._NameMap() - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let _ = try decoder.nextFieldNumber() { } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Heartbeat, rhs: Heartbeat) -> Bool { + public static func ==(lhs: Heartbeat, rhs: Heartbeat) -> Bool { if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension NodeRemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".NodeRemoteHardwarePin" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".NodeRemoteHardwarePin" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "node_num"), 2: .same(proto: "pin"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4913,7 +4913,7 @@ extension NodeRemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageIm } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -4927,7 +4927,7 @@ extension NodeRemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageIm try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: NodeRemoteHardwarePin, rhs: NodeRemoteHardwarePin) -> Bool { + public static func ==(lhs: NodeRemoteHardwarePin, rhs: NodeRemoteHardwarePin) -> Bool { if lhs.nodeNum != rhs.nodeNum {return false} if lhs._pin != rhs._pin {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -4936,15 +4936,15 @@ extension NodeRemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageIm } extension ChunkedPayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ChunkedPayload" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ChunkedPayload" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "payload_id"), 2: .standard(proto: "chunk_count"), 3: .standard(proto: "chunk_index"), 4: .standard(proto: "payload_chunk"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -4959,7 +4959,7 @@ extension ChunkedPayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.payloadID != 0 { try visitor.visitSingularUInt32Field(value: self.payloadID, fieldNumber: 1) } @@ -4975,7 +4975,7 @@ extension ChunkedPayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ChunkedPayload, rhs: ChunkedPayload) -> Bool { + public static func ==(lhs: ChunkedPayload, rhs: ChunkedPayload) -> Bool { if lhs.payloadID != rhs.payloadID {return false} if lhs.chunkCount != rhs.chunkCount {return false} if lhs.chunkIndex != rhs.chunkIndex {return false} @@ -4986,12 +4986,12 @@ extension ChunkedPayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement } extension resend_chunks: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".resend_chunks" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".resend_chunks" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "chunks"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -5003,14 +5003,14 @@ extension resend_chunks: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.chunks.isEmpty { try visitor.visitPackedUInt32Field(value: self.chunks, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: resend_chunks, rhs: resend_chunks) -> Bool { + public static func ==(lhs: resend_chunks, rhs: resend_chunks) -> Bool { if lhs.chunks != rhs.chunks {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -5018,15 +5018,15 @@ extension resend_chunks: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } extension ChunkedPayloadResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ChunkedPayloadResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ChunkedPayloadResponse" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "payload_id"), 2: .standard(proto: "request_transfer"), 3: .standard(proto: "accept_transfer"), 4: .standard(proto: "resend_chunks"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -5067,7 +5067,7 @@ extension ChunkedPayloadResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -5093,7 +5093,7 @@ extension ChunkedPayloadResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ChunkedPayloadResponse, rhs: ChunkedPayloadResponse) -> Bool { + public static func ==(lhs: ChunkedPayloadResponse, rhs: ChunkedPayloadResponse) -> Bool { if lhs.payloadID != rhs.payloadID {return false} if lhs.payloadVariant != rhs.payloadVariant {return false} if lhs.unknownFields != rhs.unknownFields {return false} diff --git a/Meshtastic/Protobufs/meshtastic/module_config.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift similarity index 83% rename from Meshtastic/Protobufs/meshtastic/module_config.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift index 465e4e1f..5e2da81a 100644 --- a/Meshtastic/Protobufs/meshtastic/module_config.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/module_config.pb.swift @@ -20,8 +20,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -enum RemoteHardwarePinType: SwiftProtobuf.Enum { - typealias RawValue = Int +public enum RemoteHardwarePinType: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Unset/unused @@ -36,11 +36,11 @@ enum RemoteHardwarePinType: SwiftProtobuf.Enum { case digitalWrite // = 2 case UNRECOGNIZED(Int) - init() { + public init() { self = .unknown } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unknown case 1: self = .digitalRead @@ -49,7 +49,7 @@ enum RemoteHardwarePinType: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unknown: return 0 case .digitalRead: return 1 @@ -64,7 +64,7 @@ enum RemoteHardwarePinType: SwiftProtobuf.Enum { extension RemoteHardwarePinType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [RemoteHardwarePinType] = [ + public static let allCases: [RemoteHardwarePinType] = [ .unknown, .digitalRead, .digitalWrite, @@ -75,18 +75,18 @@ extension RemoteHardwarePinType: CaseIterable { /// /// Module Config -struct ModuleConfig { +public 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 + public var payloadVariant: ModuleConfig.OneOf_PayloadVariant? = nil /// /// TODO: REPLACE - var mqtt: ModuleConfig.MQTTConfig { + public var mqtt: ModuleConfig.MQTTConfig { get { if case .mqtt(let v)? = payloadVariant {return v} return ModuleConfig.MQTTConfig() @@ -96,7 +96,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var serial: ModuleConfig.SerialConfig { + public var serial: ModuleConfig.SerialConfig { get { if case .serial(let v)? = payloadVariant {return v} return ModuleConfig.SerialConfig() @@ -106,7 +106,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var externalNotification: ModuleConfig.ExternalNotificationConfig { + public var externalNotification: ModuleConfig.ExternalNotificationConfig { get { if case .externalNotification(let v)? = payloadVariant {return v} return ModuleConfig.ExternalNotificationConfig() @@ -116,7 +116,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var storeForward: ModuleConfig.StoreForwardConfig { + public var storeForward: ModuleConfig.StoreForwardConfig { get { if case .storeForward(let v)? = payloadVariant {return v} return ModuleConfig.StoreForwardConfig() @@ -126,7 +126,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var rangeTest: ModuleConfig.RangeTestConfig { + public var rangeTest: ModuleConfig.RangeTestConfig { get { if case .rangeTest(let v)? = payloadVariant {return v} return ModuleConfig.RangeTestConfig() @@ -136,7 +136,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var telemetry: ModuleConfig.TelemetryConfig { + public var telemetry: ModuleConfig.TelemetryConfig { get { if case .telemetry(let v)? = payloadVariant {return v} return ModuleConfig.TelemetryConfig() @@ -146,7 +146,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var cannedMessage: ModuleConfig.CannedMessageConfig { + public var cannedMessage: ModuleConfig.CannedMessageConfig { get { if case .cannedMessage(let v)? = payloadVariant {return v} return ModuleConfig.CannedMessageConfig() @@ -156,7 +156,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var audio: ModuleConfig.AudioConfig { + public var audio: ModuleConfig.AudioConfig { get { if case .audio(let v)? = payloadVariant {return v} return ModuleConfig.AudioConfig() @@ -166,7 +166,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var remoteHardware: ModuleConfig.RemoteHardwareConfig { + public var remoteHardware: ModuleConfig.RemoteHardwareConfig { get { if case .remoteHardware(let v)? = payloadVariant {return v} return ModuleConfig.RemoteHardwareConfig() @@ -176,7 +176,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var neighborInfo: ModuleConfig.NeighborInfoConfig { + public var neighborInfo: ModuleConfig.NeighborInfoConfig { get { if case .neighborInfo(let v)? = payloadVariant {return v} return ModuleConfig.NeighborInfoConfig() @@ -186,7 +186,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var ambientLighting: ModuleConfig.AmbientLightingConfig { + public var ambientLighting: ModuleConfig.AmbientLightingConfig { get { if case .ambientLighting(let v)? = payloadVariant {return v} return ModuleConfig.AmbientLightingConfig() @@ -196,7 +196,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var detectionSensor: ModuleConfig.DetectionSensorConfig { + public var detectionSensor: ModuleConfig.DetectionSensorConfig { get { if case .detectionSensor(let v)? = payloadVariant {return v} return ModuleConfig.DetectionSensorConfig() @@ -206,7 +206,7 @@ struct ModuleConfig { /// /// TODO: REPLACE - var paxcounter: ModuleConfig.PaxcounterConfig { + public var paxcounter: ModuleConfig.PaxcounterConfig { get { if case .paxcounter(let v)? = payloadVariant {return v} return ModuleConfig.PaxcounterConfig() @@ -214,11 +214,11 @@ struct ModuleConfig { set {payloadVariant = .paxcounter(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// TODO: REPLACE - enum OneOf_PayloadVariant: Equatable { + public enum OneOf_PayloadVariant: Equatable { /// /// TODO: REPLACE case mqtt(ModuleConfig.MQTTConfig) @@ -260,7 +260,7 @@ struct ModuleConfig { case paxcounter(ModuleConfig.PaxcounterConfig) #if !swift(>=4.1) - static func ==(lhs: ModuleConfig.OneOf_PayloadVariant, rhs: ModuleConfig.OneOf_PayloadVariant) -> Bool { + public 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 @@ -325,7 +325,7 @@ struct ModuleConfig { /// /// MQTT Client Config - struct MQTTConfig { + public 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. @@ -333,228 +333,228 @@ struct ModuleConfig { /// /// 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 + public 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() + public 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() + public 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() + public 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 + public var encryptionEnabled: Bool = false /// /// Whether to send / consume json packets on MQTT - var jsonEnabled: Bool = false + public var jsonEnabled: Bool = false /// /// If true, we attempt to establish a secure connection using TLS - var tlsEnabled: Bool = false + public var tlsEnabled: Bool = false /// /// The root topic to use for MQTT messages. Default is "msh". /// This is useful if you want to use a single MQTT server for multiple meshtastic networks and separate them via ACLs - var root: String = String() + public var root: String = String() /// /// If true, we can use the connected phone / client to proxy messages to MQTT instead of a direct connection - var proxyToClientEnabled: Bool = false + public var proxyToClientEnabled: Bool = false /// /// If true, we will periodically report unencrypted information about our node to a map via MQTT - var mapReportingEnabled: Bool = false + public var mapReportingEnabled: Bool = false /// /// Settings for reporting information about our node to a map via MQTT - var mapReportSettings: ModuleConfig.MapReportSettings { + public var mapReportSettings: ModuleConfig.MapReportSettings { get {return _mapReportSettings ?? ModuleConfig.MapReportSettings()} set {_mapReportSettings = newValue} } /// Returns true if `mapReportSettings` has been explicitly set. - var hasMapReportSettings: Bool {return self._mapReportSettings != nil} + public var hasMapReportSettings: Bool {return self._mapReportSettings != nil} /// Clears the value of `mapReportSettings`. Subsequent reads from it will return its default value. - mutating func clearMapReportSettings() {self._mapReportSettings = nil} + public mutating func clearMapReportSettings() {self._mapReportSettings = nil} - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _mapReportSettings: ModuleConfig.MapReportSettings? = nil } /// /// Settings for reporting unencrypted information about our node to a map via MQTT - struct MapReportSettings { + public struct MapReportSettings { // 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. /// /// How often we should report our info to the map (in seconds) - var publishIntervalSecs: UInt32 = 0 + public var publishIntervalSecs: UInt32 = 0 /// /// Bits of precision for the location sent (default of 32 is full precision). - var positionPrecision: UInt32 = 0 + public var positionPrecision: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// RemoteHardwareModule Config - struct RemoteHardwareConfig { + public 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 + public var enabled: Bool = false /// /// Whether the Module allows consumers to read / write to pins not defined in available_pins - var allowUndefinedPinAccess: Bool = false + public var allowUndefinedPinAccess: Bool = false /// /// Exposes the available pins to the mesh for reading and writing - var availablePins: [RemoteHardwarePin] = [] + public var availablePins: [RemoteHardwarePin] = [] - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// NeighborInfoModule Config - struct NeighborInfoConfig { + public struct NeighborInfoConfig { // 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 + public var enabled: Bool = false /// /// Interval in seconds of how often we should try to send our /// Neighbor Info to the mesh - var updateInterval: UInt32 = 0 + public var updateInterval: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Detection Sensor Module Config - struct DetectionSensorConfig { + public struct DetectionSensorConfig { // 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 + public var enabled: Bool = false /// /// Interval in seconds of how often we can send a message to the mesh when a state change is detected - var minimumBroadcastSecs: UInt32 = 0 + public var minimumBroadcastSecs: UInt32 = 0 /// /// Interval in seconds of how often we should send a message to the mesh with the current state regardless of changes /// When set to 0, only state changes will be broadcasted /// Works as a sort of status heartbeat for peace of mind - var stateBroadcastSecs: UInt32 = 0 + public var stateBroadcastSecs: UInt32 = 0 /// /// Send ASCII bell with alert message /// Useful for triggering ext. notification on bell - var sendBell: Bool = false + public var sendBell: Bool = false /// /// Friendly name used to format message sent to mesh /// Example: A name "Motion" would result in a message "Motion detected" /// Maximum length of 20 characters - var name: String = String() + public var name: String = String() /// /// GPIO pin to monitor for state changes - var monitorPin: UInt32 = 0 + public var monitorPin: UInt32 = 0 /// /// Whether or not the GPIO pin state detection is triggered on HIGH (1) /// Otherwise LOW (0) - var detectionTriggeredHigh: Bool = false + public var detectionTriggeredHigh: Bool = false /// /// Whether or not use INPUT_PULLUP mode for GPIO pin /// Only applicable if the board uses pull-up resistors on the pin - var usePullup: Bool = false + public var usePullup: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Audio Config for codec2 voice - struct AudioConfig { + public 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 + public var codec2Enabled: Bool = false /// /// PTT Pin - var pttPin: UInt32 = 0 + public var pttPin: UInt32 = 0 /// /// The audio sample rate to use for codec2 - var bitrate: ModuleConfig.AudioConfig.Audio_Baud = .codec2Default + public var bitrate: ModuleConfig.AudioConfig.Audio_Baud = .codec2Default /// /// I2S Word Select - var i2SWs: UInt32 = 0 + public var i2SWs: UInt32 = 0 /// /// I2S Data IN - var i2SSd: UInt32 = 0 + public var i2SSd: UInt32 = 0 /// /// I2S Data OUT - var i2SDin: UInt32 = 0 + public var i2SDin: UInt32 = 0 /// /// I2S Clock - var i2SSck: UInt32 = 0 + public var i2SSck: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// Baudrate for codec2 voice - enum Audio_Baud: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum Audio_Baud: SwiftProtobuf.Enum { + public typealias RawValue = Int case codec2Default // = 0 case codec23200 // = 1 case codec22400 // = 2 @@ -566,11 +566,11 @@ struct ModuleConfig { case codec2700B // = 8 case UNRECOGNIZED(Int) - init() { + public init() { self = .codec2Default } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .codec2Default case 1: self = .codec23200 @@ -585,7 +585,7 @@ struct ModuleConfig { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .codec2Default: return 0 case .codec23200: return 1 @@ -602,82 +602,82 @@ struct ModuleConfig { } - init() {} + public init() {} } /// /// Config for the Paxcounter Module - struct PaxcounterConfig { + public struct PaxcounterConfig { // 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 Paxcounter Module - var enabled: Bool = false + public var enabled: Bool = false - var paxcounterUpdateInterval: UInt32 = 0 + public var paxcounterUpdateInterval: UInt32 = 0 /// /// WiFi RSSI threshold. Defaults to -80 - var wifiThreshold: Int32 = 0 + public var wifiThreshold: Int32 = 0 /// /// BLE RSSI threshold. Defaults to -80 - var bleThreshold: Int32 = 0 + public var bleThreshold: Int32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Serial Config - struct SerialConfig { + public 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 - var enabled: Bool = false + public var enabled: Bool = false /// /// TODO: REPLACE - var echo: Bool = false + public var echo: Bool = false /// /// RX pin (should match Arduino gpio pin number) - var rxd: UInt32 = 0 + public var rxd: UInt32 = 0 /// /// TX pin (should match Arduino gpio pin number) - var txd: UInt32 = 0 + public var txd: UInt32 = 0 /// /// Serial baud rate - var baud: ModuleConfig.SerialConfig.Serial_Baud = .baudDefault + public var baud: ModuleConfig.SerialConfig.Serial_Baud = .baudDefault /// /// TODO: REPLACE - var timeout: UInt32 = 0 + public var timeout: UInt32 = 0 /// /// Mode for serial module operation - var mode: ModuleConfig.SerialConfig.Serial_Mode = .default + public var mode: ModuleConfig.SerialConfig.Serial_Mode = .default /// /// Overrides the platform's defacto Serial port instance to use with Serial module config settings /// This is currently only usable in output modes like NMEA / CalTopo and may behave strangely or not work at all in other modes /// Existing logging over the Serial Console will still be present - var overrideConsoleSerialPort: Bool = false + public var overrideConsoleSerialPort: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// TODO: REPLACE - enum Serial_Baud: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum Serial_Baud: SwiftProtobuf.Enum { + public typealias RawValue = Int case baudDefault // = 0 case baud110 // = 1 case baud300 // = 2 @@ -696,11 +696,11 @@ struct ModuleConfig { case baud921600 // = 15 case UNRECOGNIZED(Int) - init() { + public init() { self = .baudDefault } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .baudDefault case 1: self = .baud110 @@ -722,7 +722,7 @@ struct ModuleConfig { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .baudDefault: return 0 case .baud110: return 1 @@ -748,8 +748,8 @@ struct ModuleConfig { /// /// TODO: REPLACE - enum Serial_Mode: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum Serial_Mode: SwiftProtobuf.Enum { + public typealias RawValue = Int case `default` // = 0 case simple // = 1 case proto // = 2 @@ -760,11 +760,11 @@ struct ModuleConfig { case caltopo // = 5 case UNRECOGNIZED(Int) - init() { + public init() { self = .default } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .default case 1: self = .simple @@ -776,7 +776,7 @@ struct ModuleConfig { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .default: return 0 case .simple: return 1 @@ -790,152 +790,152 @@ struct ModuleConfig { } - init() {} + public init() {} } /// /// External Notifications Config - struct ExternalNotificationConfig { + public 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 + public 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 + public 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 + public 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 + public 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 + public var outputBuzzer: UInt32 = 0 /// /// IF this is true, the 'output' Pin will be pulled active high, false /// means active low. - var active: Bool = false + public var active: Bool = false /// /// True: Alert when a text message arrives (output) - var alertMessage: Bool = false + public var alertMessage: Bool = false /// /// True: Alert when a text message arrives (output_vibra) - var alertMessageVibra: Bool = false + public var alertMessageVibra: Bool = false /// /// True: Alert when a text message arrives (output_buzzer) - var alertMessageBuzzer: Bool = false + public var alertMessageBuzzer: Bool = false /// /// True: Alert when the bell character is received (output) - var alertBell: Bool = false + public var alertBell: Bool = false /// /// True: Alert when the bell character is received (output_vibra) - var alertBellVibra: Bool = false + public var alertBellVibra: Bool = false /// /// True: Alert when the bell character is received (output_buzzer) - var alertBellBuzzer: Bool = false + public 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 + public 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 + public var nagTimeout: UInt32 = 0 /// /// When true, enables devices with native I2S audio output to use the RTTTL over speaker like a buzzer /// T-Watch S3 and T-Deck for example have this capability - var useI2SAsBuzzer: Bool = false + public var useI2SAsBuzzer: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Store and Forward Module Config - struct StoreForwardConfig { + public 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 + public var enabled: Bool = false /// /// TODO: REPLACE - var heartbeat: Bool = false + public var heartbeat: Bool = false /// /// TODO: REPLACE - var records: UInt32 = 0 + public var records: UInt32 = 0 /// /// TODO: REPLACE - var historyReturnMax: UInt32 = 0 + public var historyReturnMax: UInt32 = 0 /// /// TODO: REPLACE - var historyReturnWindow: UInt32 = 0 + public var historyReturnWindow: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Preferences for the RangeTestModule - struct RangeTestConfig { + public 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 + public var enabled: Bool = false /// /// Send out range test messages from this node - var sender: UInt32 = 0 + public var sender: UInt32 = 0 /// /// Bool value indicating that this node should save a RangeTest.csv file. /// ESP32 Only - var save: Bool = false + public var save: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Configuration for both device and environment metrics - struct TelemetryConfig { + public 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. @@ -943,112 +943,112 @@ struct ModuleConfig { /// /// Interval in seconds of how often we should try to send our /// device metrics to the mesh - var deviceUpdateInterval: UInt32 = 0 + public var deviceUpdateInterval: UInt32 = 0 - var environmentUpdateInterval: UInt32 = 0 + public var environmentUpdateInterval: UInt32 = 0 /// /// Preferences for the Telemetry Module (Environment) /// Enable/Disable the telemetry measurement module measurement collection - var environmentMeasurementEnabled: Bool = false + public var environmentMeasurementEnabled: Bool = false /// /// Enable/Disable the telemetry measurement module on-device display - var environmentScreenEnabled: Bool = false + public 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 + public var environmentDisplayFahrenheit: Bool = false /// /// Enable/Disable the air quality metrics - var airQualityEnabled: Bool = false + public var airQualityEnabled: Bool = false /// /// Interval in seconds of how often we should try to send our /// air quality metrics to the mesh - var airQualityInterval: UInt32 = 0 + public var airQualityInterval: UInt32 = 0 /// /// Interval in seconds of how often we should try to send our /// air quality metrics to the mesh - var powerMeasurementEnabled: Bool = false + public var powerMeasurementEnabled: Bool = false /// /// Interval in seconds of how often we should try to send our /// air quality metrics to the mesh - var powerUpdateInterval: UInt32 = 0 + public var powerUpdateInterval: UInt32 = 0 /// /// Interval in seconds of how often we should try to send our /// air quality metrics to the mesh - var powerScreenEnabled: Bool = false + public var powerScreenEnabled: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// TODO: REPLACE - struct CannedMessageConfig { + public 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 + public var rotary1Enabled: Bool = false /// /// GPIO pin for rotary encoder A port. - var inputbrokerPinA: UInt32 = 0 + public var inputbrokerPinA: UInt32 = 0 /// /// GPIO pin for rotary encoder B port. - var inputbrokerPinB: UInt32 = 0 + public var inputbrokerPinB: UInt32 = 0 /// /// GPIO pin for rotary encoder Press port. - var inputbrokerPinPress: UInt32 = 0 + public var inputbrokerPinPress: UInt32 = 0 /// /// Generate input event on CW of this kind. - var inputbrokerEventCw: ModuleConfig.CannedMessageConfig.InputEventChar = .none + public var inputbrokerEventCw: ModuleConfig.CannedMessageConfig.InputEventChar = .none /// /// Generate input event on CCW of this kind. - var inputbrokerEventCcw: ModuleConfig.CannedMessageConfig.InputEventChar = .none + public var inputbrokerEventCcw: ModuleConfig.CannedMessageConfig.InputEventChar = .none /// /// Generate input event on Press of this kind. - var inputbrokerEventPress: ModuleConfig.CannedMessageConfig.InputEventChar = .none + public 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 + public var updown1Enabled: Bool = false /// /// Enable/disable CannedMessageModule. - var enabled: Bool = false + public 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() + public var allowInputSource: String = String() /// /// CannedMessageModule also sends a bell character with the messages. /// ExternalNotificationModule can benefit from this feature. - var sendBell: Bool = false + public var sendBell: Bool = false - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// TODO: REPLACE - enum InputEventChar: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum InputEventChar: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// TODO: REPLACE @@ -1083,11 +1083,11 @@ struct ModuleConfig { case cancel // = 24 case UNRECOGNIZED(Int) - init() { + public init() { self = .none } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .none case 10: self = .select @@ -1101,7 +1101,7 @@ struct ModuleConfig { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .none: return 0 case .select: return 10 @@ -1117,50 +1117,50 @@ struct ModuleConfig { } - init() {} + public init() {} } /// ///Ambient Lighting Module - Settings for control of onboard LEDs to allow users to adjust the brightness levels and respective color levels. ///Initially created for the RAK14001 RGB LED module. - struct AmbientLightingConfig { + public struct AmbientLightingConfig { // 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 LED to on or off. - var ledState: Bool = false + public var ledState: Bool = false /// /// Sets the current for the LED output. Default is 10. - var current: UInt32 = 0 + public var current: UInt32 = 0 /// /// Sets the red LED level. Values are 0-255. - var red: UInt32 = 0 + public var red: UInt32 = 0 /// /// Sets the green LED level. Values are 0-255. - var green: UInt32 = 0 + public var green: UInt32 = 0 /// /// Sets the blue LED level. Values are 0-255. - var blue: UInt32 = 0 + public var blue: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } - init() {} + public init() {} } #if swift(>=4.2) extension ModuleConfig.AudioConfig.Audio_Baud: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [ModuleConfig.AudioConfig.Audio_Baud] = [ + public static let allCases: [ModuleConfig.AudioConfig.Audio_Baud] = [ .codec2Default, .codec23200, .codec22400, @@ -1175,7 +1175,7 @@ extension ModuleConfig.AudioConfig.Audio_Baud: CaseIterable { extension ModuleConfig.SerialConfig.Serial_Baud: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [ModuleConfig.SerialConfig.Serial_Baud] = [ + public static let allCases: [ModuleConfig.SerialConfig.Serial_Baud] = [ .baudDefault, .baud110, .baud300, @@ -1197,7 +1197,7 @@ extension ModuleConfig.SerialConfig.Serial_Baud: CaseIterable { extension ModuleConfig.SerialConfig.Serial_Mode: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [ModuleConfig.SerialConfig.Serial_Mode] = [ + public static let allCases: [ModuleConfig.SerialConfig.Serial_Mode] = [ .default, .simple, .proto, @@ -1209,7 +1209,7 @@ extension ModuleConfig.SerialConfig.Serial_Mode: CaseIterable { extension ModuleConfig.CannedMessageConfig.InputEventChar: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [ModuleConfig.CannedMessageConfig.InputEventChar] = [ + public static let allCases: [ModuleConfig.CannedMessageConfig.InputEventChar] = [ .none, .up, .down, @@ -1225,26 +1225,26 @@ extension ModuleConfig.CannedMessageConfig.InputEventChar: CaseIterable { /// /// A GPIO pin definition for remote hardware module -struct RemoteHardwarePin { +public struct RemoteHardwarePin { // 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. /// /// GPIO Pin number (must match Arduino) - var gpioPin: UInt32 = 0 + public var gpioPin: UInt32 = 0 /// /// Name for the GPIO pin (i.e. Front gate, mailbox, etc) - var name: String = String() + public var name: String = String() /// /// Type of GPIO access available to consumers on the mesh - var type: RemoteHardwarePinType = .unknown + public var type: RemoteHardwarePinType = .unknown - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -1277,7 +1277,7 @@ extension RemoteHardwarePin: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension RemoteHardwarePinType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNKNOWN"), 1: .same(proto: "DIGITAL_READ"), 2: .same(proto: "DIGITAL_WRITE"), @@ -1285,8 +1285,8 @@ extension RemoteHardwarePinType: SwiftProtobuf._ProtoNameProviding { } extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ModuleConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ModuleConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "mqtt"), 2: .same(proto: "serial"), 3: .standard(proto: "external_notification"), @@ -1302,7 +1302,7 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 13: .same(proto: "paxcounter"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1482,7 +1482,7 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -1545,7 +1545,7 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig, rhs: ModuleConfig) -> Bool { + public static func ==(lhs: ModuleConfig, rhs: ModuleConfig) -> Bool { if lhs.payloadVariant != rhs.payloadVariant {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true @@ -1553,8 +1553,8 @@ extension ModuleConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".MQTTConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".MQTTConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .same(proto: "address"), 3: .same(proto: "username"), @@ -1568,7 +1568,7 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message 11: .standard(proto: "map_report_settings"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1590,7 +1590,7 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -1631,7 +1631,7 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.MQTTConfig, rhs: ModuleConfig.MQTTConfig) -> Bool { + public 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} @@ -1649,13 +1649,13 @@ extension ModuleConfig.MQTTConfig: SwiftProtobuf.Message, SwiftProtobuf._Message } extension ModuleConfig.MapReportSettings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".MapReportSettings" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".MapReportSettings" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "publish_interval_secs"), 2: .standard(proto: "position_precision"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1668,7 +1668,7 @@ extension ModuleConfig.MapReportSettings: SwiftProtobuf.Message, SwiftProtobuf._ } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.publishIntervalSecs != 0 { try visitor.visitSingularUInt32Field(value: self.publishIntervalSecs, fieldNumber: 1) } @@ -1678,7 +1678,7 @@ extension ModuleConfig.MapReportSettings: SwiftProtobuf.Message, SwiftProtobuf._ try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.MapReportSettings, rhs: ModuleConfig.MapReportSettings) -> Bool { + public static func ==(lhs: ModuleConfig.MapReportSettings, rhs: ModuleConfig.MapReportSettings) -> Bool { if lhs.publishIntervalSecs != rhs.publishIntervalSecs {return false} if lhs.positionPrecision != rhs.positionPrecision {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -1687,14 +1687,14 @@ extension ModuleConfig.MapReportSettings: SwiftProtobuf.Message, SwiftProtobuf._ } extension ModuleConfig.RemoteHardwareConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".RemoteHardwareConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".RemoteHardwareConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .standard(proto: "allow_undefined_pin_access"), 3: .standard(proto: "available_pins"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1708,7 +1708,7 @@ extension ModuleConfig.RemoteHardwareConfig: SwiftProtobuf.Message, SwiftProtobu } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -1721,7 +1721,7 @@ extension ModuleConfig.RemoteHardwareConfig: SwiftProtobuf.Message, SwiftProtobu try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.RemoteHardwareConfig, rhs: ModuleConfig.RemoteHardwareConfig) -> Bool { + public static func ==(lhs: ModuleConfig.RemoteHardwareConfig, rhs: ModuleConfig.RemoteHardwareConfig) -> Bool { if lhs.enabled != rhs.enabled {return false} if lhs.allowUndefinedPinAccess != rhs.allowUndefinedPinAccess {return false} if lhs.availablePins != rhs.availablePins {return false} @@ -1731,13 +1731,13 @@ extension ModuleConfig.RemoteHardwareConfig: SwiftProtobuf.Message, SwiftProtobu } extension ModuleConfig.NeighborInfoConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".NeighborInfoConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".NeighborInfoConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .standard(proto: "update_interval"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1750,7 +1750,7 @@ extension ModuleConfig.NeighborInfoConfig: SwiftProtobuf.Message, SwiftProtobuf. } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -1760,7 +1760,7 @@ extension ModuleConfig.NeighborInfoConfig: SwiftProtobuf.Message, SwiftProtobuf. try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.NeighborInfoConfig, rhs: ModuleConfig.NeighborInfoConfig) -> Bool { + public static func ==(lhs: ModuleConfig.NeighborInfoConfig, rhs: ModuleConfig.NeighborInfoConfig) -> Bool { if lhs.enabled != rhs.enabled {return false} if lhs.updateInterval != rhs.updateInterval {return false} if lhs.unknownFields != rhs.unknownFields {return false} @@ -1769,8 +1769,8 @@ extension ModuleConfig.NeighborInfoConfig: SwiftProtobuf.Message, SwiftProtobuf. } extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".DetectionSensorConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".DetectionSensorConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .standard(proto: "minimum_broadcast_secs"), 3: .standard(proto: "state_broadcast_secs"), @@ -1781,7 +1781,7 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob 8: .standard(proto: "use_pullup"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1800,7 +1800,7 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -1828,7 +1828,7 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.DetectionSensorConfig, rhs: ModuleConfig.DetectionSensorConfig) -> Bool { + public static func ==(lhs: ModuleConfig.DetectionSensorConfig, rhs: ModuleConfig.DetectionSensorConfig) -> Bool { if lhs.enabled != rhs.enabled {return false} if lhs.minimumBroadcastSecs != rhs.minimumBroadcastSecs {return false} if lhs.stateBroadcastSecs != rhs.stateBroadcastSecs {return false} @@ -1843,8 +1843,8 @@ extension ModuleConfig.DetectionSensorConfig: SwiftProtobuf.Message, SwiftProtob } extension ModuleConfig.AudioConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".AudioConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".AudioConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "codec2_enabled"), 2: .standard(proto: "ptt_pin"), 3: .same(proto: "bitrate"), @@ -1854,7 +1854,7 @@ extension ModuleConfig.AudioConfig: SwiftProtobuf.Message, SwiftProtobuf._Messag 7: .standard(proto: "i2s_sck"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1872,7 +1872,7 @@ extension ModuleConfig.AudioConfig: SwiftProtobuf.Message, SwiftProtobuf._Messag } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.codec2Enabled != false { try visitor.visitSingularBoolField(value: self.codec2Enabled, fieldNumber: 1) } @@ -1897,7 +1897,7 @@ extension ModuleConfig.AudioConfig: SwiftProtobuf.Message, SwiftProtobuf._Messag try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.AudioConfig, rhs: ModuleConfig.AudioConfig) -> Bool { + public 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} @@ -1911,7 +1911,7 @@ extension ModuleConfig.AudioConfig: SwiftProtobuf.Message, SwiftProtobuf._Messag } extension ModuleConfig.AudioConfig.Audio_Baud: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "CODEC2_DEFAULT"), 1: .same(proto: "CODEC2_3200"), 2: .same(proto: "CODEC2_2400"), @@ -1925,15 +1925,15 @@ extension ModuleConfig.AudioConfig.Audio_Baud: SwiftProtobuf._ProtoNameProviding } extension ModuleConfig.PaxcounterConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".PaxcounterConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".PaxcounterConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .standard(proto: "paxcounter_update_interval"), 3: .standard(proto: "wifi_threshold"), 4: .standard(proto: "ble_threshold"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1948,7 +1948,7 @@ extension ModuleConfig.PaxcounterConfig: SwiftProtobuf.Message, SwiftProtobuf._M } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -1964,7 +1964,7 @@ extension ModuleConfig.PaxcounterConfig: SwiftProtobuf.Message, SwiftProtobuf._M try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.PaxcounterConfig, rhs: ModuleConfig.PaxcounterConfig) -> Bool { + public static func ==(lhs: ModuleConfig.PaxcounterConfig, rhs: ModuleConfig.PaxcounterConfig) -> Bool { if lhs.enabled != rhs.enabled {return false} if lhs.paxcounterUpdateInterval != rhs.paxcounterUpdateInterval {return false} if lhs.wifiThreshold != rhs.wifiThreshold {return false} @@ -1975,8 +1975,8 @@ extension ModuleConfig.PaxcounterConfig: SwiftProtobuf.Message, SwiftProtobuf._M } extension ModuleConfig.SerialConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".SerialConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".SerialConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .same(proto: "echo"), 3: .same(proto: "rxd"), @@ -1987,7 +1987,7 @@ extension ModuleConfig.SerialConfig: SwiftProtobuf.Message, SwiftProtobuf._Messa 8: .standard(proto: "override_console_serial_port"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2006,7 +2006,7 @@ extension ModuleConfig.SerialConfig: SwiftProtobuf.Message, SwiftProtobuf._Messa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -2034,7 +2034,7 @@ extension ModuleConfig.SerialConfig: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.SerialConfig, rhs: ModuleConfig.SerialConfig) -> Bool { + public 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} @@ -2049,7 +2049,7 @@ extension ModuleConfig.SerialConfig: SwiftProtobuf.Message, SwiftProtobuf._Messa } extension ModuleConfig.SerialConfig.Serial_Baud: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "BAUD_DEFAULT"), 1: .same(proto: "BAUD_110"), 2: .same(proto: "BAUD_300"), @@ -2070,7 +2070,7 @@ extension ModuleConfig.SerialConfig.Serial_Baud: SwiftProtobuf._ProtoNameProvidi } extension ModuleConfig.SerialConfig.Serial_Mode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "DEFAULT"), 1: .same(proto: "SIMPLE"), 2: .same(proto: "PROTO"), @@ -2081,8 +2081,8 @@ extension ModuleConfig.SerialConfig.Serial_Mode: SwiftProtobuf._ProtoNameProvidi } extension ModuleConfig.ExternalNotificationConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".ExternalNotificationConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".ExternalNotificationConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .standard(proto: "output_ms"), 3: .same(proto: "output"), @@ -2100,7 +2100,7 @@ extension ModuleConfig.ExternalNotificationConfig: SwiftProtobuf.Message, SwiftP 15: .standard(proto: "use_i2s_as_buzzer"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2126,7 +2126,7 @@ extension ModuleConfig.ExternalNotificationConfig: SwiftProtobuf.Message, SwiftP } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -2175,7 +2175,7 @@ extension ModuleConfig.ExternalNotificationConfig: SwiftProtobuf.Message, SwiftP try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.ExternalNotificationConfig, rhs: ModuleConfig.ExternalNotificationConfig) -> Bool { + public 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} @@ -2197,8 +2197,8 @@ extension ModuleConfig.ExternalNotificationConfig: SwiftProtobuf.Message, SwiftP } extension ModuleConfig.StoreForwardConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".StoreForwardConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".StoreForwardConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "enabled"), 2: .same(proto: "heartbeat"), 3: .same(proto: "records"), @@ -2206,7 +2206,7 @@ extension ModuleConfig.StoreForwardConfig: SwiftProtobuf.Message, SwiftProtobuf. 5: .standard(proto: "history_return_window"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2222,7 +2222,7 @@ extension ModuleConfig.StoreForwardConfig: SwiftProtobuf.Message, SwiftProtobuf. } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -2241,7 +2241,7 @@ extension ModuleConfig.StoreForwardConfig: SwiftProtobuf.Message, SwiftProtobuf. try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.StoreForwardConfig, rhs: ModuleConfig.StoreForwardConfig) -> Bool { + public 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} @@ -2253,14 +2253,14 @@ extension ModuleConfig.StoreForwardConfig: SwiftProtobuf.Message, SwiftProtobuf. } extension ModuleConfig.RangeTestConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".RangeTestConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".RangeTestConfig" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2274,7 +2274,7 @@ extension ModuleConfig.RangeTestConfig: SwiftProtobuf.Message, SwiftProtobuf._Me } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.enabled != false { try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 1) } @@ -2287,7 +2287,7 @@ extension ModuleConfig.RangeTestConfig: SwiftProtobuf.Message, SwiftProtobuf._Me try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.RangeTestConfig, rhs: ModuleConfig.RangeTestConfig) -> Bool { + public 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} @@ -2297,8 +2297,8 @@ extension ModuleConfig.RangeTestConfig: SwiftProtobuf.Message, SwiftProtobuf._Me } extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".TelemetryConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".TelemetryConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "device_update_interval"), 2: .standard(proto: "environment_update_interval"), 3: .standard(proto: "environment_measurement_enabled"), @@ -2311,7 +2311,7 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me 10: .standard(proto: "power_screen_enabled"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2332,7 +2332,7 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.deviceUpdateInterval != 0 { try visitor.visitSingularUInt32Field(value: self.deviceUpdateInterval, fieldNumber: 1) } @@ -2366,7 +2366,7 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.TelemetryConfig, rhs: ModuleConfig.TelemetryConfig) -> Bool { + public 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} @@ -2383,8 +2383,8 @@ extension ModuleConfig.TelemetryConfig: SwiftProtobuf.Message, SwiftProtobuf._Me } extension ModuleConfig.CannedMessageConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".CannedMessageConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".CannedMessageConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "rotary1_enabled"), 2: .standard(proto: "inputbroker_pin_a"), 3: .standard(proto: "inputbroker_pin_b"), @@ -2398,7 +2398,7 @@ extension ModuleConfig.CannedMessageConfig: SwiftProtobuf.Message, SwiftProtobuf 11: .standard(proto: "send_bell"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2420,7 +2420,7 @@ extension ModuleConfig.CannedMessageConfig: SwiftProtobuf.Message, SwiftProtobuf } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.rotary1Enabled != false { try visitor.visitSingularBoolField(value: self.rotary1Enabled, fieldNumber: 1) } @@ -2457,7 +2457,7 @@ extension ModuleConfig.CannedMessageConfig: SwiftProtobuf.Message, SwiftProtobuf try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.CannedMessageConfig, rhs: ModuleConfig.CannedMessageConfig) -> Bool { + public 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} @@ -2475,7 +2475,7 @@ extension ModuleConfig.CannedMessageConfig: SwiftProtobuf.Message, SwiftProtobuf } extension ModuleConfig.CannedMessageConfig.InputEventChar: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NONE"), 10: .same(proto: "SELECT"), 17: .same(proto: "UP"), @@ -2488,8 +2488,8 @@ extension ModuleConfig.CannedMessageConfig.InputEventChar: SwiftProtobuf._ProtoN } extension ModuleConfig.AmbientLightingConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = ModuleConfig.protoMessageName + ".AmbientLightingConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = ModuleConfig.protoMessageName + ".AmbientLightingConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "led_state"), 2: .same(proto: "current"), 3: .same(proto: "red"), @@ -2497,7 +2497,7 @@ extension ModuleConfig.AmbientLightingConfig: SwiftProtobuf.Message, SwiftProtob 5: .same(proto: "blue"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2513,7 +2513,7 @@ extension ModuleConfig.AmbientLightingConfig: SwiftProtobuf.Message, SwiftProtob } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.ledState != false { try visitor.visitSingularBoolField(value: self.ledState, fieldNumber: 1) } @@ -2532,7 +2532,7 @@ extension ModuleConfig.AmbientLightingConfig: SwiftProtobuf.Message, SwiftProtob try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ModuleConfig.AmbientLightingConfig, rhs: ModuleConfig.AmbientLightingConfig) -> Bool { + public static func ==(lhs: ModuleConfig.AmbientLightingConfig, rhs: ModuleConfig.AmbientLightingConfig) -> Bool { if lhs.ledState != rhs.ledState {return false} if lhs.current != rhs.current {return false} if lhs.red != rhs.red {return false} @@ -2544,14 +2544,14 @@ extension ModuleConfig.AmbientLightingConfig: SwiftProtobuf.Message, SwiftProtob } extension RemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".RemoteHardwarePin" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".RemoteHardwarePin" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "gpio_pin"), 2: .same(proto: "name"), 3: .same(proto: "type"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -2565,7 +2565,7 @@ extension RemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.gpioPin != 0 { try visitor.visitSingularUInt32Field(value: self.gpioPin, fieldNumber: 1) } @@ -2578,7 +2578,7 @@ extension RemoteHardwarePin: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: RemoteHardwarePin, rhs: RemoteHardwarePin) -> Bool { + public static func ==(lhs: RemoteHardwarePin, rhs: RemoteHardwarePin) -> Bool { if lhs.gpioPin != rhs.gpioPin {return false} if lhs.name != rhs.name {return false} if lhs.type != rhs.type {return false} diff --git a/Meshtastic/Protobufs/meshtastic/mqtt.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/mqtt.pb.swift similarity index 84% rename from Meshtastic/Protobufs/meshtastic/mqtt.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/mqtt.pb.swift index 43000bd1..efe6cdd5 100644 --- a/Meshtastic/Protobufs/meshtastic/mqtt.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/mqtt.pb.swift @@ -22,103 +22,103 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// This message wraps a MeshPacket with extra metadata about the sender and how it arrived. -struct ServiceEnvelope { +public 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 { + public 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} + public 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} + public mutating func clearPacket() {self._packet = nil} /// /// The global channel ID it was sent on - var channelID: String = String() + public 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() + public var gatewayID: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} fileprivate var _packet: MeshPacket? = nil } /// /// Information about a node intended to be reported unencrypted to a map using MQTT. -struct MapReport { +public struct MapReport { // 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 full name for this user, i.e. "Kevin Hester" - var longName: String = String() + public var longName: String = String() /// /// A VERY short name, ideally two characters. /// Suitable for a tiny OLED screen - var shortName: String = String() + public var shortName: String = String() /// /// Role of the node that applies specific settings for a particular use-case - var role: Config.DeviceConfig.Role = .client + public var role: Config.DeviceConfig.Role = .client /// /// Hardware model of the node, i.e. T-Beam, Heltec V3, etc... - var hwModel: HardwareModel = .unset + public var hwModel: HardwareModel = .unset /// /// Device firmware version string - var firmwareVersion: String = String() + public var firmwareVersion: String = String() /// /// The region code for the radio (US, CN, EU433, etc...) - var region: Config.LoRaConfig.RegionCode = .unset + public var region: Config.LoRaConfig.RegionCode = .unset /// /// Modem preset used by the radio (LongFast, MediumSlow, etc...) - var modemPreset: Config.LoRaConfig.ModemPreset = .longFast + public var modemPreset: Config.LoRaConfig.ModemPreset = .longFast /// /// Whether the node has a channel with default PSK and name (LongFast, MediumSlow, etc...) /// and it uses the default frequency slot given the region and modem preset. - var hasDefaultChannel_p: Bool = false + public var hasDefaultChannel_p: Bool = false /// /// Latitude: multiply by 1e-7 to get degrees in floating point - var latitudeI: Int32 = 0 + public var latitudeI: Int32 = 0 /// /// Longitude: multiply by 1e-7 to get degrees in floating point - var longitudeI: Int32 = 0 + public var longitudeI: Int32 = 0 /// /// Altitude in meters above MSL - var altitude: Int32 = 0 + public var altitude: Int32 = 0 /// /// Indicates the bits of precision for latitude and longitude set by the sending node - var positionPrecision: UInt32 = 0 + public var positionPrecision: UInt32 = 0 /// /// Number of online nodes (heard in the last 2 hours) this node has in its list that were received locally (not via MQTT) - var numOnlineLocalNodes: UInt32 = 0 + public var numOnlineLocalNodes: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -131,14 +131,14 @@ extension MapReport: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ServiceEnvelope" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".ServiceEnvelope" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -152,7 +152,7 @@ extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -169,7 +169,7 @@ extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: ServiceEnvelope, rhs: ServiceEnvelope) -> Bool { + public 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} @@ -179,8 +179,8 @@ extension ServiceEnvelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } extension MapReport: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".MapReport" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".MapReport" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "long_name"), 2: .standard(proto: "short_name"), 3: .same(proto: "role"), @@ -196,7 +196,7 @@ extension MapReport: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation 13: .standard(proto: "num_online_local_nodes"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -220,7 +220,7 @@ extension MapReport: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if !self.longName.isEmpty { try visitor.visitSingularStringField(value: self.longName, fieldNumber: 1) } @@ -263,7 +263,7 @@ extension MapReport: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: MapReport, rhs: MapReport) -> Bool { + public static func ==(lhs: MapReport, rhs: MapReport) -> Bool { if lhs.longName != rhs.longName {return false} if lhs.shortName != rhs.shortName {return false} if lhs.role != rhs.role {return false} diff --git a/Meshtastic/Protobufs/meshtastic/paxcount.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/paxcount.pb.swift similarity index 83% rename from Meshtastic/Protobufs/meshtastic/paxcount.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/paxcount.pb.swift index dea7d016..cf8aa463 100644 --- a/Meshtastic/Protobufs/meshtastic/paxcount.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/paxcount.pb.swift @@ -22,26 +22,26 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// TODO: REPLACE -struct Paxcount { +public struct Paxcount { // 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. /// /// seen Wifi devices - var wifi: UInt32 = 0 + public var wifi: UInt32 = 0 /// /// Seen BLE devices - var ble: UInt32 = 0 + public var ble: UInt32 = 0 /// /// Uptime in seconds - var uptime: UInt32 = 0 + public var uptime: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -53,14 +53,14 @@ extension Paxcount: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension Paxcount: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Paxcount" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Paxcount" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "wifi"), 2: .same(proto: "ble"), 3: .same(proto: "uptime"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -74,7 +74,7 @@ extension Paxcount: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.wifi != 0 { try visitor.visitSingularUInt32Field(value: self.wifi, fieldNumber: 1) } @@ -87,7 +87,7 @@ extension Paxcount: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationB try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Paxcount, rhs: Paxcount) -> Bool { + public static func ==(lhs: Paxcount, rhs: Paxcount) -> Bool { if lhs.wifi != rhs.wifi {return false} if lhs.ble != rhs.ble {return false} if lhs.uptime != rhs.uptime {return false} diff --git a/Meshtastic/Protobufs/meshtastic/portnums.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/portnums.pb.swift similarity index 97% rename from Meshtastic/Protobufs/meshtastic/portnums.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/portnums.pb.swift index a67e5ae6..71777a1b 100644 --- a/Meshtastic/Protobufs/meshtastic/portnums.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/portnums.pb.swift @@ -33,8 +33,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 +public enum PortNum: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Deprecated: do not use in new code (formerly called OPAQUE) @@ -201,11 +201,11 @@ enum PortNum: SwiftProtobuf.Enum { case max // = 511 case UNRECOGNIZED(Int) - init() { + public init() { self = .unknownApp } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unknownApp case 1: self = .textMessageApp @@ -238,7 +238,7 @@ enum PortNum: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unknownApp: return 0 case .textMessageApp: return 1 @@ -277,7 +277,7 @@ enum PortNum: SwiftProtobuf.Enum { extension PortNum: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [PortNum] = [ + public static let allCases: [PortNum] = [ .unknownApp, .textMessageApp, .remoteHardwareApp, @@ -317,7 +317,7 @@ extension PortNum: @unchecked Sendable {} // MARK: - Code below here is support for the SwiftProtobuf runtime. extension PortNum: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNKNOWN_APP"), 1: .same(proto: "TEXT_MESSAGE_APP"), 2: .same(proto: "REMOTE_HARDWARE_APP"), diff --git a/Meshtastic/Protobufs/meshtastic/powermon.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/powermon.pb.swift similarity index 100% rename from Meshtastic/Protobufs/meshtastic/powermon.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/powermon.pb.swift diff --git a/Meshtastic/Protobufs/meshtastic/remote_hardware.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/remote_hardware.pb.swift similarity index 86% rename from Meshtastic/Protobufs/meshtastic/remote_hardware.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/remote_hardware.pb.swift index b26a80a2..ac6eeb26 100644 --- a/Meshtastic/Protobufs/meshtastic/remote_hardware.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/remote_hardware.pb.swift @@ -30,30 +30,30 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 { +public 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 + public var type: HardwareMessage.TypeEnum = .unset /// /// What gpios are we changing. Not used for all MessageTypes, see MessageType for details - var gpioMask: UInt64 = 0 + public 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 + public var gpioValue: UInt64 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// TODO: REPLACE - enum TypeEnum: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum TypeEnum: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Unset/unused @@ -82,11 +82,11 @@ struct HardwareMessage { case readGpiosReply // = 5 case UNRECOGNIZED(Int) - init() { + public init() { self = .unset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unset case 1: self = .writeGpios @@ -98,7 +98,7 @@ struct HardwareMessage { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unset: return 0 case .writeGpios: return 1 @@ -112,14 +112,14 @@ struct HardwareMessage { } - init() {} + public init() {} } #if swift(>=4.2) extension HardwareMessage.TypeEnum: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [HardwareMessage.TypeEnum] = [ + public static let allCases: [HardwareMessage.TypeEnum] = [ .unset, .writeGpios, .watchGpios, @@ -141,14 +141,14 @@ extension HardwareMessage.TypeEnum: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension HardwareMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".HardwareMessage" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".HardwareMessage" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -162,7 +162,7 @@ extension HardwareMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.type != .unset { try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1) } @@ -175,7 +175,7 @@ extension HardwareMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: HardwareMessage, rhs: HardwareMessage) -> Bool { + public 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} @@ -185,7 +185,7 @@ extension HardwareMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } extension HardwareMessage.TypeEnum: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNSET"), 1: .same(proto: "WRITE_GPIOS"), 2: .same(proto: "WATCH_GPIOS"), diff --git a/Meshtastic/Protobufs/meshtastic/rtttl.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/rtttl.pb.swift similarity index 81% rename from Meshtastic/Protobufs/meshtastic/rtttl.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/rtttl.pb.swift index 3adac8a2..6fdf3208 100644 --- a/Meshtastic/Protobufs/meshtastic/rtttl.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/rtttl.pb.swift @@ -22,18 +22,18 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// Canned message module configuration. -struct RTTTLConfig { +public 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() + public var ringtone: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } #if swift(>=5.5) && canImport(_Concurrency) @@ -45,12 +45,12 @@ extension RTTTLConfig: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension RTTTLConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".RTTTLConfig" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".RTTTLConfig" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "ringtone"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -62,14 +62,14 @@ extension RTTTLConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati } } - func traverse(visitor: inout V) throws { + public 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 { + public 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/meshtastic/storeforward.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/storeforward.pb.swift similarity index 85% rename from Meshtastic/Protobufs/meshtastic/storeforward.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/storeforward.pb.swift index 697b4e87..54efa77b 100644 --- a/Meshtastic/Protobufs/meshtastic/storeforward.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/storeforward.pb.swift @@ -22,22 +22,22 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// TODO: REPLACE -struct StoreAndForward { +public 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 + public var rr: StoreAndForward.RequestResponse = .unset /// /// TODO: REPLACE - var variant: StoreAndForward.OneOf_Variant? = nil + public var variant: StoreAndForward.OneOf_Variant? = nil /// /// TODO: REPLACE - var stats: StoreAndForward.Statistics { + public var stats: StoreAndForward.Statistics { get { if case .stats(let v)? = variant {return v} return StoreAndForward.Statistics() @@ -47,7 +47,7 @@ struct StoreAndForward { /// /// TODO: REPLACE - var history: StoreAndForward.History { + public var history: StoreAndForward.History { get { if case .history(let v)? = variant {return v} return StoreAndForward.History() @@ -57,7 +57,7 @@ struct StoreAndForward { /// /// TODO: REPLACE - var heartbeat: StoreAndForward.Heartbeat { + public var heartbeat: StoreAndForward.Heartbeat { get { if case .heartbeat(let v)? = variant {return v} return StoreAndForward.Heartbeat() @@ -67,7 +67,7 @@ struct StoreAndForward { /// /// Text from history message. - var text: Data { + public var text: Data { get { if case .text(let v)? = variant {return v} return Data() @@ -75,11 +75,11 @@ struct StoreAndForward { set {variant = .text(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() /// /// TODO: REPLACE - enum OneOf_Variant: Equatable { + public enum OneOf_Variant: Equatable { /// /// TODO: REPLACE case stats(StoreAndForward.Statistics) @@ -94,7 +94,7 @@ struct StoreAndForward { case text(Data) #if !swift(>=4.1) - static func ==(lhs: StoreAndForward.OneOf_Variant, rhs: StoreAndForward.OneOf_Variant) -> Bool { + public 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 @@ -124,8 +124,8 @@ struct StoreAndForward { /// /// 001 - 063 = From Router /// 064 - 127 = From Client - enum RequestResponse: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum RequestResponse: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// Unset/unused @@ -194,11 +194,11 @@ struct StoreAndForward { case clientAbort // = 106 case UNRECOGNIZED(Int) - init() { + public init() { self = .unset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .unset case 1: self = .routerError @@ -220,7 +220,7 @@ struct StoreAndForward { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .unset: return 0 case .routerError: return 1 @@ -246,105 +246,105 @@ struct StoreAndForward { /// /// TODO: REPLACE - struct Statistics { + public 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 + public var messagesTotal: UInt32 = 0 /// /// Number of messages we have currently saved our history. - var messagesSaved: UInt32 = 0 + public var messagesSaved: UInt32 = 0 /// /// Maximum number of messages we will save - var messagesMax: UInt32 = 0 + public var messagesMax: UInt32 = 0 /// /// Router uptime in seconds - var upTime: UInt32 = 0 + public var upTime: UInt32 = 0 /// /// Number of times any client sent a request to the S&F. - var requests: UInt32 = 0 + public var requests: UInt32 = 0 /// /// Number of times the history was requested. - var requestsHistory: UInt32 = 0 + public var requestsHistory: UInt32 = 0 /// /// Is the heartbeat enabled on the server? - var heartbeat: Bool = false + public var heartbeat: Bool = false /// /// Maximum number of messages the server will return. - var returnMax: UInt32 = 0 + public var returnMax: UInt32 = 0 /// /// Maximum history window in minutes the server will return messages from. - var returnWindow: UInt32 = 0 + public var returnWindow: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// TODO: REPLACE - struct History { + public 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 + public var historyMessages: UInt32 = 0 /// /// The window of messages that was used to filter the history client requested - var window: UInt32 = 0 + public var window: UInt32 = 0 /// /// Index in the packet history of the last message sent in a previous request to the server. /// Will be sent to the client before sending the history and can be set in a subsequent request to avoid getting packets the server already sent to the client. - var lastRequest: UInt32 = 0 + public var lastRequest: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// TODO: REPLACE - struct Heartbeat { + public 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. /// /// Period in seconds that the heartbeat is sent out that will be sent to the client - var period: UInt32 = 0 + public var period: UInt32 = 0 /// /// If set, this is not the primary Store & Forward router on the mesh - var secondary: UInt32 = 0 + public var secondary: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } - init() {} + public init() {} } #if swift(>=4.2) extension StoreAndForward.RequestResponse: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [StoreAndForward.RequestResponse] = [ + public static let allCases: [StoreAndForward.RequestResponse] = [ .unset, .routerError, .routerHeartbeat, @@ -380,8 +380,8 @@ extension StoreAndForward.Heartbeat: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".StoreAndForward" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".StoreAndForward" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "rr"), 2: .same(proto: "stats"), 3: .same(proto: "history"), @@ -389,7 +389,7 @@ extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen 5: .same(proto: "text"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -448,7 +448,7 @@ extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -478,7 +478,7 @@ extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: StoreAndForward, rhs: StoreAndForward) -> Bool { + public 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} @@ -487,7 +487,7 @@ extension StoreAndForward: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } extension StoreAndForward.RequestResponse: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "UNSET"), 1: .same(proto: "ROUTER_ERROR"), 2: .same(proto: "ROUTER_HEARTBEAT"), @@ -508,8 +508,8 @@ extension StoreAndForward.RequestResponse: SwiftProtobuf._ProtoNameProviding { } extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = StoreAndForward.protoMessageName + ".Statistics" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = StoreAndForward.protoMessageName + ".Statistics" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "messages_total"), 2: .standard(proto: "messages_saved"), 3: .standard(proto: "messages_max"), @@ -521,7 +521,7 @@ extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._Mess 9: .standard(proto: "return_window"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -541,7 +541,7 @@ extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._Mess } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.messagesTotal != 0 { try visitor.visitSingularUInt32Field(value: self.messagesTotal, fieldNumber: 1) } @@ -572,7 +572,7 @@ extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._Mess try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: StoreAndForward.Statistics, rhs: StoreAndForward.Statistics) -> Bool { + public 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} @@ -588,14 +588,14 @@ extension StoreAndForward.Statistics: SwiftProtobuf.Message, SwiftProtobuf._Mess } extension StoreAndForward.History: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = StoreAndForward.protoMessageName + ".History" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = StoreAndForward.protoMessageName + ".History" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -609,7 +609,7 @@ extension StoreAndForward.History: SwiftProtobuf.Message, SwiftProtobuf._Message } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.historyMessages != 0 { try visitor.visitSingularUInt32Field(value: self.historyMessages, fieldNumber: 1) } @@ -622,7 +622,7 @@ extension StoreAndForward.History: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: StoreAndForward.History, rhs: StoreAndForward.History) -> Bool { + public 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} @@ -632,13 +632,13 @@ extension StoreAndForward.History: SwiftProtobuf.Message, SwiftProtobuf._Message } extension StoreAndForward.Heartbeat: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = StoreAndForward.protoMessageName + ".Heartbeat" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = StoreAndForward.protoMessageName + ".Heartbeat" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "period"), 2: .same(proto: "secondary"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -651,7 +651,7 @@ extension StoreAndForward.Heartbeat: SwiftProtobuf.Message, SwiftProtobuf._Messa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.period != 0 { try visitor.visitSingularUInt32Field(value: self.period, fieldNumber: 1) } @@ -661,7 +661,7 @@ extension StoreAndForward.Heartbeat: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: StoreAndForward.Heartbeat, rhs: StoreAndForward.Heartbeat) -> Bool { + public 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} diff --git a/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift similarity index 85% rename from Meshtastic/Protobufs/meshtastic/telemetry.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift index f6116cf9..395309b6 100644 --- a/Meshtastic/Protobufs/meshtastic/telemetry.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// Supported I2C Sensors for telemetry in Meshtastic -enum TelemetrySensorType: SwiftProtobuf.Enum { - typealias RawValue = Int +public enum TelemetrySensorType: SwiftProtobuf.Enum { + public typealias RawValue = Int /// /// No external telemetry sensor explicitly set @@ -130,11 +130,11 @@ enum TelemetrySensorType: SwiftProtobuf.Enum { case nau7802 // = 25 case UNRECOGNIZED(Int) - init() { + public init() { self = .sensorUnset } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .sensorUnset case 1: self = .bme280 @@ -166,7 +166,7 @@ enum TelemetrySensorType: SwiftProtobuf.Enum { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .sensorUnset: return 0 case .bme280: return 1 @@ -204,7 +204,7 @@ enum TelemetrySensorType: SwiftProtobuf.Enum { extension TelemetrySensorType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [TelemetrySensorType] = [ + public static let allCases: [TelemetrySensorType] = [ .sensorUnset, .bme280, .bme680, @@ -238,222 +238,222 @@ extension TelemetrySensorType: CaseIterable { /// /// Key native device metrics such as battery level -struct DeviceMetrics { +public 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. /// /// 0-100 (>100 means powered) - var batteryLevel: UInt32 = 0 + public var batteryLevel: UInt32 = 0 /// /// Voltage measured - var voltage: Float = 0 + public var voltage: Float = 0 /// /// Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). - var channelUtilization: Float = 0 + public var channelUtilization: Float = 0 /// /// Percent of airtime for transmission used within the last hour. - var airUtilTx: Float = 0 + public var airUtilTx: Float = 0 /// /// How long the device has been running since the last reboot (in seconds) - var uptimeSeconds: UInt32 = 0 + public var uptimeSeconds: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Weather station or other environmental metrics -struct EnvironmentMetrics { +public 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 + public var temperature: Float = 0 /// /// Relative humidity percent measured - var relativeHumidity: Float = 0 + public var relativeHumidity: Float = 0 /// /// Barometric pressure in hPA measured - var barometricPressure: Float = 0 + public var barometricPressure: Float = 0 /// /// Gas resistance in MOhm measured - var gasResistance: Float = 0 + public var gasResistance: Float = 0 /// /// Voltage measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) - var voltage: Float = 0 + public var voltage: Float = 0 /// /// Current measured (To be depreciated in favor of PowerMetrics in Meshtastic 3.x) - var current: Float = 0 + public var current: Float = 0 /// /// relative scale IAQ value as measured by Bosch BME680 . value 0-500. /// Belongs to Air Quality but is not particle but VOC measurement. Other VOC values can also be put in here. - var iaq: UInt32 = 0 + public var iaq: UInt32 = 0 /// /// RCWL9620 Doppler Radar Distance Sensor, used for water level detection. Float value in mm. - var distance: Float = 0 + public var distance: Float = 0 /// /// VEML7700 high accuracy ambient light(Lux) digital 16-bit resolution sensor. - var lux: Float = 0 + public var lux: Float = 0 /// /// VEML7700 high accuracy white light(irradiance) not calibrated digital 16-bit resolution sensor. - var whiteLux: Float = 0 + public var whiteLux: Float = 0 /// /// Infrared lux - var irLux: Float = 0 + public var irLux: Float = 0 /// /// Ultraviolet lux - var uvLux: Float = 0 + public var uvLux: Float = 0 /// /// Wind direction in degrees /// 0 degrees = North, 90 = East, etc... - var windDirection: UInt32 = 0 + public var windDirection: UInt32 = 0 /// /// Wind speed in m/s - var windSpeed: Float = 0 + public var windSpeed: Float = 0 /// /// Weight in KG - var weight: Float = 0 + public var weight: Float = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Power Metrics (voltage / current / etc) -struct PowerMetrics { +public struct PowerMetrics { // 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. /// /// Voltage (Ch1) - var ch1Voltage: Float = 0 + public var ch1Voltage: Float = 0 /// /// Current (Ch1) - var ch1Current: Float = 0 + public var ch1Current: Float = 0 /// /// Voltage (Ch2) - var ch2Voltage: Float = 0 + public var ch2Voltage: Float = 0 /// /// Current (Ch2) - var ch2Current: Float = 0 + public var ch2Current: Float = 0 /// /// Voltage (Ch3) - var ch3Voltage: Float = 0 + public var ch3Voltage: Float = 0 /// /// Current (Ch3) - var ch3Current: Float = 0 + public var ch3Current: Float = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Air quality metrics -struct AirQualityMetrics { +public struct AirQualityMetrics { // 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. /// /// Concentration Units Standard PM1.0 - var pm10Standard: UInt32 = 0 + public var pm10Standard: UInt32 = 0 /// /// Concentration Units Standard PM2.5 - var pm25Standard: UInt32 = 0 + public var pm25Standard: UInt32 = 0 /// /// Concentration Units Standard PM10.0 - var pm100Standard: UInt32 = 0 + public var pm100Standard: UInt32 = 0 /// /// Concentration Units Environmental PM1.0 - var pm10Environmental: UInt32 = 0 + public var pm10Environmental: UInt32 = 0 /// /// Concentration Units Environmental PM2.5 - var pm25Environmental: UInt32 = 0 + public var pm25Environmental: UInt32 = 0 /// /// Concentration Units Environmental PM10.0 - var pm100Environmental: UInt32 = 0 + public var pm100Environmental: UInt32 = 0 /// /// 0.3um Particle Count - var particles03Um: UInt32 = 0 + public var particles03Um: UInt32 = 0 /// /// 0.5um Particle Count - var particles05Um: UInt32 = 0 + public var particles05Um: UInt32 = 0 /// /// 1.0um Particle Count - var particles10Um: UInt32 = 0 + public var particles10Um: UInt32 = 0 /// /// 2.5um Particle Count - var particles25Um: UInt32 = 0 + public var particles25Um: UInt32 = 0 /// /// 5.0um Particle Count - var particles50Um: UInt32 = 0 + public var particles50Um: UInt32 = 0 /// /// 10.0um Particle Count - var particles100Um: UInt32 = 0 + public var particles100Um: UInt32 = 0 - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - init() {} + public init() {} } /// /// Types of Measurements the telemetry module is equipped to handle -struct Telemetry { +public 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. /// /// Seconds since 1970 - or 0 for unknown/unset - var time: UInt32 = 0 + public var time: UInt32 = 0 - var variant: Telemetry.OneOf_Variant? = nil + public var variant: Telemetry.OneOf_Variant? = nil /// /// Key native device metrics such as battery level - var deviceMetrics: DeviceMetrics { + public var deviceMetrics: DeviceMetrics { get { if case .deviceMetrics(let v)? = variant {return v} return DeviceMetrics() @@ -463,7 +463,7 @@ struct Telemetry { /// /// Weather station or other environmental metrics - var environmentMetrics: EnvironmentMetrics { + public var environmentMetrics: EnvironmentMetrics { get { if case .environmentMetrics(let v)? = variant {return v} return EnvironmentMetrics() @@ -473,7 +473,7 @@ struct Telemetry { /// /// Air quality metrics - var airQualityMetrics: AirQualityMetrics { + public var airQualityMetrics: AirQualityMetrics { get { if case .airQualityMetrics(let v)? = variant {return v} return AirQualityMetrics() @@ -483,7 +483,7 @@ struct Telemetry { /// /// Power Metrics - var powerMetrics: PowerMetrics { + public var powerMetrics: PowerMetrics { get { if case .powerMetrics(let v)? = variant {return v} return PowerMetrics() @@ -491,9 +491,9 @@ struct Telemetry { set {variant = .powerMetrics(newValue)} } - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum OneOf_Variant: Equatable { + public enum OneOf_Variant: Equatable { /// /// Key native device metrics such as battery level case deviceMetrics(DeviceMetrics) @@ -508,7 +508,7 @@ struct Telemetry { case powerMetrics(PowerMetrics) #if !swift(>=4.1) - static func ==(lhs: Telemetry.OneOf_Variant, rhs: Telemetry.OneOf_Variant) -> Bool { + public 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 @@ -535,7 +535,27 @@ struct Telemetry { #endif } - init() {} + public init() {} +} + +/// +/// NAU7802 Telemetry configuration, for saving to flash +public struct Nau7802Config { + // 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 offset setting for the NAU7802 + public var zeroOffset: Int32 = 0 + + /// + /// The calibration factor for the NAU7802 + public var calibrationFactor: Float = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} } /// @@ -574,7 +594,7 @@ extension Nau7802Config: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension TelemetrySensorType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "SENSOR_UNSET"), 1: .same(proto: "BME280"), 2: .same(proto: "BME680"), @@ -605,8 +625,8 @@ extension TelemetrySensorType: SwiftProtobuf._ProtoNameProviding { } extension DeviceMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".DeviceMetrics" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".DeviceMetrics" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "battery_level"), 2: .same(proto: "voltage"), 3: .standard(proto: "channel_utilization"), @@ -614,7 +634,7 @@ extension DeviceMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa 5: .standard(proto: "uptime_seconds"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -630,7 +650,7 @@ extension DeviceMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.batteryLevel != 0 { try visitor.visitSingularUInt32Field(value: self.batteryLevel, fieldNumber: 1) } @@ -649,7 +669,7 @@ extension DeviceMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: DeviceMetrics, rhs: DeviceMetrics) -> Bool { + public 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} @@ -661,8 +681,8 @@ extension DeviceMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".EnvironmentMetrics" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".EnvironmentMetrics" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "temperature"), 2: .standard(proto: "relative_humidity"), 3: .standard(proto: "barometric_pressure"), @@ -680,7 +700,7 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 15: .same(proto: "weight"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -706,7 +726,7 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.temperature != 0 { try visitor.visitSingularFloatField(value: self.temperature, fieldNumber: 1) } @@ -755,7 +775,7 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: EnvironmentMetrics, rhs: EnvironmentMetrics) -> Bool { + public 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} @@ -777,8 +797,8 @@ extension EnvironmentMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImple } extension PowerMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".PowerMetrics" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".PowerMetrics" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "ch1_voltage"), 2: .standard(proto: "ch1_current"), 3: .standard(proto: "ch2_voltage"), @@ -787,7 +807,7 @@ extension PowerMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 6: .standard(proto: "ch3_current"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -804,7 +824,7 @@ extension PowerMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.ch1Voltage != 0 { try visitor.visitSingularFloatField(value: self.ch1Voltage, fieldNumber: 1) } @@ -826,7 +846,7 @@ extension PowerMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: PowerMetrics, rhs: PowerMetrics) -> Bool { + public static func ==(lhs: PowerMetrics, rhs: PowerMetrics) -> Bool { if lhs.ch1Voltage != rhs.ch1Voltage {return false} if lhs.ch1Current != rhs.ch1Current {return false} if lhs.ch2Voltage != rhs.ch2Voltage {return false} @@ -839,8 +859,8 @@ extension PowerMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat } extension AirQualityMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".AirQualityMetrics" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".AirQualityMetrics" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "pm10_standard"), 2: .standard(proto: "pm25_standard"), 3: .standard(proto: "pm100_standard"), @@ -855,7 +875,7 @@ extension AirQualityMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem 12: .standard(proto: "particles_100um"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -878,7 +898,7 @@ extension AirQualityMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.pm10Standard != 0 { try visitor.visitSingularUInt32Field(value: self.pm10Standard, fieldNumber: 1) } @@ -918,7 +938,7 @@ extension AirQualityMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: AirQualityMetrics, rhs: AirQualityMetrics) -> Bool { + public static func ==(lhs: AirQualityMetrics, rhs: AirQualityMetrics) -> Bool { if lhs.pm10Standard != rhs.pm10Standard {return false} if lhs.pm25Standard != rhs.pm25Standard {return false} if lhs.pm100Standard != rhs.pm100Standard {return false} @@ -937,8 +957,8 @@ extension AirQualityMetrics: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem } extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Telemetry" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Telemetry" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "time"), 2: .standard(proto: "device_metrics"), 3: .standard(proto: "environment_metrics"), @@ -946,7 +966,7 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation 5: .standard(proto: "power_metrics"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1010,7 +1030,7 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and @@ -1040,7 +1060,7 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Telemetry, rhs: Telemetry) -> Bool { + public 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} @@ -1049,13 +1069,13 @@ extension Telemetry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } extension Nau7802Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Nau7802Config" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".Nau7802Config" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "zeroOffset"), 2: .same(proto: "calibrationFactor"), ] - mutating func decodeMessage(decoder: inout D) throws { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -1068,7 +1088,7 @@ extension Nau7802Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.zeroOffset != 0 { try visitor.visitSingularInt32Field(value: self.zeroOffset, fieldNumber: 1) } @@ -1078,7 +1098,7 @@ extension Nau7802Config: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Nau7802Config, rhs: Nau7802Config) -> Bool { + public static func ==(lhs: Nau7802Config, rhs: Nau7802Config) -> Bool { if lhs.zeroOffset != rhs.zeroOffset {return false} if lhs.calibrationFactor != rhs.calibrationFactor {return false} if lhs.unknownFields != rhs.unknownFields {return false} diff --git a/Meshtastic/Protobufs/meshtastic/xmodem.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/xmodem.pb.swift similarity index 83% rename from Meshtastic/Protobufs/meshtastic/xmodem.pb.swift rename to MeshtasticProtobufs/Sources/meshtastic/xmodem.pb.swift index 4df972b8..1f41fe0b 100644 --- a/Meshtastic/Protobufs/meshtastic/xmodem.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/xmodem.pb.swift @@ -20,23 +20,23 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct XModem { +public 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 + public var control: XModem.Control = .nul - var seq: UInt32 = 0 + public var seq: UInt32 = 0 - var crc16: UInt32 = 0 + public var crc16: UInt32 = 0 - var buffer: Data = Data() + public var buffer: Data = Data() - var unknownFields = SwiftProtobuf.UnknownStorage() + public var unknownFields = SwiftProtobuf.UnknownStorage() - enum Control: SwiftProtobuf.Enum { - typealias RawValue = Int + public enum Control: SwiftProtobuf.Enum { + public typealias RawValue = Int case nul // = 0 case soh // = 1 case stx // = 2 @@ -47,11 +47,11 @@ struct XModem { case ctrlz // = 26 case UNRECOGNIZED(Int) - init() { + public init() { self = .nul } - init?(rawValue: Int) { + public init?(rawValue: Int) { switch rawValue { case 0: self = .nul case 1: self = .soh @@ -65,7 +65,7 @@ struct XModem { } } - var rawValue: Int { + public var rawValue: Int { switch self { case .nul: return 0 case .soh: return 1 @@ -81,14 +81,14 @@ struct XModem { } - init() {} + public init() {} } #if swift(>=4.2) extension XModem.Control: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [XModem.Control] = [ + public static let allCases: [XModem.Control] = [ .nul, .soh, .stx, @@ -112,15 +112,15 @@ extension XModem.Control: @unchecked Sendable {} fileprivate let _protobuf_package = "meshtastic" extension XModem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".XModem" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let protoMessageName: String = _protobuf_package + ".XModem" + public 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 { + public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are @@ -135,7 +135,7 @@ extension XModem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas } } - func traverse(visitor: inout V) throws { + public func traverse(visitor: inout V) throws { if self.control != .nul { try visitor.visitSingularEnumField(value: self.control, fieldNumber: 1) } @@ -151,7 +151,7 @@ extension XModem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: XModem, rhs: XModem) -> Bool { + public 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} @@ -162,7 +162,7 @@ extension XModem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBas } extension XModem.Control: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NUL"), 1: .same(proto: "SOH"), 2: .same(proto: "STX"), diff --git a/MeshtasticTests/Info.plist b/MeshtasticTests/Info.plist deleted file mode 100644 index 64d65ca4..00000000 --- a/MeshtasticTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/MeshtasticTests/MeshtasticTests.swift b/MeshtasticTests/MeshtasticTests.swift deleted file mode 100644 index bc75d0da..00000000 --- a/MeshtasticTests/MeshtasticTests.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// MeshtasticAppleTests.swift -// MeshtasticAppleTests -// -// Created by Garth Vander Houwen on 8/18/21. -// - -import XCTest - -@testable import Meshtastic - -class MeshtasticTests: XCTestCase { - - override func setUpWithError() throws { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() throws { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/MeshtasticUITests/Info.plist b/MeshtasticUITests/Info.plist deleted file mode 100644 index 64d65ca4..00000000 --- a/MeshtasticUITests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/MeshtasticUITests/MeshtasticUITests.swift b/MeshtasticUITests/MeshtasticUITests.swift deleted file mode 100644 index ae140de9..00000000 --- a/MeshtasticUITests/MeshtasticUITests.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// MeshtasticUITests.swift -// MeshtasticUITests -// -// Copyright(c) Garth Vander Houwen 8/18/21. -// - -import XCTest - -class MeshtasticUITests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - - // In UI tests it is usually best to stop immediately when a failure occurs. - continueAfterFailure = false - - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // UI tests must launch the application that they test. - let app = XCUIApplication() - app.launch() - - // Use recording to get started writing UI tests. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testLaunchPerformance() throws { - if #available(macOS 13, iOS 16.0, watchOS 8.0, *) { - // This measures how long it takes to launch your application. - measure(metrics: [XCTApplicationLaunchMetric()]) { - XCUIApplication().launch() - } - } - } -} diff --git a/README.md b/README.md index 9b888e90..0db0708e 100644 --- a/README.md +++ b/README.md @@ -8,35 +8,41 @@ SwiftUI client applications for iOS, iPadOS and macOS. -## OS Requirements +## Getting Started -* iOS App Requires iOS 16 + -* iPadOS App Requires iPadOS 16 + -* Mac App Reguires macOS 13 + +This project is currently using **Xcode 15.4**. -## Code Standards +1. Clone the repo. +2. Open `Meshtastic.xcworkspace` +2. Build and run the `Meshtastic` target. -- Use SwiftUI (Maps are the exception) -- Use Hierarchical icons +```sh +git clone git@github.com:meshtastic/Meshtastic-Apple.git +cd Meshtastic-Apple +open Meshtastic.xcworkspace +``` + +## Technical Standards + +### Supported Operating Systems + +* iOS 16+ +* iPadOS 16+ +* macOS 13+ + +### Code Standards + +- Use SwiftUI +- Use SFSymbols for icons - Use Core Data for persistence -- Requires SwiftLint - see https://github.com/realm/SwiftLint -## To update protobufs: - -- install swift-protobuf: - ```bash - brew install swift-protobuf - ``` -- check out the latest protobuf commit from the master branch - ```bash - git submodule update --init - ``` +## Updating Protobufs: - run: ```bash - ./gen_protos.sh + scripts/gen_protos.sh ``` - build, test, commit changes -- You may need to run: - ```bash - swiftlint --fix - ``` + +## License + +This project is licensed under the GPL v3. See the [LICENSE](LICENSE) file for details. diff --git a/gen_protos.sh b/scripts/gen_protos.sh similarity index 76% rename from gen_protos.sh rename to scripts/gen_protos.sh index b829095f..4c7cb290 100755 --- a/gen_protos.sh +++ b/scripts/gen_protos.sh @@ -12,7 +12,7 @@ if [ ! -x "$(which protoc)" ]; then exit fi -protoc --proto_path=./protobufs --swift_out=./Meshtastic/Protobufs ./protobufs/meshtastic/*.proto +protoc --proto_path=./protobufs --swift_opt=Visibility=Public --swift_out=./MeshtasticProtobufs/Sources ./protobufs/meshtastic/*.proto echo "Done generating the swift files from the proto files." echo "Build, test, and commit changes." diff --git a/thebenternify.sh b/scripts/thebenternify.sh similarity index 100% rename from thebenternify.sh rename to scripts/thebenternify.sh diff --git a/unthebenternify.sh b/scripts/unthebenternify.sh similarity index 100% rename from unthebenternify.sh rename to scripts/unthebenternify.sh From b9061b9fd1c0521c5623a468dfa5a01a402bd9a1 Mon Sep 17 00:00:00 2001 From: Blake McAnally Date: Fri, 28 Jun 2024 11:12:22 -0500 Subject: [PATCH 29/29] bump protos --- .../Sources/meshtastic/config.pb.swift | 6 ------ .../Sources/meshtastic/telemetry.pb.swift | 20 ------------------- protobufs | 2 +- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift index e7571efd..7735f554 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/config.pb.swift @@ -2079,7 +2079,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 7: .standard(proto: "ls_secs"), 8: .standard(proto: "min_wake_secs"), 9: .standard(proto: "device_battery_ina_address"), - 32: .standard(proto: "powermon_enables"), ] public mutating func decodeMessage(decoder: inout D) throws { @@ -2096,7 +2095,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple case 7: try { try decoder.decodeSingularUInt32Field(value: &self.lsSecs) }() case 8: try { try decoder.decodeSingularUInt32Field(value: &self.minWakeSecs) }() case 9: try { try decoder.decodeSingularUInt32Field(value: &self.deviceBatteryInaAddress) }() - case 32: try { try decoder.decodeSingularUInt64Field(value: &self.powermonEnables) }() default: break } } @@ -2127,9 +2125,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if self.deviceBatteryInaAddress != 0 { try visitor.visitSingularUInt32Field(value: self.deviceBatteryInaAddress, fieldNumber: 9) } - if self.powermonEnables != 0 { - try visitor.visitSingularUInt64Field(value: self.powermonEnables, fieldNumber: 32) - } try unknownFields.traverse(visitor: &visitor) } @@ -2142,7 +2137,6 @@ extension Config.PowerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImple if lhs.lsSecs != rhs.lsSecs {return false} if lhs.minWakeSecs != rhs.minWakeSecs {return false} if lhs.deviceBatteryInaAddress != rhs.deviceBatteryInaAddress {return false} - if lhs.powermonEnables != rhs.powermonEnables {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift b/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift index 395309b6..c0c17cf4 100644 --- a/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift +++ b/MeshtasticProtobufs/Sources/meshtastic/telemetry.pb.swift @@ -558,26 +558,6 @@ public struct Nau7802Config { public init() {} } -/// -/// NAU7802 Telemetry configuration, for saving to flash -struct Nau7802Config { - // 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 offset setting for the NAU7802 - var zeroOffset: Int32 = 0 - - /// - /// The calibration factor for the NAU7802 - var calibrationFactor: Float = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - #if swift(>=5.5) && canImport(_Concurrency) extension TelemetrySensorType: @unchecked Sendable {} extension DeviceMetrics: @unchecked Sendable {} diff --git a/protobufs b/protobufs index 4da558d0..1c3029f2 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 4da558d0f73c46ef91b74431facee73c09affbfc +Subproject commit 1c3029f2868e5fc49809fd378f6c0c66aee0eaf4