Interface HostSessionPeer

All Known Implementing Classes:
EmptyHostSession, HostSession3270, HostSession5250, HostSessionEE

public interface HostSessionPeer
The interface for 3270 or 5250 host sessions.

It is also a collection of host session states.

Author:
Christopher Mindus
  • Field Details

  • Method Details

    • connect

      boolean connect()
      Connects the session to host.
    • disconnect

      boolean disconnect()
      Disconnects the session from host.
    • getScreenSize

      Size getScreenSize()
      Gets the current screen size.
    • getScreenLength

      int getScreenLength()
      Gets the current screen length (width * height).
    • sendCharacterString

      boolean sendCharacterString(String keys)
      Sends character keystrokes to host.
    • sendKey

      boolean sendKey(int key)
      Sends keystrokes to host.
      See Also:
    • setHostString

      boolean setHostString(int x, int y, int offset, int length, String string)
      Sets a string to a host field.
    • setHostStringAsKeys

      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. The host field is first cleared with (3270) Clear EOF or (5250) Field Exit or Field Minus (for negative numbers in a numeric field). The string is then entered as a set of keystrokes, followed by a potential Field Exit or Field Minus (for negative numbers in a numeric field), but only for 5250.
    • doesHostNeedFieldExit

      boolean doesHostNeedFieldExit(int x, int y, int offset, int length, String string)
      For 5250: 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.
      Returns:
      false=field doesn't require field exit, true=field requires field exit.
    • setCursor

      boolean setCursor(int x, int y)
      Sets the host cursor position.
    • getCursor

      Position getCursor()
      Gets the current host cursor position.
    • getCharactersAndAttributes

      void getCharactersAndAttributes(char[] chars, int[] attrbs, int beginPos, int endPos)
      Gets the characters and attributes between two positions, including the end position.
    • getCharactersAndAttributes

      void getCharactersAndAttributes(char[] chars, int[] attrbs, int beginPos, int endPos, char fieldOrNullChar)
      Gets the characters and attributes between two positions, including the end position. The character "fieldOrNullChar" is the character that will be used instead of field attributes and null characters.
    • getSessionState

      int getSessionState()
      Gets the current session state.
      Returns:
      A combination of HostSessionPeer.STATE_* flags is returned.
    • getComm

      SocketCommNIO getComm()
      Gets the communication engine.
      Returns:
      The NIO instance.
    • refreshHostFields

      void refreshHostFields(HostFields fields)
      Refreshes the host fields of the current session. The host session will add all available host fields sorted left to right, top to bottom.
    • is3270

      boolean is3270()
      Checks if a session is 3270 or 5250.
      Returns:
      false if 5250,
      true if 3270.
    • isPrinter

      boolean isPrinter()
      Checks if this is a printer or not.
    • getLastError

      String getLastError(boolean doClear)
      Gets the last error message of the session.
      Returns:
      null if the session doesn't support it (3270 doesn't).
    • setLastError

      void setLastError(String errMsg)
      Sets the last error message of the session.
    • getDeviceName

      String getDeviceName()
      Gets the device name of the session.
      Returns:
      null if no device name exists.
    • isProcessingDataStream

      boolean isProcessingDataStream()
      Checks if the session is currently processing data stream commands to update the screen/cursor, state, etc.
    • setInsertMode

      boolean setInsertMode(boolean on)
      Sets the insert mode.
      Returns:
      true for success, false for failure.
    • doesFieldHaveExtendedAttributes

      boolean doesFieldHaveExtendedAttributes(HostField hostField)
      Checks if a host field has extended attributes or not. 5250 never has, but 3270 could have, e.g. special highlighting.
    • getNewCharAttribute

      int getNewCharAttribute(HostField hostField)
      Gets the attribute to use for new characters in a field that contains extended attributes (always zero for non-3270).
    • getClientHostFieldFlags

      int getClientHostFieldFlags(HostField hostField)
      Gets flags that are required for the client host fields for local editing, etc.
    • isAutoReconnectSessionEnabled

      boolean isAutoReconnectSessionEnabled()
      Checks if the use of auto reconnect session is handled or not.
    • getHomeAddress

      int getHomeAddress()
      Gets the host address index on the screen.
    • setHostField

      boolean setHostField(HostField hostField, String data, int[] attrs)
      Sets a host field fully with text data and perhaps attributes (if these are non-null).
      Returns:
      true for success, false for failure.
    • getAllowedCharacters

      String getAllowedCharacters()
      Gets the string of characters that can be input by the user using the configured host code page for this session.

      If the return string is empty, for the EE package for example, all characters are "inputable".

    • isFieldFormatted

      boolean isFieldFormatted()
      Checks if this host screen is field formatted. This method is not like the one in HostScreen, this one checks directly to see if any fields are present.
    • isDisplayInSystemRequestMode

      boolean isDisplayInSystemRequestMode()
      Checks if the display (5250 only) is in System Request mode.
    • getHostSession

      HostSession getHostSession()
      Gets the HostSession, i.e. the owner of the peer.