Parse digipeated own packets differently. Fix #62

This patch adds two related aspects:

 * Incoming packets from own callsign are not parsed (i.e. not added to
   the position table / not checked for messages) - fixing #62
 * Digipeated packets can get their own notification - probably useful
ssl
Georg Lukas 2013-07-31 14:49:06 +02:00
rodzic b5f09617fe
commit 6fab82655a
5 zmienionych plików z 45 dodań i 8 usunięć

Wyświetl plik

@ -275,6 +275,11 @@
<string name="p_pos">Own Position Reports</string>
<string name="p_pos_ring">Ringtone</string>
<string name="p_pos_ring_summary">Tone for sent position reports</string>
<string name="p_dgp">Digipeated Own Packets</string>
<string name="p_dgp_ring">Ringtone</string>
<string name="p_dgp_ring_summary">Tone for digipeated packets</string>
<string name="got_digipeated">Digipeated by %s</string>
<!-- AFSK settings -->
<string name="p_aprs_path">APRS digi path</string>

Wyświetl plik

@ -196,6 +196,33 @@
android:showSilent="true"
/>
</PreferenceCategory>
<!-- digipeated position reports -->
<PreferenceCategory
android:title="@string/p_dgp">
<CheckBoxPreference
android:key="dgp_notify_led"
android:title="@string/p_msg_led"
android:summaryOn="@string/p_msg_led_on"
android:summaryOff="@string/p_msg_led_off"
android:defaultValue="false"
/>
<CheckBoxPreference
android:key="dgp_notify_vibr"
android:title="@string/p_msg_vibr"
android:summaryOn="@string/p_msg_vibr_on"
android:summaryOff="@string/p_msg_vibr_off"
android:defaultValue="false"
/>
<RingtonePreference
android:key="dgp_notify_ringtone"
android:title="@string/p_dgp_ring"
android:summary="@string/p_dgp_ring_summary"
android:ringtoneType="notification"
android:showDefault="true"
android:showSilent="true"
/>
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>

Wyświetl plik

@ -199,7 +199,7 @@ class AprsService extends Service {
}
}
def parsePacket(ts : Long, message : String) {
def parsePacket(ts : Long, message : String, source : Int) {
try {
var fap = Parser.parse(message)
if (fap.getType() == APRSTypes.T_THIRDPARTY) {
@ -209,6 +209,15 @@ class AprsService extends Service {
fap = Parser.parse(inner.substring(1, inner.length()))
}
val callssid = prefs.getCallSsid()
if (source == StorageDatabase.Post.TYPE_INCMG &&
fap.getSourceCall().equalsIgnoreCase(callssid)) {
Log.i(TAG, "got digipeated own packet")
val message = getString(R.string.got_digipeated, fap.getLastUsedDigi())
ServiceNotifier.instance.notifyPosition(this, prefs, message, "dgp_")
return
}
if (fap.getAprsInformation() == null) {
Log.d(TAG, "parsePacket() misses payload: " + message)
return
@ -231,7 +240,7 @@ class AprsService extends Service {
val ts = System.currentTimeMillis()
db.addPost(ts, t, status, message)
if (t == StorageDatabase.Post.TYPE_POST || t == StorageDatabase.Post.TYPE_INCMG) {
parsePacket(ts, message)
parsePacket(ts, message, t)
} else {
// only log status messages
Log.d(TAG, "addPost: " + status + " - " + message)

Wyświetl plik

@ -26,10 +26,6 @@ class MessageService(s : AprsService) {
def handleMessage(ts : Long, ap : APRSPacket, msg : MessagePacket) {
val callssid = s.prefs.getCallSsid()
if (ap.getSourceCall().equalsIgnoreCase(callssid)) {
Log.i(TAG, "ignoring own digipeated message")
return
}
if (msg.getTargetCallsign().equalsIgnoreCase(callssid)) {
if (msg.isAck() || msg.isRej()) {
val new_type = if (msg.isAck())

Wyświetl plik

@ -90,9 +90,9 @@ abstract class ServiceNotifier {
}
def notifyPosition(ctx : Service, prefs : PrefsWrapper,
status : String) {
status : String, prefix : String = "pos_") {
val n = newNotification(ctx, status)
setupNotification(n, ctx, prefs, false, "pos_")
setupNotification(n, ctx, prefs, false, prefix)
getNotificationMgr(ctx).notify(SERVICE_NOTIFICATION, n)
}
}