@@ -2719,29 +2719,53 @@ namespace WPEFramework
2719
2719
_instance->allocateLogicalAddress (DeviceType::TV);
2720
2720
if ( _instance->m_logicalAddressAllocated != LogicalAddress::UNREGISTERED)
2721
2721
{
2722
- logicalAddress = LogicalAddress (_instance->m_logicalAddressAllocated );
2723
- LibCCEC::getInstance ().addLogicalAddress (logicalAddress);
2724
- _instance->smConnection ->setSource (logicalAddress);
2725
- _instance->m_numberOfDevices = 0 ;
2726
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_deviceType = DeviceType::TV;
2727
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_isDevicePresent = true ;
2728
- _instance->deviceList [_instance->m_logicalAddressAllocated ].update (physical_addr);
2729
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_cecVersion = Version::V_1_4;
2730
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_vendorID = appVendorId;
2731
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_powerStatus = PowerStatus (powerState);
2732
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_currentLanguage = defaultLanguage;
2733
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_osdName = osdName.toString ().c_str ();
2734
- if (cecVersion == 2.0 ) {
2735
- _instance->deviceList [_instance->m_logicalAddressAllocated ].m_cecVersion = Version::V_2_0;
2736
- _instance->smConnection ->sendTo (LogicalAddress (LogicalAddress::BROADCAST),
2737
- MessageEncoder ().encode (ReportFeatures (Version::V_2_0,allDevicetype,rcProfile,deviceFeatures)), 500 );
2738
- }
2739
- _instance->smConnection ->addFrameListener (_instance->msgFrameListener );
2740
- _instance->smConnection ->sendTo (LogicalAddress (LogicalAddress::BROADCAST),
2741
- MessageEncoder ().encode (ReportPhysicalAddress (physical_addr, _instance->deviceList [_instance->m_logicalAddressAllocated ].m_deviceType )), 100 );
2742
-
2743
- _instance->m_sleepTime = 0 ;
2744
- _instance->m_pollThreadState = POLL_THREAD_STATE_PING;
2722
+ try (){
2723
+
2724
+ logicalAddress = LogicalAddress (_instance->m_logicalAddressAllocated );
2725
+ LibCCEC::getInstance ().addLogicalAddress (logicalAddress);
2726
+ _instance->smConnection ->setSource (logicalAddress);
2727
+ _instance->m_numberOfDevices = 0 ;
2728
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_deviceType = DeviceType::TV;
2729
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_isDevicePresent = true ;
2730
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].update (physical_addr);
2731
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_cecVersion = Version::V_1_4;
2732
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_vendorID = appVendorId;
2733
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_powerStatus = PowerStatus (powerState);
2734
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_currentLanguage = defaultLanguage;
2735
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_osdName = osdName.toString ().c_str ();
2736
+ if (cecVersion == 2.0 ) {
2737
+ _instance->deviceList [_instance->m_logicalAddressAllocated ].m_cecVersion = Version::V_2_0;
2738
+ _instance->smConnection ->sendTo (LogicalAddress (LogicalAddress::BROADCAST),
2739
+ MessageEncoder ().encode (ReportFeatures (Version::V_2_0,allDevicetype,rcProfile,deviceFeatures)), 500 );
2740
+ }
2741
+ _instance->smConnection ->addFrameListener (_instance->msgFrameListener );
2742
+ _instance->smConnection ->sendTo (LogicalAddress (LogicalAddress::BROADCAST),
2743
+ MessageEncoder ().encode (ReportPhysicalAddress (physical_addr, _instance->deviceList [_instance->m_logicalAddressAllocated ].m_deviceType )), 100 );
2744
+
2745
+ _instance->m_sleepTime = 0 ;
2746
+ _instance->m_pollThreadState = POLL_THREAD_STATE_PING;
2747
+ }
2748
+ catch (InvalidStateException &e){
2749
+ LOGWARN (" InvalidStateException caught in LibCCEC::getInstance().addLogicalAddress() %s" , e.what ());
2750
+ LOGINFO (" Not able allocate Logical Address for TV" );
2751
+ _instance->m_pollThreadState = POLL_THREAD_STATE_EXIT;
2752
+ }
2753
+ catch (IOException &e){
2754
+ LOGWARN (" IOException caught in LibCCEC::getInstance().addLogicalAddress() %s" , e.what ());
2755
+ LOGINFO (" Not able allocate Logical Address for TV" );
2756
+ _instance->m_pollThreadState = POLL_THREAD_STATE_EXIT;
2757
+ }
2758
+ catch (const std::exception& e)
2759
+ {
2760
+ LOGWARN (" CEC exception caught from LibCCEC::getInstance().addLogicalAddress() " );
2761
+ LOGINFO (" Not able allocate Logical Address for TV" );
2762
+ _instance->m_pollThreadState = POLL_THREAD_STATE_EXIT;
2763
+ }
2764
+ catch (...){
2765
+ LOGWARN (" Exception caught in LibCCEC::getInstance().addLogicalAddress()" );
2766
+ LOGINFO (" Not able allocate Logical Address for TV" );
2767
+ _instance->m_pollThreadState = POLL_THREAD_STATE_EXIT;
2768
+ }
2745
2769
}
2746
2770
else
2747
2771
{
@@ -2977,9 +3001,18 @@ namespace WPEFramework
2977
3001
{
2978
3002
LibCCEC::getInstance ().init (" HdmiCecSink" );
2979
3003
}
3004
+ catch (InvalidStateException &e){
3005
+ LOGWARN (" InvalidStateException caught in LibCCEC::init %s" , e.what ());
3006
+ }
3007
+ catch (IOException &e){
3008
+ LOGWARN (" IOException caught in LibCCEC::init %s" , e.what ());
3009
+ }
2980
3010
catch (const std::exception& e)
2981
3011
{
2982
- LOGWARN (" CEC exception caught from LibCCEC::getInstance().init()" );
3012
+ LOGWARN (" CEC exception caught from CECEnable" );
3013
+ }
3014
+ catch (...){
3015
+ LOGWARN (" Exception caught in LibCCEC::init" );
2983
3016
}
2984
3017
}
2985
3018
libcecInitStatus++;
@@ -3088,9 +3121,18 @@ namespace WPEFramework
3088
3121
{
3089
3122
LibCCEC::getInstance ().term ();
3090
3123
}
3124
+ catch (InvalidStateException &e){
3125
+ LOGWARN (" InvalidStateException caught in LibCCEC::term %s" , e.what ());
3126
+ }
3127
+ catch (IOException &e){
3128
+ LOGWARN (" IOException caught in LibCCEC::term %s" , e.what ());
3129
+ }
3091
3130
catch (const std::exception& e)
3092
3131
{
3093
- LOGWARN (" CEC exception caught from LibCCEC::getInstance().term() " );
3132
+ LOGWARN (" CEC exception caught from CECEnable" );
3133
+ }
3134
+ catch (...){
3135
+ LOGWARN (" Exception caught in LibCCEC::term" );
3094
3136
}
3095
3137
}
3096
3138
0 commit comments