public class UrlPort extends Object implements ICommandLineDevice
Constructor and Description |
---|
UrlPort(String protocol,
String hostIp,
int portNumber,
String prefix,
String suffix,
int timeout,
boolean verbose) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
connect() |
void |
flushInput() |
String |
getVersion()
Returns the hardware version (not the version of the driver software).
|
boolean |
isValid()
Tries to identify instances that are not valid.
|
static void |
main(String[] args) |
void |
open()
Opens the device with previously set parameters.
|
String |
readString()
Reads a line of text.
|
String |
readString(boolean wait)
Reads a line of text.
|
boolean |
ready()
Tells whether this stream is ready to be read.
|
void |
sendString(String payload)
Sends a command (a String) to the instance.
|
void |
setDebug(int debug)
Sets a debug parameter.
|
void |
setTimeout(int timeout)
Set timeout in milliseconds.
|
void |
setVerbosity(boolean verbosity)
Sets a verbosity flag, causing commands to be executed verbosely.
|
public static void main(String[] args)
args
- the command line argumentspublic void connect() throws IOException
IOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void sendString(String payload) throws IOException
ICommandLineDevice
sendString
in interface ICommandLineDevice
payload
- Command string to be sent.IOException
public String readString()
ICommandLineDevice
readString
in interface ICommandLineDevice
public String readString(boolean wait)
ICommandLineDevice
readString
in interface ICommandLineDevice
wait
- if true, wait until something arrives, otherwise return null if nothing there.public String getVersion() throws IOException
IHarcHardware
getVersion
in interface IHarcHardware
IOException
public void setVerbosity(boolean verbosity)
IHarcHardware
setVerbosity
in interface IHarcHardware
verbosity
- on or offpublic void setDebug(int debug)
IHarcHardware
setDebug
in interface IHarcHardware
public void setTimeout(int timeout)
IHarcHardware
setTimeout
in interface IHarcHardware
timeout
- Timeout in milliseconds.public boolean isValid()
IHarcHardware
isValid
in interface IHarcHardware
public void open() throws HarcHardwareException, IOException
IHarcHardware
open
in interface IHarcHardware
HarcHardwareException
IOException
public boolean ready() throws IOException
ICommandLineDevice
ready
in interface ICommandLineDevice
IOException
- If an I/O error occurspublic void flushInput() throws IOException
flushInput
in interface ICommandLineDevice
IOException
Copyright © 2016. All rights reserved.