Skip to content

RF Sentinel (RFSentinel): free, open-source police detector app for Android. Spots police body cams, Flock ALPR cameras, AirTag trackers, Remote ID drones, smart glasses and fake cell towers from Bluetooth LE and WiFi. No root.

Talkgroups filter: watched P25 talkgroups and ones whose radio keyed up close by (input check), with NEAR / PLAYING / HELD boxes; NEAR rows also under All, pinned and flashing at the alert threshold

CIS-C017d7abe3231a
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
index 3d12036..e176441 100644
--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
@@ -45,6 +45,10 @@ class MainActivity : AppCompatActivity() {
private const val WAZE_ROW = "waze:"
private const val RADIO_ROW = "radio:"
private const val AIRCRAFT_ROW = "air:"
+ private const val TG_ROW = "tg:"
+ /** Talkgroup rows: listed this long after their last call; NEAR while their radio was on the input this recently. */
+ private const val TG_LIST_MS = 5 * 60_000L
+ private const val TG_NEAR_MS = 2 * 60_000L
// The speaker's long-press menu: after the snooze lengths (their indexes).
private const val MUTE_ITEM = 1000
private const val SOUND_ITEM = 1001
@@ -136,6 +140,7 @@ class MainActivity : AppCompatActivity() {
onClick = {
if (it.mac.startsWith(CELL_ROW)) startActivity(Intent(this, com.rfsentinel.app.ui.CellTowersActivity::class.java))
else if (it.mac.startsWith(RADIO_ROW)) startActivity(Intent(this, com.rfsentinel.app.ui.DetectionLogActivity::class.java))
+ else if (it.mac.startsWith(TG_ROW)) startActivity(Intent(this, com.rfsentinel.app.ui.P25Activity::class.java))
else if (it.mac.startsWith(AIRCRAFT_ROW)) {
val hex = it.mac.removePrefix(AIRCRAFT_ROW)
currentAircraft(System.currentTimeMillis()).firstOrNull { a -> a.plane.hex == hex }?.let { a ->
@@ -151,7 +156,7 @@ class MainActivity : AppCompatActivity() {
}
else DeviceActions.openDetails(this, it.mac)
},
- onLongPress = { if (listOf(CELL_ROW, WAZE_ROW, RADIO_ROW, AIRCRAFT_ROW).none { p -> it.mac.startsWith(p) }) DeviceActions.showQuickActions(this, it.mac) },
+ onLongPress = { if (listOf(CELL_ROW, WAZE_ROW, RADIO_ROW, TG_ROW, AIRCRAFT_ROW).none { p -> it.mac.startsWith(p) }) DeviceActions.showQuickActions(this, it.mac) },
onMute = { row, forever -> toggleMute(row, forever) }
)
binding.recyclerView.layoutManager = LinearLayoutManager(this)
@@ -745,6 +750,7 @@ class MainActivity : AppCompatActivity() {
com.rfsentinel.app.ui.DeviceFilter.AIRCRAFT -> currentAircraft(now).size
com.rfsentinel.app.ui.DeviceFilter.FLAGGED -> all.count { f.matches(it) } + currentAircraft(now).count { it.hit != null }
com.rfsentinel.app.ui.DeviceFilter.RADIO -> if (ScanForegroundService.isRunning) com.rfsentinel.app.sdr.RadioLog.current(now).size else 0
+ com.rfsentinel.app.ui.DeviceFilter.TALKGROUPS -> currentTalkgroups(now).size
else -> all.count { f.matches(it) }
}
val label = if (f == com.rfsentinel.app.ui.DeviceFilter.ALL || n > 0) "${f.label} $n" else f.label
@@ -802,19 +808,21 @@ class MainActivity : AppCompatActivity() {
val cells = cellRows(now)
val waze = wazeRows(now, Prefs.alertThreshold(this, Category.POLICE_REPORT))
val radio = radioRows(now, Prefs.alertThreshold(this, Category.RADIO))
+ val talkgroups = talkgroupRows(now, Prefs.alertThreshold(this, Category.RADIO))
val air = aircraftRows(now, Prefs.alertThreshold(this, Category.AIRCRAFT))
// Waze reports, radios on the air and aircraft that meet the alert threshold flash at the very top;
// the rest follow the devices.
val (urgent, quiet) = waze.partition { it.flashing }
val (radioLive, radioOld) = radio.partition { it.flashing }
+ val (tgLive, tgOld) = talkgroups.partition { it.flashing }
val (airUrgent, airQuiet) = air.partition { it.flashing }
// Alerting devices from your own watchlist entries go above all of them.
fun mine(s: DeviceRegistry.Snapshot) = com.rfsentinel.app.ui.LiveWindow.alerting(s, now) &&
s.hits.any { it.source == com.rfsentinel.app.oui.OuiEntry.YOURS }
if (com.rfsentinel.app.ui.DeviceOrder.group(this) == com.rfsentinel.app.ui.DeviceOrder.Group.NONE) {
val (yours, devices) = sections.flatMap { it.items }.partition(::mine)
- submitRows(yours.map { toRow(it, now, threshold) } + airUrgent + radioLive + urgent + devices.map { toRow(it, now, threshold) } +
- airQuiet + radioOld + cells + quiet)
+ submitRows(yours.map { toRow(it, now, threshold) } + airUrgent + tgLive + radioLive + urgent + devices.map { toRow(it, now, threshold) } +
+ airQuiet + tgOld + radioOld + cells + quiet)
} else {
// Grouped: everything the list shows has a group, not only Bluetooth and WiFi devices. What's
// urgent (Waze, radio, aircraft) joins the flagged devices in Alerts, at the top.
@@ -823,14 +831,15 @@ class MainActivity : AppCompatActivity() {
val alerts = com.rfsentinel.app.ui.DeviceOrder.ALERTS
val (yours, flagged) = sections.filter { it.header == alerts }.flatMap { it.items }.partition(::mine)
submitRows(
- block(alerts, alerts, yours.map { toRow(it, now, threshold) } + airUrgent + radioLive + urgent +
+ block(alerts, alerts, yours.map { toRow(it, now, threshold) } + airUrgent + tgLive + radioLive + urgent +
flagged.map { toRow(it, now, threshold) }) +
sections.filter { it.header != alerts }.flatMap { sec -> block(sec.header.orEmpty(), sec.header.orEmpty(), sec.items.map { toRow(it, now, threshold) }) } +
- block("x:aircraft", "Aircraft", airQuiet) + block("x:radio", "Radio transmissions", radioOld) +
+ block("x:aircraft", "Aircraft", airQuiet) + block("x:talkgroups", "Talkgroups", tgOld) +
+ block("x:radio", "Radio transmissions", radioOld) +
block("x:waze", "Waze reports", quiet) + block("x:cells", "Cell towers", cells)
)
}
- shownCells = cells.size + waze.size + radio.size + air.size
+ shownCells = cells.size + waze.size + radio.size + talkgroups.size + air.size
}
binding.emptyState.visibility = if (visible.isEmpty() && (!panes.listShown || shownCells == 0) &&
(!panes.radarShown || radioBlips == 0)) View.VISIBLE else View.GONE
@@ -846,6 +855,8 @@ class MainActivity : AppCompatActivity() {
"No Waze reports in range.\nTurn on Waze police reports in Settings and keep scanning."
filter == com.rfsentinel.app.ui.DeviceFilter.RADIO ->
"No radio transmissions heard in the last 5 minutes.\nNeeds an RTL-SDR on USB, Two-way radio on in Settings › What to detect, and Radio activity sweep ticked in Settings › RTL-SDR radio."
+ filter == com.rfsentinel.app.ui.DeviceFilter.TALKGROUPS ->
+ "No talkgroups in the last 5 minutes.\nLists the ones in Watch these talkgroups (Settings › RTL-SDR radio) and any whose radio keyed up close to you, with P25 control channel ticked there."
filter == com.rfsentinel.app.ui.DeviceFilter.AIRCRAFT ->
"No aircraft yet.\nThey come from an RTL-SDR on USB (tick ADS-B aircraft receiver in Settings › RTL-SDR radio), or from the online feeds when that's on in Settings."
filter == com.rfsentinel.app.ui.DeviceFilter.CELLS ->
@@ -975,6 +986,53 @@ class MainActivity : AppCompatActivity() {
}
}
+ /** P25 talkgroups (and private calls) of the last few minutes that you watch, or whose radio was heard close by on the site's input. */
+ private fun currentTalkgroups(now: Long): List<com.rfsentinel.app.sdr.P25Log.Row> =
+ if (!ScanForegroundService.isRunning) emptyList()
+ else com.rfsentinel.app.sdr.SdrRadio.p25Log.rows().filter {
+ now - it.lastAt <= TG_LIST_MS && (it.tg in com.rfsentinel.app.sdr.SdrRadio.p25Watched || now - it.inputAt <= TG_LIST_MS)
+ }
+
+ /**
+ * The Talkgroups filter's rows (under All, only the NEAR ones): a talkgroup whose radio keyed up on the input in the
+ * last 2 minutes gets the NEAR box and, at or above the alert threshold, is tinted, flashes and is pinned to the top.
+ */
+ private fun talkgroupRows(now: Long, threshold: Int): List<DeviceRow> {
+ if (filter != com.rfsentinel.app.ui.DeviceFilter.ALL && filter != com.rfsentinel.app.ui.DeviceFilter.TALKGROUPS) return emptyList()
+ val sdr = com.rfsentinel.app.sdr.SdrRadio
+ val color = com.rfsentinel.app.ui.ThemeManager.ink(this, Category.RADIO.colorArgb)
+ val min = Prefs.radioMinSnr(this)
+ val playing = sdr.p25Playing
+ return currentTalkgroups(now).mapNotNull { r ->
+ val near = now - r.inputAt <= TG_NEAR_MS
+ if (filter == com.rfsentinel.app.ui.DeviceFilter.ALL && !near) return@mapNotNull null
+ val title = com.rfsentinel.app.ui.P25Activity.title(r) + (sdr.p25Watched[r.tg]?.ifEmpty { null }?.let { " · $it" } ?: "")
+ if (query.isNotBlank() && !title.contains(query.trim(), ignoreCase = true)) return@mapNotNull null
+ val key = TG_ROW + (r.tg ?: "r${r.target}")
+ val confidence = if (near) ScanForegroundService.p25InputConfidence(r.inputSnr, min) else ScanForegroundService.P25_CONFIDENCE
+ // Dismissed (swiped left): listed, but quiet.
+ val urgent = near && confidence >= threshold && !hidden(key, now)
+ val ago = (now - r.lastAt) / 1000
+ DeviceRow(
+ mac = key,
+ title = title,
+ subtitle = listOfNotNull(r.lastSource?.let { "Radio $it keyed up" }, "${r.calls} call" + (if (r.calls == 1) "" else "s"),
+ "EMERGENCY".takeIf { r.emergency }, "encrypted".takeIf { r.encrypted }).joinToString(" · "),
+ meta = if (ago < 3) "Call going on" else "Last call ${ago}s ago",
+ tag = (if (near) "P25 NEAR" else "P25") + " · $confidence%",
+ tagColor = color,
+ highlight = if (urgent) color else null,
+ flashing = urgent,
+ bold = now - r.lastAt <= RADIO_LIVE_MS,
+ confidence = confidence,
+ badges = listOfNotNull(
+ ("NEAR ${r.inputSnr} dB" to com.rfsentinel.app.ui.NEAR_BADGE).takeIf { near },
+ ("PLAYING" to com.rfsentinel.app.ui.PEER_BADGE).takeIf { playing != null && playing.tg == r.tg && playing.target == r.target },
+ ("HELD" to com.rfsentinel.app.ui.PEER_BADGE).takeIf { r.tg != null && r.tg == sdr.p25Hold })
+ )
+ }
+ }
+
/**
* Where an alerting device is, for its direction on the radar: its own broadcast, or a located estimate
* you are outside of (inside its circle every direction fits). Null otherwise.
@@ -1142,7 +1200,7 @@ class MainActivity : AppCompatActivity() {
/** What swiping [r] right or left does (Settings › Alerts), or null for nothing: aircraft and radio rows have no mute. */
private fun swipeAction(r: DeviceRow, right: Boolean): String? {
- val noMute = r.mac.startsWith(AIRCRAFT_ROW) || r.mac.startsWith(RADIO_ROW)
+ val noMute = r.mac.startsWith(AIRCRAFT_ROW) || r.mac.startsWith(RADIO_ROW) || r.mac.startsWith(TG_ROW)
return Prefs.swipeAction(this, right).takeIf {
when (it) {
"mute" -> r.canMute && !noMute
diff --git a/app/src/main/java/com/rfsentinel/app/car/DeviceListScreen.kt b/app/src/main/java/com/rfsentinel/app/car/DeviceListScreen.kt
index 875098a..8b18532 100644
--- a/app/src/main/java/com/rfsentinel/app/car/DeviceListScreen.kt
+++ b/app/src/main/java/com/rfsentinel/app/car/DeviceListScreen.kt
@@ -36,7 +36,7 @@ class DeviceListScreen(carContext: CarContext, private val filter: DeviceFilter)
companion object {
/** The filters offered in the car (cell towers have their own screen). */
- val CAR_FILTERS = DeviceFilter.entries.filter { it != DeviceFilter.CELLS && it != DeviceFilter.WAZE && it != DeviceFilter.RADIO && it != DeviceFilter.AIRCRAFT &&
+ val CAR_FILTERS = DeviceFilter.entries.filter { it != DeviceFilter.CELLS && it != DeviceFilter.WAZE && it != DeviceFilter.RADIO && it != DeviceFilter.TALKGROUPS && it != DeviceFilter.AIRCRAFT &&
it !in DeviceFilter.KINDS && it != DeviceFilter.OTHER }
fun titleOf(f: DeviceFilter) = when (f) {
diff --git a/app/src/main/java/com/rfsentinel/app/sdr/P25Log.kt b/app/src/main/java/com/rfsentinel/app/sdr/P25Log.kt
index 3db9bde..afd5da3 100644
--- a/app/src/main/java/com/rfsentinel/app/sdr/P25Log.kt
+++ b/app/src/main/java/com/rfsentinel/app/sdr/P25Log.kt
@@ -10,13 +10,15 @@ class P25Log {
/** One talkgroup ([tg]) or, with [tg] null, private calls to radio [target]. */
data class Row(val tg: Int?, val target: Int?, val calls: Int, val lastAt: Long, val lastChannel: Int?,
- val lastHz: Long?, val lastSource: Int?, val radios: Int, val emergency: Boolean, val encrypted: Boolean)
+ val lastHz: Long?, val lastSource: Int?, val radios: Int, val emergency: Boolean, val encrypted: Boolean,
+ /** The last time one of its radios was heard on the site's input (close to you), and how strong; 0 never. */
+ val inputAt: Long = 0L, val inputSnr: Int = 0)
/** The site and how much was heard there, for the screen's header. */
data class Summary(val site: P25Tsbk.Site?, val messages: Long, val registrations: Int, val since: Long)
private class Group { var calls = 0; var lastAt = 0L; var lastChannel: Int? = null; var lastSource: Int? = null
- val radios = HashSet<Int>(); var emergency = false; var encrypted = false }
+ val radios = HashSet<Int>(); var emergency = false; var encrypted = false; var inputAt = 0L; var inputSnr = 0 }
private val groups = HashMap<Pair<Int?, Int?>, Group>()
private val channels = P25Tsbk.Channels()
@@ -62,10 +64,15 @@ class P25Log {
return if (new) tg else null
}
+ /** A radio on [tg]'s call (or the private call to [target]) heard on the site's input, [snr] dB above the noise. */
+ @Synchronized fun heardInput(tg: Int?, target: Int?, snr: Int, now: Long) {
+ group(tg, target).apply { inputAt = now; inputSnr = snr }
+ }
+
/** Most recent first. */
@Synchronized fun rows(): List<Row> = groups.map { (k, g) ->
Row(k.first, k.second, g.calls, g.lastAt, g.lastChannel, g.lastChannel?.let(channels::hz), g.lastSource,
- g.radios.size, g.emergency, g.encrypted)
+ g.radios.size, g.emergency, g.encrypted, g.inputAt, g.inputSnr)
}.filter { it.calls > 0 || it.radios > 0 }.sortedByDescending { it.lastAt }
@Synchronized fun summary() = Summary(site, messages, registrations, since)
diff --git a/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt b/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt
index 7cbb025..b6dea48 100644
--- a/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt
+++ b/app/src/main/java/com/rfsentinel/app/sdr/SdrRadio.kt
@@ -520,7 +520,9 @@ object SdrRadio {
pending = null
val snr = measureInput(sdr, hz) ?: return@detour true
inputs++
- if (snr >= RadioWatch.activeDb(config.minSnrDb)) { heard++; onP25Input?.invoke(call, hz, snr) }
+ if (snr >= RadioWatch.activeDb(config.minSnrDb)) {
+ heard++; p25Log.heardInput(call.tg, call.target, snr, System.currentTimeMillis()); onP25Input?.invoke(call, hz, snr)
+ }
true
}
val lost = hunt.listen(lock, stop, detour) {
diff --git a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt
index 4affde2..9eaded4 100644
--- a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt
+++ b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt
@@ -74,7 +74,9 @@ class ScanForegroundService : Service() {
private const val OWNER_CHECK_MS = 30_000L
private const val RADAR_HOLD_MS = 120_000L
/** A watched talkgroup's call: the user asked for it, like a watched frequency. */
- private const val P25_CONFIDENCE = 70
+ const val P25_CONFIDENCE = 70
+ /** A talkgroup's radio heard on the site's input, [snr] dB above the noise ([min]: the radio threshold): near you. */
+ fun p25InputConfidence(snr: Int, min: Int) = if (snr >= min + 10) 75 else 60
/** A talkgroup much busier than usual: probable, not certain (an event, a shift change, a drill). */
private const val P25_UNUSUAL_CONFIDENCE = 55
private const val P25_UNUSUAL_CHECK_MS = 5 * 60_000L
@@ -1563,7 +1565,7 @@ class ScanForegroundService : Service() {
.filter { com.rfsentinel.app.ui.LiveWindow.inRange(it, now) && !WhitelistCache.contains(it.mac) }.map { it.mac }, now)
}
val min = Prefs.radioMinSnr(this)
- val confidence = if (snr >= min + 10) 75 else 60
+ val confidence = p25InputConfidence(snr, min)
val name = call.tg?.let { com.rfsentinel.app.sdr.P25Log.watched(Prefs.p25Talkgroups(this))[it]?.ifEmpty { null } }
val called = name ?: call.tg?.let { "talkgroup $it" } ?: "a private call"
val near = when { snr >= 40 -> "very close"; snr >= 30 -> "close"; else -> "nearby" }
diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.kt
index 864a0ce..bb1ce7f 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceAdapter.kt
@@ -43,7 +43,9 @@ data class DeviceRow(
val header: Boolean = false,
/** A flagged device: its row has the mute button ([com.rfsentinel.app.data.AlertMutes]). */
val canMute: Boolean = false,
- val muted: Boolean = false
+ val muted: Boolean = false,
+ /** More boxes after the heard-by ones, label and colour ("NEAR 38 dB" on a talkgroup row). */
+ val badges: List<Pair<String, Int>> = emptyList()
) {
companion object {
/** Keyed by the group ([key]), not its label: the count changing must not swap the row (it flickered). */
@@ -54,11 +56,12 @@ data class DeviceRow(
private const val ESP_BADGE = 0xFF1E88E5.toInt()
private const val PHONE_BADGE = 0xFF2E7D32.toInt()
private const val USB_BADGE = 0xFF6A1B9A.toInt()
-private const val PEER_BADGE = 0xFF00838F.toInt()
+internal const val PEER_BADGE = 0xFF00838F.toInt()
+internal const val NEAR_BADGE = 0xFFD0503C.toInt()
/** The meta line, followed by small coloured "ESP32" / "INTERNAL" / "VIA <Sentinel>" badges. */
private fun metaWithBadges(row: DeviceRow): CharSequence {
- if (!row.heardByEsp && !row.heardByUsb && !row.heardByUsbBt && !row.heardByPhone && row.heardByPeer == null) return row.meta
+ if (!row.heardByEsp && !row.heardByUsb && !row.heardByUsbBt && !row.heardByPhone && row.heardByPeer == null && row.badges.isEmpty()) return row.meta
val sb = android.text.SpannableStringBuilder(row.meta)
fun badge(label: String, color: Int) {
sb.append(" ")
@@ -74,6 +77,7 @@ private fun metaWithBadges(row: DeviceRow): CharSequence {
if (row.heardByUsbBt) badge("USB BT", USB_BADGE)
if (row.heardByPhone) badge("INTERNAL", PHONE_BADGE)
row.heardByPeer?.let { badge("VIA " + it.uppercase(), PEER_BADGE) }
+ row.badges.forEach { (label, color) -> badge(label, color) }
return sb
}
diff --git a/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt b/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt
index 7516079..d4969af 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/DeviceFilter.kt
@@ -26,6 +26,8 @@ enum class DeviceFilter(val label: String, val liveOnly: Boolean = false) {
CELLS("Cells", liveOnly = true),
/** RTL-SDR radio hits: not devices, listed from the radio log (list only). */
RADIO("Radio", liveOnly = true),
+ /** P25 talkgroups watched or heard close by on the site's input: not devices, from the P25 log (list only). */
+ TALKGROUPS("Talkgroups", liveOnly = true),
/** Waze reports: not devices, drawn on the map from the Waze poll (map only). */
WAZE("Waze", liveOnly = true),
/** Aircraft from the RTL-SDR's ADS-B receiver and the online feeds: not devices (list and map). */
@@ -90,7 +92,7 @@ enum class DeviceFilter(val label: String, val liveOnly: Boolean = false) {
TRACKER_TYPE.containsMatchIn(s.type))
DRONES -> s.hits.any { it.category == Category.DRONE } || s.remoteId || s.type.startsWith("Drone")
NEW -> s.isNew
- CELLS, WAZE, RADIO, AIRCRAFT -> false
+ CELLS, WAZE, RADIO, TALKGROUPS, AIRCRAFT -> false
EXTERNAL -> com.rfsentinel.app.esp.HeardBy.esp.recent(s.mac) || com.rfsentinel.app.esp.HeardBy.usb.recent(s.mac) ||
com.rfsentinel.app.esp.HeardBy.usbBt.recent(s.mac)
SENTINELS -> com.rfsentinel.app.esp.HeardBy.peer.recent(s.mac)
@@ -168,7 +170,7 @@ enum class DeviceFilter(val label: String, val liveOnly: Boolean = false) {
* The main screen's chip order: the counts worth a glance first (flagged, then what's heard on each
* radio), so they fit without scrolling; the narrower filters after them.
*/
- val MAIN_ORDER = listOf(ALL, FLAGGED, BLE, WIFI, CELLS, TRACKERS, DRONES, AIRCRAFT, RADIO, WAZE, EXTERNAL, SENTINELS, FAVORITES, NEW) + KINDS + OTHER
+ val MAIN_ORDER = listOf(ALL, FLAGGED, BLE, WIFI, CELLS, TRACKERS, DRONES, AIRCRAFT, RADIO, TALKGROUPS, WAZE, EXTERNAL, SENTINELS, FAVORITES, NEW) + KINDS + OTHER
/** The chips of a saved snapshot or trace: the main screen's, less those that only mean something live. */
val SAVED_ORDER = MAIN_ORDER.filterNot { it.liveOnly }
diff --git a/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt b/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt
index 1a842fe..28d14a7 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt
@@ -1293,7 +1293,7 @@ class MapFragment : Fragment() {
return
}
// The main screen's order; the choice is shared with it (a trace starts on it, then keeps its own).
- val options = if (tripId == null) DeviceFilter.MAIN_ORDER.filter { it != DeviceFilter.RADIO } else DeviceFilter.SAVED_ORDER
+ val options = if (tripId == null) DeviceFilter.MAIN_ORDER.filter { it != DeviceFilter.RADIO && it != DeviceFilter.TALKGROUPS } else DeviceFilter.SAVED_ORDER
filter = DeviceFilter.parse(Prefs.mapFilter(act)).takeIf { it in options } ?: DeviceFilter.ALL
val group = binding.mapFilterChips
for (f in options) {
@@ -1343,7 +1343,7 @@ class MapFragment : Fragment() {
DeviceFilter.CELLS -> rf?.towerCount ?: 0
DeviceFilter.WAZE -> com.rfsentinel.app.online.WazePolice.latest.size
DeviceFilter.AIRCRAFT -> com.rfsentinel.app.online.PoliceAircraft.all().size
- DeviceFilter.RADIO -> 0
+ DeviceFilter.RADIO, DeviceFilter.TALKGROUPS -> 0
else -> placed.count { f.matches(it) }
}
chip.text = if (f == DeviceFilter.ALL || n > 0) "${f.label} $n" else f.label
diff --git a/app/src/main/java/com/rfsentinel/app/ui/MapShared.kt b/app/src/main/java/com/rfsentinel/app/ui/MapShared.kt
index c716450..a1f9e25 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/MapShared.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/MapShared.kt
@@ -30,7 +30,7 @@ internal object MapPins {
val pos = s.place ?: return@mapNotNull null
val flagged = DeviceColors.isFlagged(s)
val located = s.located?.takeIf { flagged && s.broadcast == null }
- if (!filter.matches(s) || filter == DeviceFilter.RADIO) return@mapNotNull null
+ if (!filter.matches(s) || filter == DeviceFilter.RADIO || filter == DeviceFilter.TALKGROUPS) return@mapNotNull null
val best = s.best
MapPin(
s.mac, pos.lat, pos.lon,
diff --git a/app/src/test/java/com/rfsentinel/app/sdr/P25LogTest.kt b/app/src/test/java/com/rfsentinel/app/sdr/P25LogTest.kt
index bc7c40d..0ac0e9f 100644
--- a/app/src/test/java/com/rfsentinel/app/sdr/P25LogTest.kt
+++ b/app/src/test/java/com/rfsentinel/app/sdr/P25LogTest.kt
@@ -40,6 +40,18 @@ class P25LogTest {
assertEquals(emptyList<P25Log.Row>(), log.rows())
}
+ @Test
+ fun inputCatchMarksItsCall() {
+ val log = P25Log()
+ log.add(P25Tsbk.Grant(0x1002, 2301, null, 1001, false, false), 1_000)
+ log.add(P25Tsbk.Grant(0x1003, null, 77, 1001, false, false), 1_000)
+ log.heardInput(2301, null, 38, 2_000)
+ log.heardInput(null, 77, 25, 3_000)
+ val rows = log.rows().associateBy { it.tg to it.target }
+ assertEquals(2_000L to 38, rows.getValue(2301 to null).let { it.inputAt to it.inputSnr })
+ assertEquals(3_000L to 25, rows.getValue(null to 77).let { it.inputAt to it.inputSnr })
+ }
+
@Test
fun watchedTalkgroups() {
val w = P25Log.watched("1234 Sheriff dispatch\n2001\n 9 - Fire\nnot a number\n70000 too big\n123456 too long")