From 068e73f646f6849bd0507c003ce0c06588ce21d4 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 17 Jun 2022 07:46:02 -0700 Subject: [PATCH] Update core data model and protobufs --- Meshtastic Apple.xcodeproj/project.pbxproj | 4 +- MeshtasticApple/Helpers/BLEManager.swift | 10 +- .../Meshtastic.xcdatamodeld/.xccurrentversion | 2 +- .../contents | 6 - .../contents | 111 ++++++++++++++++++ MeshtasticApple/Protobufs/mesh.pb.swift | 12 +- MeshtasticApple/Views/Settings/Settings.swift | 2 + 7 files changed, 130 insertions(+), 17 deletions(-) create mode 100644 MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 4.xcdatamodel/contents diff --git a/Meshtastic Apple.xcodeproj/project.pbxproj b/Meshtastic Apple.xcodeproj/project.pbxproj index 2d2a36f9..5a0f433e 100644 --- a/Meshtastic Apple.xcodeproj/project.pbxproj +++ b/Meshtastic Apple.xcodeproj/project.pbxproj @@ -117,6 +117,7 @@ DD4DED8F27AD2975004BA27E /* cannedmessages.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = cannedmessages.pb.swift; sourceTree = ""; }; DD5394FD276BA0EF00AD86B1 /* PositionEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionEntityExtension.swift; sourceTree = ""; }; DD539501276DAA6A00AD86B1 /* MapLocation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapLocation.swift; sourceTree = ""; }; + DD619373285CC7D600E59241 /* MeshtasticDataModel v 4.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "MeshtasticDataModel v 4.xcdatamodel"; sourceTree = ""; }; DD6B85A728009258000ACD6B /* ShareChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareChannel.swift; sourceTree = ""; }; DD8169F8271F1A6100F4AB02 /* MeshLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshLogger.swift; sourceTree = ""; }; DD8169FA271F1F3A00F4AB02 /* MeshLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshLog.swift; sourceTree = ""; }; @@ -1013,11 +1014,12 @@ DD9D8F2D2764403B00080993 /* Meshtastic.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + DD619373285CC7D600E59241 /* MeshtasticDataModel v 4.xcdatamodel */, DDB2CC6F27F3F0AC009C5FCC /* MeshtasticDataModel v 3.xcdatamodel */, DD45C77427BD4EF80011784F /* MeshtasticDataModel v2.xcdatamodel */, DD9D8F2E2764403B00080993 /* CoreDataSample.xcdatamodel */, ); - currentVersion = DDB2CC6F27F3F0AC009C5FCC /* MeshtasticDataModel v 3.xcdatamodel */; + currentVersion = DD619373285CC7D600E59241 /* MeshtasticDataModel v 4.xcdatamodel */; name = Meshtastic.xcdatamodeld; path = MeshtasticApple/Meshtastic.xcdatamodeld; sourceTree = ""; diff --git a/MeshtasticApple/Helpers/BLEManager.swift b/MeshtasticApple/Helpers/BLEManager.swift index 1d897de1..46dbca57 100644 --- a/MeshtasticApple/Helpers/BLEManager.swift +++ b/MeshtasticApple/Helpers/BLEManager.swift @@ -429,13 +429,17 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } } - } else if decodedInfo.config.version == 13 { + } else if decodedInfo.config.isInitialized { - localConfig(config: decodedInfo.config, meshlogging: meshLoggingEnabled, context: context!, nodeLongName: self.connectedPeripheral.longName) + //localConfig(config: decodedInfo.config, meshlogging: meshLoggingEnabled, context: context!, nodeLongName: self.connectedPeripheral.longName) + if meshLoggingEnabled { MeshLogger.log("ℹ️ MESH PACKET received for Unknown App UNHANDLED \(try! decodedInfo.config.jsonString())") } } else { - if meshLoggingEnabled { MeshLogger.log("ℹ️ MESH PACKET received for Unknown App UNHANDLED \(try! decodedInfo.packet.jsonString())") } + if decodedInfo.configCompleteID == 0 { + + if meshLoggingEnabled { MeshLogger.log("ℹ️ MESH PACKET received for Unknown App UNHANDLED \(try! decodedInfo.packet.jsonString())") } + } } case .textMessageApp: textMessageAppPacket(packet: decodedInfo.packet, connectedNode: (self.connectedPeripheral != nil ? connectedPeripheral.num : 0), meshLogging: meshLoggingEnabled, context: context!) diff --git a/MeshtasticApple/Meshtastic.xcdatamodeld/.xccurrentversion b/MeshtasticApple/Meshtastic.xcdatamodeld/.xccurrentversion index 0ef73013..5d3a865e 100644 --- a/MeshtasticApple/Meshtastic.xcdatamodeld/.xccurrentversion +++ b/MeshtasticApple/Meshtastic.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - MeshtasticDataModel v 3.xcdatamodel + MeshtasticDataModel v 4.xcdatamodel diff --git a/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents b/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents index 7d5d50e1..2be97c35 100644 --- a/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents +++ b/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 3.xcdatamodel/contents @@ -1,10 +1,5 @@ - - - - - @@ -104,6 +99,5 @@ - \ No newline at end of file diff --git a/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 4.xcdatamodel/contents b/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 4.xcdatamodel/contents new file mode 100644 index 00000000..71115514 --- /dev/null +++ b/MeshtasticApple/Meshtastic.xcdatamodeld/MeshtasticDataModel v 4.xcdatamodel/contents @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MeshtasticApple/Protobufs/mesh.pb.swift b/MeshtasticApple/Protobufs/mesh.pb.swift index 0d2fc06a..b1f4484d 100644 --- a/MeshtasticApple/Protobufs/mesh.pb.swift +++ b/MeshtasticApple/Protobufs/mesh.pb.swift @@ -1810,11 +1810,11 @@ struct FromRadio { } /// - /// Include the entire config (was: RadioConfig radio) - var config: LocalConfig { + /// Include a part of the config (was: RadioConfig radio) + var config: Config { get { if case .config(let v)? = _storage._payloadVariant {return v} - return LocalConfig() + return Config() } set {_uniqueStorage()._payloadVariant = .config(newValue)} } @@ -1872,8 +1872,8 @@ struct FromRadio { /// starts over with the first node in our DB case nodeInfo(NodeInfo) /// - /// Include the entire config (was: RadioConfig radio) - case config(LocalConfig) + /// Include a part of the config (was: RadioConfig radio) + case config(Config) /// /// Set to send debug console output over our protobuf stream case logRecord(LogRecord) @@ -3356,7 +3356,7 @@ extension FromRadio: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation } }() case 6: try { - var v: LocalConfig? + var v: Config? var hadOneofValue = false if let current = _storage._payloadVariant { hadOneofValue = true diff --git a/MeshtasticApple/Views/Settings/Settings.swift b/MeshtasticApple/Views/Settings/Settings.swift index 4e8db7ea..a436150f 100644 --- a/MeshtasticApple/Views/Settings/Settings.swift +++ b/MeshtasticApple/Views/Settings/Settings.swift @@ -13,6 +13,8 @@ struct Settings: View { @EnvironmentObject var bleManager: BLEManager @EnvironmentObject var userSettings: UserSettings +// var connectednode: NodeInfoEntity + var body: some View { NavigationView { List {