aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tsou <tom@tsou.cc>2014-10-06 10:38:43 -0700
committerThomas Tsou <tom@tsou.cc>2014-10-06 19:16:20 -0700
commite287598e6b9ebf46c73263f62767250cc96b10ab (patch)
tree92d3253c7e2cf9904e3a082b045e7bb634915fb2
parent98b1af896c3e16bec418af654dd8fc2212c85fc5 (diff)
ms: Add BSIC request command
The GETBSIC command returns 1 if no SCH has been decoded, and 0 with the BSIC value if SCH decoding has been successful. Signed-off-by: Thomas Tsou <tom@tsou.cc>
-rw-r--r--Transceiver52M/Transceiver.cpp11
-rw-r--r--Transceiver52M/Transceiver.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 05f3b16..1e76ec0 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -98,7 +98,8 @@ Transceiver::Transceiver(int wBasePort,
: mBasePort(wBasePort), mAddr(TRXAddress),
mTransmitLatency(wTransmitLatency), mClockSocket(NULL),
mRadioInterface(wRadioInterface), mSPSTx(wSPS), mSPSRx(1), mChans(wChans),
- mOn(false), mTxFreq(0.0), mRxFreq(0.0), mPower(-10), mMaxExpectedDelay(0)
+ mOn(false), mTxFreq(0.0), mRxFreq(0.0), mPower(-10), mMaxExpectedDelay(0),
+ mBSIC(-1)
{
GSM::Time startTime(random() % gHyperframe,0);
@@ -435,6 +436,8 @@ bool Transceiver::decodeSCH(SoftVector *burst, GSM::Time *time)
if (!gsm_sch_decode(info, data)) {
gsm_sch_parse(info, &sch);
+ mBSIC = sch.bsic;
+
std::cout << "SCH : Decoded values" << std::endl;
std::cout << " BSIC: " << sch.bsic << std::endl;
std::cout << " T1 : " << sch.t1 << std::endl;
@@ -851,6 +854,12 @@ void Transceiver::driveControl(size_t chan)
sprintf(response,"RSP SETTSC 0 %d", TSC);
}
}
+ else if (!strcmp(command,"GETBSIC")) {
+ if (mBSIC < 0)
+ sprintf(response, "RSP GETBSIC 1");
+ else
+ sprintf(response, "RSP GETBSIC 0 %d", mBSIC);
+ }
else if (strcmp(command,"SETSLOT")==0) {
// set TSC
int corrCode;
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index 8f3e47b..e31a9a9 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -183,6 +183,7 @@ private:
int mPower; ///< the transmit power in dB
unsigned mTSC; ///< the midamble sequence code
unsigned mMaxExpectedDelay; ///< maximum expected time-of-arrival offset in GSM symbols
+ int mBSIC; ///< MS - detected BSIC
std::vector<TransceiverState> mStates;