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/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index d67b486..369f2ac 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -171,15 +171,20 @@
   return mRadio->setRxFreq(freq, chan);
 }
 
-
-void RadioInterface::start()
+bool RadioInterface::start()
 {
-  LOG(INFO) << "Starting radio";
+  if (mOn)
+    return true;
+
+  LOG(INFO) << "Starting radio device";
 #ifdef USRP1
   mAlignRadioServiceLoopThread.start((void * (*)(void*))AlignRadioServiceLoopAdapter,
                                      (void*)this);
 #endif
-  mRadio->start();
+
+  if (!mRadio->start())
+    return false;
+
   writeTimestamp = mRadio->initialWriteTimestamp();
   readTimestamp = mRadio->initialReadTimestamp();
 
@@ -188,6 +193,23 @@
 
   mOn = true;
   LOG(INFO) << "Radio started";
+  return true;
+}
+
+/*
+ * Stop the radio device
+ *
+ * This is a pass-through call to the device interface. Because the underlying
+ * stop command issuance generally doesn't return confirmation on device status,
+ * this call will only return false if the device is already stopped.
+ */
+bool RadioInterface::stop()
+{
+  if (!mOn || !mRadio->stop())
+    return false;
+
+  mOn = false;
+  return true;
 }
 
 #ifdef USRP1