void CPanasonicNode::Do_Work() { m_Busy = true; if (DEBUG_LOGGING) _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Entering work loop.", m_Name.c_str()); int iPollCount = 9; while (!m_stoprequested) { sleep_milliseconds(500); iPollCount++; if (iPollCount >= 10) { iPollCount = 0; try { std::string _volReply; std::string _muteReply; _volReply = handleWriteAndRead(buildXMLStringRendCtl("Get", "Volume")); if (_volReply != "ERROR") { int iVol = handleMessage(_volReply); m_CurrentStatus.Volume(iVol); if (m_CurrentStatus.Status() != MSTAT_ON && iVol > -1) { m_CurrentStatus.Status(MSTAT_ON); UpdateStatus(); } } else { if (m_CurrentStatus.Status() != MSTAT_OFF) { m_CurrentStatus.Clear(); m_CurrentStatus.Status(MSTAT_OFF); UpdateStatus(); } } //_muteReply = handleWriteAndRead(buildXMLStringRendCtl("Get", "Mute")); //_log.Log(LOG_NORM, "Panasonic Plugin: (%s) Mute reply - \r\n", m_Name.c_str(), _muteReply.c_str()); //if (_muteReply != "ERROR") //{ // m_CurrentStatus.Muted((handleMessage(_muteReply)==0) ? false : true); //} UpdateStatus(); } catch (std::exception& e) { _log.Log(LOG_ERROR, "Panasonic Plugin: (%s) Exception: %s", m_Name.c_str(), e.what()); } } } _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Exiting work loop.", m_Name.c_str()); m_Busy = false; }
bool CPanasonicNode::SendShutdown() { std::string sPanasonicCall = buildXMLStringNetCtl("POWER-ONOFF"); if (handleWriteAndRead(sPanasonicCall) != "ERROR") { _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Sent command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); return true; } else _log.Log(LOG_NORM, "Panasonic Plugin: (%s) can't send command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); return false; }
void CPanasonicNode::SendCommand(const std::string command, const int iValue) { std::string sPanasonicCall; if (command == "setvolume") sPanasonicCall = buildXMLStringRendCtl("Set", "Volume", boost::to_string(iValue)); else _log.Log(LOG_ERROR, "Panasonic Plugin: (%s) Command: '%s'. Unknown command.", m_Name.c_str(), command.c_str()); if (sPanasonicCall.length()) { if (handleWriteAndRead(sPanasonicCall) != "ERROR") _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Sent command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); else _log.Log(LOG_NORM, "Panasonic Plugin: (%s) can't send command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); } }
void CPanasonicNode::SendCommand(const std::string command) { std::string sPanasonicCall = ""; if (m_CurrentStatus.Status() == MSTAT_OFF) { // no point trying to send a command if we know the device is off // no network on Panasonic TV's when it's in the off state _log.Log(LOG_ERROR, "Panasonic Plugin: (%s) Device is Off, cannot send command.", m_Name.c_str()); return; } if (command == "Home") sPanasonicCall = buildXMLStringNetCtl("CANCEL-ONOFF"); else if (command == "Up") sPanasonicCall = buildXMLStringNetCtl("UP-ONOFF"); else if (command == "Down") sPanasonicCall = buildXMLStringNetCtl("DOWN-ONOFF"); else if (command == "Left") sPanasonicCall = buildXMLStringNetCtl("LEFT-ONOFF"); else if (command == "Right") sPanasonicCall = buildXMLStringNetCtl("RIGHT-ONOFF"); else if (command == "ChannelUp") sPanasonicCall = buildXMLStringNetCtl("CH_UP-ONOFF"); else if (command == "ChannelDown") sPanasonicCall = buildXMLStringNetCtl("CH_DOWN-ONOFF"); else if (command == "VolumeUp") sPanasonicCall = buildXMLStringNetCtl("VOLUP-ONOFF"); else if (command == "VolumeDown") sPanasonicCall = buildXMLStringNetCtl("VOLDOWN-ONOFF"); else if (command == "Mute") sPanasonicCall = buildXMLStringNetCtl("MUTE-ONOFF"); else if (command == "inputtv") sPanasonicCall = buildXMLStringNetCtl("TV-ONOFF"); else if (command == "inputav") sPanasonicCall = buildXMLStringNetCtl("AV-ONOFF"); else if (command == "Red") sPanasonicCall = buildXMLStringNetCtl("RED-ONOFF"); else if (command == "Green") sPanasonicCall = buildXMLStringNetCtl("GREEN-ONOFF"); else if (command == "Blue") sPanasonicCall = buildXMLStringNetCtl("BLUE-ONOFF"); else if (command == "Yellow") sPanasonicCall = buildXMLStringNetCtl("YELLOW-ONOFF"); else if (command == "ContextMenu") sPanasonicCall = buildXMLStringNetCtl("MENU-ONOFF"); else if (command == "Channels" || command == "guide") sPanasonicCall = buildXMLStringNetCtl("EPG-ONOFF"); else if (command == "Back" || command == "Return") sPanasonicCall = buildXMLStringNetCtl("RETURN-ONOFF"); else if (command == "Select") sPanasonicCall = buildXMLStringNetCtl("ENTER-ONOFF"); else if (command == "Info") sPanasonicCall = buildXMLStringNetCtl("INFO-ONOFF"); else if (command == "1") sPanasonicCall = buildXMLStringNetCtl("D1-ONOFF"); else if (command == "2") sPanasonicCall = buildXMLStringNetCtl("D2-ONOFF"); else if (command == "3") sPanasonicCall = buildXMLStringNetCtl("D3-ONOFF"); else if (command == "4") sPanasonicCall = buildXMLStringNetCtl("D4-ONOFF"); else if (command == "5") sPanasonicCall = buildXMLStringNetCtl("D5-ONOFF"); else if (command == "6") sPanasonicCall = buildXMLStringNetCtl("D6-ONOFF"); else if (command == "7") sPanasonicCall = buildXMLStringNetCtl("D7-ONOFF"); else if (command == "8") sPanasonicCall = buildXMLStringNetCtl("D8-ONOFF"); else if (command == "9") sPanasonicCall = buildXMLStringNetCtl("D9-ONOFF"); else if (command == "0") sPanasonicCall = buildXMLStringNetCtl("D0-ONOFF"); else if (command == "hdmi1") sPanasonicCall = buildXMLStringNetCtl("HDMI1"); else if (command == "hdmi2") sPanasonicCall = buildXMLStringNetCtl("HDMI2"); else if (command == "hdmi3") sPanasonicCall = buildXMLStringNetCtl("HDMI3"); else if (command == "hdmi4") sPanasonicCall = buildXMLStringNetCtl("HDMI4"); else if (command == "Rewind") sPanasonicCall = buildXMLStringNetCtl("REW-ONOFF"); else if (command == "FastForward") sPanasonicCall = buildXMLStringNetCtl("FF-ONOFF"); else if (command == "PlayPause") sPanasonicCall = buildXMLStringNetCtl("PLAY-ONOFF"); else if (command == "Stop") sPanasonicCall = buildXMLStringNetCtl("STOP-ONOFF"); else if (command == "pause") sPanasonicCall = buildXMLStringNetCtl("PAUSE-ONOFF"); else if (command == "Power" || command == "power" || command == "off" || command == "Off") sPanasonicCall = buildXMLStringNetCtl("POWER-ONOFF"); else if (command == "ShowSubtitles") sPanasonicCall = buildXMLStringNetCtl("STTL-ONOFF"); else if (command == "On" || command == "on") { _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Can't use command: '%s'.", m_Name.c_str(), command.c_str()); // Workaround to get the plugin to reset device status, otherwise the UI goes out of sync with plugin m_CurrentStatus.Clear(); m_CurrentStatus.Status(MSTAT_UNKNOWN); UpdateStatus(true); } else _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Unknown command: '%s'.", m_Name.c_str(), command.c_str()); if (sPanasonicCall.length()) { if (handleWriteAndRead(sPanasonicCall) != "ERROR") _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Sent command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); //else // _log.Log(LOG_NORM, "Panasonic Plugin: (%s) can't send command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); } }
void CPanasonicNode::SendCommand(const std::string command) { std::string sPanasonicCall; std::string sPanasonicParam = ""; if (command == "Home") sPanasonicCall = buildXMLStringNetCtl("CANCEL-ONOFF"); else if (command == "Up") sPanasonicCall = buildXMLStringNetCtl("UP-ONOFF"); else if (command == "Down") sPanasonicCall = buildXMLStringNetCtl("DOWN-ONOFF"); else if (command == "Left") sPanasonicCall = buildXMLStringNetCtl("LEFT-ONOFF"); else if (command == "Right") sPanasonicCall = buildXMLStringNetCtl("RIGHT-ONOFF"); else if (command == "ChannelUp") sPanasonicCall = buildXMLStringNetCtl("CH_UP-ONOFF"); else if (command == "ChannelDown") sPanasonicCall = buildXMLStringNetCtl("CH_DOWN-ONOFF"); else if (command == "VolumeUp") sPanasonicCall = buildXMLStringNetCtl("VOLUP-ONOFF"); else if (command == "VolumeDown") sPanasonicCall = buildXMLStringNetCtl("VOLDOWN-ONOFF"); else if (command == "Mute") sPanasonicCall = buildXMLStringNetCtl("MUTE-ONOFF"); else if (command == "inputtv") sPanasonicCall = buildXMLStringNetCtl("TV-ONOFF"); else if (command == "inputav") sPanasonicCall = buildXMLStringNetCtl("AV-ONOFF"); else if (command == "Red") sPanasonicCall = buildXMLStringNetCtl("RED-ONOFF"); else if (command == "Green") sPanasonicCall = buildXMLStringNetCtl("GREEN-ONOFF"); else if (command == "Blue") sPanasonicCall = buildXMLStringNetCtl("BLUE-ONOFF"); else if (command == "Yellow") sPanasonicCall = buildXMLStringNetCtl("YELLOW-ONOFF"); else if (command == "ContextMenu") sPanasonicCall = buildXMLStringNetCtl("MENU-ONOFF"); else if (command == "Channels" || command == "guide") sPanasonicCall = buildXMLStringNetCtl("EPG-ONOFF"); else if (command == "Back" || command == "return") sPanasonicCall = buildXMLStringNetCtl("RETURN-ONOFF"); else if (command == "Select") sPanasonicCall = buildXMLStringNetCtl("ENTER-ONOFF"); else if (command == "Info") sPanasonicCall = buildXMLStringNetCtl("INFO-ONOFF"); else if (command == "1") sPanasonicCall = buildXMLStringNetCtl("D1-ONOFF"); else if (command == "2") sPanasonicCall = buildXMLStringNetCtl("D2-ONOFF"); else if (command == "3") sPanasonicCall = buildXMLStringNetCtl("D3-ONOFF"); else if (command == "4") sPanasonicCall = buildXMLStringNetCtl("D4-ONOFF"); else if (command == "5") sPanasonicCall = buildXMLStringNetCtl("D5-ONOFF"); else if (command == "6") sPanasonicCall = buildXMLStringNetCtl("D6-ONOFF"); else if (command == "7") sPanasonicCall = buildXMLStringNetCtl("D7-ONOFF"); else if (command == "8") sPanasonicCall = buildXMLStringNetCtl("D8-ONOFF"); else if (command == "9") sPanasonicCall = buildXMLStringNetCtl("D9-ONOFF"); else if (command == "0") sPanasonicCall = buildXMLStringNetCtl("D0-ONOFF"); else if (command == "hdmi1") sPanasonicCall = buildXMLStringNetCtl("HDMI1"); else if (command == "hdmi2") sPanasonicCall = buildXMLStringNetCtl("HDMI2"); else if (command == "hdmi3") sPanasonicCall = buildXMLStringNetCtl("HDMI3"); else if (command == "hdmi4") sPanasonicCall = buildXMLStringNetCtl("HDMI4"); else if (command == "Rewind") sPanasonicCall = buildXMLStringNetCtl("REW-ONOFF"); else if (command == "FastForward") sPanasonicCall = buildXMLStringNetCtl("FF-ONOFF"); else if (command == "PlayPause") sPanasonicCall = buildXMLStringNetCtl("PLAY-ONOFF"); else if (command == "Stop") sPanasonicCall = buildXMLStringNetCtl("STOP-ONOFF"); else if (command == "pause") sPanasonicCall = buildXMLStringNetCtl("PAUSE-ONOFF"); else if (command == "Power" || command == "power" || command == "off") sPanasonicCall = buildXMLStringNetCtl("POWER-ONOFF"); else if (command == "ShowSubtitles") sPanasonicCall = buildXMLStringNetCtl("STTL-ONOFF"); else _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Unknown command: '%s'.", m_Name.c_str(), command.c_str()); if (sPanasonicCall.length()) { if (handleWriteAndRead(sPanasonicCall) != "ERROR") _log.Log(LOG_NORM, "Panasonic Plugin: (%s) Sent command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); //else // _log.Log(LOG_NORM, "Panasonic Plugin: (%s) can't send command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str()); } }