aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Transceiver52M/Transceiver.cpp27
-rw-r--r--Transceiver52M/Transceiver.h1
2 files changed, 27 insertions, 1 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index f572987..8a53895 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <iomanip> // std::setprecision
+#include <fstream>
#include "Transceiver.h"
#include <Logger.h>
@@ -151,7 +152,7 @@ Transceiver::Transceiver(int wBasePort,
mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface),
rssiOffset(wRssiOffset),
mSPSTx(wSPS), mSPSRx(1), mChans(wChans), mOn(false),
- mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelay(0)
+ mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelay(0), mWriteBurstToDiskMask(0)
{
txFullScale = mRadioInterface->fullScaleInputValue();
rxFullScale = mRadioInterface->fullScaleOutputValue();
@@ -616,6 +617,16 @@ SoftVector *Transceiver::demodulate(TransceiverState *state,
return demodulateBurst(burst, mSPSRx, amp, toa);
}
+void writeToFile(radioVector *radio_burst, size_t chan)
+{
+ GSM::Time time = radio_burst->getTime();
+ std::ostringstream fname;
+ fname << chan << "_" << time.FN() << "_" << time.TN() << ".fc";
+ std::ofstream outfile (fname.str().c_str(), std::ofstream::binary);
+ outfile.write((char*)radio_burst->getVector()->begin(), radio_burst->getVector()->size() * 2 * sizeof(float));
+ outfile.close();
+}
+
/*
* Pull bursts from the FIFO and handle according to the slot
* and burst correlation type. Equalzation is currently disabled.
@@ -643,6 +654,12 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI, bool &i
GSM::Time time = radio_burst->getTime();
CorrType type = expectedCorrType(time, chan);
+ /* Debug: dump bursts to disk */
+ /* bits 0-7 - chan 0 timeslots
+ * bits 8-15 - chan 1 timeslots */
+ if (mWriteBurstToDiskMask & ((1<<time.TN()) << (8*chan)))
+ writeToFile(radio_burst, chan);
+
/* No processing if the timeslot is off.
* Not even power level or noise calculation. */
if (type == OFF) {
@@ -858,6 +875,14 @@ void Transceiver::driveControl(size_t chan)
sprintf(response,"RSP SETSLOT 0 %d %d",timeslot,corrCode);
}
+ else if (strcmp(command,"_SETBURSTTODISKMASK")==0) {
+ // debug command! may change or disapear without notice
+ // set a mask which bursts to dump to disk
+ int mask;
+ sscanf(buffer,"%3s %s %d",cmdcheck,command,&mask);
+ mWriteBurstToDiskMask = mask;
+ sprintf(response,"RSP _SETBURSTTODISKMASK 0 %d",mask);
+ }
else {
LOG(WARNING) << "bogus command " << command << " on control interface.";
sprintf(response,"RSP ERR 1");
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index 45d3980..2816ae5 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -232,6 +232,7 @@ private:
double mRxFreq; ///< the receive frequency
unsigned mTSC; ///< the midamble sequence code
unsigned mMaxExpectedDelay; ///< maximum expected time-of-arrival offset in GSM symbols
+ unsigned mWriteBurstToDiskMask; ///< debug: bitmask to indicate which timeslots to dump to disk
std::vector<TransceiverState> mStates;