📄 acpicommand.java
字号:
/*
* $Id: AcpiCommand.java,v 1.1 2003/11/25 11:53:00 epr Exp $
*/
package org.jnode.driver.acpi.command;
import javax.naming.NameNotFoundException;
import org.jnode.driver.acpi.ACPI;
import org.jnode.naming.InitialNaming;
import org.jnode.shell.help.Help;
import org.jnode.shell.help.OptionArgument;
import org.jnode.shell.help.Parameter;
import org.jnode.shell.help.ParsedArguments;
import org.jnode.shell.help.Syntax;
/**
* ACPI command.
*
* <p>
* Title:
* </p>
* <p>
* Description:
* </p>
* <p>
* Copyright: Copyright (c) 2003
* </p>
* <p>
* Company:
* </p>
*
* @author not attributable
* @version 1.0
*/
public class AcpiCommand {
public AcpiCommand() {
}
static final String FUNC_DUMP = "dump";
static final String FUNC_BATTERY = "battery";
static final OptionArgument ARG_FUNCTION =
new OptionArgument(
"function",
"the function to perform",
new OptionArgument.Option[] {
new OptionArgument.Option(FUNC_DUMP, "lists all devices that can be discovered and controlled through ACPI"),
new OptionArgument.Option(FUNC_BATTERY, "displays information about installed batteries")});
public static Help.Info HELP_INFO =
new Help.Info(
"acpi",
new Syntax[] { new Syntax("displays ACPI details"), new Syntax("manage ACPI system", new Parameter[] { new Parameter(ARG_FUNCTION, Parameter.OPTIONAL)})
});
public static void main(String[] args) throws Exception {
ParsedArguments cmdLine = HELP_INFO.parse(args);
ACPI acpi = null;
try {
acpi = (ACPI) InitialNaming.lookup(ACPI.NAME);
} catch (NameNotFoundException ex2) {
System.out.println("Could not connect to ACPI");
return;
}
if (cmdLine.size() == 0) {
System.out.println(acpi.toDetailedString());
} else {
String func = ARG_FUNCTION.getValue(cmdLine);
if (func.equalsIgnoreCase(FUNC_DUMP)) {
acpi.dump();
} else if (func.equalsIgnoreCase(FUNC_BATTERY)) {
acpi.dumpBattery();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -