Switch to side-by-side view

--- a/sc2src/sc2mpd.cpp
+++ b/sc2src/sc2mpd.cpp
@@ -111,7 +111,6 @@
 using namespace OpenHome::TestFramework;
 using namespace OpenHome::Av;
 
-
 class OhmReceiverDriver : public IOhmReceiverDriver, public IOhmMsgProcessor {
 public:
     OhmReceiverDriver(AudioEater* eater, AudioEater::Context *ctxt);
@@ -458,7 +457,7 @@
 
 #define SOCK_PATH "/tmp/sc2mpd.sock"
 #define BUF_SIZE 16
-void HandleUserCmd(OhmReceiver* receiver, const Brx& aUri)
+void HandleUserCmd(OhmReceiver* receiver, AudioEater* audio, const Brx& aUri)
 {
     struct sockaddr_un server_addr, client_addr;
     struct timeval read_timeout;
@@ -521,7 +520,19 @@
                 receiver->Play(aUri);
             else if (strncmp("stop", buf, num_bytes) == 0)
                 receiver->Stop();
-
+            else if (strncmp("state", buf, num_bytes) == 0) {
+                response = "Unknown";
+                if (audio->state) {
+                    switch (audio->state()) {
+                        case AudioEater::AudioState::STOPPED:
+                            response = "Stopped"; break;
+                        case AudioEater::AudioState::PLAYING:
+                            response = "Playing"; break;
+                        case AudioEater::AudioState::UNKNOWN:
+                            break;
+                    }
+                }
+            }
             ssize_t bytes_sent = sendto(sockfd, (const void *)response.c_str(),
                                         response.length(), 0,
                                         (struct sockaddr *)&client_addr, len);
@@ -636,9 +647,10 @@
            ((subnet >> 8) & 0xff) << "." << ((subnet >> 16) & 0xff) << "." <<
            ((subnet >> 24) & 0xff) << endl);
 
-    OhmReceiverDriver* driver = 
-        new OhmReceiverDriver(optionDevice.Value() ? 
-                              &alsaAudioEater : &httpAudioEater, ctxt);
+    AudioEater* eater = optionDevice.Value() ?
+                          &alsaAudioEater : &httpAudioEater;
+
+    OhmReceiverDriver* driver = new OhmReceiverDriver(eater, ctxt);
 
     OhmReceiver* receiver = new OhmReceiver(lib->Env(), adapter, ttl, *driver);
 
@@ -672,7 +684,7 @@
         }
         receiver->Play(uri);
         for (;;) {
-            HandleUserCmd(receiver, uri);
+            HandleUserCmd(receiver, eater, uri);
             if (g_quitrequest) {
                 LOGDEB("Quit requested\n");
                 break;