public class gpio_java
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
action
Array with all allowed actions.
|
static java.lang.String[][] |
rel_map
Mapping from generic relay name to particular gpio port.
|
Constructor and Description |
---|
gpio_java() |
Modifier and Type | Method and Description |
---|---|
static void |
checkargs(java.lang.String[] argumens)
The checkargs method checks whether two correct arguments have been entered.
|
static void |
gpio_cmdhandler(java.lang.String port,
java.lang.String cmd)
The gpio_cmdhandler method switches the relays on, off or returns the status.
|
static int |
gpio_getport(java.lang.String port)
The gpio_getport method searches in the rel_map variable for the correct port and return index.
|
static void |
gpio_read_status(java.lang.String port)
The method checks the status and displays it in the command line.
|
static void |
init_gpio()
The init_gpio method defines all relevant GPIO ports as output.
|
static java.lang.String |
launchcmd(java.lang.String cmd)
The launchcmd method runs the command.
|
static void |
main(java.lang.String[] args)
Implement the main function of the application gpio_java.
|
static void |
show_usage()
The show_usage method provides assistance in case of wrong input.
|
public static java.lang.String[][] rel_map
public static java.lang.String[] action
public static void main(java.lang.String[] args)
args
- The passing argument in the commandline.public static void checkargs(java.lang.String[] argumens)
argumens
- Commandline argumentpublic static void init_gpio()
public static int gpio_getport(java.lang.String port)
port
- relay(rel1-rel8)public static void gpio_cmdhandler(java.lang.String port, java.lang.String cmd)
port
- relay(rel1-rel8)cmd
- action (on/off/status)public static void gpio_read_status(java.lang.String port)
port
- the relay boardpublic static void show_usage()
public static java.lang.String launchcmd(java.lang.String cmd)
cmd
- a specified system command.