Skip to content

Commit 631f548

Browse files
fix the encoding format for UMTS Cell ID
Previously, the broadcast value was ~16 times smaller than it should have been. The 28-bit Cell ID is stored in a 32-bit variable, and the 0 padding needs to be at the LSB end rather than the MSB end.
1 parent d528034 commit 631f548

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

UMTS/UMTSConfig.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,9 +1025,11 @@ void BeaconConfig::regenerate()
10251025
// UC-Id or C-Id is used to identify a cell in UTRAN Iub and Iur interfaces or Iur-g interface: UC-Id = RNC-Id + C-Id.
10261026
// (pat) This last does not apply to us because we dont use the Iub/Iur interfaces.
10271027
uint32_t *cellID = RN_CALLOC(uint32_t);
1028-
// (pat) TODO: Is this right? network order is high byte first.
1029-
// Luckily, hardly matters.
1030-
*cellID = htonl(gConfig.getNum("UMTS.Identity.CI"));
1028+
*cellID = gConfig.getNum("UMTS.Identity.CI");
1029+
// UMTS protocol specifies that the cell ID is a 28 bit number, but it is represented as a 32 bit value in memory.
1030+
// The value that is broadcast is the first 28 bits, not the last 28, so the data must be shifted.
1031+
*cellID = *cellID << 4;
1032+
*cellID = htonl(*cellID);
10311033
// cellID is a 28-bit BIT_STRING
10321034
setAsnBIT_STRING(&mSIB3.cellIdentity,(uint8_t*)cellID,28);
10331035
// ASN CellSelectReselectInfoSIB_3_4 cellSelectReselectInfo, 10.3.2.3

0 commit comments

Comments
 (0)