1763 MPX_DEBUG(_L("CMPXVideoPlaybackController::IsKeyLocked(%d)"), keylock); |
1764 MPX_DEBUG(_L("CMPXVideoPlaybackController::IsKeyLocked(%d)"), keylock); |
1764 |
1765 |
1765 return keylock; |
1766 return keylock; |
1766 } |
1767 } |
1767 |
1768 |
|
1769 // ------------------------------------------------------------------------------------------------- |
|
1770 // CMPXVideoPlaybackController::SendTvOutEventL |
|
1771 // ------------------------------------------------------------------------------------------------- |
|
1772 // |
|
1773 TBool CMPXVideoPlaybackController::SendTvOutEventL( TBool aConnected, TBool aPlaybackAllowed ) |
|
1774 { |
|
1775 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::SendTvOutEventL()")); |
|
1776 |
|
1777 // |
|
1778 // Send notice to the playback view with TV-Out connection status |
|
1779 // and TV-Out playback allowed flag |
|
1780 // |
|
1781 CMPXMessage* message = CMPXMessage::NewL(); |
|
1782 CleanupStack::PushL( message ); |
|
1783 |
|
1784 message->SetTObjectValueL<TMPXMessageId>( KMPXMessageGeneralId, KMPXMediaIdVideoPlayback ); |
|
1785 message->SetTObjectValueL<TMPXVideoPlaybackCommand> |
|
1786 ( KMPXMediaVideoPlaybackCommand, EPbCmdTvOutEvent ); |
|
1787 message->SetTObjectValueL<TInt>( KMPXMediaVideoTvOutConnected, aConnected ); |
|
1788 message->SetTObjectValueL<TInt>( KMPXMediaVideoTvOutPlayAllowed, aPlaybackAllowed ); |
|
1789 |
|
1790 iMPXPluginObs->HandlePlaybackMessage( message, KErrNone ); |
|
1791 |
|
1792 CleanupStack::PopAndDestroy( message ); |
|
1793 } |
|
1794 |
1768 // ------------------------------------------------------------------------------------------------ |
1795 // ------------------------------------------------------------------------------------------------ |
1769 // CMPXVideoPlaybackController::HandleTvOutEventL() |
1796 // CMPXVideoPlaybackController::HandleTvOutEventL() |
1770 // ------------------------------------------------------------------------------------------------ |
1797 // ------------------------------------------------------------------------------------------------ |
1771 // |
1798 // |
1772 void CMPXVideoPlaybackController::HandleTvOutEventL( TBool aConnected ) |
1799 void CMPXVideoPlaybackController::HandleTvOutEventL( TBool aConnected ) |
1773 { |
1800 { |
1774 MPX_ENTER_EXIT( _L("CMPXVideoPlaybackController::HandleTvOutEventL()"), |
1801 MPX_ENTER_EXIT( _L("CMPXVideoPlaybackController::HandleTvOutEventL()"), |
1775 _L("aConnected = %d"), aConnected ); |
1802 _L("aConnected = %d"), aConnected ); |
1776 |
1803 |
1777 TBool playbackAllowed = ETrue; |
1804 TBool playbackAllowed = iAccessoryMonitor->IsTvOutPlaybackAllowed(); |
1778 |
1805 |
|
1806 SendTvOutEventL( aConnected, playbackAllowed ); |
|
1807 |
|
1808 // |
|
1809 // Check playback status of clip with new Tv-Out status |
|
1810 // |
1779 if ( aConnected ) |
1811 if ( aConnected ) |
1780 { |
1812 { |
1781 // |
1813 // |
1782 // TV-Out accessory connected |
1814 // TV-Out accessory connected |
1783 // |
1815 // |
1784 if ( ! iAccessoryMonitor->IsTvOutPlaybackAllowed() ) |
1816 if ( ! playbackAllowed ) |
1785 { |
1817 { |
1786 // |
1818 // |
1787 // Clip has DRM protection and TV-Out is connected |
1819 // Clip has DRM protection and TV-Out is connected |
1788 // Pause playback and display info note |
1820 // Pause playback and display info note |
1789 // |
1821 // |
1790 DoHandleCommandL( EPbCmdPause ); |
1822 DoHandleCommandL( EPbCmdPause ); |
1791 |
1823 |
1792 playbackAllowed = EFalse; |
|
1793 |
|
1794 iState->SendErrorToViewL( KMPXVideoTvOutPlaybackNotAllowed ); |
1824 iState->SendErrorToViewL( KMPXVideoTvOutPlaybackNotAllowed ); |
1795 } |
1825 } |
1796 else |
1826 else |
1797 { |
1827 { |
1798 // If lights are being controlled enable display timer so that screen backlight will be turned |
1828 // If lights are being controlled enable display timer so that screen backlight will be turned |
1799 // of after timeout. |
1829 // of after timeout. |
1800 if ( iBackLightTimer->IsActive() ) |
1830 if ( iBackLightTimer->IsActive() ) |
1801 { |
1831 { |
1802 RestartDisplayTimer(); |
1832 RestartDisplayTimer(); |
1803 } |
1833 } |
1804 } |
1834 } |
1805 } |
1835 } |
1806 else |
1836 else |
1807 { |
1837 { |
1808 // TV out disconnected |
1838 // TV out disconnected |
1809 CancelDisplayTimer(); |
1839 CancelDisplayTimer(); |
1810 |
1840 |
1811 // Ensure that lights are on after this |
1841 // Ensure that lights are on after this |
1812 ReleaseLights(); |
1842 ReleaseLights(); |
1813 |
1843 |
1814 // Pause playback since TV-Out accessory has been disconnected. |
1844 // Pause playback since TV-Out accessory has been disconnected. |
1815 DoHandleCommandL( EPbCmdPause ); |
1845 DoHandleCommandL( EPbCmdPause ); |
1816 } |
1846 } |
1817 |
|
1818 // |
|
1819 // Send notice to the playback view with TV-Out connection status |
|
1820 // and TV-Out playback allowed flag |
|
1821 // |
|
1822 CMPXMessage* message = CMPXMessage::NewL(); |
|
1823 CleanupStack::PushL( message ); |
|
1824 |
|
1825 message->SetTObjectValueL<TMPXMessageId>( KMPXMessageGeneralId, KMPXMediaIdVideoPlayback ); |
|
1826 message->SetTObjectValueL<TMPXVideoPlaybackCommand> |
|
1827 ( KMPXMediaVideoPlaybackCommand, EPbCmdTvOutEvent ); |
|
1828 message->SetTObjectValueL<TInt>( KMPXMediaVideoTvOutConnected, aConnected ); |
|
1829 message->SetTObjectValueL<TInt>( KMPXMediaVideoTvOutPlayAllowed, playbackAllowed ); |
|
1830 |
|
1831 iMPXPluginObs->HandlePlaybackMessage( message, KErrNone ); |
|
1832 |
|
1833 CleanupStack::PopAndDestroy( message ); |
|
1834 } |
1847 } |
1835 |
1848 |
1836 // ------------------------------------------------------------------------------------------------ |
1849 // ------------------------------------------------------------------------------------------------ |
1837 // CMPXVideoPlaybackController::CancelBackLightTimer |
1850 // CMPXVideoPlaybackController::CancelBackLightTimer |
1838 // ------------------------------------------------------------------------------------------------ |
1851 // ------------------------------------------------------------------------------------------------ |
1931 // ----------------------------------------------------------------------------- |
1942 // ----------------------------------------------------------------------------- |
1932 // |
1943 // |
1933 void CMPXVideoPlaybackController::CancelLightsControl() |
1944 void CMPXVideoPlaybackController::CancelLightsControl() |
1934 { |
1945 { |
1935 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelLightsControl()")); |
1946 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelLightsControl()")); |
1936 |
1947 |
1937 // This is called whenever there is no need to keep screensaver of anymore |
1948 // This is called whenever there is no need to keep screensaver of anymore |
1938 // This means that also displaytimer and activity monitoring can be stopped. |
1949 // This means that also displaytimer and activity monitoring can be stopped. |
1939 // This method is not correct place for these calls |
1950 // This method is not correct place for these calls |
1940 CancelBackLightTimer(); |
1951 CancelBackLightTimer(); |
1941 |
1952 |
1942 CancelUserActivityTimer(); |
1953 CancelUserActivityTimer(); |
1943 |
1954 |
1944 CancelDisplayTimer(); |
1955 CancelDisplayTimer(); |
1945 |
1956 |
1946 // Ensure that lights are on |
1957 // Ensure that lights are on |
1947 EnableDisplayBacklight(); |
1958 EnableDisplayBacklight(); |
1948 |
1959 |
1949 // Release lights if releserved |
1960 // Release lights if releserved |
1950 ReleaseLights(); |
1961 ReleaseLights(); |
1951 } |
1962 } |
1952 |
1963 |
1953 |
1964 |
1954 // ----------------------------------------------------------------------------- |
1965 // ----------------------------------------------------------------------------- |
1955 // CMPXVideoPlaybackController::InitDisplayTimerL |
1966 // CMPXVideoPlaybackController::InitDisplayTimerL |
1956 // ----------------------------------------------------------------------------- |
1967 // ----------------------------------------------------------------------------- |
1957 // |
1968 // |
1958 TTimeIntervalMicroSeconds32 CMPXVideoPlaybackController::InitDisplayTimerL() |
1969 TTimeIntervalMicroSeconds32 CMPXVideoPlaybackController::InitDisplayTimerL() |
1959 { |
1970 { |
1960 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::InitDisplayTimerL()")); |
1971 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::InitDisplayTimerL()")); |
1961 |
1972 |
1962 if ( !iDisplayTimer ) |
1973 if ( !iDisplayTimer ) |
1963 { |
1974 { |
1964 iDisplayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); |
1975 iDisplayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard ); |
1965 |
1976 |
1966 MPX_DEBUG(_L("CMPXVideoPlaybackController::InitDisplayTimerL() - created") ); |
1977 MPX_DEBUG(_L("CMPXVideoPlaybackController::InitDisplayTimerL() - created") ); |
1967 |
1978 } |
1968 } |
1979 |
1969 |
|
1970 if ( iDisplayTimerTimeout.Int() == 0 ) |
1980 if ( iDisplayTimerTimeout.Int() == 0 ) |
1971 { |
1981 { |
1972 // Get the display light time-out value from CenRep |
1982 // Get the display light time-out value from CenRep |
1973 CRepository* repository = CRepository::NewLC( KCRUidLightSettings ); |
1983 CRepository* repository = CRepository::NewLC( KCRUidLightSettings ); |
1974 // What's the timeout value (in seconds ) for the display light? |
1984 // What's the timeout value (in seconds ) for the display light? |
1975 TInt displayTimeOut ( 0 ); |
1985 TInt displayTimeOut ( 0 ); |
1976 repository->Get( KDisplayLightsTimeout, displayTimeOut ); |
1986 repository->Get( KDisplayLightsTimeout, displayTimeOut ); |
1977 |
1987 |
1978 if ( ( displayTimeOut * KMPXMicroSecondsInASecond ) > KMaxTInt ) |
1988 if ( ( displayTimeOut * KMPXMicroSecondsInASecond ) > KMaxTInt ) |
1979 { |
1989 { |
1980 iDisplayTimerTimeout = KMaxTInt; |
1990 iDisplayTimerTimeout = KMaxTInt; |
1981 } |
1991 } |
1982 else |
1992 else |
1983 { |
1993 { |
1984 iDisplayTimerTimeout = displayTimeOut * KMPXMicroSecondsInASecond; |
1994 iDisplayTimerTimeout = displayTimeOut * KMPXMicroSecondsInASecond; |
1985 } |
1995 } |
1986 |
1996 |
1987 CleanupStack::PopAndDestroy( repository ); |
1997 CleanupStack::PopAndDestroy( repository ); |
1988 } |
1998 } |
1989 |
1999 |
1990 |
|
1991 MPX_DEBUG( _L("CMPXVideoPlaybackController::InitDisplayTimerL Timeout(%d)"), iDisplayTimerTimeout.Int() ); |
2000 MPX_DEBUG( _L("CMPXVideoPlaybackController::InitDisplayTimerL Timeout(%d)"), iDisplayTimerTimeout.Int() ); |
1992 |
2001 |
1993 // Convert the timeout value to microseconds |
2002 // Convert the timeout value to microseconds |
1994 return iDisplayTimerTimeout; |
2003 return iDisplayTimerTimeout; |
1995 } |
2004 } |
1996 |
2005 |
1997 // ----------------------------------------------------------------------------- |
2006 // ----------------------------------------------------------------------------- |
1998 // CMPXVideoPlaybackController::RestartDisplayTimer |
2007 // CMPXVideoPlaybackController::RestartDisplayTimer |
1999 // ----------------------------------------------------------------------------- |
2008 // ----------------------------------------------------------------------------- |
2004 |
2013 |
2005 TTimeIntervalMicroSeconds32 displayTimeOut(0); |
2014 TTimeIntervalMicroSeconds32 displayTimeOut(0); |
2006 // Leave system to safe state if following leaves. Lights stay on |
2015 // Leave system to safe state if following leaves. Lights stay on |
2007 MPX_TRAPD(err, displayTimeOut=InitDisplayTimerL(); ) |
2016 MPX_TRAPD(err, displayTimeOut=InitDisplayTimerL(); ) |
2008 if ( err == KErrNone ) |
2017 if ( err == KErrNone ) |
2009 { |
2018 { |
2010 // check if the display timer is running and cancel it |
2019 // check if the display timer is running and cancel it |
2011 if ( iDisplayTimer->IsActive() ) |
2020 if ( iDisplayTimer->IsActive() ) |
2012 { |
2021 { |
2013 iDisplayTimer->Cancel(); |
2022 iDisplayTimer->Cancel(); |
2014 } |
2023 } |
2015 |
2024 |
2016 MPX_DEBUG( _L("CMPXVideoPlaybackController::RestartDisplayTimer() restarting displayTimer to=%d ms"), displayTimeOut.Int() ); |
2025 MPX_DEBUG( _L("CMPXVideoPlaybackController::RestartDisplayTimer() restarting displayTimer to=%d ms"), displayTimeOut.Int() ); |
2017 |
2026 |
2018 iDisplayTimer->Start( displayTimeOut, displayTimeOut, |
2027 iDisplayTimer->Start( displayTimeOut, displayTimeOut, |
2019 TCallBack( CMPXVideoPlaybackController::HandleDisplayTimeout, this ) ); |
2028 TCallBack( CMPXVideoPlaybackController::HandleDisplayTimeout, this ) ); |
2020 } |
2029 } |
2021 |
|
2022 } |
2030 } |
2023 |
2031 |
2024 // ----------------------------------------------------------------------------- |
2032 // ----------------------------------------------------------------------------- |
2025 // CMPXVideoPlaybackController::CancelDisplayTimer |
2033 // CMPXVideoPlaybackController::CancelDisplayTimer |
2026 // ----------------------------------------------------------------------------- |
2034 // ----------------------------------------------------------------------------- |
2027 // |
2035 // |
2028 void CMPXVideoPlaybackController::CancelDisplayTimer() |
2036 void CMPXVideoPlaybackController::CancelDisplayTimer() |
2029 { |
2037 { |
2030 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelDisplayTimer")); |
2038 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelDisplayTimer")); |
2031 |
2039 |
2032 if ( iDisplayTimer ) |
2040 if ( iDisplayTimer ) |
2033 { |
2041 { |
2034 if ( iDisplayTimer->IsActive() ) |
2042 if ( iDisplayTimer->IsActive() ) |
2035 { |
2043 { |
2036 iDisplayTimer->Cancel(); |
2044 iDisplayTimer->Cancel(); |
2069 |
2077 |
2070 |
2078 |
2071 // ------------------------------------------------------------------------------------------------ |
2079 // ------------------------------------------------------------------------------------------------ |
2072 // CMPXVideoPlaybackController::EnableDisplayBacklight |
2080 // CMPXVideoPlaybackController::EnableDisplayBacklight |
2073 // ------------------------------------------------------------------------------------------------ |
2081 // ------------------------------------------------------------------------------------------------ |
2074 // |
2082 // |
2075 void CMPXVideoPlaybackController::EnableDisplayBacklight() |
2083 void CMPXVideoPlaybackController::EnableDisplayBacklight() |
2076 { |
2084 { |
2077 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::EnableDisplayBacklight()")); |
2085 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::EnableDisplayBacklight()")); |
2078 |
2086 |
2079 // ELightStatusUnknown - We are not controlling lights and we don't care about lights |
2087 // ELightStatusUnknown - We are not controlling lights and we don't care about lights |
2080 // ELightOn - Ligths are certainly on |
2088 // ELightOn - Ligths are certainly on |
2081 MPX_DEBUG(_L("CMPXVideoPlaybackController::EnableDisplayBacklight() iLightStatus=%d"), iLightStatus ); |
2089 MPX_DEBUG(_L("CMPXVideoPlaybackController::EnableDisplayBacklight() iLightStatus=%d"), iLightStatus ); |
2082 |
2090 |
2083 // We are responsible of turning lights on only if we have switched them off. |
2091 // We are responsible of turning lights on only if we have switched them off. |
2084 if ( iLightStatus == CHWRMLight::ELightOff ) |
2092 if ( iLightStatus == CHWRMLight::ELightOff ) |
2085 { |
2093 { |
2086 |
2094 |
2087 MPX_TRAPD( err, |
2095 MPX_TRAPD( err, |
2088 { |
2096 { |
2089 // Following GetLightsL() call will not leave. |
2097 // Following GetLightsL() call will not leave. |
2090 // This call should not result to creation of CHWRMLight in this case |
2098 // This call should not result to creation of CHWRMLight in this case |
2091 // because CHWRMLight was created when lights were turned off. |
2099 // because CHWRMLight was created when lights were turned off. |
2092 CHWRMLight* lights= GetLightsL(); |
2100 CHWRMLight* lights= GetLightsL(); |
2093 if ( lights->LightStatus(CHWRMLight::EPrimaryDisplay) == CHWRMLight::ELightOff ) |
2101 if ( lights->LightStatus(CHWRMLight::EPrimaryDisplay) == CHWRMLight::ELightOff ) |
2094 { |
2102 { |
2095 MPX_DEBUG(_L("CMPXVideoPlaybackController::EnableDisplayBacklight() enabling") ); |
2103 MPX_DEBUG(_L("CMPXVideoPlaybackController::EnableDisplayBacklight() enabling") ); |
2096 |
2104 |
2097 lights->LightOnL( CHWRMLight::EPrimaryDisplay, 0 ); |
2105 lights->LightOnL( CHWRMLight::EPrimaryDisplay, 0 ); |
2098 iLightStatus = CHWRMLight::ELightOn; |
2106 iLightStatus = CHWRMLight::ELightOn; |
2099 } |
2107 } |
2100 } ); |
2108 } ); |
2101 |
2109 } |
2102 } |
|
2103 |
|
2104 } |
2110 } |
2105 |
2111 |
2106 // ------------------------------------------------------------------------------------------------ |
2112 // ------------------------------------------------------------------------------------------------ |
2107 // CMPXVideoPlaybackController::DisableDisplayBacklight |
2113 // CMPXVideoPlaybackController::DisableDisplayBacklight |
2108 // ------------------------------------------------------------------------------------------------ |
2114 // ------------------------------------------------------------------------------------------------ |
2109 // |
2115 // |
2110 void CMPXVideoPlaybackController::DisableDisplayBacklight() |
2116 void CMPXVideoPlaybackController::DisableDisplayBacklight() |
2111 { |
2117 { |
2112 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DisableDisplayBacklight()")); |
2118 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DisableDisplayBacklight()")); |
2113 |
2119 |
2114 // No major harm done if following block leaves. Lights are left on |
2120 // No major harm done if following block leaves. Lights are left on |
2115 MPX_TRAPD( err, |
2121 MPX_TRAPD( err, |
2116 { |
2122 { |
2117 CHWRMLight* lights = GetLightsL(); |
2123 CHWRMLight* lights = GetLightsL(); |
2118 if ( lights->LightStatus(CHWRMLight::EPrimaryDisplay) == CHWRMLight::ELightOn ) |
2124 if ( lights->LightStatus(CHWRMLight::EPrimaryDisplay) == CHWRMLight::ELightOn ) |
2119 { |
2125 { |
2120 MPX_DEBUG(_L("CMPXVideoPlaybackController::DisableDisplayBacklight() disabling") ); |
2126 MPX_DEBUG(_L("CMPXVideoPlaybackController::DisableDisplayBacklight() disabling") ); |
2121 |
2127 |
2122 lights->LightOffL( CHWRMLight::EPrimaryDisplay, 0 ); |
2128 lights->LightOffL( CHWRMLight::EPrimaryDisplay, 0 ); |
2123 iLightStatus = CHWRMLight::ELightOff; |
2129 iLightStatus = CHWRMLight::ELightOff; |
2124 } |
2130 } |
2125 } ); |
2131 } ); |
2126 |
|
2127 } |
2132 } |
2128 |
2133 |
2129 |
2134 |
2130 // ------------------------------------------------------------------------------------------------ |
2135 // ------------------------------------------------------------------------------------------------ |
2131 // CMPXVideoPlaybackController::InitUserActivityTimer |
2136 // CMPXVideoPlaybackController::InitUserActivityTimer |
2132 // ------------------------------------------------------------------------------------------------ |
2137 // ------------------------------------------------------------------------------------------------ |
2133 // |
2138 // |
2134 void CMPXVideoPlaybackController::InitUserActivityTimerL() |
2139 void CMPXVideoPlaybackController::InitUserActivityTimerL() |
2135 { |
2140 { |
2136 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::InitUserActivityTimerL()")); |
2141 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::InitUserActivityTimerL()")); |
2137 |
2142 |
2138 iUserActivityTimer = CPeriodic::NewL( CActive::EPriorityStandard); |
2143 iUserActivityTimer = CPeriodic::NewL( CActive::EPriorityStandard); |
2139 |
2144 |
2140 // This timer will not run to the end. Timer will be canceled and reset at backlight timeout. |
2145 // This timer will not run to the end. Timer will be canceled and reset at backlight timeout. |
2141 iUserActivityTimer->Start( |
2146 iUserActivityTimer->Start( |
2142 0, |
2147 0, |
2143 KMPXInactivityTimeout, |
2148 KMPXInactivityTimeout, |
2144 TCallBack( CMPXVideoPlaybackController::HandleUserActivityTimeout, this )); |
2149 TCallBack( CMPXVideoPlaybackController::HandleUserActivityTimeout, this )); |
2145 |
|
2146 } |
2150 } |
2147 |
2151 |
2148 // ------------------------------------------------------------------------------------------------ |
2152 // ------------------------------------------------------------------------------------------------ |
2149 // CMPXVideoPlaybackController::RestartUserActivityTimer |
2153 // CMPXVideoPlaybackController::RestartUserActivityTimer |
2150 // ------------------------------------------------------------------------------------------------ |
2154 // ------------------------------------------------------------------------------------------------ |
2151 // |
2155 // |
2152 void CMPXVideoPlaybackController::RestartUserActivityTimer() |
2156 void CMPXVideoPlaybackController::RestartUserActivityTimer() |
2153 { |
2157 { |
2154 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::RestartUserActivityTimer()")); |
2158 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::RestartUserActivityTimer()")); |
2155 |
2159 |
2156 if ( !iUserActivityTimer ) |
2160 if ( !iUserActivityTimer ) |
2157 { |
2161 { |
2158 // This is first call. Create and initialize timer |
2162 // This is first call. Create and initialize timer |
2159 MPX_TRAPD( err, |
2163 MPX_TRAPD( err, |
2160 { |
2164 { |
2161 InitUserActivityTimerL(); |
2165 InitUserActivityTimerL(); |
2162 } ); |
2166 } ); |
2163 // If user activity timer creation fails we can't detect user activity and |
2167 |
2164 // get lights back on when user taps screen. |
2168 // If user activity timer creation fails we can't detect user activity and |
|
2169 // get lights back on when user taps screen. |
2165 // Leave lights on. |
2170 // Leave lights on. |
2166 if ( err != KErrNone ) |
2171 if ( err != KErrNone ) |
2167 { |
2172 { |
2168 EnableDisplayBacklight(); |
2173 EnableDisplayBacklight(); |
2169 } |
2174 } |
2170 } |
2175 } |
2171 |
2176 |
2172 if ( iUserActivityTimer ) |
2177 if ( iUserActivityTimer ) |
2173 { |
2178 { |
2174 if ( iUserActivityTimer->IsActive() ) |
2179 if ( iUserActivityTimer->IsActive() ) |
2175 { |
2180 { |
2176 iUserActivityTimer->Cancel(); |
2181 iUserActivityTimer->Cancel(); |
2177 } |
2182 } |
|
2183 |
2178 // Not interested about inactivity callback, only activity |
2184 // Not interested about inactivity callback, only activity |
2179 // If CPeriodic::Inactivity is started with argument 0 |
2185 // If CPeriodic::Inactivity is started with argument 0 |
2180 // timer will fire when system's user inactivity timer resets. |
2186 // timer will fire when system's user inactivity timer resets. |
2181 iUserActivityTimer->Inactivity( 0 ); |
2187 iUserActivityTimer->Inactivity( 0 ); |
2182 } |
2188 } |
2183 } |
2189 } |
2184 |
2190 |
2185 // ------------------------------------------------------------------------------------------------ |
2191 // ------------------------------------------------------------------------------------------------ |
2186 // CMPXVideoPlaybackController::CancelUserActivityTimer |
2192 // CMPXVideoPlaybackController::CancelUserActivityTimer |
2187 // ------------------------------------------------------------------------------------------------ |
2193 // ------------------------------------------------------------------------------------------------ |
2188 // |
2194 // |
2189 void CMPXVideoPlaybackController::CancelUserActivityTimer() |
2195 void CMPXVideoPlaybackController::CancelUserActivityTimer() |
2190 { |
2196 { |
2191 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelUserActivityTimer()")); |
2197 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelUserActivityTimer()")); |
2192 |
2198 |
2193 if ( iUserActivityTimer ) |
2199 if ( iUserActivityTimer ) |
2194 { |
2200 { |
2195 if ( iUserActivityTimer->IsActive() ) |
2201 if ( iUserActivityTimer->IsActive() ) |
2196 { |
2202 { |
2197 iUserActivityTimer->Cancel(); |
2203 iUserActivityTimer->Cancel(); |
2198 } |
2204 } |
2199 } |
2205 } |
2200 } |
2206 } |
2201 |
2207 |
2202 // ------------------------------------------------------------------------------------------------ |
2208 // ------------------------------------------------------------------------------------------------ |
2203 // CMPXVideoPlaybackController::HandleUserActivityTimeout |
2209 // CMPXVideoPlaybackController::HandleUserActivityTimeout |
2204 // ------------------------------------------------------------------------------------------------ |
2210 // ------------------------------------------------------------------------------------------------ |
2205 // |
2211 // |
2206 TInt CMPXVideoPlaybackController::HandleUserActivityTimeout( TAny* aPtr ) |
2212 TInt CMPXVideoPlaybackController::HandleUserActivityTimeout( TAny* aPtr ) |
2207 { |
2213 { |
2208 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::HandleUserActivityTimeout()")); |
2214 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::HandleUserActivityTimeout()")); |
2209 |
2215 |
2210 static_cast<CMPXVideoPlaybackController*>(aPtr)->DoHandleUserActivityTimeout(); |
2216 static_cast<CMPXVideoPlaybackController*>(aPtr)->DoHandleUserActivityTimeout(); |
2211 return KErrNone; |
2217 return KErrNone; |
2212 } |
2218 } |
2213 |
2219 |
2214 // ------------------------------------------------------------------------------------------------ |
2220 // ------------------------------------------------------------------------------------------------ |
2215 // CMPXVideoPlaybackController::DoHandleUserActivityTimeout |
2221 // CMPXVideoPlaybackController::DoHandleUserActivityTimeout |
2216 // ------------------------------------------------------------------------------------------------ |
2222 // ------------------------------------------------------------------------------------------------ |
2217 // |
2223 // |
2218 void CMPXVideoPlaybackController::DoHandleUserActivityTimeout() |
2224 void CMPXVideoPlaybackController::DoHandleUserActivityTimeout() |
2219 { |
2225 { |
2220 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DoHandleUserActivityTimeout()")); |
2226 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DoHandleUserActivityTimeout()")); |
2221 |
2227 |
2222 // Act only once for detected activity. |
2228 // Act only once for detected activity. |
2223 if ( iUserActivityTimer->IsActive() ) |
2229 if ( iUserActivityTimer->IsActive() ) |
2224 { |
2230 { |
2225 iUserActivityTimer->Cancel(); |
2231 iUserActivityTimer->Cancel(); |
2226 } |
2232 } |
2227 |
2233 |
2228 // iUserActivityTimer runs when TV-out is connected and playback with video is going on |
2234 // iUserActivityTimer runs when TV-out is connected and playback with video is going on |
2229 // This timer fires in two situations. |
2235 // This timer fires in two situations. |
2230 // a) Lights are off and user activity is detected - Turn lights on and restart display timer |
2236 // a) Lights are off and user activity is detected - Turn lights on and restart display timer |
2231 // b) Lights are on and user activity is detected - restart display timer to prevent lights go off |
2237 // b) Lights are on and user activity is detected - restart display timer to prevent lights go off |
2232 EnableDisplayBacklight(); |
2238 EnableDisplayBacklight(); |
2233 |
2239 |
2234 // Start counting down to next lights off |
2240 // Start counting down to next lights off |
2235 RestartDisplayTimer(); |
2241 RestartDisplayTimer(); |
2236 } |
2242 } |
2237 |
2243 |
2238 // ------------------------------------------------------------------------------------------------ |
2244 // ------------------------------------------------------------------------------------------------ |