mil.dod.th.ose.bbb.platform/src/mil/dod/th/ose/bbb/platform/BeagleBoneBlackPowerManager.java
private void handleWakeSource(final PhysicalLink link, final String state)
    {
        final String path = String.format("/sys/devices/%s/power/wakeup", m_SupportedLinks.get(link.getName()));
        final File wakeupFile = m_FileService.getFile(path);
        
        final String currentState;
        try (FileReader fileReader = m_FileService.createFileReader(wakeupFile);
                BufferedReader buffReader = m_FileService.createBufferedReader(fileReader))
        {
            currentState = buffReader.readLine();
        }
        catch (final IOException ex)
        {
            m_LogService.warning(ex, "Unable to read current wakeup state for physical link [%s].", link.getName());
            return;
        }
        
        if (currentState.equals(state))
        {
            throw new IllegalStateException(String.format("Physical link [%s] is already [%s] as a wakeup source.",
                    link.getName(), state));
        }
        
        try (FileOutputStream fos = m_FileService.createFileOutputStream(wakeupFile, false);
                PrintStream printStream = m_FileService.createPrintStream(fos))
        {
            printStream.print(state);
        }
        catch (final IOException ex)
        {
            m_LogService.warning(ex, "Unable to set wakeup state for physical link [%s] to [%s].", 
                    link.getName(), state);
        }
    }
/**
     * Method that handles enabling and disabling wake sources.
     * 
     * @param link
     *      The physical link to be enabled/disabled as a wake source.
     * @param state
     *      The state the the wake source is to be set to (enabled/disabled).
     */
Method that handles enabling and disabling wake sources.

@param link
The physical link to be enabled/disabled as a wake source.
@param state
The state the the wake source is to be set to (enabled/disabled).
Method that handles enabling and disabling wake sources . @param link The physical link to be enabled / disabled as a wake source . @param state The state the the wake source is to be set to ( enabled / disabled ) .
private void handleWakeSource(final PhysicalLink link, final String state)
    {
        final String path = String.format("/sys/devices/%s/power/wakeup", m_SupportedLinks.get(link.getName()));
        final File wakeupFile = m_FileService.getFile(path);
        final String currentState;
        try (FileReader fileReader = m_FileService.createFileReader(wakeupFile);
                BufferedReader buffReader = m_FileService.createBufferedReader(fileReader))
        {
            currentState = buffReader.readLine();
        }
        catch (final IOException ex)
        {
            m_LogService.warning(ex, "Unable to read current wakeup state for physical link [%s].", link.getName());
            return;
        }
        if (currentState.equals(state))
        {
            throw new IllegalStateException(String.format("Physical link [%s] is already [%s] as a wakeup source.",
                    link.getName(), state));
        }
        try (FileOutputStream fos = m_FileService.createFileOutputStream(wakeupFile, false);
                PrintStream printStream = m_FileService.createPrintStream(fos))
        {
            printStream.print(state);
        }
        catch (final IOException ex)
        {
            m_LogService.warning(ex, "Unable to set wakeup state for physical link [%s] to [%s].", 
                    link.getName(), state);
        }
    }
private void handleWakeSource ( final PhysicalLink link , final String state ) { final String path = String . format ( "/sys/devices/%s/power/wakeup" , m_SupportedLinks . get ( link . getName ( ) ) ) ; final File wakeupFile = m_FileService . getFile ( path ) ; final String currentState ; try ( FileReader fileReader = m_FileService . createFileReader ( wakeupFile ) ; BufferedReader buffReader = m_FileService . createBufferedReader ( fileReader ) ) { currentState = buffReader . readLine ( ) ; } catch ( final IOException ex ) { m_LogService . warning ( ex , "Unable to read current wakeup state for physical link [%s]." , link . getName ( ) ) ; return ; } if ( currentState . equals ( state ) ) { throw new IllegalStateException ( String . format ( "Physical link [%s] is already [%s] as a wakeup source." , link . getName ( ) , state ) ) ; } try ( FileOutputStream fos = m_FileService . createFileOutputStream ( wakeupFile , false ) ; PrintStream printStream = m_FileService . createPrintStream ( fos ) ) { printStream . print ( state ) ; } catch ( final IOException ex ) { m_LogService . warning ( ex , "Unable to set wakeup state for physical link [%s] to [%s]." , link . getName ( ) , state ) ; } }
Method that handles enabling and disabling wake sources.
Method that handles enabling and disabling wake sources .