Skip to content

Commit

Permalink
Merge pull request #491 from handymenny/rename-shannonnr
Browse files Browse the repository at this point in the history
Rename ShannonUECapNr to ShannonNrUECap
  • Loading branch information
handymenny authored Sep 30, 2024
2 parents 7e9dbd8 + 493cfa0 commit 938d815
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonComboNr
import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonComponentNr
import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonFeaturePerCCNr
import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonFeatureSetEutra
import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonUECapNr
import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonNrUECap
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromByteArray
import kotlinx.serialization.protobuf.ProtoBuf
Expand All @@ -28,7 +28,7 @@ object ImportShannonNrUeCap : ImportCapabilities {
override fun parse(input: InputSource): Capabilities {
val capabilities = Capabilities()
val byteArray = input.readBytes()
val nrUeCap = ProtoBuf.decodeFromByteArray<ShannonUECapNr>(byteArray)
val nrUeCap = ProtoBuf.decodeFromByteArray<ShannonNrUECap>(byteArray)

capabilities.setMetadata("shannonUeCapVersion", nrUeCap.version)
if (nrUeCap.id != null) capabilities.setMetadata("shannonUeCapId", nrUeCap.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ data class ShannonComponentNr(
* hardcoded elsewhere (see [ShannonFeatureSetEutra]).
*
* For NR this is FeatureSetDownlinkId, the corresponding FeatureSetDownlink is stored in
* [ShannonUECapNr.dlFeatureList].
* [ShannonNrUECap.dlFeatureList].
*
* Note that the index starts from 1 as per 3GPP spec, 0 means DL not supported.
*/
Expand All @@ -46,7 +46,7 @@ data class ShannonComponentNr(
* hardcoded elsewhere (see [ShannonFeatureSetEutra]).
*
* For NR this is FeatureSetUplinkId, the corresponding FeatureSetUplink is stored in
* [ShannonUECapNr.ulFeatureList].
* [ShannonNrUECap.ulFeatureList].
*
* Note that the index starts from 1 as per 3GPP spec, 0 means UL not supported.
*/
Expand All @@ -55,14 +55,14 @@ data class ShannonComponentNr(
/**
* This is a list of FeatureSetDownlinkPerCC-Id per each CC. This only applies to NR.
*
* The corresponding FeatureSetDownlinkPerCC is stored in [ShannonUECapNr.dlFeaturePerCCList].
* The corresponding FeatureSetDownlinkPerCC is stored in [ShannonNrUECap.dlFeaturePerCCList].
*/
@ProtoNumber(6) @ProtoPacked val dlFeaturePerCCIds: List<Long> = emptyList(),

/**
* This is a list of FeatureSetUplinkPerCC-Id per each CC. This only applies to NR.
*
* The corresponding FeatureSetUplinkPerCC are stored in [ShannonUECapNr.ulFeaturePerCCList].
* The corresponding FeatureSetUplinkPerCC are stored in [ShannonNrUECap.ulFeaturePerCCList].
*/
@ProtoNumber(7) @ProtoPacked val ulFeaturePerCCIds: List<Long> = emptyList(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import kotlinx.serialization.protobuf.ProtoNumber
* This work wouldn't have been possible without the help of @NXij.
*/
@Serializable
@SerialName("ShannonUECapNr")
data class ShannonUECapNr(
@SerialName("ShannonNrUECap")
data class ShannonNrUECap(
/** ShannonNrUECap version. */
@ProtoNumber(1) val version: Long = 0,
/** ID assigned to this ShannonNrUECap. */
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/definition/ShannonNrUeCap.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto2";

message ShannonUECapNr {
message ShannonNrUECap {
// ShannonNrUECap version.
optional uint32 version = 1;
// ID assigned to this ShannonNrUECap.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package it.smartphonecombo.uecapabilityparser.model

import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonUECapNr
import it.smartphonecombo.uecapabilityparser.model.shannon.nr.ShannonNrUECap
import java.io.File
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromByteArray
Expand All @@ -13,7 +13,7 @@ import org.junit.jupiter.api.Assertions.assertArrayEquals
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

internal class ShannonUECapNrTest {
internal class ShannonNrUECapTest {

private val resourcesPath = "src/test/resources/shannon/input"
private val oracleJsonPath = "src/test/resources/shannon/oracle"
Expand Down Expand Up @@ -90,19 +90,19 @@ internal class ShannonUECapNrTest {

private fun protobufToJson(inputPath: String, oraclePath: String) {
val inputBinary = File(inputPath).readBytes()
val nrUECap = ProtoBuf.decodeFromByteArray<ShannonUECapNr>(inputBinary)
val nrUECap = ProtoBuf.decodeFromByteArray<ShannonNrUECap>(inputBinary)

val oracleText = File(oraclePath).readText()
val oracleObject = Json.decodeFromString<ShannonUECapNr>(oracleText)
val oracleObject = Json.decodeFromString<ShannonNrUECap>(oracleText)

assertEquals(oracleObject, nrUECap)
}

private fun reEncodeProtobuf(inputPath: String) {
val inputBinary = File(inputPath).readBytes()
val nrUECap = ProtoBuf.decodeFromByteArray<ShannonUECapNr>(inputBinary)
val nrUECap = ProtoBuf.decodeFromByteArray<ShannonNrUECap>(inputBinary)

val reEncodedBinary = ProtoBuf.encodeToByteArray<ShannonUECapNr>(nrUECap)
val reEncodedBinary = ProtoBuf.encodeToByteArray<ShannonNrUECap>(nrUECap)

assertArrayEquals(inputBinary, reEncodedBinary)
}
Expand Down

0 comments on commit 938d815

Please sign in to comment.