aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/DriveLoop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Transceiver52M/DriveLoop.cpp')
-rw-r--r--Transceiver52M/DriveLoop.cpp49
1 files changed, 29 insertions, 20 deletions
diff --git a/Transceiver52M/DriveLoop.cpp b/Transceiver52M/DriveLoop.cpp
index e50c5cd..b4541f6 100644
--- a/Transceiver52M/DriveLoop.cpp
+++ b/Transceiver52M/DriveLoop.cpp
@@ -46,18 +46,40 @@ DriveLoop::DriveLoop(int wBasePort, const char *TRXAddress,
mLastClockUpdateTime = mStartTime;
mRadioInterface->getClock()->set(mStartTime);
+ txFullScale = mRadioInterface->fullScaleInputValue();
- // generate pulse and setup up signal processing library
- gsmPulse = generateGSMPulse(2, mSPS);
- LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
- sigProcLibSetup(mSPS);
+ mOn = false;
+}
- txFullScale = mRadioInterface->fullScaleInputValue();
+DriveLoop::~DriveLoop()
+{
+ if (mOn) {
+ mOn = false;
+
+ if (mRadioDriveLoopThread)
+ delete mRadioDriveLoopThread;
+ }
+
+ sigProcLibDestroy();
+}
+
+bool DriveLoop::init()
+{
+ if (!sigProcLibSetup(mSPS)) {
+ LOG(ALERT) << "Failed to initialize signal processing library";
+ return false;
+ }
// initialize filler tables with dummy bursts on C0, empty bursts otherwise
for (int i = 0; i < 8; i++) {
- signalVector* modBurst = modulateBurst(gDummyBurst, *gsmPulse,
+ signalVector* modBurst = modulateBurst(gDummyBurst,
8 + (i % 4 == 0), mSPS);
+ if (!modBurst) {
+ sigProcLibDestroy();
+ LOG(ALERT) << "Failed to initialize filler table";
+ return false;
+ }
+
scaleVector(*modBurst, txFullScale);
for (int j = 0; j < 102; j++) {
for (int n = 0; n < mChanM; n++) {
@@ -75,20 +97,7 @@ DriveLoop::DriveLoop(int wBasePort, const char *TRXAddress,
}
}
- mOn = false;
-}
-
-DriveLoop::~DriveLoop()
-{
- if (mOn) {
- mOn = false;
-
- if (mRadioDriveLoopThread)
- delete mRadioDriveLoopThread;
- }
-
- delete gsmPulse;
- sigProcLibDestroy();
+ return true;
}
void DriveLoop::start()