driveTxPriorityQueue(): use trxd_hdr_common for message parsing

Change-Id: If6a93e2b7fc9ada55edbdd16352cd4f7040e3d2a
This commit is contained in:
Vadim Yanitskiy 2019-07-15 23:53:08 +07:00 committed by Pau Espin Pedrol
parent 8d771d24e7
commit b31232537a
1 changed files with 10 additions and 6 deletions

View File

@ -33,6 +33,7 @@ extern "C" {
#include <osmocom/core/utils.h> #include <osmocom/core/utils.h>
#include <osmocom/core/socket.h> #include <osmocom/core/socket.h>
#include <osmocom/core/bits.h>
} }
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -914,6 +915,8 @@ bool Transceiver::driveTxPriorityQueue(size_t chan)
int msgLen; int msgLen;
int burstLen; int burstLen;
char buffer[EDGE_BURST_NBITS + 50]; char buffer[EDGE_BURST_NBITS + 50];
struct trxd_hdr_common *chdr;
uint32_t fn;
// check data socket // check data socket
msgLen = read(mDataSockets[chan], buffer, sizeof(buffer)); msgLen = read(mDataSockets[chan], buffer, sizeof(buffer));
@ -934,12 +937,13 @@ bool Transceiver::driveTxPriorityQueue(size_t chan)
return false; return false;
} }
int timeSlot = (int) buffer[0]; /* Common header part: HDR version, TDMA TN & FN */
uint32_t frameNum = 0; chdr = (struct trxd_hdr_common *) buffer;
for (int i = 0; i < 4; i++)
frameNum = (frameNum << 8) | (0x0ff & buffer[i+1]);
LOG(DEBUG) << "rcvd. burst at: " << GSM::Time(frameNum,timeSlot); /* Convert TDMA FN to the host endianness */
fn = osmo_load32be(&chdr->fn);
LOG(DEBUG) << "rcvd. burst at: " << GSM::Time(fn, chdr->tn);
int RSSI = (int) buffer[5]; int RSSI = (int) buffer[5];
BitVector newBurst(burstLen); BitVector newBurst(burstLen);
@ -948,7 +952,7 @@ bool Transceiver::driveTxPriorityQueue(size_t chan)
while (itr < newBurst.end()) while (itr < newBurst.end())
*itr++ = *bufferItr++; *itr++ = *bufferItr++;
GSM::Time currTime = GSM::Time(frameNum,timeSlot); GSM::Time currTime = GSM::Time(fn, chdr->tn);
addRadioVector(chan, newBurst, RSSI, currTime); addRadioVector(chan, newBurst, RSSI, currTime);