From a27e8b29fa4afcc0d3cb9053dba25627557c04cc Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 12 Sep 2021 17:51:10 -0700 Subject: [PATCH] Update Models --- Meshtastic Client.xcodeproj/project.pbxproj | 17 +++++++++++++ MeshtasticClient/Helpers/BLEManager.swift | 6 +++-- .../MeshtasticClient.xcdatamodel/contents | 9 ------- .../.xccurrentversion | 5 +++- .../MeshtasticClient.xcdatamodel/contents | 24 +++++++++++++++++++ 5 files changed, 49 insertions(+), 12 deletions(-) delete mode 100644 MeshtasticClient/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents rename MeshtasticClient/{ => Model}/MeshtasticClient.xcdatamodeld/.xccurrentversion (64%) create mode 100644 MeshtasticClient/Model/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index 3b649743..8870ecb8 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + DD8E565A26EE85E3002CD952 /* MeshtasticClient.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DD8E565826EE85E3002CD952 /* MeshtasticClient.xcdatamodeld */; }; DDAF8C5326EB1DF10058C060 /* BLEManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C5226EB1DF10058C060 /* BLEManager.swift */; }; DDAF8C5826ED07FD0058C060 /* mesh.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF8C5726ED07FD0058C060 /* mesh.pb.swift */; }; DDAF8C5B26ED08D30058C060 /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = DDAF8C5A26ED08D30058C060 /* SwiftProtobuf */; }; @@ -58,6 +59,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + DD8E565926EE85E3002CD952 /* MeshtasticClient.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MeshtasticClient.xcdatamodel; sourceTree = ""; }; DDAF8C5226EB1DF10058C060 /* BLEManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLEManager.swift; sourceTree = ""; }; DDAF8C5726ED07FD0058C060 /* mesh.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mesh.pb.swift; sourceTree = ""; }; DDAF8C5C26ED09490058C060 /* portnums.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = portnums.pb.swift; sourceTree = ""; }; @@ -215,6 +217,7 @@ DDC2E18826CE24EE0042C5E4 /* Model */ = { isa = PBXGroup; children = ( + DD8E565826EE85E3002CD952 /* MeshtasticClient.xcdatamodeld */, DDC2E19C26CE27580042C5E4 /* ModelData.swift */, DDC2E19E26CE27630042C5E4 /* Device.swift */, DDAF8C6F26ED1DD20058C060 /* Device2.swift */, @@ -424,6 +427,7 @@ DDAF8C5D26ED09490058C060 /* portnums.pb.swift in Sources */, DDC2E18F26CE25FE0042C5E4 /* ContentView.swift in Sources */, DDAF8C6326ED0A230058C060 /* admin.pb.swift in Sources */, + DD8E565A26EE85E3002CD952 /* MeshtasticClient.xcdatamodeld in Sources */, DDAF8C5826ED07FD0058C060 /* mesh.pb.swift in Sources */, DDC2E19326CE266B0042C5E4 /* DeviceHome.swift in Sources */, DDC2E19B26CE27150042C5E4 /* CircleImage.swift in Sources */, @@ -769,6 +773,19 @@ productName = SwiftProtobuf; }; /* End XCSwiftPackageProductDependency section */ + +/* Begin XCVersionGroup section */ + DD8E565826EE85E3002CD952 /* MeshtasticClient.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + DD8E565926EE85E3002CD952 /* MeshtasticClient.xcdatamodel */, + ); + currentVersion = DD8E565926EE85E3002CD952 /* MeshtasticClient.xcdatamodel */; + path = MeshtasticClient.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ }; rootObject = DDC2E14C26CE248E0042C5E4 /* Project object */; } diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index a6931d7a..476711d2 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -1,4 +1,5 @@ import Foundation +import CoreData import CoreBluetooth struct Peripheral: Identifiable { @@ -222,7 +223,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph var decodedInfo = FromRadio() decodedInfo = try! FromRadio(serializedData: characteristic.value!) - //print(decodedInfo.myInfo.myNodeNum) + //print(decodedInfo) if decodedInfo.myInfo.myNodeNum != 0 { @@ -238,13 +239,14 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph { print("Save a nodeInfo") do { + let node = print(try decodedInfo.nodeInfo.jsonString()) } catch { fatalError("Failed to decode json") } } - if decodedInfo.packet.from != 0 + if decodedInfo.packet.id != 0 { print("Save a packet") do { diff --git a/MeshtasticClient/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents b/MeshtasticClient/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents deleted file mode 100644 index e8d6ec87..00000000 --- a/MeshtasticClient/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/MeshtasticClient/MeshtasticClient.xcdatamodeld/.xccurrentversion b/MeshtasticClient/Model/MeshtasticClient.xcdatamodeld/.xccurrentversion similarity index 64% rename from MeshtasticClient/MeshtasticClient.xcdatamodeld/.xccurrentversion rename to MeshtasticClient/Model/MeshtasticClient.xcdatamodeld/.xccurrentversion index 0c67376e..0e918e50 100644 --- a/MeshtasticClient/MeshtasticClient.xcdatamodeld/.xccurrentversion +++ b/MeshtasticClient/Model/MeshtasticClient.xcdatamodeld/.xccurrentversion @@ -1,5 +1,8 @@ - + + _XCCurrentVersionName + MeshtasticClient.xcdatamodel + diff --git a/MeshtasticClient/Model/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents b/MeshtasticClient/Model/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents new file mode 100644 index 00000000..95f22585 --- /dev/null +++ b/MeshtasticClient/Model/MeshtasticClient.xcdatamodeld/MeshtasticClient.xcdatamodel/contents @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file