Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xb826: initial support for ul tx switch #538

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import it.smartphonecombo.uecapabilityparser.model.BwClass
import it.smartphonecombo.uecapabilityparser.model.Capabilities
import it.smartphonecombo.uecapabilityparser.model.Mimo
import it.smartphonecombo.uecapabilityparser.model.UplinkTxSwitchConfig
import it.smartphonecombo.uecapabilityparser.model.UplinkTxSwitchOption
import it.smartphonecombo.uecapabilityparser.model.UplinkTxSwitchType
import it.smartphonecombo.uecapabilityparser.model.bandwidth.Bandwidth
import it.smartphonecombo.uecapabilityparser.model.bandwidth.InvalidBandwidth
import it.smartphonecombo.uecapabilityparser.model.bandwidth.toBandwidth
Expand Down Expand Up @@ -164,17 +167,22 @@
if (version >= 8) {
stream.skipBytes(3)
}

val numComponents = getNumComponents(stream, version)
val bands = mutableListWithCapacity<ComponentLte>(numComponents)
var nrBands = mutableListWithCapacity<ComponentNr>(numComponents)
var nrDcBands = mutableListWithCapacity<ComponentNr>(numComponents)
val ulTxSwitchConfig = if (version >= 13) parseUlTxSwitch(stream) else null

when (version) {
6,
8 -> stream.skipBytes(1)
7 -> stream.skipBytes(3)
in 9..13 -> stream.skipBytes(9)
in 14..Int.MAX_VALUE -> stream.skipBytes(25)
in 9..12 -> stream.skipBytes(9)
13 -> stream.skipBytes(8)
in 14..Int.MAX_VALUE -> stream.skipBytes(24)
}

for (i in 0 until numComponents) {
val component = parseComponent(stream, version)
if (component is ComponentNr) {
Expand Down Expand Up @@ -206,6 +214,8 @@
ComboEnDc(bands, nrBands)
} else if (nrDcBands.isNotEmpty()) {
ComboNrDc(nrBands, nrDcBands)
} else if (ulTxSwitchConfig != null) {
ComboNr(nrBands, uplinkTxSwitch = listOf(ulTxSwitchConfig))
} else {
ComboNr(nrBands)
}
Expand Down Expand Up @@ -582,4 +592,17 @@
val shiftAmount = index - 1
return (1 shl shiftAmount) * 15
}

private fun parseUlTxSwitch(stream: InputStream): UplinkTxSwitchConfig? {
val ulTxSwitch = stream.readUByte().readNBits(2, offset = 2)
val ulTxSwitchOption =
when (ulTxSwitch) {
1 -> UplinkTxSwitchOption.SWITCHED_UL
2 -> UplinkTxSwitchOption.DUAL_UL

Check warning on line 601 in src/main/java/it/smartphonecombo/uecapabilityparser/importer/Import0xB826.kt

View check run for this annotation

Codecov / codecov/patch

src/main/java/it/smartphonecombo/uecapabilityparser/importer/Import0xB826.kt#L601

Added line #L601 was not covered by tests
3 -> UplinkTxSwitchOption.BOTH
else -> return null
}

return UplinkTxSwitchConfig(UplinkTxSwitchType.R16, ulTxSwitchOption)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ internal class Import0xB826Test :
parse("0xB826-v13-SA2.bin", "0xB826-v13-SA2.json")
}

@Test
fun parseV13SAulTxSwitch() {
parse("0xB826-v13-SA-ulTxSwitch.bin", "0xB826-v13-SA-ulTxSwitch.json")
}

@Test
fun parseV13NRDC() {
parse("0xB826-v13-NRDC.bin", "0xB826-v13-NRDC.json")
Expand All @@ -217,6 +222,11 @@ internal class Import0xB826Test :
parse("0xB826-v14-SA.bin", "0xB826-v14-SA.json")
}

@Test
fun parseV14SAulTxSwitch() {
parse("0xB826-v14-SA-ulTxSwitch.bin", "0xB826-v14-SA-ulTxSwitch.json")
}

@Test
fun parseV17NSA() {
parse("0xB826-v17-NSA.bin", "0xB826-v17-NSA.json")
Expand All @@ -228,8 +238,8 @@ internal class Import0xB826Test :
}

@Test
fun parseV17SA2() {
parse("0xB826-v17-SA2.bin", "0xB826-v17-SA2.json")
fun parseV17SAulTxSwitch() {
parse("0xB826-v17-SA-ulTxSwitch.bin", "0xB826-v17-SA-ulTxSwitch.json")
}

@Test
Expand Down
Binary file not shown.
Binary file not shown.
Loading