diff options
author | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2013-04-08 00:11:56 +0200 |
---|---|---|
committer | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2013-06-24 01:46:33 +0400 |
commit | 8f47387777a182562d3a9b2e21f48822dc4ebb0f (patch) | |
tree | 366767c9143bc72aa1f32a306b1573d6c2286e49 /Transceiver52M | |
parent | c707f42396f85352c479ba08c03047def0c5b9f2 (diff) |
Transceiver52M: Check for correctly set TSC before setting timeslot types.
Diffstat (limited to 'Transceiver52M')
-rw-r--r-- | Transceiver52M/Transceiver.cpp | 11 | ||||
-rw-r--r-- | Transceiver52M/Transceiver.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index df7c619..47da48a 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -55,7 +55,8 @@ Transceiver::Transceiver(int wBasePort, RadioInterface *wRadioInterface) :mDataSocket(wBasePort+2,TRXAddress,wBasePort+102), mControlSocket(wBasePort+1,TRXAddress,wBasePort+101), - mClockSocket(wBasePort,TRXAddress,wBasePort+100) + mClockSocket(wBasePort,TRXAddress,wBasePort+100), + mTSC(-1) { //GSM::Time startTime(0,0); //GSM::Time startTime(gHyperframe/2 - 4*216*60,0); @@ -506,7 +507,7 @@ void Transceiver::driveControl() } else if (strcmp(command,"POWERON")==0) { // turn on transmitter/demod - if (!mTxFreq || !mRxFreq) + if (!mTxFreq || !mRxFreq || (mTSC<0)) sprintf(response,"RSP POWERON 1"); else { sprintf(response,"RSP POWERON 0"); @@ -602,7 +603,7 @@ void Transceiver::driveControl() // set TSC int TSC; sscanf(buffer,"%3s %s %d",cmdcheck,command,&TSC); - if (mOn) + if (mOn || (TSC<0) || (TSC>7)) sprintf(response,"RSP SETTSC 1 %d",TSC); else { mTSC = TSC; @@ -611,11 +612,11 @@ void Transceiver::driveControl() } } else if (strcmp(command,"SETSLOT")==0) { - // set TSC + // set slot type int corrCode; int timeslot; sscanf(buffer,"%3s %s %d %d",cmdcheck,command,×lot,&corrCode); - if ((timeslot < 0) || (timeslot > 7)) { + if ((mTSC<0) || (timeslot < 0) || (timeslot > 7)) { LOG(WARNING) << "bogus message on control interface"; sprintf(response,"RSP SETSLOT 1 %d %d",timeslot,corrCode); return; diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 30eb7b9..b23c3fa 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -133,7 +133,7 @@ private: double mTxFreq; ///< the transmit frequency double mRxFreq; ///< the receive frequency int mPower; ///< the transmit power in dB - unsigned mTSC; ///< the midamble sequence code + int mTSC; ///< the midamble sequence code double mEnergyThreshold; ///< threshold to determine if received data is potentially a GSM burst GSM::Time prevFalseDetectionTime; ///< last timestamp of a false energy detection int fillerModulus[8]; ///< modulus values of all timeslots, in frames |