Commits

iorodeo committed 89c7eb0

Added get-status command.

Comments (0)

Files changed (4)

src/gui/basic_http_server.cpp

         }
         else if (name == QString("get-status"))
         {
-            cmdMap.insert("success", true);
-            cmdMap.insert("message", "");
-            cmdMap.insert("value", "");
+            cmdMap = handleGetStatus();
         }
         else if (name == QString("close"))
         {
     }
 
 
+    QVariantMap BasicHttpServer::handleGetStatus()
+    {
+        QVariantMap cmdMap;
+        QVariantMap statusMap;
+        bool connected = cameraWindowPtr_ -> isConnected();
+        bool capturing = cameraWindowPtr_ -> isCapturing();
+        bool logging = cameraWindowPtr_ -> isLoggingEnabled();
+        unsigned long frameCount = cameraWindowPtr_ -> getFrameCount();
+        statusMap.insert("connected", connected);
+        statusMap.insert("capturing", capturing);
+        statusMap.insert("logging", logging);
+        statusMap.insert("frameCount", qulonglong(frameCount));
+        cmdMap.insert("success", true);
+        cmdMap.insert("message", QString("Status retrieved successfully"));
+        cmdMap.insert("value", statusMap);
+        return cmdMap;
+    }
+
+
     void BasicHttpServer::sendBadRequestResp(QTextStream &os, QString msg)
     { 
 

src/gui/basic_http_server.hpp

             QVariantMap handleLoadConfiguration(QString fileName);
             QVariantMap handleGetCameraGuid();
             QVariantMap handleGetFrameCount();
+            QVariantMap handleGetStatus();
 
             void sendBadRequestResp(QTextStream &os, QString msg);
             void sendRunningResp(QTextStream &os);

src/gui/camera_window.cpp

         if (!imageDispatcherPtr_.isNull())
         {
             imageDispatcherPtr_ -> acquireLock();
+            frameCount_ = imageDispatcherPtr_ -> getFrameCount();
             imageDispatcherPtr_ -> stop();
             imageDispatcherPtr_ -> releaseLock();
 
         statusbarPtr_ -> showMessage(QString("Connected, Stopped"));
         capturing_ = false;
 
+        updateAllImageLabels();
         updateAllMenus();
 
         emit imageCaptureStopped();
         return frameCount_;
     }
 
+
+    bool CameraWindow::isConnected()
+    {
+        return connected_;
+    }
+
+
+    bool CameraWindow::isCapturing()
+    {
+        return capturing_;
+    }
+
+    
+    bool CameraWindow::isLoggingEnabled()
+    {
+        return logging_;
+    }
+
     // Protected methods
     // ----------------------------------------------------------------------------------
 

src/gui/camera_window.hpp

                     QString fileName, 
                     bool showErrorDlg=true
                     );
-
             QString getCameraGuidString(RtnStatus &rtnStatus);
 
             unsigned long getFrameCount();
+            bool isConnected();
+            bool isCapturing();
+            bool isLoggingEnabled();
 
 
         signals: