From 457116657afc2fd2aa2b1e6a3e6265b19e934361 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 26 Mar 2024 09:59:07 -0700 Subject: [PATCH] Save favorite and hops away --- Meshtastic/Helpers/MeshPackets.swift | 4 ++++ Meshtastic/Persistence/UpdateCoreData.swift | 3 +++ de.lproj/Localizable.strings | 4 ++++ en.lproj/Localizable.strings | 1 + fr.lproj/Localizable.strings | 1 + he.lproj/Localizable.strings | 1 + pl.lproj/Localizable.strings | 4 ++++ zh-Hans.lproj/Localizable.strings | 4 ++++ zh-Hant-TW.lproj/Localizable.strings | 3 +++ 9 files changed, 25 insertions(+) diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index f05bb3cd..a408af14 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -263,6 +263,8 @@ func nodeInfoPacket (nodeInfo: NodeInfo, channel: UInt32, context: NSManagedObje newNode.id = Int64(nodeInfo.num) newNode.num = Int64(nodeInfo.num) newNode.channel = Int32(nodeInfo.channel) + newNode.favorite = nodeInfo.isFavorite + newNode.hopsAway = Int32(nodeInfo.hopsAway) if nodeInfo.hasDeviceMetrics { let telemetry = TelemetryEntity(context: context) @@ -346,6 +348,8 @@ func nodeInfoPacket (nodeInfo: NodeInfo, channel: UInt32, context: NSManagedObje fetchedNode[0].lastHeard = Date(timeIntervalSince1970: TimeInterval(Int64(nodeInfo.lastHeard))) fetchedNode[0].snr = nodeInfo.snr fetchedNode[0].channel = Int32(nodeInfo.channel) + fetchedNode[0].favorite = nodeInfo.isFavorite + fetchedNode[0].hopsAway = Int32(nodeInfo.hopsAway) if nodeInfo.hasUser { if (fetchedNode[0].user == nil) { diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index 98561c0d..41920890 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -144,11 +144,13 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext) newNode.snr = packet.rxSnr newNode.rssi = packet.rxRssi newNode.viaMqtt = packet.viaMqtt + if packet.to == 4294967295 || packet.to == UserDefaults.preferredPeripheralNum { newNode.channel = Int32(packet.channel) } if let nodeInfoMessage = try? NodeInfo(serializedData: packet.decoded.payload) { newNode.hopsAway = Int32(nodeInfoMessage.hopsAway) + newNode.favorite = nodeInfoMessage.isFavorite } else if packet.hopStart != 0 && packet.hopLimit <= packet.hopStart { newNode.hopsAway = Int32(packet.hopStart - packet.hopLimit) } @@ -222,6 +224,7 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext) if let nodeInfoMessage = try? NodeInfo(serializedData: packet.decoded.payload) { fetchedNode[0].hopsAway = Int32(nodeInfoMessage.hopsAway) + fetchedNode[0].favorite = nodeInfoMessage.isFavorite if nodeInfoMessage.hasDeviceMetrics { let telemetry = TelemetryEntity(context: context) telemetry.batteryLevel = Int32(nodeInfoMessage.deviceMetrics.batteryLevel) diff --git a/de.lproj/Localizable.strings b/de.lproj/Localizable.strings index 2599d7b2..c3d3d0fc 100644 --- a/de.lproj/Localizable.strings +++ b/de.lproj/Localizable.strings @@ -98,6 +98,10 @@ "device.role.routerclient"="Router Client - Mesh Pakete werden bevorzugt über diesen Node gerouted. Der Router Client kann parallel auch von einer Client-App genutzt werden."; "device.role.repeater"="Repeater - Mesh packets will prefer to be routed over this node. This role eliminates unnecessary overhead such as NodeInfo, DeviceTelemetry, and any other mesh packet, resulting in the device not appearing as part of the network. Please see Rebroadcast Mode for additional settings specific to this role."; "device.role.tracker"="Tracker - For use with devices intended as a GPS tracker. Position packets sent from this device will be higher priority, with position broadcasting every two minutes. Smart Position Broadcast will default to off."; +"device.role.lostandfound"="Broadcasts location as message to default channel regularly for to assist with device recovery."; +"device.role.sensor"="Broadcasts telemetry packets as priority."; +"device.role.tak"="Optimized for ATAK system communication, reduces routine broadcasts."; +"device.role.taktracker"="Enables automatic TAK PLI broadcasts and reduces routine broadcasts."; "direct.messages"="Direktnachrichten"; "dismiss.keyboard"="Dismiss Keyboard"; "display"="Display (Device Screen)"; diff --git a/en.lproj/Localizable.strings b/en.lproj/Localizable.strings index 251e1b0d..e0d113b8 100644 --- a/en.lproj/Localizable.strings +++ b/en.lproj/Localizable.strings @@ -99,6 +99,7 @@ "device.role.lostandfound"="Broadcasts location as message to default channel regularly for to assist with device recovery."; "device.role.sensor"="Broadcasts telemetry packets as priority."; "device.role.tak"="Optimized for ATAK system communication, reduces routine broadcasts."; +"device.role.taktracker"="Enables automatic TAK PLI broadcasts and reduces routine broadcasts."; "device.role.repeater"="Infrastructure node for extending network coverage by relaying messages with minimal overhead. Not visible in Nodes list."; "device.role.router"="Infrastructure node for extending network coverage by relaying messages. Visible in Nodes list."; "device.role.routerclient"="Combination of both ROUTER and CLIENT. Not for mobile devices."; diff --git a/fr.lproj/Localizable.strings b/fr.lproj/Localizable.strings index 31642beb..b41a35a4 100644 --- a/fr.lproj/Localizable.strings +++ b/fr.lproj/Localizable.strings @@ -76,6 +76,7 @@ "device.role.lostandfound"="Transmet régulièrement la position par message dans le canal par défaut pour vous aider à retrouver l'appareil."; "device.role.sensor"="Transmet les paquets de télémétrie en priorité."; "device.role.tak"="Optimisé pour le système de communication ATAK, diminue les émissions de routine."; +"device.role.taktracker"="Enables automatic TAK PLI broadcasts and reduces routine broadcasts."; "device.role.repeater"="Noeud d'infrastructure qui étend la couverture du réseau en relayant les messages avec un minimum de surcharge. Invisible dans la liste des noeuds."; "device.role.router"="Noeud d'infrastructure qui étend la couverture du réseau en relayant les messages. Visible dans la liste des noeuds."; "device.role.routerclient"="Combinaison des modes ROUTER et CLIENT. Pas pour les appareils mobiles."; diff --git a/he.lproj/Localizable.strings b/he.lproj/Localizable.strings index 22e5a2df..e9dc8ce1 100644 --- a/he.lproj/Localizable.strings +++ b/he.lproj/Localizable.strings @@ -99,6 +99,7 @@ "device.role.lostandfound"="משדר מיקום כהודעה לערוץ ברירת מחדל לעיתים קבועות בכדי לסייע במציאת המכשיר."; "device.role.sensor"="משדר טלמטריה בעדיפות גבוהה."; "device.role.tak"="מותאם למערכת ATAK, מקטין תקשורת קבועה."; +"device.role.taktracker"="Enables automatic TAK PLI broadcasts and reduces routine broadcasts."; "device.role.repeater"="מכשיר תשתית להרחבת המש על ידי העברת הודעות עם דאטה נוסף מינימלי."; "device.role.router"="מכשיר תשתית להרחבת המש על ידי העברת הודעות. מופיע ברשימת מכשירים."; "device.role.routerclient"="קומבינציה של ROUTER וCLIENT. לא למכשירים ניידים."; diff --git a/pl.lproj/Localizable.strings b/pl.lproj/Localizable.strings index 2c5aa853..5e194834 100644 --- a/pl.lproj/Localizable.strings +++ b/pl.lproj/Localizable.strings @@ -100,6 +100,10 @@ "device.role.routerclient"="Router Client - Hybryda ról klienta i routera. Podobnie jak w przypadku routera, z tym że Router Client może być używany zarówno jako router, jak i klient połączony z aplikacją. Radia BLE/Wi-Fi i ekran OLED nie zostaną uśpione."; "device.role.repeater"="Przekaźnik - Pakiety siatki będą preferować trasowanie przez ten węzeł. Ta rola eliminuje niepotrzebny nadmiar, taki jak NodeInfo, DeviceTelemetry i inne pakiety siatki, skutkując tym, że urządzenie nie będzie widoczne jako część sieci. Proszę zobaczyć tryb Rebroadcast dla dodatkowych ustawień specyficznych dla tej roli."; "device.role.tracker"="Tracker - Do użytku z urządzeniami przeznaczonymi jako śledzenie GPS. Pakiety pozycyjne wysyłane z tego urządzenia będą miały wyższy priorytet, z nadawaniem pozycji co dwie minuty. Inteligentna transmisja pozycji będzie domyślnie wyłączona."; +"device.role.lostandfound"="Broadcasts location as message to default channel regularly for to assist with device recovery."; +"device.role.sensor"="Broadcasts telemetry packets as priority."; +"device.role.tak"="Optimized for ATAK system communication, reduces routine broadcasts."; +"device.role.taktracker"="Enables automatic TAK PLI broadcasts and reduces routine broadcasts."; "direct.messages"="Bezpośrednie Wiadomości"; "dismiss.keyboard"="Zamknij"; "display"="Wyświetlacz (Ekran Urządzenia)"; diff --git a/zh-Hans.lproj/Localizable.strings b/zh-Hans.lproj/Localizable.strings index 6c8f6b0a..d4521ef2 100644 --- a/zh-Hans.lproj/Localizable.strings +++ b/zh-Hans.lproj/Localizable.strings @@ -98,6 +98,10 @@ "device.role.routerclient"="路由客户端模式 - 优先转发 Mesh 网络中其他节点的消息,App 也可以连接到电台进行收发操作。"; "device.role.repeater"="中继模式 - Mesh 网络数据包将优先通过此节点路由。此模式可消除不必要的开销,如 NodeInfo、DeviceTelemetry 和任何其他 Mesh 数据包,从而使设备不显示为 Mesh 网络的一部分。有关此角色的其他特定设置,请参阅转播模式。"; "device.role.tracker"="定位模式 - 用于作为 GPS 跟踪器。从该设备发送的定位数据包优先级较高,每两分钟广播一次。智能位置广播默认为关闭。"; +"device.role.lostandfound"="Broadcasts location as message to default channel regularly for to assist with device recovery."; +"device.role.sensor"="Broadcasts telemetry packets as priority."; +"device.role.tak"="Optimized for ATAK system communication, reduces routine broadcasts."; +"device.role.taktracker"="Enables automatic TAK PLI broadcasts and reduces routine broadcasts."; "direct.messages"="直频消息"; "dismiss.keyboard"="隐藏键盘"; "display"="屏幕(电台屏幕)"; diff --git a/zh-Hant-TW.lproj/Localizable.strings b/zh-Hant-TW.lproj/Localizable.strings index d0f8e876..8bef85fd 100644 --- a/zh-Hant-TW.lproj/Localizable.strings +++ b/zh-Hant-TW.lproj/Localizable.strings @@ -98,6 +98,9 @@ "device.role.routerclient"="路由客户端模式 - 優先轉發 Mesh 網路中其他中繼點的消息,App 也可以連接到電台進行收發操作。"; "device.role.repeater"="中繼模式 - Mesh 網路數據包將優先通過此中繼點路由。此模式可消除不必要的開銷,如 NodeInfo、DeviceTelemetry 和任何其他 Mesh 數據包,從而使設備不顯示為 Mesh 網路的一部分。有關此角色的其他特定設置,請參閱轉播模式。"; "device.role.tracker"="追蹤模式 - 用於作為 GPS 追蹤器。從該設備發送的定位數據包優先級較高,每兩分鐘廣播一次。智能位置廣播預設為關閉。"; +"device.role.sensor"="Broadcasts telemetry packets as priority."; +"device.role.tak"="Optimized for ATAK system communication, reduces routine broadcasts."; +"device.role.taktracker"="Enables automatic TAK PLI broadcasts and reduces routine broadcasts."; "direct.messages"="聊天"; "dismiss.keyboard"="隱藏鍵盤"; "display"="螢幕(電台螢幕)";