diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 16095b2cd..419cd3769 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -278,21 +278,36 @@ CRCInput::~CRCInput() * stopInput - stop reading rcin for plugins * **************************************************************************/ -void CRCInput::stopInput() +void CRCInput::stopInput(const bool ext) { + if (isLocked()) + return; + input_stopped = true; close(); + if (ext) + postMsg(NeutrinoMessages::LOCK_RC_EXTERN, 0); +} + +bool CRCInput::isLocked(void) +{ + return input_stopped; } /************************************************************************** * restartInput - restart reading rcin after calling plugins * **************************************************************************/ -void CRCInput::restartInput() +void CRCInput::restartInput(const bool ext) { + if (!isLocked()) + return; + close(); open(); input_stopped = false; + if (ext) + postMsg(NeutrinoMessages::UNLOCK_RC_EXTERN, 0); } #if 0 //never used diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index a6d43e9db..0f7869e43 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -278,8 +278,9 @@ class CRCInput { return fd_rc[0]; } - void stopInput(); - void restartInput(); + void stopInput(const bool ext = false); + void restartInput(const bool ext = false); + bool isLocked(void); uint64_t repeat_block; uint64_t repeat_block_generic; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 0ad0a0b10..19f0b71f5 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -529,26 +529,6 @@ void CChannelList::calcSize() else pig_height = 0; infozone_height = height - theight - pig_height - footerHeight; - - ChannelList_Rec = 0; - int icon_w, h; - int recmode_icon_max = 0; - frameBuffer->getIconSize(NEUTRINO_ICON_REC, &icon_w, &h); - recmode_icon_max = std::max(recmode_icon_max, icon_w); - frameBuffer->getIconSize(NEUTRINO_ICON_AUTO_SHIFT, &icon_w, &h); - recmode_icon_max = std::max(recmode_icon_max, icon_w); - frameBuffer->getIconSize(NEUTRINO_ICON_PIP, &icon_w, &h); - recmode_icon_max = std::max(recmode_icon_max, icon_w); - - for (uint32_t i = 0; i < (*chanlist).size(); i++) { - if (CRecordManager::getInstance()->GetRecordMode((*chanlist)[i]->getChannelID()) || - (*chanlist)[i]->getChannelID() == CZapit::getInstance()->GetPipChannelID()) { - ChannelList_Rec = recmode_icon_max; - break; - } - } - if (ChannelList_Rec > 0) - ChannelList_Rec += 8; } bool CChannelList::updateSelection(int newpos) @@ -1937,13 +1917,13 @@ void CChannelList::paintItem(int pos, const bool firstpaint) char nameAndDescription[255]; char tmp[10]; CZapitChannel* chan = (*chanlist)[curr]; - int prg_offset=0; - int title_offset=0; + int prg_offset = 0; + int title_offset = 0; int rec_mode; if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) { prg_offset = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00:00"); - title_offset=6; + title_offset = OFFSET_INNER_SMALL; } snprintf(tmp, sizeof(tmp), "%d", this->historyMode ? pos : chan->number); @@ -1958,52 +1938,99 @@ void CChannelList::paintItem(int pos, const bool firstpaint) rec_mode = CRecordManager::getInstance()->GetRecordMode((*chanlist)[curr]->getChannelID()); //set recording icon - std::string rec_icon; + const char *record_icon = NULL; if (rec_mode & CRecordManager::RECMODE_REC) - rec_icon = NEUTRINO_ICON_REC; + record_icon = NEUTRINO_ICON_REC; else if (rec_mode & CRecordManager::RECMODE_TSHIFT) - rec_icon = NEUTRINO_ICON_AUTO_SHIFT; + record_icon = NEUTRINO_ICON_AUTO_SHIFT; + + //set pip icon + const char *pip_icon = NULL; #ifdef ENABLE_PIP - else if ((*chanlist)[curr]->getChannelID() == CZapit::getInstance()->GetPipChannelID()) - rec_icon = NEUTRINO_ICON_PIP; + if ((*chanlist)[curr]->getChannelID() == CZapit::getInstance()->GetPipChannelID()) + pip_icon = NEUTRINO_ICON_PIP; #endif - //calculating icons - bool isWebTV = !chan->getUrl().empty(); - const char *icon = isWebTV ? NEUTRINO_ICON_STREAMING : NEUTRINO_ICON_SCRAMBLED; - int icon_x = (x+width-15-2) - RADIUS_LARGE/2; - int r_icon_w; int s_icon_h=0; int s_icon_w=0; - frameBuffer->getIconSize(icon, &s_icon_w, &s_icon_h); - r_icon_w = ChannelList_Rec; - int r_icon_x = icon_x; - //paint icon - if(chan->scrambled || isWebTV) - if (frameBuffer->paintIcon(icon, icon_x - s_icon_w, ypos, fheight))//ypos + (fheight - 16)/2); - r_icon_x = r_icon_x - s_icon_w; + //set webtv icon + const char *webtv_icon = NULL; + if (!chan->getUrl().empty()) + webtv_icon = NEUTRINO_ICON_STREAMING; - //paint recording icon - if (!rec_icon.empty()) - frameBuffer->paintIcon(rec_icon, r_icon_x - r_icon_w, ypos, fheight);//ypos + (fheight - 16)/2); + //set scramble icon + const char *scramble_icon = NULL; + if (chan->scrambled) + scramble_icon = NEUTRINO_ICON_SCRAMBLED; + + //calculate and paint right status icons + int icon_w = 0; + int icon_h = 0; + int offset_right = OFFSET_INNER_MID; + int icon_x_right = x + width - 15 - offset_right; + + if (scramble_icon) + { + frameBuffer->getIconSize(scramble_icon, &icon_w, &icon_h); + if (frameBuffer->paintIcon(scramble_icon, icon_x_right - icon_w, ypos, fheight)) + { + offset_right += icon_w + OFFSET_INNER_MID; + icon_x_right -= icon_w + OFFSET_INNER_MID; + } + } + + if (webtv_icon) + { + frameBuffer->getIconSize(webtv_icon, &icon_w, &icon_h); + if (frameBuffer->paintIcon(webtv_icon, icon_x_right - icon_w, ypos, fheight)) + { + offset_right += icon_w + OFFSET_INNER_MID; + icon_x_right -= icon_w + OFFSET_INNER_MID; + } + } + + if (pip_icon) + { + frameBuffer->getIconSize(pip_icon, &icon_w, &icon_h); + if (frameBuffer->paintIcon(pip_icon, icon_x_right - icon_w, ypos, fheight)) + { + offset_right += icon_w + OFFSET_INNER_MID; + icon_x_right -= icon_w + OFFSET_INNER_MID; + } + } + + if (record_icon) + { + frameBuffer->getIconSize(record_icon, &icon_w, &icon_h); + if (frameBuffer->paintIcon(record_icon, icon_x_right - icon_w, ypos, fheight)) + { + offset_right += icon_w + OFFSET_INNER_MID; + icon_x_right -= icon_w + OFFSET_INNER_MID; + } + } //paint buttons if (paintbuttons) paintButtonBar(is_available); - int icon_space = r_icon_w+s_icon_w; - //channel numbers - int icon_w = 0, icon_h = 0; - if (curr == selected && move_state == beMoving) { + if (curr == selected && move_state == beMoving) + { frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icon_w, &icon_h); - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5 + numwidth - icon_w, ypos, fheight); - } else if (edit_state && chan->bLocked) { + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_SMALL + numwidth - icon_w, ypos, fheight); + } + else if (edit_state && chan->bLocked) + { frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icon_w, &icon_h); - frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 5 + numwidth - icon_w, ypos, fheight); - } else if (g_settings.channellist_show_numbers) { - int numpos = x+5+numwidth- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos,ypos+fheight, numwidth+5, tmp, color, fheight); - } else if (!edit_state) + frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_SMALL + numwidth - icon_w, ypos, fheight); + } + else if (g_settings.channellist_show_numbers) + { + int numpos = x + OFFSET_INNER_SMALL + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + fheight, numwidth + 5, tmp, color, fheight); + } + else if (!edit_state) + { numwidth = -5; + } int l=0; if (this->historyMode) @@ -2013,7 +2040,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) int pb_space = prg_offset - title_offset; int pb_height = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getDigitHeight(); - CProgressBar pb(x+5+numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_space + 2, pb_height, COL_MENUCONTENT_PLUS_0); + CProgressBar pb(x + OFFSET_INNER_SMALL + numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_space + 2, pb_height, COL_MENUCONTENT_PLUS_0); pb.setType(CProgressBar::PB_TIMESCALE); pb.setDesign(g_settings.channellist_progressbar_design); pb.setCornerType(0); @@ -2028,14 +2055,13 @@ void CChannelList::paintItem(int pos, const bool firstpaint) pb.doPaintBg(false); int pb_max = pb_space - 4; - if (!(p_event->description.empty())) { + if (!(p_event->description.empty())) + { snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l,g_settings.channellist_epgtext_align_right ? " ":" - "); unsigned int ch_name_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(nameAndDescription); unsigned int ch_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(p_event->description); - int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 20; // 15 = scrollbar, 20 = spaces - if (chan->scrambled || g_settings.channellist_epgtext_align_right) - max_desc_len -= icon_space+g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getWidth(); /* do we need space for the lock/rec icon? */ + int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 2*OFFSET_INNER_MID - offset_right; // 15 = scrollbar if (max_desc_len < 0) max_desc_len = 0; @@ -2048,7 +2074,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) struct tm *pStartZeit = localtime(&p_event->startTime); snprintf(tmp, sizeof(tmp), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x+ 5+ numwidth+ 6, ypos + fheight, width- numwidth- 20- 15 -prg_offset, tmp, ecolor, fheight); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + OFFSET_INNER_SMALL + numwidth + 6, ypos + fheight, width - numwidth - 15 - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight); } else { @@ -2065,18 +2091,20 @@ void CChannelList::paintItem(int pos, const bool firstpaint) } } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10+prg_offset, ypos+ fheight, width- numwidth- 40- 15-prg_offset, nameAndDescription, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + prg_offset, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color); if (g_settings.channellist_epgtext_align_right) { // align right - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 20 - ch_desc_len - icon_space - 4, ypos + fheight, ch_desc_len, p_event->description, ecolor); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 15 - offset_right - ch_desc_len, ypos + fheight, ch_desc_len, p_event->description, ecolor); } else { // align left - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ 5+ numwidth+ 10+ ch_name_len+ 5+prg_offset, ypos+ fheight, ch_desc_len, p_event->description, ecolor); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + ch_name_len + OFFSET_INNER_SMALL + prg_offset, ypos + fheight, ch_desc_len, p_event->description, ecolor); } } - else { - if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) { + else + { + if (g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) + { pb.setValues(0, pb_max); if (g_settings.progressbar_design == CProgressBar::PB_GRAPHIC) //NI graphic pb.setGraphic("progressbar_inactive"); diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 49d057105..2a4058bff 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -133,9 +133,6 @@ private: bool displayList; bool pig_on_win; - int ChannelList_Rec; - - bool headerNew; void paintDetails(int index); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index a8cb33d63..8fbe7d235 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -54,7 +54,7 @@ #include #include #include - +#include #include #include #include @@ -935,11 +935,95 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return res; } + else if (actionKey == "show_records"){ + showRecords(); + return res; + } return showTestMenu(); } +void CTestMenu::showRecords() +{ + CRecordManager * crm = CRecordManager::getInstance(); + + const int box_posX = 30; + const int box_posY = 300; + + if (crm->RecordingStatus()) + { + CComponentsForm *recordsbox = new CComponentsForm(); + recordsbox->setWidth(0); + recordsbox->doPaintBg(false); + recordsbox->setCornerType(CORNER_NONE); + //recordsbox->setColorBody(COL_BACKGROUND_PLUS_0); + + recmap_t recmap = crm->GetRecordMap(); + std::vector images; + CComponentsForm *recline = NULL; + CComponentsText *rec_name = NULL; + int y_recline = 0; + int h_recline = 0; + int w_recbox = 0; + int w_shadow = OFFSET_SHADOW/2; + + for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) + { + CRecordInstance * inst = it->second; + + recline = new CComponentsForm(0, y_recline, 0); + recline->doPaintBg(true); + recline->setColorBody(COL_INFOBAR_PLUS_0); + recline->enableShadow(CC_SHADOW_ON, w_shadow); + recline->setCorner(CORNER_RADIUS_MID); + recordsbox->addCCItem(recline); + + CComponentsPicture *iconf = new CComponentsPicture(OFFSET_INNER_MID, CC_CENTERED, NEUTRINO_ICON_REC, recline, CC_SHADOW_OFF, COL_RED, COL_INFOBAR_PLUS_0); + iconf->setCornerType(CORNER_NONE); + iconf->doPaintBg(true); + iconf->SetTransparent(CFrameBuffer::TM_BLACK); + images.push_back(iconf); + h_recline = iconf->getHeight(); + y_recline += h_recline + w_shadow; + recline->setHeight(h_recline); + + std::string records_msg = inst->GetEpgTitle(); + + rec_name = new CComponentsText(iconf->getWidth()+2*OFFSET_INNER_MID, CC_CENTERED, 0, 0, records_msg, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]); + rec_name->doPaintBg(false); + rec_name->setTextColor(COL_INFOBAR_TEXT); + + recline->setHeight(std::max(rec_name->getHeight(), iconf->getHeight())); + recline->setWidth(OFFSET_INNER_MIN+iconf->getWidth()+OFFSET_INNER_MID+rec_name->getWidth()+OFFSET_INNER_MID); + w_recbox = (std::max(recline->getWidth(), recordsbox->getWidth())); + + recline->addCCItem(rec_name); + + recordsbox->setWidth(std::max(recordsbox->getWidth(), recline->getWidth())); + y_recline += h_recline; + } + + int h_rbox = 0; + for(size_t i = 0; i< recordsbox->size(); i++) + h_rbox += recordsbox->getCCItem(i)->getHeight()+w_shadow; + + recordsbox->setDimensionsAll(box_posX, box_posY, w_recbox+w_shadow, h_rbox); + recordsbox->paint0(); + + for(size_t j = 0; j< images.size(); j++){ + images[j]->kill(); + images[j]->paintBlink(); + } + + ShowHint("Testmenu: Records", "Record test ...", 200, 30, NULL, NEUTRINO_ICON_HINT_RECORDING, CComponentsHeader::CC_BTN_EXIT); + recordsbox->kill(); + delete recordsbox; recordsbox = NULL; + } + else + ShowHint("Testmenu: Records", "No records ...", 200, 30, NULL, NEUTRINO_ICON_HINT_RECORDING, CComponentsHeader::CC_BTN_EXIT); +} + /* shows entries for proxy settings */ int CTestMenu::showTestMenu() { @@ -1011,6 +1095,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarder("Text-Extended", true, NULL, this, "text_ext")); widget->addItem(new CMenuForwarder("Blinking Extended Text", true, NULL, this, "blinking_text_ext")); widget->addItem(new CMenuForwarder("Scrollbar", true, NULL, this, "scrollbar")); + widget->addItem(new CMenuForwarder("Record", true, NULL, this, "show_records")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 1b09192b0..20c4937b1 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -60,6 +60,7 @@ class CTestMenu : public CMenuTarget void showHWTests(CMenuWidget *widget); void showCCTests(CMenuWidget *widget); void showMsgTests(CMenuWidget *widget); + void showRecords(); public: CTestMenu(); ~CTestMenu(); diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index c1c17ce60..6c78b4f48 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -890,11 +890,17 @@ int CTextBox::getLines(const std::string& text) int CTextBox::getMaxLineWidth(const std::string& text, Font* font) { - // if found no linebreak, return pure size only - if (text.find('\n', 0) == std::string::npos) - return font->getRenderWidth(text.c_str()); + std::string txt = text; + if (txt.find('\n', 0) == std::string::npos){ + /* If found no linebreak, return pure size with additional space char. + * Space char simulates a line termination as a workaround to get + * largest possible width. + */ + txt += ' '; + return font->getRenderWidth(txt.c_str()); + } - std::stringstream in (text); + std::stringstream in (txt); if (!in) return 0; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 04146ed3d..0f11dcae3 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3604,6 +3604,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CRCLock::getInstance()->exec(NULL, CRCLock::NO_USER_INPUT); 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 ) { printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", data & mode_mask, (data & norezap) != norezap); if((data & mode_mask)== mode_radio) { diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index 4049ead7e..fe89d019a 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -71,10 +71,13 @@ struct NeutrinoMessages { REMIND = CRCInput::RC_Messages + 18, LOCK_RC = CRCInput::RC_Messages + 19, UNLOCK_RC = CRCInput::RC_Messages + 20, - REBOOT = CRCInput::RC_Messages + 21, - RELOAD_SETUP = CRCInput::RC_Messages + 22, - SHOW_MAINMENU = CRCInput::RC_Messages + 23, - LEAVE_ALL = CRCInput::RC_Messages + 24, + LOCK_RC_EXTERN = CRCInput::RC_Messages + 21, + UNLOCK_RC_EXTERN = CRCInput::RC_Messages + 22, + REBOOT = CRCInput::RC_Messages + 23, + 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_MUTECHANGED = CRCInput::RC_Events + 2, diff --git a/src/zapit/include/zapit/client/msgtypes.h b/src/zapit/include/zapit/client/msgtypes.h index dd479f868..c38b754d5 100644 --- a/src/zapit/include/zapit/client/msgtypes.h +++ b/src/zapit/include/zapit/client/msgtypes.h @@ -150,9 +150,8 @@ class CZapitMessages CMD_GET_MODE43 = 109, CMD_SET_MODE43 = 110, CMD_STOP_PIP = 111, - CMD_ZAPTO_EPG = 112 - - + CMD_ZAPTO_EPG = 112, + CMD_LOCKRC = 113 }; struct commandBoolean diff --git a/src/zapit/include/zapit/client/zapitclient.h b/src/zapit/include/zapit/client/zapitclient.h index 0995abf1f..47a90177c 100644 --- a/src/zapit/include/zapit/client/zapitclient.h +++ b/src/zapit/include/zapit/client/zapitclient.h @@ -375,6 +375,9 @@ class CZapitClient:public CBasicClient /* get dvb transmission type */ delivery_system_t getDeliverySystem(void); + /* Lock remote control */ + void lockRc(const bool mute); + void zaptoNvodSubService(const int num); /* send diseqc 1.2 motor command */ diff --git a/src/zapit/lib/zapitclient.cpp b/src/zapit/lib/zapitclient.cpp index a7f3ba252..f733112ef 100644 --- a/src/zapit/lib/zapitclient.cpp +++ b/src/zapit/lib/zapitclient.cpp @@ -611,6 +611,19 @@ void CZapitClient::getVolume(unsigned int *left, unsigned int *right) close_connection(); } + +void CZapitClient::lockRc(const bool b) +{ + CZapitMessages::commandBoolean msg; + //VALGRIND_PARANOIA; + + msg.truefalse = b; + + OpenThreads::ScopedLock lock(mutex); + send(CZapitMessages::CMD_LOCKRC, (char*)&msg, sizeof(msg)); + + close_connection(); +} #if 0 //never used delivery_system_t CZapitClient::getDeliverySystem(void) diff --git a/src/zapit/src/pzapit.cpp b/src/zapit/src/pzapit.cpp index d31e8a718..744187486 100644 --- a/src/zapit/src/pzapit.cpp +++ b/src/zapit/src/pzapit.cpp @@ -70,6 +70,8 @@ int usage (const char * basename) std::cout << "switch to pal mode: " << basename << " --pal" << std::endl; std::cout << "switch to hd 720p mode: " << basename << " --720p" << std::endl; std::cout << "send diseqc 1.2 motor command: " << basename << " -m " << std::endl; + std::cout << "lock remote control: " << basename << " -lockrc" << std::endl; + std::cout << "unlock remote control: " << basename << " -unlockrc" << std::endl; return -1; } @@ -92,6 +94,7 @@ int main (int argc, char** argv) int nvod = -1; int arat = -1; int m43 = -1; + int lockrc = -1; const char * channelName = NULL; bool playback = false; @@ -351,6 +354,16 @@ int main (int argc, char** argv) 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) { 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); return 0; } + if (lockrc != -1) + { + zapit.lockRc(lockrc); + return 0; + } if (rezap) { zapit.Rezap(); diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index a9ab8e307..6b3d34604 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -1861,6 +1861,17 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) 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: { CZapitMessages::commandVolume msgVolume; CBasicServer::receive_data(connfd, &msgVolume, sizeof(msgVolume));