public class Terminal
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Class and Description |
---|---|
class |
Terminal.Action |
class |
Terminal.CursorPosition
Cursor position.
|
Constructor and Description |
---|
Terminal()
Build a headless TN3270 session.
|
Terminal(java.lang.String id)
Build session binded to pw3270's session window.
|
Modifier and Type | Method and Description |
---|---|
boolean |
activatable(java.lang.String action)
Test if a lib3270 action is activatable.
|
void |
activate(java.lang.String action)
Launch a lib3270 action by name.
|
void |
close()
Close tn3270 session, release resources.
|
void |
connect(int seconds)
Connect to default 3270 host.
|
void |
connect(java.lang.String url,
int seconds)
Connect to 3270 host.
|
boolean |
contains(java.lang.String chars)
Test for string in terminal.
|
void |
disconnect()
Disconnect from tn3270 host.
|
void |
enter() |
void |
erase_eof()
Erase from cursor position until the end of the field.
|
void |
erase_eol() |
void |
erase_input() |
void |
erase() |
int |
find(java.lang.String chars)
Find string in the terminal.
|
int |
find(java.lang.String chars,
int pos)
Find string in the terminal.
|
java.lang.String |
getAssociatedLUName()
Get the LU name associated with the session, if there is one.
|
boolean |
getConnected() |
boolean |
getConnected(int timeout)
Get connected state.
|
int |
getConnectionState() |
int |
getCursorAddress() |
Terminal.CursorPosition |
getCursorPosition() |
int |
getHeight() |
int |
getKeyboardLockState()
Get bitmask with keyboard lock state.
|
int |
getLength() |
java.lang.String |
getLib3270Revision()
Get the lib3270 revision string.
|
java.lang.String |
getLib3270Version()
Get the lib3270 version string.
|
int |
getProgramMessage()
Get the current program message id.
|
boolean |
getReady()
Check if terminal is ready to receive inputs.
|
boolean |
getReady(int timeout)
Get 'readyness' of terminal.
|
static java.lang.String |
getRevision()
Get the current ipc3270 revision.
|
int |
getSSLState()
Get SSL state.
|
java.lang.String |
getText()
Get all terminal contents.
|
java.lang.String |
getText(int baddr,
int len)
Get terminal contents at address.
|
java.lang.String |
getText(int row,
int col,
int len)
Get terminal contents at position.
|
java.lang.String |
getURL() |
static java.lang.String |
getVersion()
Get the current ipc3270 version.
|
int |
getWidth() |
int |
input(java.lang.String str)
Insert string parsing the action codes prefixed with the defined control character.
|
int |
input(java.lang.String str,
char control)
Input string parsing control char.
|
void |
open()
Open headless tn3270 session with default charset (UTF-8).
|
void |
open(java.lang.String id)
Open tn3270 session with default charset (UTF-8).
|
void |
open(java.lang.String id,
java.lang.String charset)
Open tn3270 session.
|
void |
pakey(int key)
Send a pakey to host.
|
void |
pfkey(int key)
Send a pfkey to host.
|
void |
setCharSet(java.lang.String charset) |
int |
setCursorPosition(int addr) |
int |
setCursorPosition(int row,
int col) |
int |
setCursorPosition(Terminal.CursorPosition position) |
void |
setLockOnOperatorError(boolean lock) |
void |
setProperty(java.lang.String name,
boolean value) |
void |
setProperty(java.lang.String name,
int value) |
void |
setProperty(java.lang.String name,
java.lang.String value) |
void |
setTimeout(int timeout) |
void |
setUnlockDelay(int delay) |
void |
setURL(java.lang.String url) |
void |
sleep(int seconds)
Wait for an specified amount of time.
|
java.lang.String |
toString() |
java.lang.String |
toString(int baddr,
int len) |
java.lang.String |
toString(int row,
int col,
int len) |
void |
wait(int seconds)
Wait for terminal negociation.
|
void |
wait(int row,
int col,
java.lang.String text,
int seconds)
Wait for text at defined row,col
|
void |
wait(int baddr,
java.lang.String text,
int seconds)
Wait for text at defined address.
|
void |
wait(java.lang.String text,
int seconds)
Wait for an specified string in terminal.
|
public Terminal()
public Terminal(java.lang.String id)
id
- pw3270 window id (A: for the first one, B: for second ... )public static java.lang.String getVersion()
public static java.lang.String getRevision()
public void open(java.lang.String id, java.lang.String charset)
id
- Session ID ("" for headless).charset
- Local charset.public void open()
public void open(java.lang.String id)
public void close()
close
in interface java.lang.AutoCloseable
public void connect(java.lang.String url, int seconds)
Connect to the 3270 host
URI formats:
url
- Host URL.seconds
- How many seconds to wait for a connection.public void connect(int seconds)
When using a GUI session this connected to the session defined tn3270 host.
seconds
- How many seconds to wait for a connection.public void disconnect()
public java.lang.String getText(int baddr, int len)
baddr
- address of string to get.len
- length of string to get.public java.lang.String getText(int row, int col, int len)
row
- row of the string start.col
- column of the string start.len
- length of string to get.public java.lang.String getText()
public int getProgramMessage()
Value | Lib3270 name | Description |
---|---|---|
0 | LIB3270_MESSAGE_NONE | No message |
1 | LIB3270_MESSAGE_SYSWAIT | |
2 | LIB3270_MESSAGE_TWAIT | |
3 | LIB3270_MESSAGE_CONNECTED | Connected to host |
4 | LIB3270_MESSAGE_DISCONNECTED | Disconnected from host |
5 | LIB3270_MESSAGE_AWAITING_FIRST | |
6 | LIB3270_MESSAGE_MINUS | |
7 | LIB3270_MESSAGE_PROTECTED | |
8 | LIB3270_MESSAGE_NUMERIC | |
9 | LIB3270_MESSAGE_OVERFLOW | |
10 | LIB3270_MESSAGE_INHIBIT | |
11 | LIB3270_MESSAGE_KYBDLOCK | Keyboard is locked |
12 | LIB3270_MESSAGE_X | |
13 | LIB3270_MESSAGE_RESOLVING | Resolving hostname (running DNS query) |
14 | LIB3270_MESSAGE_CONNECTING | Connecting to host |
public int getConnectionState()
public int getSSLState()
Value | State |
---|---|
0 | Unsafe |
1 | Valid CA |
2 | Invalid CA or self-signed |
3 | Negotiating |
4 | Undefined |
public int getKeyboardLockState()
Value | Lib3270 id | Description |
---|---|---|
0x0000 | LIB3270_KL_UNLOCKED | Keyboard is unlocked. |
0x0001 | LIB3270_KL_OERR_PROTECTED | |
0x0002 | LIB3270_KL_OERR_NUMERIC | |
0x0003 | LIB3270_KL_OERR_OVERFLOW | |
0x0004 | LIB3270_KL_OERR_DBCS | |
0x0010 | LIB3270_KL_NOT_CONNECTED | Not connected to host. |
0x0020 | LIB3270_KL_AWAITING_FIRST | |
0x0040 | LIB3270_KL_OIA_TWAIT | |
0x0080 | LIB3270_KL_OIA_LOCKED | |
0x0100 | LIB3270_KL_DEFERRED_UNLOCK | |
0x0200 | LIB3270_KL_ENTER_INHIBIT | |
0x0400 | LIB3270_KL_SCROLLED | |
0x0800 | LIB3270_KL_OIA_MINUS |
public int getWidth()
public int getHeight()
public int getLength()
public int getCursorAddress()
public Terminal.CursorPosition getCursorPosition()
public boolean contains(java.lang.String chars)
chars
- The string to search.public int find(java.lang.String chars, int pos)
chars
- The string to search.pos
- Starting address.public int find(java.lang.String chars)
chars
- The string to search.public boolean getConnected(int timeout)
timeout
- Time to wait for state (0 = no wait).public boolean getConnected()
public boolean getReady(int timeout)
timeout
- Time to wait for 'ready' state (0 = no wait).public boolean getReady()
public java.lang.String getLib3270Version()
public java.lang.String getLib3270Revision()
public java.lang.String getAssociatedLUName()
public java.lang.String getURL()
public java.lang.String toString(int baddr, int len)
public java.lang.String toString(int row, int col, int len)
public java.lang.String toString()
toString
in class java.lang.Object
public void setURL(java.lang.String url)
public void setUnlockDelay(int delay)
public void setTimeout(int timeout)
public void setLockOnOperatorError(boolean lock)
public int setCursorPosition(int addr)
public int setCursorPosition(int row, int col)
public void setCharSet(java.lang.String charset)
public void setProperty(java.lang.String name, int value)
public void setProperty(java.lang.String name, boolean value)
public void setProperty(java.lang.String name, java.lang.String value)
public int setCursorPosition(Terminal.CursorPosition position)
public int input(java.lang.String str, char control)
public int input(java.lang.String str)
Value | Action | Description |
---|---|---|
@@P | Print the screen contents (if available) | |
@@@@ | Input the @@ char. | |
@@E | ENTER | |
@@F | ERASE_EOF | |
@@1 | PF1 | Send the PF1 key. |
@@2 | PF2 | Send the PF2 key. |
@@3 | PF3 | Send the PF3 key. |
@@4 | PF4 | Send the PF4 key. |
@@5 | PF5 | Send the PF5 key. |
@@6 | PF6 | Send the PF6 key. |
@@7 | PF7 | Send the PF7 key. |
@@8 | PF8 | Send the PF8 key. |
@@9 | PF9 | Send the PF9 key. |
@@a | PF10 | Send the PF10 key. |
@@b | PF11 | Send the PF11 key. |
@@c | PF12 | Send the PF12 key. |
@@d | PF13 | Send the PF13 key. |
@@e | PF14 | Send the PF14 key. |
@@f | PF15 | Send the PF15 key. |
@@g | PF16 | Send the PF16 key. |
@@h | PF17 | Send the PF17 key. |
@@u | PF18 | Send the PF18 key. |
@@j | PF19 | Send the PF19 key. |
@@k | PF20 | Send the PF20 key. |
@@l | PF21 | Send the PF21 key. |
@@m | PF22 | Send the PF22 key. |
@@n | PF23 | Send the PF23 key. |
@@o | PF24 | Send the PF24 key. |
@@x | PA1 | Send the PA1 key. |
@@y | PA2 | Send the PA2 key. |
@@z | PA3 | Send the PA3 key. |
@@D | CHAR_DELETE | |
@@N | NEWLINE | |
@@C | CLEAR | |
@@R | KYBD_RESET |
public void activate(java.lang.String action)
action
- The action to activate.public boolean activatable(java.lang.String action)
action
- Name of the action.public void pfkey(int key)
key
- PFkey number.public void pakey(int key)
key
- PAkey number.public void enter()
public void erase()
public void erase_eol()
public void erase_input()
public void erase_eof()
public void sleep(int seconds)
Wait for the specified time keeping the main loop active.
seconds
- Number of seconds to wait.public void wait(java.lang.String text, int seconds)
text
- The string to wait.seconds
- How many seconds to wait for text to appear.public void wait(int seconds)
Wait on a loop until the terminal contents are ready for reading.
seconds
- Maximum time (in seconds) to wait for.public void wait(int baddr, java.lang.String text, int seconds)
baddr
- address of string.text
- String to compare.seconds
- Maximum time (in seconds) to wait for.public void wait(int row, int col, java.lang.String text, int seconds)
row
- Row for text to compare.col
- Column for text to compare.text
- String to compare.seconds
- Maximum time (in seconds) to wait for.