X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FUSBCECAdapterCommunication.cpp;h=e2b03862d437cf75da03dda403a94e3da4e8f600;hb=b057edadea84636e4e48fff043631b4bf98a9a34;hp=0134751d31b2b05f8eb4f88f3320ff9b09fba686;hpb=9bb14797c432e3d85c81b935fff0972cd61b5e66;p=deb_libcec.git diff --git a/src/lib/adapter/USBCECAdapterCommunication.cpp b/src/lib/adapter/USBCECAdapterCommunication.cpp index 0134751..e2b0386 100644 --- a/src/lib/adapter/USBCECAdapterCommunication.cpp +++ b/src/lib/adapter/USBCECAdapterCommunication.cpp @@ -432,6 +432,29 @@ bool CUSBCECAdapterCommunication::SetAckMask(uint16_t iMask) return bReturn; } + +bool CUSBCECAdapterCommunication::SetControlledMode(bool controlled) +{ + bool bReturn(false); + CStdString strLog; + strLog.Format("turning controlled mode %s", controlled ? "on" : "off"); + CLibCEC::AddLog(CEC_LOG_DEBUG, strLog.c_str()); + + CCECAdapterMessage *output = new CCECAdapterMessage; + + output->PushBack(MSGSTART); + output->PushEscaped(MSGCODE_SET_CONTROLLED); + output->PushEscaped(controlled); + output->PushBack(MSGEND); + output->isTransmission = false; + + if ((bReturn = Write(output)) == false) + CLibCEC::AddLog(CEC_LOG_ERROR, "could not set controlled mode"); + delete output; + + return bReturn; +} + bool CUSBCECAdapterCommunication::IsOpen(void) { return !IsStopped() && m_port->IsOpen() && IsRunning();