33 #include "iarmProxy.hpp"
34 #include "audioOutputPortConfig.hpp"
35 #include "videoOutputPortConfig.hpp"
38 #include "videoDeviceConfig.hpp"
47 #include "hostEDID.hpp"
72 IARMProxy::getInstance().UnRegisterPowerEventHandler();
91 static bool isFirstTime =
true;
100 cout <<
"Host Exception Thrown ...!\n";
118 std::list < PowerModeChangeListener* > ::iterator it;
120 it = find (powerEvntListeners.begin(),powerEvntListeners.end(), l);
121 if (it == powerEvntListeners.end())
123 powerEvntListeners.push_back (l);
124 cout <<
"Added Power Mode listener...!\n";
128 cout <<
"Already register for Power Mode Change\n";
144 std::list < PowerModeChangeListener* > ::iterator it ;
145 it = find (powerEvntListeners.begin(),powerEvntListeners.end(), l);
146 if (it == powerEvntListeners.end())
148 cout <<
"Not Registered for Power Mode change yet...!\n";
152 powerEvntListeners.erase (it);
153 cout <<
"Removed from Power Mode listener group..!\n";
176 std::list < DisplayConnectionChangeListener* > ::iterator it;
178 it = find (dispEvntListeners.begin(), dispEvntListeners.end(), l);
179 if (it == dispEvntListeners.end())
181 dispEvntListeners.push_back (l);
182 cout <<
"Added Display listener...!\n";
186 cout <<
"Already registered to the Display listener\n";
202 std::list < DisplayConnectionChangeListener* > ::iterator it ;
203 it = find (dispEvntListeners.begin(), dispEvntListeners.end(), l);
204 if (it == dispEvntListeners.end())
206 cout <<
"Not Registered to Display Listener yet...!\n";
210 dispEvntListeners.erase (it);
211 cout <<
"Removed from the Display listener...!\n";
224 void Host::notifyPowerChange (
const int mode)
226 std::list < PowerModeChangeListener* > ::iterator it;
227 for ( it = powerEvntListeners.begin() ; it != powerEvntListeners.end(); it++ )
229 (*it)->powerModeChanged (mode);
233 void Host::notifyDisplayConnectionChange (
int portHandle,
bool newConnectionStatus)
235 std::list < DisplayConnectionChangeListener* > ::iterator it;
236 for ( it = dispEvntListeners.begin() ; it != dispEvntListeners.end(); it++ )
238 (*it)->displayConnectionChanged(getVideoOutputPort(portHandle), newConnectionStatus);
239 getVideoOutputPort(portHandle).setDisplayConnected(newConnectionStatus);
256 bool Host::setPowerMode(
int mode)
269 int Host::getPowerMode()
290 for (
size_t i = 0; i < vTypes.
size(); i++) {
292 for (
size_t j = 0; j < vPorts.
size(); j++) {
314 for (
size_t i = 0; i < aTypes.
size(); i++) {
316 for (
size_t j = 0; j < aPorts.
size(); j++) {
333 return VideoDeviceConfig::getInstance().getDevices();
352 return VideoOutputPortConfig::getInstance().getPort(name);
371 return VideoOutputPortConfig::getInstance().getPort(
id);
390 return AudioOutputPortConfig::getInstance().getPort(name);
409 return AudioOutputPortConfig::getInstance().getPort(
id);
427 return SleepMode::getInstance(mode);
430 printf(
"Host::getPreferredSleepMode failed IPC, returning default LIGHT_SLEEP\r\n");
458 SleepMode mode = SleepMode::getInstance(1);
459 return mode.getSleepModes();
470 float Host::getCPUTemperature()
472 float temperature = 45.0;
485 uint32_t Host::getVersion(
void)
487 uint32_t versionNumber;
489 return versionNumber;
499 void Host::setVersion(uint32_t versionNumber)
511 void Host::getHostEDID(std::vector<uint8_t> &edid)
const
513 printf(
"Host::getHostEDID \r\n");
516 unsigned char edidBytes[EDID_MAX_DATA_SIZE];
518 const char* exceptionstr =
"";
522 printf(
"Host::getHostEDID has ret %d\r\n", ret);
525 edid.insert(edid.begin(), edidBytes, edidBytes + length);
527 exceptionstr =
"getHostEDID failed";
544 std::string Host::getSocIDFromSDK()
548 return std::string(socID);
568 audioFormat = aFormat;
585 void Host::getSinkDeviceAtmosCapability(dsATMOSCapability_t & atmosCapability)
588 dsATMOSCapability_t capability;
595 atmosCapability = capability;
603 void Host::setAudioAtmosOutputMode(
bool enable)
626 void Host::setAssociatedAudioMixing(
const bool mixing)
644 void Host::getAssociatedAudioMixing(
bool *mixing)
647 bool _mixing =
false;
676 void Host::setFaderControl(
const int mixerBalance)
692 void Host::getFaderControl(
int *mixerBalance)
695 int _mixerBalance = 0;
697 if(mixerBalance == NULL) {
705 *mixerBalance = _mixerBalance;
725 void Host::setPrimaryLanguage(
const std::string pLang)
746 void Host::getPrimaryLanguage(std::string &pLang)
749 char _pLang[MAX_LANGUAGE_LEN] = {0};
752 pLang.assign(_pLang);
772 void Host::setSecondaryLanguage(
const std::string sLang)
793 void Host::getSecondaryLanguage(std::string &sLang)
796 char _sLang[MAX_LANGUAGE_LEN] = {0};
799 sLang.assign(_sLang);
807 bool Host::isHDMIOutPortPresent()
809 bool isHDMIOutPort =
false;
812 for (
size_t i = 0; i < aTypes.
size(); i++) {
814 for (
size_t j = 0; j < aPorts.
size(); j++) {
815 string portName = aPorts.at(j).getName();
816 if (portName.find(
"HDMI0") != string::npos) {
817 isHDMIOutPort =
true;
826 return isHDMIOutPort;
829 std::string Host::getDefaultVideoPortName()
831 std::string strDefaultVideoPortName =
"HDMI0";
832 bool isDefaultPortfound =
false;
833 List<VideoOutputPortType> vTypes = VideoOutputPortConfig::getInstance().getSupportedTypes();
834 for (
size_t i = 0; i < vTypes.size(); i++) {
835 List<VideoOutputPort> vPorts = vTypes.at(i).getPorts();
836 for (
size_t j = 0; j < vPorts.size(); j++) {
837 string portName = vPorts.at(j).getName();
840 strDefaultVideoPortName.assign (portName);
843 if (portName.find(
"HDMI0") != string::npos) {
844 strDefaultVideoPortName.assign (portName);
845 isDefaultPortfound =
true;
849 if (portName.find(
"INTERNAL0") != string::npos) {
850 strDefaultVideoPortName.assign (portName);
851 isDefaultPortfound =
true;
855 if (isDefaultPortfound) {
860 return strDefaultVideoPortName;
863 std::string Host::getDefaultAudioPortName()
865 std::string strDefaultAudioPortName =
"HDMI0";
866 bool isDefaultPortfound =
false;
867 List<AudioOutputPortType> aTypes = AudioOutputPortConfig::getInstance().getSupportedTypes();
868 for (
size_t i = 0; i < aTypes.size(); i++) {
869 List<AudioOutputPort> aPorts = aTypes.at(i).getPorts();
870 for (
size_t j = 0; j < aPorts.size(); j++) {
871 string portName = aPorts.at(j).getName();
874 strDefaultAudioPortName.assign (portName);
877 if (portName.find(
"HDMI0") != string::npos || portName.find(
"SPEAKER0") != string::npos) {
878 strDefaultAudioPortName.assign (portName);
879 isDefaultPortfound =
true;
883 if (isDefaultPortfound) {
888 return strDefaultAudioPortName;