Transceiver52M: Implement POWEROFF command
Add stop and restart capability through the POWEROFF and POWERON
commands. Calling stop causes receive streaming to cease, and I/O
threads to shutdown leaving only the control handling thread running.
Upon receiving a POWERON command, I/O threads and device streaming are
restarted.
Proper shutdown of the transceiver is now initiated by the destructor,
which calls the stop command internally to wind down and deallocate
threads.
Signed-off-by: Tom Tsou <tom@tsou.cc>
diff --git a/Transceiver52M/radioClock.cpp b/Transceiver52M/radioClock.cpp
index 710018a..505bb01 100644
--- a/Transceiver52M/radioClock.cpp
+++ b/Transceiver52M/radioClock.cpp
@@ -23,32 +23,27 @@
void RadioClock::set(const GSM::Time& wTime)
{
- mLock.lock();
+ ScopedLock lock(mLock);
mClock = wTime;
updateSignal.signal();
- mLock.unlock();
}
void RadioClock::incTN()
{
- mLock.lock();
+ ScopedLock lock(mLock);
mClock.incTN();
updateSignal.signal();
- mLock.unlock();
}
GSM::Time RadioClock::get()
{
- mLock.lock();
+ ScopedLock lock(mLock);
GSM::Time retVal = mClock;
- mLock.unlock();
-
return retVal;
}
void RadioClock::wait()
{
- mLock.lock();
+ ScopedLock lock(mLock);
updateSignal.wait(mLock,1);
- mLock.unlock();
}