neutrino.cpp: log and return messages_return::handled, if msg data was deleted;

add fast-scan update: if version changed on boot,
forced after 30 seconds in standby, and at shutdown
This commit is contained in:
[CST] Focus
2014-04-02 17:09:32 +04:00
parent d18d83fbf3
commit 022608cb98
2 changed files with 65 additions and 21 deletions

View File

@@ -116,6 +116,7 @@
#include <zapit/zapit.h>
#include <zapit/getservices.h>
#include <zapit/satconfig.h>
#include <zapit/scan.h>
#include <zapit/client/zapitclient.h>
#include <linux/reboot.h>
@@ -135,6 +136,7 @@ char zapit_lat[20]="#";
char zapit_long[20]="#";
bool autoshift = false;
uint32_t scrambled_timer;
uint32_t fst_timer;
t_channel_id standby_channel_id = 0;
//NEW
@@ -1857,6 +1859,9 @@ TIMER_START();
CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_NEUTRINO_STARTING));
CVFD::getInstance()->setBacklight(g_settings.backlight_tv);
if (!scanSettings.loadSettings(NEUTRINO_SCAN_SETTINGS_FILE))
dprintf(DEBUG_NORMAL, "Loading of scan settings failed. Using defaults.\n");
/* set service manager options before starting zapit */
CServiceManager::getInstance()->KeepNumbers(g_settings.keep_channel_numbers);
//zapit start parameters
@@ -1896,6 +1901,8 @@ TIMER_START();
InitZapitClient();
g_Zapit->setStandby(false);
CheckFastScan();
//timer start
timer_wakeup = false;//init
wake_up( timer_wakeup );
@@ -1917,21 +1924,9 @@ TIMER_START();
cpuFreq = new cCpuFreqManager();
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
switch (CFEManager::getInstance()->getLiveFE()->getInfo()->type) {
case FE_QPSK:
g_info.delivery_system = DVB_S;
break;
case FE_OFDM:
g_info.delivery_system = DVB_T;
break;
case FE_QAM:
default:
g_info.delivery_system = DVB_C;
break;
}
#if HAVE_COOL_HARDWARE
/* only SAT-hd1 before rev 8 has fan */
g_info.has_fan = (cs_get_revision() < 8 && g_info.delivery_system == DVB_S);
g_info.has_fan = (cs_get_revision() < 8 && CFEManager::getInstance()->getFE(0)->getInfo()->type == FE_QPSK);
#endif
dprintf(DEBUG_NORMAL, "g_info.has_fan: %d\n", g_info.has_fan);
//fan speed
@@ -1952,10 +1947,6 @@ TIMER_START();
CEitManager::getInstance()->Start();
#endif
if (!scanSettings.loadSettings(NEUTRINO_SCAN_SETTINGS_FILE, g_info.delivery_system)) {
dprintf(DEBUG_NORMAL, "Loading of scan settings failed. Using defaults.\n");
}
CVFD::getInstance()->showVolume(g_settings.current_volume);
CVFD::getInstance()->setMuted(current_muted);
@@ -2487,7 +2478,7 @@ void CNeutrinoApp::zapTo(t_channel_id channel_id)
}
}
void CNeutrinoApp::wakeupFromStandby(void)
bool CNeutrinoApp::wakeupFromStandby(void)
{
bool alive = recordingstatus || CEpgScan::getInstance()->Running() ||
CStreamManager::getInstance()->StreamStatus();
@@ -2500,7 +2491,9 @@ void CNeutrinoApp::wakeupFromStandby(void)
}
g_Zapit->setStandby(false);
g_Zapit->getMode();
return true;
}
return false;
}
void CNeutrinoApp::standbyToStandby(void)
@@ -2549,6 +2542,16 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
}
return messages_return::handled;
}
if(data == fst_timer) {
g_RCInput->killTimer(fst_timer);
if (wakeupFromStandby()) {
CheckFastScan(true);
standbyToStandby();
} else if (mode == mode_standby) {
fst_timer = g_RCInput->addTimer(30*1000*1000, true);
}
return messages_return::handled;
}
}
res = res | g_RemoteControl->handleMsg(msg, data);
@@ -3099,9 +3102,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
g_volume->setVolumeExt((int)data);
return messages_return::handled;
}
if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000))
if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) {
INFO("###################################### DELETED msg %x data %x\n", msg, data);
delete [] (unsigned char*) data;
return messages_return::handled;
}
return messages_return::unhandled;
}
@@ -3140,6 +3145,11 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode)
g_Sectionsd->setPauseScanning(true);
saveEpg(true);// true CVFD::MODE_SHUTDOWN
}
/* on shutdown force load new fst */
if (retcode)
CheckFastScan(true, false);
CVFD::getInstance()->setMode(CVFD::MODE_SHUTDOWN);
stop_daemons(true /*retcode*/);//need here for timer_is_rec before saveSetup
@@ -3434,12 +3444,15 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
// Active standby on
powerManager->SetStandby(false, false);
CEpgScan::getInstance()->Start(true);
if (scansettings.fst_version)
fst_timer = g_RCInput->addTimer(30*1000*1000, true);
} else {
// Active standby off
powerManager->SetStandby(false, false);
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
videoDecoder->Standby(false);
CEpgScan::getInstance()->Stop();
g_RCInput->killTimer(fst_timer);
if(init_cec_setting){
//init cec settings
@@ -4208,3 +4221,33 @@ void CNeutrinoApp::Cleanup()
#endif
#endif
}
void CNeutrinoApp::CheckFastScan(bool standby, bool reload)
{
if (scansettings.fst_version) {
g_Zapit->getMode();
INFO("fst version %02x (%s)", scansettings.fst_version, standby ? "force" : "check");
CServiceScan::getInstance()->QuietFastScan(true);
int new_fst = scansettings.fst_version;
if (!standby) {
if (CServiceScan::getInstance()->ReadFstVersion(scansettings.fast_op))
new_fst = CServiceScan::getInstance()->GetFstVersion();
}
if (standby || (new_fst != scansettings.fst_version)) {
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_SATSETUP_FASTSCAN_HEAD));
CHintBox * fhintbox = NULL;
if (!standby) {
fhintbox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SATSETUP_FASTSCAN_HEAD));
fhintbox->paint();
}
if (CServiceScan::getInstance()->ScanFast(scansettings.fast_op, reload)) {
scanSettings.fst_version = CServiceScan::getInstance()->GetFstVersion();
scanSettings.saveSettings(NEUTRINO_SCAN_SETTINGS_FILE);
}
delete fhintbox;
if (standby)
CVFD::getInstance()->setMode(CVFD::MODE_STANDBY);
}
}
}

View File

@@ -130,6 +130,7 @@ private:
void SetupFrameBuffer();
void CmdParser(int argc, char **argv);
void Cleanup();
void CheckFastScan(bool standby = false, bool reload = true);
CNeutrinoApp();
public:
@@ -213,7 +214,7 @@ public:
CPersonalizeGui & getPersonalizeGui() { return personalize; }
bool getChannellistIsVisible() { return channellist_visible; }
void zapTo(t_channel_id channel_id);
void wakeupFromStandby(void);
bool wakeupFromStandby(void);
void standbyToStandby(void);
};
#endif