From 756444c53c4a7a7a38f1afc359efe70b9bc417d0 Mon Sep 17 00:00:00 2001
From: Chris Cassano <1285652+glitch003@users.noreply.github.com>
Date: Sun, 31 Jul 2022 19:05:47 -0400
Subject: [PATCH 1/9] trying to debug why we aren't getting channel settings
back. only routing packets
---
Meshtastic.xcodeproj/project.pbxproj | 8 +-
.../xcschemes/Meshtastic.xcscheme | 98 +++++++++++++++++++
Meshtastic/Helpers/BLEManager.swift | 53 +++++++++-
Meshtastic/Helpers/MeshPackets.swift | 1 +
Meshtastic/Views/Settings/ShareChannel.swift | 7 ++
5 files changed, 162 insertions(+), 5 deletions(-)
create mode 100644 Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj
index be06040b..252463b9 100644
--- a/Meshtastic.xcodeproj/project.pbxproj
+++ b/Meshtastic.xcodeproj/project.pbxproj
@@ -866,7 +866,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Meshtastic/Preview Content\"";
- DEVELOPMENT_TEAM = GCH7VS5Y9R;
+ DEVELOPMENT_TEAM = QWER3PMRVZ;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Meshtastic/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Meshtastic;
@@ -876,7 +876,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.27;
- PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
+ PRODUCT_BUNDLE_IDENTIFIER = cvc.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
@@ -898,7 +898,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Meshtastic/Preview Content\"";
- DEVELOPMENT_TEAM = GCH7VS5Y9R;
+ DEVELOPMENT_TEAM = QWER3PMRVZ;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Meshtastic/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Meshtastic;
@@ -908,7 +908,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.27;
- PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
+ PRODUCT_BUNDLE_IDENTIFIER = cvc.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
new file mode 100644
index 00000000..ec979844
--- /dev/null
+++ b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift
index 8bc54686..a37697c6 100644
--- a/Meshtastic/Helpers/BLEManager.swift
+++ b/Meshtastic/Helpers/BLEManager.swift
@@ -451,6 +451,9 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
print(characteristic.value!)
}
+ print("Incoming packet with portnum", decodedInfo.packet.decoded.portnum)
+ print("decodedInfo.packet.decoded", decodedInfo.packet.decoded)
+
switch decodedInfo.packet.decoded.portnum {
// Handle Any local only packets we get over BLE
@@ -465,7 +468,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
let myInfo = myInfoPacket(myInfo: decodedInfo.myInfo, meshLogging: meshLoggingEnabled, context: context!)
if myInfo != nil {
-
+ print("my info packet", decodedInfo.myInfo)
self.connectedPeripheral.bitrate = myInfo!.bitrate
self.connectedPeripheral.num = myInfo!.myNodeNum
lastConnnectionVersion = myInfo?.firmwareVersion ?? myInfo!.firmwareVersion ?? "Unknown"
@@ -1169,6 +1172,54 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
return 0
}
+ public func getChannel(channelIndex: UInt32, wantResponse: Bool) -> Bool {
+
+ var adminPacket = AdminMessage()
+ adminPacket.getChannelRequest = channelIndex
+
+
+ var meshPacket: MeshPacket = MeshPacket()
+ meshPacket.to = UInt32(connectedPeripheral.num)
+ meshPacket.from = 0 //UInt32(connectedPeripheral.num)
+ meshPacket.id = UInt32.random(in: UInt32(UInt8.max).. Bool {
var adminPacket = AdminMessage()
diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift
index 3a7670b7..370cd226 100644
--- a/Meshtastic/Helpers/MeshPackets.swift
+++ b/Meshtastic/Helpers/MeshPackets.swift
@@ -1205,6 +1205,7 @@ func positionPacket (packet: MeshPacket, meshLogging: Bool, context: NSManagedOb
}
func routingPacket (packet: MeshPacket, meshLogging: Bool, context: NSManagedObjectContext) {
+ print("Routing packet", packet)
if let routingMessage = try? Routing(serializedData: packet.decoded.payload) {
diff --git a/Meshtastic/Views/Settings/ShareChannel.swift b/Meshtastic/Views/Settings/ShareChannel.swift
index 0615b803..614ea480 100644
--- a/Meshtastic/Views/Settings/ShareChannel.swift
+++ b/Meshtastic/Views/Settings/ShareChannel.swift
@@ -86,6 +86,13 @@ struct ShareChannel: View {
.onAppear {
self.bleManager.context = context
+ var i: UInt32 = 1;
+ while i < 9 {
+ print("requesting channel",i)
+ let resp = self.bleManager.getChannel(channelIndex: i, wantResponse: true)
+ print("resp from getChannel", resp)
+ i+=1;
+ }
}
}
From 090e714bf4c062d505f7c7d89d8da7387bee2122 Mon Sep 17 00:00:00 2001
From: Chris Cassano <1285652+glitch003@users.noreply.github.com>
Date: Sun, 31 Jul 2022 19:53:44 -0400
Subject: [PATCH 2/9] remove some debug code
---
Meshtastic/Helpers/BLEManager.swift | 5 +----
Meshtastic/Helpers/MeshPackets.swift | 3 +++
Meshtastic/Views/Settings/ShareChannel.swift | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift
index a37697c6..313b154e 100644
--- a/Meshtastic/Helpers/BLEManager.swift
+++ b/Meshtastic/Helpers/BLEManager.swift
@@ -448,11 +448,8 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
decodedInfo = try FromRadio(serializedData: characteristic.value!)
} catch {
-
print(characteristic.value!)
}
- print("Incoming packet with portnum", decodedInfo.packet.decoded.portnum)
- print("decodedInfo.packet.decoded", decodedInfo.packet.decoded)
switch decodedInfo.packet.decoded.portnum {
@@ -468,7 +465,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
let myInfo = myInfoPacket(myInfo: decodedInfo.myInfo, meshLogging: meshLoggingEnabled, context: context!)
if myInfo != nil {
- print("my info packet", decodedInfo.myInfo)
self.connectedPeripheral.bitrate = myInfo!.bitrate
self.connectedPeripheral.num = myInfo!.myNodeNum
lastConnnectionVersion = myInfo?.firmwareVersion ?? myInfo!.firmwareVersion ?? "Unknown"
@@ -1188,6 +1184,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
var dataMessage = DataMessage()
dataMessage.payload = try! adminPacket.serializedData()
dataMessage.portnum = PortNum.adminApp
+ dataMessage.wantResponse = true
meshPacket.decoded = dataMessage
diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift
index 370cd226..ba7555b9 100644
--- a/Meshtastic/Helpers/MeshPackets.swift
+++ b/Meshtastic/Helpers/MeshPackets.swift
@@ -1133,6 +1133,9 @@ func adminAppPacket (packet: MeshPacket, meshLogging: Bool, context: NSManagedOb
print(try! powerConfig.jsonUTF8Data())
print(powerConfig.meshSdsTimeoutSecs)
+ } else if let channel = try? Channel(serializedData: packet.decoded.payload) {
+ print(try! channel.jsonUTF8Data())
+ print("channel settings:", channel.settings)
}
if meshLogging { MeshLogger.log("ℹ️ MESH PACKET received for Admin App UNHANDLED \(try! packet.jsonString())") }
diff --git a/Meshtastic/Views/Settings/ShareChannel.swift b/Meshtastic/Views/Settings/ShareChannel.swift
index 614ea480..17a78be2 100644
--- a/Meshtastic/Views/Settings/ShareChannel.swift
+++ b/Meshtastic/Views/Settings/ShareChannel.swift
@@ -86,13 +86,13 @@ struct ShareChannel: View {
.onAppear {
self.bleManager.context = context
- var i: UInt32 = 1;
- while i < 9 {
+ let i: UInt32 = 1;
+// while i < 9 { // this should actually loop over MyNodeInfo.maxChannels to get all channels
print("requesting channel",i)
let resp = self.bleManager.getChannel(channelIndex: i, wantResponse: true)
print("resp from getChannel", resp)
- i+=1;
- }
+// i+=1;
+// }
}
}
From 7cc1b43f57470ef26853134765d34bb356713314 Mon Sep 17 00:00:00 2001
From: Chris Cassano <1285652+glitch003@users.noreply.github.com>
Date: Sun, 31 Jul 2022 20:13:48 -0400
Subject: [PATCH 3/9] trying to debug why we aren't getting channel settings
back. only routing packets
---
Meshtastic/Helpers/BLEManager.swift | 1 +
1 file changed, 1 insertion(+)
diff --git a/Meshtastic/Helpers/BLEManager.swift b/Meshtastic/Helpers/BLEManager.swift
index 313b154e..1e0c281a 100644
--- a/Meshtastic/Helpers/BLEManager.swift
+++ b/Meshtastic/Helpers/BLEManager.swift
@@ -465,6 +465,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
let myInfo = myInfoPacket(myInfo: decodedInfo.myInfo, meshLogging: meshLoggingEnabled, context: context!)
if myInfo != nil {
+
self.connectedPeripheral.bitrate = myInfo!.bitrate
self.connectedPeripheral.num = myInfo!.myNodeNum
lastConnnectionVersion = myInfo?.firmwareVersion ?? myInfo!.firmwareVersion ?? "Unknown"
From fa25c5e2ccd9aa079d762395a6f40bed202fdd8b Mon Sep 17 00:00:00 2001
From: Garth Vander Houwen
Date: Wed, 3 Aug 2022 16:56:44 -0700
Subject: [PATCH 4/9] Hook into both URL events, pass a string so we keep the
url
---
Meshtastic.xcodeproj/project.pbxproj | 8 +++----
Meshtastic/Meshtastic.entitlements | 2 +-
Meshtastic/MeshtasticApp.swift | 22 +++++++++++++------
.../Views/Settings/SaveChannelQRCode.swift | 4 ++--
4 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj
index 252463b9..be06040b 100644
--- a/Meshtastic.xcodeproj/project.pbxproj
+++ b/Meshtastic.xcodeproj/project.pbxproj
@@ -866,7 +866,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Meshtastic/Preview Content\"";
- DEVELOPMENT_TEAM = QWER3PMRVZ;
+ DEVELOPMENT_TEAM = GCH7VS5Y9R;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Meshtastic/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Meshtastic;
@@ -876,7 +876,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.27;
- PRODUCT_BUNDLE_IDENTIFIER = cvc.MeshtasticClient;
+ PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
@@ -898,7 +898,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Meshtastic/Preview Content\"";
- DEVELOPMENT_TEAM = QWER3PMRVZ;
+ DEVELOPMENT_TEAM = GCH7VS5Y9R;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Meshtastic/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Meshtastic;
@@ -908,7 +908,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.27;
- PRODUCT_BUNDLE_IDENTIFIER = cvc.MeshtasticClient;
+ PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
diff --git a/Meshtastic/Meshtastic.entitlements b/Meshtastic/Meshtastic.entitlements
index 68669b4c..3d8c755d 100644
--- a/Meshtastic/Meshtastic.entitlements
+++ b/Meshtastic/Meshtastic.entitlements
@@ -4,7 +4,7 @@
com.apple.developer.associated-domains
- applinks:meshtastic.org/E/*
+ applinks:meshtastic.org/*
com.apple.security.app-sandbox
diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift
index e59de623..679ebb1d 100644
--- a/Meshtastic/MeshtasticApp.swift
+++ b/Meshtastic/MeshtasticApp.swift
@@ -12,7 +12,7 @@ struct MeshtasticAppleApp: App {
@ObservedObject private var userSettings: UserSettings = UserSettings()
@State var saveQR = false
- @State private var channelUrl: URL?
+ @State var channelUrl: URL?
@Environment(\.scenePhase) var scenePhase
@@ -26,20 +26,28 @@ struct MeshtasticAppleApp: App {
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { userActivity in
print("QR Code URL received from the Camera \(userActivity)")
- guard let channelUrl = userActivity.webpageURL else {
- return
+ channelUrl = userActivity.webpageURL
+ if channelUrl!.absoluteString.lowercased().contains("https://meshtastic.org/e/#") {
+ saveQR = true
}
-
- print("User wants to open URL: \(channelUrl)")
- saveQR = true
+
+ print("User wants to open URL: \(channelUrl?.relativeString)")
}
.sheet(isPresented: $saveQR) {
- SaveChannelQRCode(channelHash: channelUrl)
+ SaveChannelQRCode(channelHash: channelUrl?.absoluteString ?? "Empty Channel URL")
}
.onOpenURL(perform: { (url) in
+ print("QR Code URL received from the Camera \(url)")
+ channelUrl = url
+ print("User wants to open URL: \(channelUrl?.absoluteString ?? "No QR Code Link")")
+
+ if url.absoluteString.lowercased().contains("https://meshtastic.org/e/#") {
+ saveQR = true
+ }
+
//we are expecting a .mbtiles map file that contains raster data
//save it to the documents directory, and name it offline_map.mbtiles
let fileManager = FileManager.default
diff --git a/Meshtastic/Views/Settings/SaveChannelQRCode.swift b/Meshtastic/Views/Settings/SaveChannelQRCode.swift
index 650a0e9d..4024f861 100644
--- a/Meshtastic/Views/Settings/SaveChannelQRCode.swift
+++ b/Meshtastic/Views/Settings/SaveChannelQRCode.swift
@@ -8,7 +8,7 @@ import SwiftUI
struct SaveChannelQRCode: View {
- var channelHash: URL?
+ var channelHash: String
var body: some View {
@@ -22,7 +22,7 @@ struct SaveChannelQRCode: View {
.font(.callout)
.padding()
- Text(String(channelHash?.path ?? "URL did not pass through properly"))
+ Text(channelHash)
.font(.title2)
.padding()
From 5b6f589b08b8dce8fdc3c54e1a8be1b253716572 Mon Sep 17 00:00:00 2001
From: Garth Vander Houwen
Date: Tue, 23 Aug 2022 08:05:47 -0700
Subject: [PATCH 5/9] Removed file that shouldn't be tracked
---
.../xcschemes/Meshtastic.xcscheme | 98 -------------------
1 file changed, 98 deletions(-)
delete mode 100644 Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
deleted file mode 100644
index ec979844..00000000
--- a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From a52af37c4069d9ab281fd4a1a61281aeb2a3e20f Mon Sep 17 00:00:00 2001
From: Garth Vander Houwen
Date: Tue, 23 Aug 2022 08:07:03 -0700
Subject: [PATCH 6/9] Delete file that should not be tracked
---
.../xcschemes/Meshtastic.xcscheme | 98 +++++++++++++++++++
1 file changed, 98 insertions(+)
create mode 100644 Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
new file mode 100644
index 00000000..ec979844
--- /dev/null
+++ b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 8a587114a5fe835a249d9db542f761fcb7e93b81 Mon Sep 17 00:00:00 2001
From: Garth Vander Houwen
Date: Tue, 23 Aug 2022 08:07:54 -0700
Subject: [PATCH 7/9] Removed file that shouldn't be tracked
---
.../xcschemes/Meshtastic.xcscheme | 98 -------------------
1 file changed, 98 deletions(-)
delete mode 100644 Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
deleted file mode 100644
index ec979844..00000000
--- a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From de4f855ac04f0dc49ce6e7acb90d9156ff0d8cb7 Mon Sep 17 00:00:00 2001
From: Garth Vander Houwen
Date: Tue, 23 Aug 2022 08:08:39 -0700
Subject: [PATCH 8/9] Delete
---
.../xcschemes/Meshtastic.xcscheme | 98 +++++++++++++++++++
1 file changed, 98 insertions(+)
create mode 100644 Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
new file mode 100644
index 00000000..ec979844
--- /dev/null
+++ b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From a9ba79f1517d68193fc20eaba0666d91377f0e23 Mon Sep 17 00:00:00 2001
From: Garth Vander Houwen
Date: Thu, 25 Aug 2022 14:49:05 -0700
Subject: [PATCH 9/9] Delete Meshtastic.xcscheme
Delete local config file from pull
---
.../xcschemes/Meshtastic.xcscheme | 98 -------------------
1 file changed, 98 deletions(-)
delete mode 100644 Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
diff --git a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme b/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
deleted file mode 100644
index ec979844..00000000
--- a/Meshtastic.xcodeproj/xcshareddata/xcschemes/Meshtastic.xcscheme
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-