public class CommandArgumentParser extends Object
Constructor and Description |
---|
CommandArgumentParser() |
Modifier and Type | Method and Description |
---|---|
static Pin |
getPin(Class<? extends PinProvider> pinProviderClass,
Pin defaultPin,
String... args)
This utility method searches for "--pin (#)" or "-p (#)" in the command
arguments array and returns a Pin instance based on the pin
address/number specified.
|
static PinPullResistance |
getPinPullResistance(PinPullResistance defaultPull,
String... args)
This utility method searches for "--pull (up|down|off)", "--l (up|down|off)", "--up", or "--down" in the command
arguments array and returns a PinPullResistance instance based on the option
value provided.
|
static SerialConfig |
getSerialConfig(SerialConfig defaultConfig,
String... args)
This utility method searches for the following options:
"--device (device-path)" [DEFAULT: /dev/ttyAMA0]
"--baud (baud-rate)" [DEFAULT: 38400]
"--data-bits (5|6|7|8)" [DEFAULT: 8]
"--parity (none|odd|even)" [DEFAULT: none]
"--stop-bits (1|2)" [DEFAULT: 1]
"--flow-control (none|hardware|software)" [DEFAULT: none]
in the arguments array and returns a SerialConfig instance based on the option
values detected.
|
public CommandArgumentParser()
public static Pin getPin(Class<? extends PinProvider> pinProviderClass, Pin defaultPin, String... args)
pinProviderClass
- pin provider class to get pin instance fromdefaultPin
- default pin instance to use if no --pin argument is foundargs
- the argument array to search inpublic static PinPullResistance getPinPullResistance(PinPullResistance defaultPull, String... args)
defaultPull
- default pin pull resistance to apply if no option/argument is foundargs
- the argument array to search inpublic static SerialConfig getSerialConfig(SerialConfig defaultConfig, String... args)
defaultConfig
- default serial configuration to apply if no option/arguments are foundargs
- the argument array to search inCopyright © 2012–2019 Pi4J. All rights reserved.