mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-09 22:58:28 +02:00
pzapit: add -lockrc/-unlockrc options; port from martii
I've pulled it from Duckbox-Developers/neutrino-mp-cst-next
and modified it to work
Origin commit data
------------------
Commit: 0330515abc
Author: GetAway <get-away@t-online.de>
Date: 2016-12-11 (Sun, 11 Dec 2016)
This commit is contained in:
@@ -278,21 +278,36 @@ CRCInput::~CRCInput()
|
|||||||
* stopInput - stop reading rcin for plugins
|
* stopInput - stop reading rcin for plugins
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
void CRCInput::stopInput()
|
void CRCInput::stopInput(const bool ext)
|
||||||
{
|
{
|
||||||
|
if (isLocked())
|
||||||
|
return;
|
||||||
|
|
||||||
input_stopped = true;
|
input_stopped = true;
|
||||||
close();
|
close();
|
||||||
|
if (ext)
|
||||||
|
postMsg(NeutrinoMessages::LOCK_RC_EXTERN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRCInput::isLocked(void)
|
||||||
|
{
|
||||||
|
return input_stopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* restartInput - restart reading rcin after calling plugins
|
* restartInput - restart reading rcin after calling plugins
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
void CRCInput::restartInput()
|
void CRCInput::restartInput(const bool ext)
|
||||||
{
|
{
|
||||||
|
if (!isLocked())
|
||||||
|
return;
|
||||||
|
|
||||||
close();
|
close();
|
||||||
open();
|
open();
|
||||||
input_stopped = false;
|
input_stopped = false;
|
||||||
|
if (ext)
|
||||||
|
postMsg(NeutrinoMessages::UNLOCK_RC_EXTERN, 0);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
//never used
|
//never used
|
||||||
|
@@ -278,8 +278,9 @@ class CRCInput
|
|||||||
{
|
{
|
||||||
return fd_rc[0];
|
return fd_rc[0];
|
||||||
}
|
}
|
||||||
void stopInput();
|
void stopInput(const bool ext = false);
|
||||||
void restartInput();
|
void restartInput(const bool ext = false);
|
||||||
|
bool isLocked(void);
|
||||||
|
|
||||||
uint64_t repeat_block;
|
uint64_t repeat_block;
|
||||||
uint64_t repeat_block_generic;
|
uint64_t repeat_block_generic;
|
||||||
|
@@ -3394,6 +3394,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
|
|||||||
CRCLock::getInstance()->exec(NULL, CRCLock::NO_USER_INPUT);
|
CRCLock::getInstance()->exec(NULL, CRCLock::NO_USER_INPUT);
|
||||||
return messages_return::handled;
|
return messages_return::handled;
|
||||||
}
|
}
|
||||||
|
else if (msg == NeutrinoMessages::LOCK_RC_EXTERN || msg == NeutrinoMessages::UNLOCK_RC_EXTERN)
|
||||||
|
{
|
||||||
|
printf("CNeutrinoApp::handleMsg: RC is %s now\n", msg == NeutrinoMessages::LOCK_RC_EXTERN ? "LOCKED" : "UNLOCKED");
|
||||||
|
return messages_return::handled;
|
||||||
|
}
|
||||||
else if( msg == NeutrinoMessages::CHANGEMODE ) {
|
else if( msg == NeutrinoMessages::CHANGEMODE ) {
|
||||||
printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", data & mode_mask, (data & norezap) != norezap);
|
printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", data & mode_mask, (data & norezap) != norezap);
|
||||||
if((data & mode_mask)== mode_radio) {
|
if((data & mode_mask)== mode_radio) {
|
||||||
|
@@ -71,10 +71,13 @@ struct NeutrinoMessages {
|
|||||||
REMIND = CRCInput::RC_Messages + 18,
|
REMIND = CRCInput::RC_Messages + 18,
|
||||||
LOCK_RC = CRCInput::RC_Messages + 19,
|
LOCK_RC = CRCInput::RC_Messages + 19,
|
||||||
UNLOCK_RC = CRCInput::RC_Messages + 20,
|
UNLOCK_RC = CRCInput::RC_Messages + 20,
|
||||||
REBOOT = CRCInput::RC_Messages + 21,
|
LOCK_RC_EXTERN = CRCInput::RC_Messages + 21,
|
||||||
RELOAD_SETUP = CRCInput::RC_Messages + 22,
|
UNLOCK_RC_EXTERN = CRCInput::RC_Messages + 22,
|
||||||
SHOW_MAINMENU = CRCInput::RC_Messages + 23,
|
REBOOT = CRCInput::RC_Messages + 23,
|
||||||
LEAVE_ALL = CRCInput::RC_Messages + 24,
|
RELOAD_SETUP = CRCInput::RC_Messages + 24,
|
||||||
|
SHOW_MAINMENU = CRCInput::RC_Messages + 25,
|
||||||
|
LEAVE_ALL = CRCInput::RC_Messages + 26,
|
||||||
|
|
||||||
|
|
||||||
EVT_VOLCHANGED = CRCInput::RC_Events + 1,
|
EVT_VOLCHANGED = CRCInput::RC_Events + 1,
|
||||||
EVT_MUTECHANGED = CRCInput::RC_Events + 2,
|
EVT_MUTECHANGED = CRCInput::RC_Events + 2,
|
||||||
|
@@ -150,9 +150,8 @@ class CZapitMessages
|
|||||||
CMD_GET_MODE43 = 109,
|
CMD_GET_MODE43 = 109,
|
||||||
CMD_SET_MODE43 = 110,
|
CMD_SET_MODE43 = 110,
|
||||||
CMD_STOP_PIP = 111,
|
CMD_STOP_PIP = 111,
|
||||||
CMD_ZAPTO_EPG = 112
|
CMD_ZAPTO_EPG = 112,
|
||||||
|
CMD_LOCKRC = 113
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct commandBoolean
|
struct commandBoolean
|
||||||
|
@@ -375,6 +375,9 @@ class CZapitClient:public CBasicClient
|
|||||||
/* get dvb transmission type */
|
/* get dvb transmission type */
|
||||||
delivery_system_t getDeliverySystem(void);
|
delivery_system_t getDeliverySystem(void);
|
||||||
|
|
||||||
|
/* Lock remote control */
|
||||||
|
void lockRc(const bool mute);
|
||||||
|
|
||||||
void zaptoNvodSubService(const int num);
|
void zaptoNvodSubService(const int num);
|
||||||
|
|
||||||
/* send diseqc 1.2 motor command */
|
/* send diseqc 1.2 motor command */
|
||||||
|
@@ -611,6 +611,19 @@ void CZapitClient::getVolume(unsigned int *left, unsigned int *right)
|
|||||||
|
|
||||||
close_connection();
|
close_connection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CZapitClient::lockRc(const bool b)
|
||||||
|
{
|
||||||
|
CZapitMessages::commandBoolean msg;
|
||||||
|
//VALGRIND_PARANOIA;
|
||||||
|
|
||||||
|
msg.truefalse = b;
|
||||||
|
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||||
|
send(CZapitMessages::CMD_LOCKRC, (char*)&msg, sizeof(msg));
|
||||||
|
|
||||||
|
close_connection();
|
||||||
|
}
|
||||||
#if 0
|
#if 0
|
||||||
//never used
|
//never used
|
||||||
delivery_system_t CZapitClient::getDeliverySystem(void)
|
delivery_system_t CZapitClient::getDeliverySystem(void)
|
||||||
|
@@ -70,6 +70,8 @@ int usage (const char * basename)
|
|||||||
std::cout << "switch to pal mode: " << basename << " --pal" << std::endl;
|
std::cout << "switch to pal mode: " << basename << " --pal" << std::endl;
|
||||||
std::cout << "switch to hd 720p mode: " << basename << " --720p" << std::endl;
|
std::cout << "switch to hd 720p mode: " << basename << " --720p" << std::endl;
|
||||||
std::cout << "send diseqc 1.2 motor command: " << basename << " -m <cmdtype> <addr> <cmd> <number of parameters> <parameter 1> <parameter 2>" << std::endl;
|
std::cout << "send diseqc 1.2 motor command: " << basename << " -m <cmdtype> <addr> <cmd> <number of parameters> <parameter 1> <parameter 2>" << std::endl;
|
||||||
|
std::cout << "lock remote control: " << basename << " -lockrc" << std::endl;
|
||||||
|
std::cout << "unlock remote control: " << basename << " -unlockrc" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +94,7 @@ int main (int argc, char** argv)
|
|||||||
int nvod = -1;
|
int nvod = -1;
|
||||||
int arat = -1;
|
int arat = -1;
|
||||||
int m43 = -1;
|
int m43 = -1;
|
||||||
|
int lockrc = -1;
|
||||||
const char * channelName = NULL;
|
const char * channelName = NULL;
|
||||||
|
|
||||||
bool playback = false;
|
bool playback = false;
|
||||||
@@ -351,6 +354,16 @@ int main (int argc, char** argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!strncmp(argv[i], "-lockrc", 7))
|
||||||
|
{
|
||||||
|
lockrc = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (!strncmp(argv[i], "-unlockrc", 9))
|
||||||
|
{
|
||||||
|
lockrc = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (i < argc - 1)
|
else if (i < argc - 1)
|
||||||
{
|
{
|
||||||
if ((sscanf(argv[i], "%d", &bouquet) > 0) && (sscanf(argv[++i], "%u", &channel) > 0))
|
if ((sscanf(argv[i], "%d", &bouquet) > 0) && (sscanf(argv[++i], "%u", &channel) > 0))
|
||||||
@@ -418,6 +431,11 @@ int main (int argc, char** argv)
|
|||||||
zapit.setVolume(volume, volume);
|
zapit.setVolume(volume, volume);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (lockrc != -1)
|
||||||
|
{
|
||||||
|
zapit.lockRc(lockrc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (rezap)
|
if (rezap)
|
||||||
{
|
{
|
||||||
zapit.Rezap();
|
zapit.Rezap();
|
||||||
|
@@ -1862,6 +1862,17 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CZapitMessages::CMD_LOCKRC: {
|
||||||
|
CZapitMessages::commandBoolean msgBoolean;
|
||||||
|
CBasicServer::receive_data(connfd, &msgBoolean, sizeof(msgBoolean));
|
||||||
|
extern CRCInput *g_RCInput;
|
||||||
|
if (msgBoolean.truefalse)
|
||||||
|
g_RCInput->stopInput(true);
|
||||||
|
else
|
||||||
|
g_RCInput->restartInput(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CZapitMessages::CMD_SET_VOLUME: {
|
case CZapitMessages::CMD_SET_VOLUME: {
|
||||||
CZapitMessages::commandVolume msgVolume;
|
CZapitMessages::commandVolume msgVolume;
|
||||||
CBasicServer::receive_data(connfd, &msgVolume, sizeof(msgVolume));
|
CBasicServer::receive_data(connfd, &msgVolume, sizeof(msgVolume));
|
||||||
|
Reference in New Issue
Block a user