public class HostSession5250 extends Object implements HostSessionPeer, TelnetCommListener
STATE_AnyLock, STATE_Connected, STATE_Connecting, STATE_Error, STATE_FieldFullError, STATE_InsertMode, STATE_Lock, STATE_MessageWaiting, STATE_MinusError, STATE_NonNumericError, STATE_OnFieldOrProtected, STATE_ReceiveWait, STATE_Reconnecting, STATE_Secure, STATE_Sending, STATE_SSCPLUOwned, STATE_SystemAvailable
Constructor and Description |
---|
HostSession5250(HostSession owner,
TerminalProps properties)
Constructor only from this package.
|
Modifier and Type | Method and Description |
---|---|
boolean |
connect()
Connects the session to host.
|
boolean |
disconnect()
Disconnects the session from host.
|
boolean |
doesFieldHaveExtendedAttributes(HostField hostField)
Checks if a host field has extended attributes or not.
|
boolean |
doesHostNeedFieldExit(int x,
int y,
int offset,
int length,
String string)
For 5250 only: checks if a field has the attributes that requires this particular
string to enter the data followed by a "Field Exit" or "Field Minus" key.
|
String |
getAllowedCharacters()
Gets the string of characters that can be input by the user using
the configured host code page for this session.
|
void |
getCharactersAndAttributes(char[] chars,
int[] attrbs,
int beginPos,
int endPos)
Gets the characters and attributes between two positions, including
the end position.
|
void |
getCharactersAndAttributes(char[] chars,
int[] attrbs,
int beginPos,
int endPos,
char fieldOrNullChar)
Gets the characters and attributes between two positions, including
the end position.
|
int |
getClientHostFieldFlags(HostField hostField)
Gets flags that are required for the client host fields for local editing, etc.
|
SocketCommNIO |
getComm()
Gets the communication engine.
|
Position |
getCursor()
Gets the current host cursor position.
|
String |
getDeviceName()
Gets the device name of the session.
|
int |
getHomeAddress()
Gets the host address index on the screen.
|
HostSession |
getHostSession()
Gets the host session owner.
|
String |
getLastError(boolean doClear)
Gets the last error message of the session.
|
int |
getNewCharAttribute(HostField hostField)
Gets the attribute to use for new characters in a field that contains
extended attributes (always zero for non-3270).
|
int |
getScreenLength()
Gets the current screen length (width * height).
|
Size |
getScreenSize()
Gets the current screen size.
|
int |
getSessionState()
Gets the current session state.
|
void |
hostAcceptedDataStream(TelnetComm comm,
String terminalType)
The host accepted the options for the terminal
type and went into BINARY mode.
|
boolean |
is3270()
Checks if a session is 3270 or 5250.
|
boolean |
isAutoReconnectSessionEnabled()
Checks if the use of auto reconnect session is handled or not.
|
boolean |
isDisplayInSystemRequestMode()
Checks if the display (5250 only) is in System Request mode.
|
boolean |
isFieldFormatted()
Checks if this host screen is field formatted.
|
boolean |
isPrinter()
Checks if this is a printer or not (always false).
|
boolean |
isProcessingDataStream()
Checks if the session is currently processing data stream commands
to update the screen/cursor, state, etc.
|
void |
onCommClosed(TelnetComm comm)
Called when the communication link is closed.
|
void |
onCommConnected(TelnetComm comm)
Called when the communication link is connected.
|
void |
onCommError(TelnetComm comm,
IOException e)
Called when the communication link is closed.
|
void |
onCommOpen(TelnetComm comm)
Called when the communication link is opened.
|
void |
onCommState(SocketCommNIO comm)
Called when the state changes.
|
void |
processInboundDataStream(TelnetComm comm,
byte[] inputBuf,
int pos,
int inputBufLen)
Processes the inbound 3270 or 5250 data stream.
|
void |
processInboundSCSDataStream(TelnetComm comm,
byte[] inputBuf,
int inputBufLen)
Processes the inbound 3270 printer data stream.
|
void |
processInboundSSCPLUDataStream(TelnetComm comm,
byte[] inputBuf,
int pos,
int inputBufLen)
Processes the inbound 3270 SSCP-LU data stream.
|
void |
processPrintEOJ(TelnetComm comm)
Processes a Print End-of-Job for 3270 printers.
|
void |
refreshHostFields(HostFields fields)
Refreshes the host fields of the current session.
|
boolean |
sendCharacterString(String keys)
Sends character keystrokes to host.
|
boolean |
sendKey(int key)
Sends character keystrokes to host.
|
boolean |
setCursor(int x,
int y)
Sets the host cursor position.
|
boolean |
setHostField(HostField hostField,
String data,
int[] attrs)
Sets a host field fully with text data and perhaps
attributes (if these are non-null).
|
boolean |
setHostString(int x,
int y,
int offset,
int length,
String string)
Sets a string to a host field.
|
boolean |
setHostStringAsKeys(int x,
int y,
int offset,
int length,
String string)
Sets a string to a host field just as if the user typed the characters.
|
boolean |
setInsertMode(boolean on)
Sets the insert mode.
|
void |
setLastError(String errMsg)
Sets the last error message of the session.
|
public HostSession5250(HostSession owner, TerminalProps properties) throws IOException
owner
- Owner of session.properties
- The terminal and communication properties.IOException
- For connection failure.public HostSession getHostSession()
getHostSession
in interface HostSessionPeer
public boolean is3270()
is3270
in interface HostSessionPeer
public boolean isProcessingDataStream()
isProcessingDataStream
in interface HostSessionPeer
public boolean connect()
connect
in interface HostSessionPeer
public boolean disconnect()
disconnect
in interface HostSessionPeer
public boolean sendCharacterString(String keys)
sendCharacterString
in interface HostSessionPeer
public boolean sendKey(int key)
sendKey
in interface HostSessionPeer
HostSendKeys
public boolean setHostString(int x, int y, int offset, int length, String string)
setHostString
in interface HostSessionPeer
public boolean setHostStringAsKeys(int x, int y, int offset, int length, String string)
setHostStringAsKeys
in interface HostSessionPeer
public boolean doesHostNeedFieldExit(int x, int y, int offset, int length, String string)
doesHostNeedFieldExit
in interface HostSessionPeer
public boolean setCursor(int x, int y)
setCursor
in interface HostSessionPeer
public Position getCursor()
getCursor
in interface HostSessionPeer
public Size getScreenSize()
getScreenSize
in interface HostSessionPeer
public int getScreenLength()
getScreenLength
in interface HostSessionPeer
public int getSessionState()
getSessionState
in interface HostSessionPeer
public void getCharactersAndAttributes(char[] chars, int[] attrbs, int beginPos, int endPos)
getCharactersAndAttributes
in interface HostSessionPeer
public void getCharactersAndAttributes(char[] chars, int[] attrbs, int beginPos, int endPos, char fieldOrNullChar)
getCharactersAndAttributes
in interface HostSessionPeer
public void refreshHostFields(HostFields fields)
refreshHostFields
in interface HostSessionPeer
public String getLastError(boolean doClear)
getLastError
in interface HostSessionPeer
public void setLastError(String errMsg)
setLastError
in interface HostSessionPeer
public String getDeviceName()
getDeviceName
in interface HostSessionPeer
public boolean isPrinter()
isPrinter
in interface HostSessionPeer
public boolean setInsertMode(boolean on)
setInsertMode
in interface HostSessionPeer
public boolean doesFieldHaveExtendedAttributes(HostField hostField)
doesFieldHaveExtendedAttributes
in interface HostSessionPeer
public int getNewCharAttribute(HostField hostField)
getNewCharAttribute
in interface HostSessionPeer
public int getClientHostFieldFlags(HostField hostField)
getClientHostFieldFlags
in interface HostSessionPeer
public boolean isAutoReconnectSessionEnabled()
isAutoReconnectSessionEnabled
in interface HostSessionPeer
public int getHomeAddress()
getHomeAddress
in interface HostSessionPeer
public boolean setHostField(HostField hostField, String data, int[] attrs)
setHostField
in interface HostSessionPeer
public String getAllowedCharacters()
If the return string is empty, for the EE package for example, all characters are "inputable".
getAllowedCharacters
in interface HostSessionPeer
public boolean isFieldFormatted()
isFieldFormatted
in interface HostSessionPeer
public boolean isDisplayInSystemRequestMode()
isDisplayInSystemRequestMode
in interface HostSessionPeer
public void onCommOpen(TelnetComm comm)
TelnetCommListener
onCommOpen
in interface TelnetCommListener
comm
- The telnet communication instance.public void onCommConnected(TelnetComm comm)
TelnetCommListener
onCommConnected
in interface TelnetCommListener
comm
- The telnet communication instance.public void hostAcceptedDataStream(TelnetComm comm, String terminalType)
TelnetCommListener
hostAcceptedDataStream
in interface TelnetCommListener
comm
- The telnet communication instance.terminalType
- The terminal type accepted by the host at Telnet terminal negotiation.public void processInboundDataStream(TelnetComm comm, byte[] inputBuf, int pos, int inputBufLen) throws IOException
TelnetCommListener
processInboundDataStream
in interface TelnetCommListener
comm
- The telnet communication instance.inputBuf
- The input buffer.pos
- Start position in buffer.inputBufLen
- Length of input buffer.IOException
- If an I/O error occurs.public void processInboundSCSDataStream(TelnetComm comm, byte[] inputBuf, int inputBufLen) throws IOException
TelnetCommListener
processInboundSCSDataStream
in interface TelnetCommListener
comm
- The telnet communication instance.inputBuf
- The input buffer.inputBufLen
- Length of input buffer.IOException
- If an I/O error occurs.public void processInboundSSCPLUDataStream(TelnetComm comm, byte[] inputBuf, int pos, int inputBufLen) throws IOException
TelnetCommListener
processInboundSSCPLUDataStream
in interface TelnetCommListener
comm
- The telnet communication instance.inputBuf
- The input buffer.pos
- Start position in buffer.inputBufLen
- Length of input buffer.IOException
- If an I/O error occurs.public void processPrintEOJ(TelnetComm comm) throws IOException
TelnetCommListener
processPrintEOJ
in interface TelnetCommListener
comm
- The telnet communication instance.IOException
- If an I/O error occurs.public void onCommError(TelnetComm comm, IOException e)
TelnetCommListener
onCommError
in interface TelnetCommListener
comm
- The telnet communication instance.e
- The exception.public SocketCommNIO getComm()
getComm
in interface HostSessionPeer
public void onCommState(SocketCommNIO comm)
onCommState
in interface TelnetCommListener
comm
- Socket communication instance.public void onCommClosed(TelnetComm comm)
TelnetCommListener
onCommClosed
in interface TelnetCommListener
comm
- The telnet communication instance.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.