diff --git a/build_dependencies.sh b/build_dependencies.sh index 090f105a..566fca25 100644 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -47,7 +47,7 @@ cd rfc autoreconf -i ./configure --enable-rfctool=yes --enable-tr181set=yes cd rfcapi -make librfcapi_la_CPPFLAGS="-I/usr/include/cjson" +make CXXFLAGS="-DUSE_IARMBUS" librfcapi_la_CPPFLAGS="-I/usr/include/cjson" make install export RFC_PATH=$ROOT/rfc diff --git a/ds/host.cpp b/ds/host.cpp index d621e479..6bd99723 100644 --- a/ds/host.cpp +++ b/ds/host.cpp @@ -2,7 +2,7 @@ * If not stated otherwise in this file or this component's LICENSE file the * following copyright and licenses apply: * - * Copyright 2016 RDK Management + * Copyright 2025 RDK Management * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -241,7 +241,6 @@ namespace device } } - /** * @fn bool Host::setPowerMode(int mode) * @brief This API is used to change the power mode of the device. @@ -913,11 +912,268 @@ namespace device printf ("%s:%d - Set Audio Mixer levels for audio input: %d with volume = %d\n", __PRETTY_FUNCTION__, __LINE__,aInput, volume); } +/* virtual */ void Host::IHDMIInEvents::OnHDMIInEventHotPlug(dsHdmiInPort_t port, bool isConnected) +{ + /* If client needs to handle this event, they should override this method */ +INT_WARN("Base impl of OnHDMIInEventHotPlug called. port: %d isConnected %d", port, isConnected); +} + +/* virtual */ void Host::IHDMIInEvents::OnHDMIInEventSignalStatus(dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDMIInEventSignalStatus called. port: %d signalStatus %d", port, signalStatus); +} + +/* virtual */ void Host::IHDMIInEvents::OnHDMIInEventStatus(dsHdmiInPort_t activePort, bool isPresented) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDMIInEventStatus called. activePort: %d isPresented %d", activePort, isPresented); +} + +/* virtual */ void Host::IHDMIInEvents::OnHDMIInVideoModeUpdate(dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDMIInVideoModeUpdate called. port: %d videoPortResolution.pixelresolution %d", + port, videoPortResolution.pixelResolution); +} + +/* virtual */ void Host::IHDMIInEvents::OnHDMIInAllmStatus(dsHdmiInPort_t port, bool allmStatus) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDMIInAllmStatus called. port %d allmStatus: %d", port, allmStatus); +} + +/* virtual */ void Host::IHDMIInEvents::OnHDMIInAVIContentType(dsHdmiInPort_t port, dsAviContentType_t aviContentType) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDMIInAVIContentType called. port %d aviContentType: %d", port, aviContentType); +} + +/* virtual */ void Host::IHDMIInEvents::OnHDMIInVRRStatus(dsHdmiInPort_t port, dsVRRType_t vrrType) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDMIInVRRStatus called. port %d vrrType: %d", port, vrrType); +} + +/* virtual */ void Host::IHDMIInEvents::OnHDMIInAVLatency(int audioDelay, int videoDelay) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDMIInAVLatency called. audioDelay: %d videoDelay %d", audioDelay, videoDelay); +} + +/* virtual */ void Host::IVideoDeviceEvents::OnDisplayFrameratePreChange(const std::string& frameRate) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnDisplayFrameratePreChange called. frameRate: %s", frameRate.c_str()); +} + +/* virtual */ void Host::IVideoDeviceEvents::OnDisplayFrameratePostChange(const std::string& frameRate) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnDisplayFrameratePostChange called. frameRate: %s", frameRate.c_str()); +} + +/* virtual */ void Host::IVideoDeviceEvents::OnZoomSettingsChanged(dsVideoZoom_t zoomSetting) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnZoomSettingsChanged called. zoomSetting: %d", zoomSetting); +} + +/* virtual */ void Host::IVideoOutputPortEvents::OnResolutionPreChange(int width, int height) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnResolutionPreChange called. width: %d, height: %d", width, height); +} + +/* virtual */ void Host::IVideoOutputPortEvents::OnResolutionPostChange(int width, int height) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnResolutionPostChange called. width: %d, height: %d", width, height); +} + +/* virtual */ void Host::IVideoOutputPortEvents::OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnHDCPStatusChange called. hdcpStatus: %d", hdcpStatus); +} + +/* virtual */ void Host::IVideoOutputPortEvents::OnVideoFormatUpdate(dsHDRStandard_t videoFormatHDR) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnVideoFormatUpdate called. videoFormatHDR: %d", videoFormatHDR); +} + +/* virtual */ void Host::IAudioOutputPortEvents::OnAssociatedAudioMixingChanged(bool mixing) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAssociatedAudioMixingChanged called. mixing: %d", mixing); +} +/* virtual */ void Host::IAudioOutputPortEvents::OnAudioFaderControlChanged(int mixerBalance) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAudioFaderControlChanged called. mixerBalance: %d", mixerBalance); +} +/* virtual */ void Host::IAudioOutputPortEvents::OnAudioPrimaryLanguageChanged(const std::string& primaryLanguage) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAudioPrimaryLanguageChanged called. primaryLanguage: %s", primaryLanguage.c_str()); +} + +/* virtual */ void Host::IAudioOutputPortEvents::OnAudioSecondaryLanguageChanged(const std::string& secondaryLanguage) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAudioSecondaryLanguageChanged called. secondaryLanguage: %s", secondaryLanguage.c_str()); +} + +/* virtual */ void Host::IAudioOutputPortEvents::OnAudioOutHotPlug(dsAudioPortType_t portType, uint32_t uiPortNumber, bool isPortConnected) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAudioOutHotPlug called. portType: %d, uiPortNumber: %d, isPortConnected: %d", portType, uiPortNumber, isPortConnected); +} + +/* virtual */ void Host::IAudioOutputPortEvents::OnDolbyAtmosCapabilitiesChanged(dsATMOSCapability_t atmosCapability, bool status) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnDolbyAtmosCapabilitiesChanged called. atmosCapability: %d, status: %d", atmosCapability, status); +} + +// TODO: requires dsMgr.h header include ?? +// void Host::IAudioOutputPortEvents::OnAudioPortStateChanged(dsAudioPortState_t audioPortState) { } + +/* virtual */ void Host::IAudioOutputPortEvents::OnAudioModeEvent(dsAudioPortType_t audioPortType, dsAudioStereoMode_t audioStereoMode) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAudioModeEvent called. audioPortType: %d, audioStereoMode: %d", audioPortType, audioStereoMode); +} + +/* virtual */ void Host::IAudioOutputPortEvents::OnAudioLevelChangedEvent(int audioLevel) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAudioLevelChangedEvent called. audioLevel: %d", audioLevel); +} + +/* virtual */ void Host::IAudioOutputPortEvents::OnAudioFormatUpdate(dsAudioFormat_t audioFormat) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnAudioFormatUpdate called. audioFormat: %d", audioFormat); +} + +/* virtual */ void Host::IDisplayDeviceEvents::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnDisplayHDMIHotPlug called. displayEvent: %d", displayEvent); +} +/* virtual */ void Host::ICompositeInEvents::OnCompositeInHotPlug(dsCompositeInPort_t port, bool isConnected) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnCompositeInHotPlug called. port: %d isConnected %d", port, isConnected); +} + +/* virtual */ void Host::ICompositeInEvents::OnCompositeInSignalStatus(dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnCompositeInSignalStatus called. port: %d signalStatus %d", port, signalStatus); +} + +/* virtual */ void Host::ICompositeInEvents::OnCompositeInStatus(dsCompositeInPort_t activePort, bool isPresented) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnCompositeInStatus called. activePort: %d isPresented %d", activePort, isPresented); +} +/* virtual */ void Host::ICompositeInEvents::OnCompositeInVideoModeUpdate(dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnCompositeInVideoModeUpdate called. activePort: %d videoResolution %d", activePort, videoResolution.pixelResolution); +} + +/* virtual */ void Host::IDisplayEvents::OnDisplayRxSense(dsDisplayEvent_t displayEvent) +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnDisplayRxSense called. displayEvent: %d ", displayEvent); +} +/* virtual */ void Host::IDisplayEvents::OnDisplayHDCPStatus() +{ + /* If client needs to handle this event, they should override this method */ + INT_WARN("Base impl of OnDisplayHDCPStatus called. "); +} + +dsError_t Host::Register(IHDMIInEvents *listener) +{ + return dsERR_NONE; +} + +dsError_t Host::UnRegister(IHDMIInEvents *listener) +{ + return dsERR_NONE; +} + +dsError_t Host::Register(ICompositeInEvents *listener) +{ + return dsERR_NONE; +} + +dsError_t Host::UnRegister(ICompositeInEvents *listener) +{ + return dsERR_NONE; +} + +dsError_t Host::Register(IDisplayEvents *listener) +{ + return dsERR_NONE; +} + +dsError_t Host::UnRegister(IDisplayEvents *listener) +{ + return dsERR_NONE; +} + +dsError_t Host::Register(IVideoDeviceEvents* listener) +{ + return dsERR_NONE; +} + +dsError_t Host::UnRegister(IVideoDeviceEvents* listener) +{ + return dsERR_NONE; +} + +dsError_t Host::Register(IVideoOutputPortEvents* listener) +{ + return dsERR_NONE; +} + +dsError_t Host::UnRegister(IVideoOutputPortEvents* listener) +{ + return dsERR_NONE; +} + +dsError_t Host::Register(IAudioOutputPortEvents* listener) +{ + return dsERR_NONE; +} + +dsError_t Host::UnRegister(IAudioOutputPortEvents* listener) +{ + return dsERR_NONE; +} + +dsError_t Host::Register(IDisplayDeviceEvents* listener) +{ + return dsERR_NONE; +} + +dsError_t Host::UnRegister(IDisplayDeviceEvents* listener) +{ + return dsERR_NONE; } /** @} */ +} + + + /** @} */ /** @} */ diff --git a/ds/include/host.hpp b/ds/include/host.hpp index d14d42dc..4c83e9a9 100644 --- a/ds/include/host.hpp +++ b/ds/include/host.hpp @@ -2,7 +2,7 @@ * If not stated otherwise in this file or this component's LICENSE file the * following copyright and licenses apply: * - * Copyright 2016 RDK Management + * Copyright 2025 RDK Management * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ * limitations under the License. */ - - /** * @defgroup devicesettings * @{ @@ -29,7 +27,8 @@ #ifndef _DS_HOST_HPP_ #define _DS_HOST_HPP_ - +#include +#include #include #include "powerModeChangeListener.hpp" #include "displayConnectionChangeListener.hpp" @@ -38,9 +37,10 @@ #include "videoDevice.hpp" #include "sleepMode.hpp" #include "list.hpp" - -#include -#include +#include "dsMgr.h" +#include "dsTypes.h" +#include "dsDisplay.h" +#include "dsError.h" /** @@ -59,6 +59,237 @@ namespace device { */ class Host { public: + + struct IHDMIInEvents { + virtual ~IHDMIInEvents() = default; + // @brief HDMI Event Hot Plug + // @param port: port 0 or 1 et al + // @param isConnected: is it connected (true) or not (false) + virtual void OnHDMIInEventHotPlug(dsHdmiInPort_t port, bool isConnected); + + // @brief HDMI Event Signal status + // @param port: port 0 or 1 et al + // @param signalStatus: Signal Status + virtual void OnHDMIInEventSignalStatus(dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus); + + // @brief HDMI Event Signal status + // @param activePort: port 0 or 1 et al + // @param isPresented: is it presented or not + virtual void OnHDMIInEventStatus(dsHdmiInPort_t activePort, bool isPresented); + + // @brief HDMI Video Mode update + // @param port: port 0 or 1 et al + // @param videoPortResolution: Video port resolution + virtual void OnHDMIInVideoModeUpdate(dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution); + + // @brief HDMI ALLM (Auto Low Latency Mode) status + // @param port: port 0 or 1 et al + // @param allmStatus: allm status + virtual void OnHDMIInAllmStatus(dsHdmiInPort_t port, bool allmStatus); + + // @brief HDMI Event AVI content type + // @param port: port 0 or 1 et al + // @param aviContentType: AVI content type + virtual void OnHDMIInAVIContentType(dsHdmiInPort_t port, dsAviContentType_t aviContentType); + + // @brief HDMI VRR status + // @param port: port 0 or 1 et al + // @param vrrType: VRR type + virtual void OnHDMIInVRRStatus(dsHdmiInPort_t port, dsVRRType_t vrrType); + + // @brief HDMI Event AV Latency + // @param audioDelay: audio delay (in millisecs) + // @param videoDelay: video delay (in millisecs) + virtual void OnHDMIInAVLatency(int audioDelay, int videoDelay); + + }; + + // @brief Register a listener for HDMI device events + // @param listener: class object implementing the listener + dsError_t Register(IHDMIInEvents *listener); + + // @brief UnRegister a listener for HDMI device events + // @param listener: class object implementing the listener + dsError_t UnRegister(IHDMIInEvents *listener); + + struct ICompositeInEvents { + virtual ~ICompositeInEvents() = default; + // @brief Composite In Hotplug event + // @param port: Port of the hotplug + // @param isConnected: Is it connected (true) or not(false) + virtual void OnCompositeInHotPlug(dsCompositeInPort_t port, bool isConnected); + + // @brief Composite In Signal status + // @param port: Port of the hotplug + // @param signalStatus: Signal status + virtual void OnCompositeInSignalStatus(dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus); + + // @brief Composite In status + // @param activePort: Active port + // @param isPresented: is it presented to user + virtual void OnCompositeInStatus(dsCompositeInPort_t activePort, bool isPresented); + + // @brief Composite In Video Mode Update + // @param activePort: Active port + // @param videoResolution: See DisplayVideoPortResolution + virtual void OnCompositeInVideoModeUpdate(dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution); + }; + + // @brief Register a listener for composite events + // @param listener: class object implementing the listener + dsError_t Register(ICompositeInEvents *listener); + + // @brief UnRegister a listener for composite events + // @param listener: class object implementing the listener + dsError_t UnRegister(ICompositeInEvents *listener); + + struct IDisplayEvents { + virtual ~IDisplayEvents() = default; + + // @brief Display RX Sense event + // @param displayEvent: DS_DISPLAY_RXSENSE_ON or DS_DISPLAY_RXSENSE_OFF + virtual void OnDisplayRxSense(dsDisplayEvent_t displayEvent); + + // @brief Display HDCP Status + virtual void OnDisplayHDCPStatus(); + }; + + // @brief Register a listener for display events + // @param listener: class object implementing the listener + dsError_t Register(IDisplayEvents *listener); + + // @brief UnRegister a listener for display events + // @param listener: class object implementing the listener + dsError_t UnRegister(IDisplayEvents *listener); + + + struct IVideoDeviceEvents { + virtual ~IVideoDeviceEvents() = default; + + // @brief Display Frame rate Pre-change notification + // @param frameRate: new framerate + virtual void OnDisplayFrameratePreChange(const std::string& frameRate); + + // @brief Display Frame rate Post-change notification + // @param frameRate: new framerate + virtual void OnDisplayFrameratePostChange(const std::string& frameRate); + + // @brief Zoom settings changed + // @param zoomSetting: Currently applied zoom setting + virtual void OnZoomSettingsChanged(dsVideoZoom_t zoomSetting); + }; + + // @brief Register a listener for video device events + // @param listener: class object implementing the listener + dsError_t Register(IVideoDeviceEvents* listener); + + // @brief UnRegister a listener for video device events + // @param listener: class object implementing the listener + dsError_t UnRegister(IVideoDeviceEvents* listener); + + struct IVideoOutputPortEvents { + virtual ~IVideoOutputPortEvents() = default; + + // @brief On Resolution Pre changed + // @param width: width of the resolution + // @param height: height of the resolution + virtual void OnResolutionPreChange(int width, int height); + + // @brief On Resolution Post change + // @param width: width of the resolution + // @param height: height of the resolution + virtual void OnResolutionPostChange(int width, int height); + + // @brief On HDCP Status change + // @param hdcpStatus: HDCP Status + virtual void OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus); + + // @brief On Video Format update + // @param videoFormatHDR: Video format HDR standard + virtual void OnVideoFormatUpdate(dsHDRStandard_t videoFormatHDR); + }; + + // @brief Register a listener for video port events + // @param listener: class object implementing the listener + dsError_t Register(IVideoOutputPortEvents* listener); + + // @brief UnRegister a listener for video port events + // @param listener: class object implementing the listener + dsError_t UnRegister(IVideoOutputPortEvents* listener); + + struct IAudioOutputPortEvents { + virtual ~IAudioOutputPortEvents() = default; + + // @brief Associated Audio mixing changed + // @param mixing: true or false + virtual void OnAssociatedAudioMixingChanged(bool mixing); + + // @brief Audio Fader balance changed + // @param mixerBalance: applied mixer balance value + virtual void OnAudioFaderControlChanged(int mixerBalance); + + // @brief Primary language for Audio changed + // @param primaryLanguage: current primary language for audio + virtual void OnAudioPrimaryLanguageChanged(const std::string& primaryLanguage); + + // @brief Secondary language for Audio changed + // @param secondaryLanguage: current secondary language for audio + virtual void OnAudioSecondaryLanguageChanged(const std::string& secondaryLanguage); + + // @brief Audio output hot plug event + // @param portType: Type of audio port see AudioPortType + // @param uiPortNumber: The port number assigned by UI + // @param isPortConnected: true (connected) or false (not connected) + virtual void OnAudioOutHotPlug(dsAudioPortType_t portType, uint32_t uiPortNumber, bool isPortConnected); + + // @brief Dolby Atmos capabilities changed + // @param atmosCapability: the Dolby Atmos capability + // @param status: true (available) or false (not available) + virtual void OnDolbyAtmosCapabilitiesChanged(dsATMOSCapability_t atmosCapability, bool status); + + // @brief Audio port state changed + // @param audioPortState: audio port state + // TODO: requires dsMgr.h header include ?? + // virtual void OnAudioPortStateChanged(dsAudioPortState_t audioPortState); + + // @brief Audio mode for the respective audio port - raised for every type of port + // @param audioPortType: audio port type see dsAudioPortType_t + // @param audioStereoMode: audio stereo mode - see dsAudioStereoMode_t + virtual void OnAudioModeEvent(dsAudioPortType_t audioPortType, dsAudioStereoMode_t audioStereoMode); + + // @brief Audio level changed + // @param audioiLevel: audio level value + virtual void OnAudioLevelChangedEvent(int audioLevel); + + // @brief Audio Output format changed + // @param audioFormat: Type of audio format see AudioFormat + virtual void OnAudioFormatUpdate(dsAudioFormat_t audioFormat); + }; + + // @brief Register a listener for audio port events + // @param listener: class object implementing the listener + dsError_t Register(IAudioOutputPortEvents* listener); + + // @brief UnRegister a listener for audio port events + // @param listener: class object implementing the listener + dsError_t UnRegister(IAudioOutputPortEvents* listener); + + struct IDisplayDeviceEvents { + virtual ~IDisplayDeviceEvents() = default; + + // @brief Display HDMI (out) Hot plug event + // @param displayEvent: display event type see dsDisplayEvent_t + virtual void OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent); + }; + + // @brief Register a listener for display device events + // @param listener: class object implementing the listener + dsError_t Register(IDisplayDeviceEvents* listener); + + // @brief UnRegister a listener for display device events + // @param listener: class object implementing the listener + dsError_t UnRegister(IDisplayDeviceEvents* listener); + static const int kPowerOn; static const int kPowerOff; static const int kPowerStandby;