neutrino: refactor the PROGRAMLOCKSTATUS code

Rewrite the NeutrinoMessages::EVT_PROGRAMLOCKSTATUS handling code to
be more readable and understandable. Should be functionally equivalent.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1230 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: 696e168de7
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-02-27 (Sun, 27 Feb 2011)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2011-02-27 21:19:35 +00:00
parent 01d7e96cc1
commit 0f12a3320e

View File

@@ -874,53 +874,64 @@ bool CChannelList::showInfo(int pos, int epgpos)
int CChannelList::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) int CChannelList::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
{ {
if ( msg == NeutrinoMessages::EVT_PROGRAMLOCKSTATUS) { bool startvideo = true;
if (msg != NeutrinoMessages::EVT_PROGRAMLOCKSTATUS) // right now the only message handled here.
return messages_return::unhandled;
//printf("===> program-lock-status: %d zp: %d\n", data, zapProtection != NULL);
if (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_NEVER)
goto out;
// 0x100 als FSK-Status zeigt an, dass (noch) kein EPG zu einem Kanal der NICHT angezeigt // 0x100 als FSK-Status zeigt an, dass (noch) kein EPG zu einem Kanal der NICHT angezeigt
// werden sollte (vorgesperrt) da ist // werden sollte (vorgesperrt) da ist
// oder das bouquet des Kanals ist vorgesperrt // oder das bouquet des Kanals ist vorgesperrt
//printf("program-lock-status: %d\n", data); if (zapProtection != NULL) {
if ((g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_ONSIGNAL) || (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED))
{
if ( zapProtection != NULL )
zapProtection->fsk = data; zapProtection->fsk = data;
else { startvideo = false;
goto out;
}
// require password if either // require password if either
// CHANGETOLOCK mode and channel/bouquet is pre locked (0x100) // CHANGETOLOCK mode and channel/bouquet is pre locked (0x100)
// ONSIGNAL mode and fsk(data) is beyond configured value // ONSIGNAL mode and fsk(data) is beyond configured value
// if programm has already been unlocked, dont require pin // if program has already been unlocked, dont require pin
#if 1 if (data < (neutrino_msg_data_t)g_settings.parentallock_lockage)
if ((data >= (neutrino_msg_data_t)g_settings.parentallock_lockage) && goto out;
((chanlist[selected]->last_unlocked_EPGid != g_RemoteControl->current_EPGid) || (g_RemoteControl->current_EPGid == 0)) &&
((g_settings.parentallock_prompt != PARENTALLOCK_PROMPT_CHANGETOLOCKED) || (data >= 0x100))) /* already unlocked */
{ if (chanlist[selected]->last_unlocked_EPGid == g_RemoteControl->current_EPGid && g_RemoteControl->current_EPGid != 0)
goto out;
/* PARENTALLOCK_PROMPT_CHANGETOLOCKED: only pre-locked channels, don't care for fsk sent in SI */
if (g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED && data < 0x100)
goto out;
/* OK, let's ask for a PIN */
g_RemoteControl->stopvideo(); g_RemoteControl->stopvideo();
//printf("stopped video\n");
startvideo = false;
zapProtection = new CZapProtection(g_settings.parentallock_pincode, data); zapProtection = new CZapProtection(g_settings.parentallock_pincode, data);
if (zapProtection->check()) if (zapProtection->check())
{ {
g_RemoteControl->startvideo(); //printf("checked true\n");
// remember it for the next time // remember it for the next time
chanlist[selected]->last_unlocked_EPGid= g_RemoteControl->current_EPGid; chanlist[selected]->last_unlocked_EPGid= g_RemoteControl->current_EPGid;
startvideo = true;
} }
delete zapProtection; delete zapProtection;
zapProtection = NULL; zapProtection = NULL;
}
else out:
g_RemoteControl->startvideo(); if (startvideo)
#endif
}
}
else
g_RemoteControl->startvideo(); g_RemoteControl->startvideo();
return messages_return::handled; return messages_return::handled;
} }
else
return messages_return::unhandled;
}
/* bToo default to true */ /* bToo default to true */
/* TODO make this member of CNeutrinoApp, because this only called from "whole" list ? */ /* TODO make this member of CNeutrinoApp, because this only called from "whole" list ? */
bool CChannelList::adjustToChannelID(const t_channel_id channel_id, bool bToo) bool CChannelList::adjustToChannelID(const t_channel_id channel_id, bool bToo)