diff --git a/HdmiCecSink/HdmiCecSinkImplementation.cpp b/HdmiCecSink/HdmiCecSinkImplementation.cpp index 7363bb76..205e6a19 100644 --- a/HdmiCecSink/HdmiCecSinkImplementation.cpp +++ b/HdmiCecSink/HdmiCecSinkImplementation.cpp @@ -2205,31 +2205,36 @@ namespace WPEFramework } - void HdmiCecSinkImplementation::requestAudioDevicePowerStatus() - { - if ( cecEnableStatus != true ) - { - LOGWARN("cec is disabled-> EnableCEC first"); - return; - } - - if(!HdmiCecSinkImplementation::_instance) - return; - - if(!(_instance->smConnection)) + Core::hresult HdmiCecSinkImplementation::RequestAudioDevicePowerStatus(HdmiCecSinkSuccess &success) + { + if ( cecEnableStatus != true ) { - return; + LOGWARN("[%s]cec is disabled-> EnableCEC first", __FUNCTION__); + return Core::ERROR_GENERAL; } - if ( _instance->m_logicalAddressAllocated == LogicalAddress::UNREGISTERED ){ - LOGERR("Logical Address NOT Allocated"); - return; - } - - LOGINFO(" Send GiveDevicePowerStatus Message to Audio system in the network \n"); - _instance->smConnection->sendTo(LogicalAddress::AUDIO_SYSTEM, MessageEncoder().encode(GiveDevicePowerStatus()), 500); - + if(!HdmiCecSinkImplementation::_instance) + { + LOGWARN("[%s]HdmiCecSinkImplementation instance is NULL", __FUNCTION__); + success.success = false; + return Core::ERROR_GENERAL; + } + if(!(_instance->smConnection)) + { + LOGWARN("[%s]smConnection is NULL", __FUNCTION__); + success.success = false; + return Core::ERROR_GENERAL; + } + if ( _instance->m_logicalAddressAllocated == LogicalAddress::UNREGISTERED ){ + LOGWARN("[%s]Logical Address NOT Allocated", __FUNCTION__); + success.success = false; + return Core::ERROR_GENERAL; + } + LOGINFO(" Send GiveDevicePowerStatus Message to Audio system in the network \n"); + _instance->smConnection->sendTo(LogicalAddress::AUDIO_SYSTEM, MessageEncoder().encode(GiveDevicePowerStatus()), 500); m_audioDevicePowerStatusRequested = true; - } + success.success = true; + return Core::ERROR_NONE; + } void HdmiCecSinkImplementation::sendFeatureAbort(const LogicalAddress logicalAddress, const OpCode feature, const AbortReason reason) { diff --git a/HdmiCecSink/HdmiCecSinkImplementation.h b/HdmiCecSink/HdmiCecSinkImplementation.h index c9d91c11..410942b8 100644 --- a/HdmiCecSink/HdmiCecSinkImplementation.h +++ b/HdmiCecSink/HdmiCecSinkImplementation.h @@ -562,7 +562,6 @@ namespace WPEFramework { void reportFeatureAbortEvent(const LogicalAddress logicalAddress, const OpCode feature, const AbortReason reason); void systemAudioModeRequest(); void SendStandbyMsgEvent(const int logicalAddress); - void requestAudioDevicePowerStatus(); void reportAudioDevicePowerStatusInfo(const int logicalAddress, const int powerStatus); void updateCurrentLatency(int videoLatency, bool lowLatencyMode, int audioOutputCompensated, int audioOutputDelay); void setLatencyInfo(); @@ -742,6 +741,7 @@ namespace WPEFramework { Core::hresult Register(Exchange::IHdmiCecSink::INotification *notification) override; Core::hresult Unregister(Exchange::IHdmiCecSink::INotification *notification) override; Core::hresult SetMenuLanguage(const string &language, HdmiCecSinkSuccess &success) override; + Core::hresult RequestAudioDevicePowerStatus(HdmiCecSinkSuccess &success) override; private: std::list _hdmiCecSinkNotifications;