Typo / Add more settings

pull/369/head
Mike 2024-12-22 23:34:09 -08:00
rodzic 1aaaffa465
commit 101301c155
3 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -219,7 +219,7 @@
<string name="p_status_entry">Enter your beacon comment</string>
<string name="p__connection">APRS Connection</string>
<string name="p__digipeating">Digipeating Preferences</string>
<string name="p__igating">IGating Prefences</string>
<string name="p__igating">IGating Preferences</string>
<string name="p__messaging">Messaging Preferences</string>
<string name="p_conntype">Connection Protocol</string>
@ -434,6 +434,10 @@
<string name="p_igfilter_summary">Filter for incoming packets</string>
<string name="p_igfilter_entry">Enter a filter for incoming packets</string>
<string name="p_igconnectretry">Connection Retry Interval</string>
<string name="p_igconnectretry_summary">Enter a filter for incoming packets</string>
<string name="p_igconnectretry_entry">Retry interval in seconds</string>
<string name="p_filterhelp">Message filter help</string>
<string name="p_filterhelp_summary">Online reference for APRS-IS filters</string>

Wyświetl plik

@ -35,4 +35,13 @@
android:summary="@string/p_igsotimeout_summary"
android:dialogTitle="@string/p_igsotimeout_entry" />
<de.duenndns.EditTextPreferenceWithValue
android:key="p.igconnectretry"
android:defaultValue="30"
android:hint="30"
android:inputType="number"
android:title="@string/p_igconnectretry"
android:summary="@string/p_igconnectretry_summary"
android:dialogTitle="@string/p_igconnectretry_entry" />
</PreferenceScreen>

Wyświetl plik

@ -16,6 +16,7 @@ class IgateService(service: AprsService, prefs: PrefsWrapper) extends Connection
val hostport = prefs.getString("p.igserver", "rotate.aprs2.net")
val (host, port) = parseHostPort(hostport)
val so_timeout = prefs.getStringInt("p.igsotimeout", 30)
val connectretryinterval = prefs.getStringInt("p.igconnectretry", 30)
var conn: TcpSocketThread = _
var reconnecting = false // Track if we're reconnecting
@ -100,7 +101,7 @@ class IgateService(service: AprsService, prefs: PrefsWrapper) extends Connection
stop()
// Step 2: Wait for a while before reconnecting
Thread.sleep(5000) // Wait for 5 seconds before reconnect attempt (can be adjusted)
Thread.sleep(connectretryinterval * 1000) // Wait for 5 seconds before reconnect attempt (can be adjusted)
// Step 3: Create a new connection
Log.d(TAG, "reconnect() - Attempting to create a new connection.")
@ -112,6 +113,7 @@ 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
}
}