example.platform.power/src/example/platform/power/ExamplePlatformKernel.java
public void enableLowPowerMode()
    {
        if (m_PowerModeHandler == null || m_PowerModeHandler.isDone())
        {
            m_Logging.debug("Enabling low power mode.");
            Long shutdownDelay = m_StandbyNoticeTimeMs;
            
            final Map<String, Object> eventProps = new HashMap<>();
            eventProps.put(PlatformPowerManager.EVENT_PROP_STANDBY_TIME, shutdownDelay);
            
            final Event lowPowerModeEvent = new Event(PlatformPowerManager.TOPIC_STANDBY_NOTICE_EVENT, eventProps);
            m_EventAdmin.postEvent(lowPowerModeEvent);
            
            // Schedule shutdown       
            if(m_LowPowerThread == null)
            {
                m_LowPowerThread = new Thread(new ShutdownTask(shutdownDelay, m_Logging, this, m_EventAdmin));
            }
        
            m_PowerModeHandler = 
                m_Scheduler.scheduleWithFixedDelay(m_LowPowerThread, 0, m_StartupTimeMs, MILLISECONDS);
            
            //Schedule a wake up for the max sleep time
            m_Scheduler.schedule(new Runnable()
            {            
                @Override
                public void run()
                {                
                    disableLowPowerMode();
                }
            }, m_MaxSleepTimeMs, MILLISECONDS);
        }
    }
/**
     * Enables low power mode on the platform
     */
Enables low power mode on the platform
Enables low power mode on the platform
public void enableLowPowerMode()
    {
        if (m_PowerModeHandler == null || m_PowerModeHandler.isDone())
        {
            m_Logging.debug("Enabling low power mode.");
            Long shutdownDelay = m_StandbyNoticeTimeMs;
            final Map<String, Object> eventProps = new HashMap<>();
            eventProps.put(PlatformPowerManager.EVENT_PROP_STANDBY_TIME, shutdownDelay);
            final Event lowPowerModeEvent = new Event(PlatformPowerManager.TOPIC_STANDBY_NOTICE_EVENT, eventProps);
            m_EventAdmin.postEvent(lowPowerModeEvent);
            if(m_LowPowerThread == null)
            {
                m_LowPowerThread = new Thread(new ShutdownTask(shutdownDelay, m_Logging, this, m_EventAdmin));
            }
            m_PowerModeHandler = 
                m_Scheduler.scheduleWithFixedDelay(m_LowPowerThread, 0, m_StartupTimeMs, MILLISECONDS);
            m_Scheduler.schedule(new Runnable()
            {            
                @Override
                public void run()
                {                
                    disableLowPowerMode();
                }
            }, m_MaxSleepTimeMs, MILLISECONDS);
        }
    }
public void enableLowPowerMode ( ) { if ( m_PowerModeHandler == null || m_PowerModeHandler . isDone ( ) ) { m_Logging . debug ( "Enabling low power mode." ) ; Long shutdownDelay = m_StandbyNoticeTimeMs ; final Map < String , Object > eventProps = new HashMap < > ( ) ; eventProps . put ( PlatformPowerManager . EVENT_PROP_STANDBY_TIME , shutdownDelay ) ; final Event lowPowerModeEvent = new Event ( PlatformPowerManager . TOPIC_STANDBY_NOTICE_EVENT , eventProps ) ; m_EventAdmin . postEvent ( lowPowerModeEvent ) ; if ( m_LowPowerThread == null ) { m_LowPowerThread = new Thread ( new ShutdownTask ( shutdownDelay , m_Logging , this , m_EventAdmin ) ) ; } m_PowerModeHandler = m_Scheduler . scheduleWithFixedDelay ( m_LowPowerThread , 0 , m_StartupTimeMs , MILLISECONDS ) ; m_Scheduler . schedule ( new Runnable ( ) { @ Override public void run ( ) { disableLowPowerMode ( ) ; } } , m_MaxSleepTimeMs , MILLISECONDS ) ; } }
Enables low power mode on the platform
Enables low power mode on the platform
// Schedule shutdown        //Schedule a wake up for the max sleep time