- more readability for modes while logging

This commit is contained in:
GetAway
2022-03-27 20:35:54 +02:00
parent 980d348191
commit bf1375e9bb
5 changed files with 54 additions and 10 deletions

View File

@@ -1701,7 +1701,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend *
int mode = channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE ? int mode = channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE ?
NeutrinoModes::mode_tv : NeutrinoModes::mode_radio; 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(); last_mode = CNeutrinoApp::getInstance()->getMode();
if(last_mode == NeutrinoModes::mode_standby && recmap.empty()) { if(last_mode == NeutrinoModes::mode_standby && recmap.empty()) {
@@ -1746,7 +1746,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); printf("%s found same tp, zapTo_record channel_id %" PRIx64 " result %d\n", __func__, channel_id, ret);
} }
else { 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); StopAutoRecord(false);
if (mode != last_mode && (last_mode != NeutrinoModes::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { if (mode != last_mode && (last_mode != NeutrinoModes::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) {
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoModes::norezap ); CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoModes::norezap );
@@ -1795,7 +1795,7 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend *
} else if(!ret && mode_changed /*mode != last_mode*/) } else if(!ret && mode_changed /*mode != last_mode*/)
CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , 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; return ret;
} }

View File

@@ -311,7 +311,7 @@ void CMoviePlayerGui::cutNeutrino()
m_ThisMode = NeutrinoModes::mode_unknown; m_ThisMode = NeutrinoModes::mode_unknown;
m_LastMode = CNeutrinoApp::getInstance()->getMode(); 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) if (isWebChannel)
{ {
bool isRadioMode = (m_LastMode == NeutrinoModes::mode_radio || m_LastMode == NeutrinoModes::mode_webradio); bool isRadioMode = (m_LastMode == NeutrinoModes::mode_radio || m_LastMode == NeutrinoModes::mode_webradio);
@@ -322,8 +322,8 @@ void CMoviePlayerGui::cutNeutrino()
{ {
m_ThisMode = NeutrinoModes::mode_ts; m_ThisMode = NeutrinoModes::mode_ts;
} }
printf("%s: this mode %d\n", __func__, m_ThisMode);fflush(stdout); printf("%s: this mode %s\n", __func__, neutrinoMode_to_string(m_ThisMode));fflush(stdout);
printf("%s: save mode %x\n", __func__, m_LastMode);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); CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::norezap | m_ThisMode);
} }
@@ -359,7 +359,7 @@ void CMoviePlayerGui::restoreNeutrino()
#else #else
CZapit::getInstance()->EnablePlayback(true); CZapit::getInstance()->EnablePlayback(true);
#endif #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 0
if (m_LastMode == NeutrinoModes::mode_tv) if (m_LastMode == NeutrinoModes::mode_tv)
g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x200, false); g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x200, false);

View File

@@ -4542,7 +4542,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
return messages_return::handled; return messages_return::handled;
} }
else if( msg == NeutrinoMessages::CHANGEMODE ) { 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((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_radio) {
if( mode != NeutrinoModes::mode_radio ) { if( mode != NeutrinoModes::mode_radio ) {
radioMode((data & NeutrinoModes::norezap) != NeutrinoModes::norezap); radioMode((data & NeutrinoModes::norezap) != NeutrinoModes::norezap);
@@ -4883,7 +4883,7 @@ void CNeutrinoApp::tvMode( bool rezap )
CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); CVFD::getInstance()->ShowIcon(FP_ICON_TV, false);
rezap = true; 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 (mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) {
if (g_settings.radiotext_enable && g_Radiotext) { if (g_settings.radiotext_enable && g_Radiotext) {
delete g_Radiotext; delete g_Radiotext;
@@ -5169,7 +5169,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
void CNeutrinoApp::radioMode( bool rezap) void CNeutrinoApp::radioMode( bool rezap)
{ {
//printf("radioMode: rezap %s\n", rezap ? "yes" : "no"); //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) { if (mode == NeutrinoModes::mode_webtv) {
CMoviePlayerGui::getInstance().setLastMode(NeutrinoModes::mode_unknown); CMoviePlayerGui::getInstance().setLastMode(NeutrinoModes::mode_unknown);
CMoviePlayerGui::getInstance().stopPlayBack(); CMoviePlayerGui::getInstance().stopPlayBack();

View File

@@ -26,6 +26,7 @@
#endif #endif
#include <iostream> #include <iostream>
#include <sstream>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -50,6 +51,7 @@
#include "debug.h" #include "debug.h"
#include <global.h> #include <global.h>
#include <neutrinoMessages.h>
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
//#include <driver/framebuffer.h> //#include <driver/framebuffer.h>
#include <system/helpers.h> #include <system/helpers.h>
@@ -73,6 +75,47 @@ using namespace std;
#include <gui/widget/hintbox.h> #include <gui/widget/hintbox.h>
#endif #endif
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) { int mySleep(int sec) {
struct timeval timeout; struct timeval timeout;

View File

@@ -84,6 +84,7 @@ time_t toEpoch(std::string &date);
const char *cstr_replace(const char *search, const char *replace, const char *text); 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& str_replace(const std::string &search, const std::string &replace, std::string &text);
std::string& htmlEntityDecode(std::string& text); std::string& htmlEntityDecode(std::string& text);
const char* neutrinoMode_to_string(int mode);
struct helpersDebugInfo { struct helpersDebugInfo {
std::string msg; std::string msg;