add suspended status to panel
authorJim Morris <morris@wolfman.com>
Wed, 17 Dec 2014 08:09:08 +0000 (00:09 -0800)
committerJim Morris <morris@wolfman.com>
Wed, 17 Dec 2014 08:09:08 +0000 (00:09 -0800)
src/modules/utils/panel/Panel.cpp
src/modules/utils/panel/Panel.h
src/modules/utils/panel/screens/WatchScreen.cpp
src/modules/utils/player/Player.cpp
src/modules/utils/player/PlayerPublicAccess.h

index 7ed9e06..4de832e 100644 (file)
@@ -594,6 +594,18 @@ bool Panel::is_playing() const
     return false;
 }
 
+bool Panel::is_suspended() const
+{
+    void *returned_data;
+
+    bool ok = PublicData::get_value( player_checksum, is_suspended_checksum, &returned_data );
+    if (ok) {
+        bool b = *static_cast<bool *>(returned_data);
+        return b;
+    }
+    return false;
+}
+
 void  Panel::set_playing_file(string f)
 {
     // just copy the first 20 characters after the first / if there
index dfc2012..8c0daa1 100644 (file)
@@ -75,6 +75,7 @@ class Panel : public Module {
 
         // file playing from sd
         bool is_playing() const;
+        bool is_suspended() const;
         void set_playing_file(string f);
         const char* get_playing_file() { return playing_file; }
 
index 5c1aac5..c83b363 100644 (file)
@@ -290,23 +290,23 @@ void WatchScreen::display_menu_line(uint16_t line)
 
 const char *WatchScreen::get_status()
 {
-    if (THEPANEL->hasMessage()) {
+    if (THEPANEL->hasMessage())
         return THEPANEL->getMessage().c_str();
-    }
 
-    if (THEPANEL->is_halted()) {
+    if (THEPANEL->is_halted())
         return "HALTED Reset or M999";
-    }
 
     if (THEKERNEL->pauser->paused())
         return "Paused";
 
+    if (THEPANEL->is_suspended())
+        return "Suspended";
+
     if (THEPANEL->is_playing())
         return THEPANEL->get_playing_file();
 
-    if (!THEKERNEL->conveyor->is_queue_empty()) {
+    if (!THEKERNEL->conveyor->is_queue_empty())
         return "Printing";
-    }
 
     const char *ip = get_network();
     if (ip == NULL) {
index 711e01a..5429ac8 100644 (file)
@@ -433,9 +433,9 @@ void Player::on_get_public_data(void *argument)
 
     if(!pdr->starts_with(player_checksum)) return;
 
-    if(pdr->second_element_is(is_playing_checksum)) {
+    if(pdr->second_element_is(is_playing_checksum) || pdr->second_element_is(is_suspended_checksum)) {
         static bool bool_data;
-        bool_data = this->playing_file;
+        bool_data = pdr->second_element_is(is_playing_checksum) ? this->playing_file : this->suspended;
         pdr->set_data_ptr(&bool_data);
         pdr->set_taken();
 
index 40ae830..bf81337 100644 (file)
@@ -3,6 +3,7 @@
 
 #define player_checksum           CHECKSUM("player")
 #define is_playing_checksum       CHECKSUM("is_playing")
+#define is_suspended_checksum     CHECKSUM("is_suspended")
 #define abort_play_checksum       CHECKSUM("abort_play")
 #define get_progress_checksum     CHECKSUM("progress")