diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 3f58b5ac2..a154aa165 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1788,7 +1788,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * int mode = channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE ? NeutrinoModes::mode_tv : NeutrinoModes::mode_radio; - printf("%s channel_id %" PRIx64 " mode %d\n", __func__, channel_id, mode); + printf("%s channel_id %" PRIx64 " mode %s\n", __func__, channel_id, neutrinoMode_to_string(mode)); last_mode = CNeutrinoApp::getInstance()->getMode(); if(last_mode == NeutrinoModes::mode_standby && recmap.empty()) { @@ -1833,7 +1833,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * printf("%s found same tp, zapTo_record channel_id %" PRIx64 " result %d\n", __func__, channel_id, ret); } else { - printf("%s mode %d last_mode %d getLastMode %d\n", __FUNCTION__, mode, last_mode, CNeutrinoApp::getInstance()->getLastMode()); + printf("%s mode %s last_mode %s getLastMode %s\n", __FUNCTION__, neutrinoMode_to_string(mode), neutrinoMode_to_string(last_mode), neutrinoMode_to_string(CNeutrinoApp::getInstance()->getLastMode())); StopAutoRecord(false); if (mode != last_mode && (last_mode != NeutrinoModes::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoModes::norezap ); @@ -1882,7 +1882,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * } else if(!ret && mode_changed /*mode != last_mode*/) CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , last_mode); - printf("%s channel_id %" PRIx64 " mode %d : result %s\n", __func__, channel_id, mode, ret ? "OK" : "BAD"); + printf("%s channel_id %" PRIx64 " mode %s : result %s\n", __func__, channel_id, neutrinoMode_to_string(mode), ret ? "OK" : "BAD"); return ret; } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 8b0d7decc..19076adc0 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -310,7 +310,7 @@ void CMoviePlayerGui::cutNeutrino() m_ThisMode = NeutrinoModes::mode_unknown; m_LastMode = CNeutrinoApp::getInstance()->getMode(); - printf("%s: last mode %d\n", __func__, m_LastMode);fflush(stdout); + printf("%s: last mode %s\n", __func__, neutrinoMode_to_string(m_LastMode));fflush(stdout); if (isWebChannel) { bool isRadioMode = (m_LastMode == NeutrinoModes::mode_radio || m_LastMode == NeutrinoModes::mode_webradio); @@ -321,8 +321,8 @@ void CMoviePlayerGui::cutNeutrino() { m_ThisMode = NeutrinoModes::mode_ts; } - printf("%s: this mode %d\n", __func__, m_ThisMode);fflush(stdout); - printf("%s: save mode %x\n", __func__, m_LastMode);fflush(stdout); + printf("%s: this mode %s\n", __func__, neutrinoMode_to_string(m_ThisMode));fflush(stdout); + printf("%s: save mode %s\n", __func__, neutrinoMode_to_string(m_LastMode));fflush(stdout); CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::norezap | m_ThisMode); } @@ -358,7 +358,7 @@ void CMoviePlayerGui::restoreNeutrino() #else CZapit::getInstance()->EnablePlayback(true); #endif - printf("%s: restore mode %x\n", __func__, m_LastMode);fflush(stdout); + printf("%s: restore mode %s\n", __func__, neutrinoMode_to_string(m_LastMode));fflush(stdout); #if 0 if (m_LastMode == NeutrinoModes::mode_tv) g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x200, false); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 8e70f5cd2..54506f3ea 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4546,7 +4546,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::CHANGEMODE ) { - printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", (int)(data & NeutrinoModes::mode_mask), (data & NeutrinoModes::norezap) != NeutrinoModes::norezap); + printf("CNeutrinoApp::handleMsg: CHANGEMODE to %s rezap %d\n", neutrinoMode_to_string(data & NeutrinoModes::mode_mask), (data & NeutrinoModes::norezap) != NeutrinoModes::norezap); if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_radio) { if( mode != NeutrinoModes::mode_radio ) { radioMode((data & NeutrinoModes::norezap) != NeutrinoModes::norezap); @@ -4891,7 +4891,7 @@ void CNeutrinoApp::tvMode( bool rezap ) CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); rezap = true; } - INFO("rezap %d current mode %d", rezap, mode); + INFO("rezap %d current mode %s", rezap, neutrinoMode_to_string(mode)); if (mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) { if (g_settings.radiotext_enable && g_Radiotext) { delete g_Radiotext; @@ -5177,7 +5177,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) void CNeutrinoApp::radioMode( bool rezap) { //printf("radioMode: rezap %s\n", rezap ? "yes" : "no"); - INFO("rezap %d current mode %d", rezap, mode); + INFO("rezap %d current mode %s", rezap, neutrinoMode_to_string(mode)); if (mode == NeutrinoModes::mode_webtv) { CMoviePlayerGui::getInstance().setLastMode(NeutrinoModes::mode_unknown); CMoviePlayerGui::getInstance().stopPlayBack(); diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 66a3425d2..d05ea34a1 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -26,6 +26,7 @@ #endif #include +#include #include #include #include @@ -50,6 +51,7 @@ #include "debug.h" #include #include +#include #include //#include #include @@ -73,6 +75,47 @@ using namespace std; #define MD5_DIGEST_LENGTH 16 #include +const char* neutrinoMode_to_string(int mode) +{ + std::stringstream s; + + switch (mode) + { + case NeutrinoModes::mode_unknown: + return "MODE_UNKOWN"; + case NeutrinoModes::mode_tv: + return "MODE_TV"; + case NeutrinoModes::mode_radio: + return "MODE_RADIO"; + case NeutrinoModes::mode_avinput: + return "MODE_AVINPUT"; + case NeutrinoModes::mode_standby: + return "MODE_STANDBY"; + case NeutrinoModes::mode_audio: + return "MODE_AUDIO"; + case NeutrinoModes::mode_pic: + return "MODE_PIC"; + case NeutrinoModes::mode_ts: + return "MODE_TS"; + case NeutrinoModes::mode_off: + return "MODE_OFF"; + case NeutrinoModes::mode_webtv: + return "MODE_WEBTV"; + case NeutrinoModes::mode_upnp: + return "MODE_UPNP"; + case NeutrinoModes::mode_webradio: + return "MODE_WEBRADIO"; + case (int)NeutrinoModes::mode_mask: + return "MODE_MASK"; + case (int)NeutrinoModes::norezap: + return "NO_REZAP"; + default: + s << std::hex << mode; + std::string res = s.str(); + return res.c_str(); + } +} + int mySleep(int sec) { struct timeval timeout; diff --git a/src/system/helpers.h b/src/system/helpers.h index f3372ee0e..8a1ab923f 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -86,6 +86,7 @@ time_t toEpoch(std::string &date); const char *cstr_replace(const char *search, const char *replace, const char *text); std::string& str_replace(const std::string &search, const std::string &replace, std::string &text); std::string& htmlEntityDecode(std::string& text); +const char* neutrinoMode_to_string(int mode); struct helpersDebugInfo { std::string msg;