From cd5edc915d7095876f4659ffd9de7e88e5082b07 Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 23 Dec 2024 20:58:59 -0800 Subject: [PATCH] Fix onclick log --- res/values/strings.xml | 2 +- src/IgateService.scala | 7 +++++-- src/LogActivity.scala | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 36a1736..1a4bc28 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -122,7 +122,7 @@ IGate Settings Suppress APRS-IS Traffic Log -Suppresse all APRS-IS serverside traffic in the log +Suppresses all APRS-IS serverside traffic in the log Enable Bidirectional IGate Allows messages to pass to RF diff --git a/src/IgateService.scala b/src/IgateService.scala index cf47f62..5aa08d0 100644 --- a/src/IgateService.scala +++ b/src/IgateService.scala @@ -100,6 +100,8 @@ class IgateService(service: AprsService, prefs: PrefsWrapper) extends Connection reconnecting = true + service.addPost(StorageDatabase.Post.TYPE_INFO, "APRS-IS", s"Connection lost... Reconnecting in $connectretryinterval seconds") + // Step 1: Stop the current connection stop() @@ -116,7 +118,6 @@ class IgateService(service: AprsService, prefs: PrefsWrapper) extends Connection // Callback implementation when the connection is lost override def onConnectionLost(): Unit = { Log.d(TAG, "onConnectionLost() - Connection lost, attempting to reconnect.") - service.addPost(StorageDatabase.Post.TYPE_INFO, "APRS-IS", s"Connection lost... Reconnecting in $connectretryinterval seconds") reconnect() // Automatically reconnect } } @@ -330,6 +331,8 @@ class TcpSocketThread(host: String, port: Int, timeout: Int, service: AprsServic val payloadString = if (payload != null) payload.toString else "" val digipath = prefs.getString("igpath", "WIDE1-1") val formattedDigipath = if (digipath.nonEmpty) s",$digipath" else "" + val version = service.APP_VERSION // Version information (as in Python example) + // Extract the targeted callsign by stripping leading and trailing colons and removing spaces val targetedCallsign = payloadString .stripPrefix(":") // Remove any leading colon @@ -352,7 +355,7 @@ class TcpSocketThread(host: String, port: Int, timeout: Int, service: AprsServic if (timeElapsed <= timelastheard * 60 * 1000) { // If it was heard within 30 minutes // Process and send the packet - val igatedPacket = s"$callssid>APDR17$formattedDigipath:}$sourceCall>$destinationCall,TCPIP,$callssid*:$payload" + val igatedPacket = s"$callssid>$version$formattedDigipath:}$sourceCall>$destinationCall,TCPIP,$callssid*:$payload" Log.d("IgateService", igatedPacket) service.sendThirdPartyPacket(igatedPacket) // Send the packet } else { diff --git a/src/LogActivity.scala b/src/LogActivity.scala index 466444e..8f6b25c 100644 --- a/src/LogActivity.scala +++ b/src/LogActivity.scala @@ -66,7 +66,7 @@ class LogActivity extends MainListActivity("log", R.id.log) { //super.onListItemClick(l, v, position, id) val c = getListView().getItemAtPosition(position).asInstanceOf[Cursor] val t = c.getInt(COLUMN_TYPE) - if (t != TYPE_POST && t != TYPE_INCMG) + if (t != TYPE_POST && t != TYPE_INCMG && t != TYPE_DIGI) return val call = c.getString(COLUMN_MESSAGE).split(">")(0) Log.d(TAG, "onListItemClick: %s".format(call))