-
Notifications
You must be signed in to change notification settings - Fork 3
LLAMA-14031: Moved getHdmiArcPortID away from Initialize #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
fa85a40
a1b1fd0
12cfb8e
c2f6579
ab1a234
1cc4cd2
6df4370
e35dc16
bf0c502
e80e685
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
Check failure on line 1 in HdmiCecSink/HdmiCecSink.cpp
|
||
* If not stated otherwise in this file or this component's LICENSE | ||
* file the following copyright and licenses apply: | ||
* | ||
|
@@ -76,6 +76,7 @@ | |
#define HDMICECSINK_NUMBER_TV_ADDR 2 | ||
#define HDMICECSINK_UPDATE_POWER_STATUS_INTERVA_MS (60 * 1000) | ||
#define HDMISINK_ARC_START_STOP_MAX_WAIT_MS 4000 | ||
#define HDMICECSINK_UPDATE_AUDIO_STATUS_INTERVAL_MS 500 | ||
|
||
|
||
#define SAD_FMT_CODE_AC3 2 | ||
|
@@ -175,9 +176,7 @@ | |
|
||
#define API_VERSION_NUMBER_MAJOR 1 | ||
#define API_VERSION_NUMBER_MINOR 3 | ||
#define API_VERSION_NUMBER_PATCH 7 | ||
|
||
using PowerState = WPEFramework::Exchange::IPowerManager::PowerState; | ||
#define API_VERSION_NUMBER_PATCH 10 | ||
|
||
namespace WPEFramework | ||
{ | ||
|
@@ -711,7 +710,10 @@ | |
m_currentActiveSource = -1; | ||
m_isHdmiInConnected = false; | ||
hdmiCecAudioDeviceConnected = false; | ||
m_audioDevicePowerStatusRequested = false; | ||
m_isAudioStatusInfoUpdated = false; | ||
m_audioStatusReceived = false; | ||
m_audioStatusTimerStarted = false; | ||
m_audioDevicePowerStatusRequested = false; | ||
m_pollNextState = POLL_THREAD_STATE_NONE; | ||
m_pollThreadState = POLL_THREAD_STATE_NONE; | ||
m_video_latency = DEFAULT_VIDEO_LATENCY; | ||
|
@@ -746,22 +748,23 @@ | |
Register(HDMICECSINK_METHOD_SET_LATENCY_INFO, &HdmiCecSink::setLatencyInfoWrapper, this); | ||
logicalAddressDeviceType = "None"; | ||
logicalAddress = 0xFF; | ||
// load persistence setting | ||
loadSettings(); | ||
|
||
int err; | ||
dsHdmiInGetNumberOfInputsParam_t hdmiInput; | ||
InitializeIARM(); | ||
m_sendKeyEventThreadExit = false; | ||
m_sendKeyEventThread = std::thread(threadSendKeyEvent); | ||
|
||
m_currentArcRoutingState = ARC_STATE_ARC_TERMINATED; | ||
m_semSignaltoArcRoutingThread.acquire(); | ||
m_arcRoutingThread = std::thread(threadArcRouting); | ||
|
||
|
||
m_audioStatusDetectionTimer.connect( std::bind( &HdmiCecSink::audioStatusTimerFunction, this ) ); | ||
m_audioStatusDetectionTimer.setSingleShot(true); | ||
m_arcStartStopTimer.connect( std::bind( &HdmiCecSink::arcStartStopTimerFunction, this ) ); | ||
m_arcStartStopTimer.setSingleShot(true); | ||
// load persistence setting | ||
loadSettings(); | ||
|
||
int err; | ||
dsHdmiInGetNumberOfInputsParam_t hdmiInput; | ||
InitializeIARM(); | ||
// get power state: | ||
uint32_t res = Core::ERROR_GENERAL; | ||
PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN; | ||
|
@@ -813,7 +816,7 @@ | |
} | ||
} | ||
getCecVersion(); | ||
getHdmiArcPortID(); | ||
LOGINFO(" HdmiCecSink plugin Initialize completed \n"); | ||
return (std::string()); | ||
|
||
} | ||
|
@@ -1146,6 +1149,18 @@ | |
JsonObject params; | ||
if(!HdmiCecSink::_instance) | ||
return; | ||
if (m_audioStatusTimerStarted) | ||
{ | ||
m_audioStatusReceived = true; | ||
m_isAudioStatusInfoUpdated = true; | ||
m_audioStatusTimerStarted = false; | ||
if (m_audioStatusDetectionTimer.isActive()) | ||
{ | ||
LOGINFO("AudioStatus received from the Audio Device and the timer is still active. So stopping the timer!\n"); | ||
m_audioStatusDetectionTimer.stop(); | ||
} | ||
LOGINFO("AudioStatus received from the Audio Device. Updating the AudioStatus info! m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); | ||
} | ||
LOGINFO("Command: ReportAudioStatus %s audio Mute status %d means %s and current Volume level is %d \n",GetOpName(msg.opCode()),msg.status.getAudioMuteStatus(),msg.status.toString().c_str(),msg.status.getAudioVolume()); | ||
params["muteStatus"] = msg.status.getAudioMuteStatus(); | ||
params["volumeLevel"] = msg.status.getAudioVolume(); | ||
|
@@ -2476,7 +2491,14 @@ | |
params["status"] = string("success"); | ||
params["audioDeviceConnected"] = string("false"); | ||
hdmiCecAudioDeviceConnected = false; | ||
sendNotify(eventString[HDMICECSINK_EVENT_AUDIO_DEVICE_CONNECTED_STATUS], params); | ||
if (m_audioStatusDetectionTimer.isActive()){ | ||
m_audioStatusDetectionTimer.stop(); | ||
} | ||
m_isAudioStatusInfoUpdated = false; | ||
m_audioStatusReceived = false; | ||
m_audioStatusTimerStarted = false; | ||
LOGINFO("Audio device removed, reset the audio status info. m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); | ||
sendNotify(eventString[HDMICECSINK_EVENT_AUDIO_DEVICE_CONNECTED_STATUS], params) | ||
} | ||
|
||
_instance->deviceList[logicalAddress].m_isRequestRetry = 0; | ||
|
@@ -2719,29 +2741,44 @@ | |
_instance->allocateLogicalAddress(DeviceType::TV); | ||
if ( _instance->m_logicalAddressAllocated != LogicalAddress::UNREGISTERED) | ||
{ | ||
logicalAddress = LogicalAddress(_instance->m_logicalAddressAllocated); | ||
LibCCEC::getInstance().addLogicalAddress(logicalAddress); | ||
_instance->smConnection->setSource(logicalAddress); | ||
_instance->m_numberOfDevices = 0; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType = DeviceType::TV; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_isDevicePresent = true; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].update(physical_addr); | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_1_4; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_vendorID = appVendorId; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_powerStatus = PowerStatus(powerState); | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_currentLanguage = defaultLanguage; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_osdName = osdName.toString().c_str(); | ||
if(cecVersion == 2.0) { | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_2_0; | ||
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST), | ||
MessageEncoder().encode(ReportFeatures(Version::V_2_0,allDevicetype,rcProfile,deviceFeatures)), 500); | ||
} | ||
_instance->smConnection->addFrameListener(_instance->msgFrameListener); | ||
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST), | ||
MessageEncoder().encode(ReportPhysicalAddress(physical_addr, _instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType)), 100); | ||
|
||
_instance->m_sleepTime = 0; | ||
_instance->m_pollThreadState = POLL_THREAD_STATE_PING; | ||
try{ | ||
|
||
logicalAddress = LogicalAddress(_instance->m_logicalAddressAllocated); | ||
LibCCEC::getInstance().addLogicalAddress(logicalAddress); | ||
_instance->smConnection->setSource(logicalAddress); | ||
_instance->m_numberOfDevices = 0; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType = DeviceType::TV; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_isDevicePresent = true; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].update(physical_addr); | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_1_4; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_vendorID = appVendorId; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_powerStatus = PowerStatus(powerState); | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_currentLanguage = defaultLanguage; | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_osdName = osdName.toString().c_str(); | ||
if(cecVersion == 2.0) { | ||
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_2_0; | ||
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST), | ||
MessageEncoder().encode(ReportFeatures(Version::V_2_0,allDevicetype,rcProfile,deviceFeatures)), 500); | ||
} | ||
_instance->smConnection->addFrameListener(_instance->msgFrameListener); | ||
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST), | ||
MessageEncoder().encode(ReportPhysicalAddress(physical_addr, _instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType)), 100); | ||
|
||
_instance->m_sleepTime = 0; | ||
_instance->m_pollThreadState = POLL_THREAD_STATE_PING; | ||
} | ||
catch(InvalidStateException &e){ | ||
LOGWARN("InvalidStateException caught while allocated logical address. %s", e.what()); | ||
_instance->m_pollThreadState = POLL_THREAD_STATE_EXIT; | ||
} | ||
catch(IOException &e){ | ||
LOGWARN("IOException caught while allocated logical address. %s", e.what()); | ||
_instance->m_pollThreadState = POLL_THREAD_STATE_EXIT; | ||
} | ||
catch(...){ | ||
LOGWARN("Exception caught while allocated logical address."); | ||
_instance->m_pollThreadState = POLL_THREAD_STATE_EXIT; | ||
} | ||
} | ||
else | ||
{ | ||
|
@@ -2977,9 +3014,14 @@ | |
{ | ||
LibCCEC::getInstance().init("HdmiCecSink"); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
LOGWARN("CEC exception caught from LibCCEC::getInstance().init()"); | ||
catch(InvalidStateException &e){ | ||
LOGWARN("InvalidStateException caught in LibCCEC::init %s", e.what()); | ||
} | ||
catch(IOException &e){ | ||
LOGWARN("IOException caught in LibCCEC::init %s", e.what()); | ||
} | ||
catch(...){ | ||
LOGWARN("Exception caught in LibCCEC::init"); | ||
} | ||
} | ||
libcecInitStatus++; | ||
|
@@ -3073,6 +3115,14 @@ | |
|
||
m_logicalAddressAllocated = LogicalAddress::UNREGISTERED; | ||
m_currentArcRoutingState = ARC_STATE_ARC_TERMINATED; | ||
if (m_audioStatusDetectionTimer.isActive()){ | ||
m_audioStatusDetectionTimer.stop(); | ||
} | ||
m_isAudioStatusInfoUpdated = false; | ||
m_audioStatusReceived = false; | ||
m_audioStatusTimerStarted = false; | ||
LOGINFO("CEC Disabled, reset the audio status info. m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); | ||
|
||
|
||
for(int i=0; i< 16; i++) | ||
{ | ||
|
@@ -3088,9 +3138,14 @@ | |
{ | ||
LibCCEC::getInstance().term(); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
LOGWARN("CEC exception caught from LibCCEC::getInstance().term() "); | ||
catch(InvalidStateException &e){ | ||
LOGWARN("InvalidStateException caught in LibCCEC::term %s", e.what()); | ||
} | ||
catch(IOException &e){ | ||
LOGWARN("IOException caught in LibCCEC::term %s", e.what()); | ||
} | ||
catch(...){ | ||
LOGWARN("Exception caught in LibCCEC::term"); | ||
} | ||
} | ||
|
||
|
@@ -3323,12 +3378,43 @@ | |
|
||
if((_instance->m_SendKeyQueue.size()<=1 || (_instance->m_SendKeyQueue.size() % 2 == 0)) && ((keyInfo.keyCode == VOLUME_UP) || (keyInfo.keyCode == VOLUME_DOWN) || (keyInfo.keyCode == MUTE)) ) | ||
{ | ||
_instance->sendGiveAudioStatusMsg(); | ||
} | ||
if(keyInfo.keyCode == MUTE) | ||
{ | ||
_instance->sendGiveAudioStatusMsg(); | ||
} | ||
else | ||
{ | ||
LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ",_instance->m_isAudioStatusInfoUpdated,_instance->m_audioStatusReceived,_instance->m_audioStatusTimerStarted); | ||
if (!_instance->m_isAudioStatusInfoUpdated) | ||
{ | ||
if ( !(_instance->m_audioStatusDetectionTimer.isActive())) | ||
{ | ||
LOGINFO("Audio status info not updated. Starting the Timer!"); | ||
_instance->m_audioStatusTimerStarted = true; | ||
_instance->m_audioStatusDetectionTimer.start((HDMICECSINK_UPDATE_AUDIO_STATUS_INTERVAL_MS)); | ||
} | ||
LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", _instance->m_isAudioStatusInfoUpdated,_instance->m_audioStatusReceived,_instance->m_audioStatusTimerStarted); | ||
} | ||
else | ||
{ | ||
if (!_instance->m_audioStatusReceived){ | ||
_instance->sendGiveAudioStatusMsg(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
}//while(!_instance->m_sendKeyEventThreadExit) | ||
}//threadSendKeyEvent | ||
|
||
void HdmiCecSink::audioStatusTimerFunction() | ||
{ | ||
m_audioStatusTimerStarted = false; | ||
m_isAudioStatusInfoUpdated = true; | ||
LOGINFO("Timer Expired. Requesting the AudioStatus since not received.\n"); | ||
sendGiveAudioStatusMsg(); | ||
LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted); | ||
} | ||
|
||
void HdmiCecSink::threadArcRouting() | ||
{ | ||
|
@@ -3339,7 +3425,7 @@ | |
return; | ||
|
||
LOGINFO("Running threadArcRouting"); | ||
|
||
_instance->getHdmiArcPortID(); | ||
|
||
while(1) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
Check failure on line 1 in HdmiCecSink/HdmiCecSink.h
|
||
* If not stated otherwise in this file or this component's LICENSE | ||
* file the following copyright and licenses apply: | ||
* | ||
|
@@ -573,9 +573,10 @@ | |
void sendKeyReleaseEvent(const int logicalAddress); | ||
void sendUserControlPressed(const int logicalAddress, int keyCode); | ||
void sendUserControlReleased(const int logicalAddress); | ||
void sendGiveAudioStatusMsg(); | ||
void onPowerModeChanged(const PowerState ¤tState, const PowerState &newState); | ||
void registerEventHandlers(); | ||
void sendGiveAudioStatusMsg(); | ||
void getHdmiArcPortID(); | ||
int m_numberOfDevices; /* Number of connected devices othethan own device */ | ||
bool m_audioDevicePowerStatusRequested; | ||
|
||
|
@@ -667,6 +668,9 @@ | |
/* Send Key event related */ | ||
bool m_sendKeyEventThreadExit; | ||
bool m_sendKeyEventThreadRun; | ||
bool m_isAudioStatusInfoUpdated; | ||
bool m_audioStatusReceived; | ||
bool m_audioStatusTimerStarted; | ||
std::thread m_sendKeyEventThread; | ||
std::mutex m_sendKeyEventMutex; | ||
std::queue<SendKeyInfo> m_SendKeyQueue; | ||
|
@@ -685,6 +689,7 @@ | |
binary_semaphore m_semSignaltoArcRoutingThread; | ||
bool m_arcstarting; | ||
TpTimer m_arcStartStopTimer; | ||
TpTimer m_audioStatusDetectionTimer; | ||
|
||
Connection *smConnection; | ||
std::vector<uint8_t> m_connectedDevices; | ||
|
@@ -731,7 +736,7 @@ | |
void Send_Request_Arc_Termination_Message(); | ||
void Send_Report_Arc_Terminated_Message(); | ||
void arcStartStopTimerFunction(); | ||
void getHdmiArcPortID(); | ||
void audioStatusTimerFunction(); | ||
void getCecVersion(); | ||
}; | ||
} // namespace Plugin | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
Check failure on line 1 in HdmiCecSource/HdmiCecSource.cpp
|
||
* If not stated otherwise in this file or this component's LICENSE | ||
* file the following copyright and licenses apply: | ||
* | ||
|
@@ -1118,9 +1118,14 @@ | |
{ | ||
LibCCEC::getInstance().init("HdmiCecSource"); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
LOGWARN("CEC exception caught from LibCCEC::getInstance().init()"); | ||
catch(InvalidStateException &e){ | ||
LOGWARN("InvalidStateException caught in LibCCEC::init %s", e.what()); | ||
} | ||
catch(IOException &e){ | ||
LOGWARN("IOException caught in LibCCEC::init %s", e.what()); | ||
} | ||
catch(...){ | ||
LOGWARN("Exception caught in LibCCEC::init"); | ||
} | ||
} | ||
libcecInitStatus++; | ||
|
@@ -1265,9 +1270,14 @@ | |
{ | ||
LibCCEC::getInstance().term(); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
LOGWARN("CEC exception caught from LibCCEC::getInstance().term() "); | ||
catch(InvalidStateException &e){ | ||
LOGWARN("InvalidStateException caught in LibCCEC::getInstance().term() %s", e.what()); | ||
} | ||
catch(IOException &e){ | ||
LOGWARN("IOException caught in LibCCEC::getInstance().term()%s", e.what()); | ||
} | ||
catch(...){ | ||
LOGWARN("Exception caught in LibCCEC::getInstance().term()"); | ||
} | ||
} | ||
|
||
|
@@ -1525,7 +1535,15 @@ | |
CECFrame frame = CECFrame((const uint8_t *)buf.data(), size); | ||
// SVCLOG_WARN("Frame to be sent from servicemanager in %s \n",__FUNCTION__); | ||
// frame.hexDump(); | ||
smConnection->sendAsync(frame); | ||
try{ | ||
smConnection->sendAsync(frame); | ||
} | ||
catch(InvalidStateException &e){ | ||
LOGERR("InvalidStateException caught in sendUnencryptMsg %s", e.what()); | ||
} | ||
catch(...){ | ||
LOGERR("Exception caught in sendUnencryptMsg"); | ||
} | ||
} | ||
else | ||
LOGWARN("cecEnableStatus=false"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you add any new IARM registration? Or this initialize was not called before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no @apatel859 , It is just a re-arragement of lines, it was exisiting before. line no 764 is brought here.