Skip to content

Commit 96ef25a

Browse files
committed
Fix primary cell identification
We ran into an issue that all available cells are not of type "NoneConnection" (available, but not connected), but of type "SecondaryConnection" which made the being identified as connected. Fix this by checking for "PrimaryConnection" type instead of checking for "not NoneConnection". A similar issue war reported to netmonster-core before: mroczis/netmonster-core#53
1 parent 915c12d commit 96ef25a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

app/src/main/java/eu/bschmidt/devicepublisher/model/celldata/CellDataViewModel.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import cz.mroczis.netmonster.core.model.cell.CellLte
1717
import cz.mroczis.netmonster.core.model.cell.CellNr
1818
import cz.mroczis.netmonster.core.model.cell.ICell
1919
import cz.mroczis.netmonster.core.model.connection.NoneConnection
20+
import cz.mroczis.netmonster.core.model.connection.PrimaryConnection
2021
import eu.bschmidt.devicepublisher.MainApplication
2122
import eu.bschmidt.devicepublisher.model.DataViewModelInterface
2223
import eu.bschmidt.devicepublisher.util.DevPubUtils
@@ -43,8 +44,8 @@ data class CellData (
4344
val rssi: Int? = 0,
4445
val rsrq: Double? = 0.0,
4546
val rsrp: Double? = 0.0,
46-
val estimatedDownBandwidth: Int? = 0,
47-
val estimatedUpBandwidth: Int? = 0,
47+
var estimatedDownBandwidth: Int? = 0,
48+
var estimatedUpBandwidth: Int? = 0,
4849
)
4950

5051
class CellDataViewModel : ViewModel(), DataViewModelInterface {
@@ -182,8 +183,8 @@ class CellDataViewModel : ViewModel(), DataViewModelInterface {
182183
rssi = lteCell.signal.rssi,
183184
rsrp = lteCell.signal.rsrp,
184185
rsrq = lteCell.signal.rsrq,
185-
estimatedDownBandwidth = if (cell.connectionStatus != NoneConnection()) down else null,
186-
estimatedUpBandwidth = if (cell.connectionStatus != NoneConnection()) up else null,
186+
estimatedDownBandwidth = null,
187+
estimatedUpBandwidth = null,
187188
)
188189
}
189190
is CellNr -> {
@@ -199,12 +200,14 @@ class CellDataViewModel : ViewModel(), DataViewModelInterface {
199200
rsrp = nrCell.signal.ssRsrp?.toDouble(),
200201
rsrq = nrCell.signal.ssRsrq?.toDouble(),
201202
frequency = nrCell.band!!.downlinkFrequency,
202-
estimatedDownBandwidth = if (cell.connectionStatus != NoneConnection()) down else null,
203-
estimatedUpBandwidth = if (cell.connectionStatus != NoneConnection()) up else null,
203+
estimatedDownBandwidth = null,
204+
estimatedUpBandwidth = null,
204205
)
205206
}
206207
}
207-
if (cell.connectionStatus != NoneConnection()) {
208+
if (cell.connectionStatus is PrimaryConnection) {
209+
cellData.estimatedUpBandwidth = up
210+
cellData.estimatedDownBandwidth = down
208211
conList.add(cellData)
209212
caList.add(cellData)
210213
} else {

0 commit comments

Comments
 (0)