driveTxPriorityQueue(): use trxd_hdr_common for message parsing

Change-Id: If6a93e2b7fc9ada55edbdd16352cd4f7040e3d2a
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 1e0339b..368ed3f 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -33,6 +33,7 @@
 
 #include <osmocom/core/utils.h>
 #include <osmocom/core/socket.h>
+#include <osmocom/core/bits.h>
 }
 
 #ifdef HAVE_CONFIG_H
@@ -914,6 +915,8 @@
   int msgLen;
   int burstLen;
   char buffer[EDGE_BURST_NBITS + 50];
+  struct trxd_hdr_common *chdr;
+  uint32_t fn;
 
   // check data socket
   msgLen = read(mDataSockets[chan], buffer, sizeof(buffer));
@@ -934,12 +937,13 @@
     return false;
   }
 
-  int timeSlot = (int) buffer[0];
-  uint32_t frameNum = 0;
-  for (int i = 0; i < 4; i++)
-    frameNum = (frameNum << 8) | (0x0ff & buffer[i+1]);
+  /* Common header part: HDR version, TDMA TN & FN */
+  chdr = (struct trxd_hdr_common *) buffer;
 
-  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];
   BitVector newBurst(burstLen);
@@ -948,7 +952,7 @@
   while (itr < newBurst.end())
     *itr++ = *bufferItr++;
 
-  GSM::Time currTime = GSM::Time(frameNum,timeSlot);
+  GSM::Time currTime = GSM::Time(fn, chdr->tn);
 
   addRadioVector(chan, newBurst, RSSI, currTime);