Kenwood: UI for enabling GPS tx and logging

mediatek_nojit
Georg Lukas 2017-05-10 11:35:43 +02:00
rodzic 77004a0670
commit e3274fb20a
3 zmienionych plików z 32 dodań i 9 usunięć

Wyświetl plik

@ -185,6 +185,10 @@
<string name="p_conn_kiss">TNC (KISS)</string>
<string name="p_conn_kwd">Kenwood (NMEA waypoint)</string>
<string name="p_conn_kwd_info">Kenwood setup help</string>
<string name="p_conn_kwd_gps">Use Android GPS</string>
<string name="p_conn_kwd_gps_summary">Forward NMEA sentences to radio</string>
<string name="p_conn_kwd_gps_debug">Display GPS in log</string>
<string name="p_conn_kwd_gps_debug_summary">Show raw NMEA in APRSdroid</string>
<!-- array of APRS-IS protocols -->
<string name="p_aprsis_tcp">TCP connection</string>
<string name="p_aprsis_http">HTTP POST (send only)</string>

Wyświetl plik

@ -11,6 +11,21 @@
android:data="@string/kwd_help_url" />
</Preference>
<CheckBoxPreference
android:key="kenwood.gps"
android:title="@string/p_conn_kwd_gps"
android:summary="@string/p_conn_kwd_gps_summary"
android:defaultValue="false"
/>
<CheckBoxPreference
android:key="kenwood.gps_debug"
android:title="@string/p_conn_kwd_gps_debug"
android:summary="@string/p_conn_kwd_gps_debug_summary"
android:dependency="kenwood.gps"
android:defaultValue="false"
/>
<de.duenndns.ListPreferenceWithValue
android:key="link"

Wyświetl plik

@ -16,12 +16,14 @@ class KenwoodProto(service : AprsService, is : InputStream, os : OutputStream) e
val output = new OutputStreamWriter(os)
var listener : NmeaListener = null
new Handler(Looper.getMainLooper()).post(new Runnable() { override def run() {
listener = new NmeaListener()
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,
0, 0, sinkhole)
locMan.addNmeaListener(listener)
}})
if (service.prefs.getBoolean("kenwood.gps", false)) {
new Handler(Looper.getMainLooper()).post(new Runnable() { override def run() {
listener = new NmeaListener()
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,
0, 0, sinkhole)
locMan.addNmeaListener(listener)
}})
}
def wpl2aprs(line : String) = {
val s = line.split("[,*]") // get and split nmea
@ -57,8 +59,9 @@ class KenwoodProto(service : AprsService, is : InputStream, os : OutputStream) e
Log.d(TAG, "NMEA >>> " + nmea)
try {
output.write(nmea)
service.postAddPost(StorageDatabase.Post.TYPE_TX,
R.string.p_conn_kwd, nmea.trim())
if (service.prefs.getBoolean("kenwood.gps_debug", false))
service.postAddPost(StorageDatabase.Post.TYPE_TX,
R.string.p_conn_kwd, nmea.trim())
} catch {
case e : Exception =>
Log.e(TAG, "error sending NMEA to Kenwood: " + e)
@ -82,7 +85,8 @@ class KenwoodProto(service : AprsService, is : InputStream, os : OutputStream) e
override def stop() {
locMan.removeUpdates(sinkhole)
locMan.removeNmeaListener(listener)
if (listener != null)
locMan.removeNmeaListener(listener)
super.stop()
}
}