diff src/com/five_ten_sg/connectbot/transport/TN5250.java @ 31:139394237973 tn5250

start tn5250 integration
author Carl Byington <carl@five-ten-sg.com>
date Tue, 10 Jun 2014 12:00:07 -0700
parents d738f6b876fe
children b086dd794dba
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java	Tue Jun 03 16:05:21 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java	Tue Jun 10 12:00:07 2014 -0700
@@ -52,15 +52,13 @@
     private static final String PROTOCOL = "tn5250";
     private static final String TAG = "ConnectBot.tn5250";
     private static final int DEFAULT_PORT = 23;
+
     private Screen5250 screen52;
-
-    private tnvt   handler = null;
-    private Socket socket;
-
-    private int width;
-    private int height;
-
-    private boolean connected = false;
+    private tnvt       handler = null;
+    private Socket     socket;
+    private int        width;
+    private int        height;
+    private boolean    connected = false;
 
     static final Pattern hostmask;
     static {
@@ -72,18 +70,19 @@
        super();
    }
 
-   public TN5250(HostBean host, TerminalBridge bridge, TerminalManager manager) {
-       super(host, bridge, manager);
-   }
 
-
-   /**
-    * @return protocol part of the URI
-    */
+    /**
+     * @return protocol part of the URI
+     */
    public static String getProtocolName() {
        return PROTOCOL;
    }
 
+
+    /**
+     * Encode the current transport into a URI that can be passed via intent calls.
+     * @return URI to host
+     */
    public Uri getUri(String input) {
         Matcher matcher = hostmask.matcher(input);
 
@@ -121,6 +120,7 @@
         return uri;
    }
 
+
    /**
     * Causes transport to connect to the target host. After connecting but before a
     * session is started, must call back to {@link TerminalBridge#onConnected()}.
@@ -145,6 +145,7 @@
         return true;
     }
 
+
     /**
      * Reads from the transport. Transport must support reading into a byte array
      * <code>buffer</code> at the start of <code>offset</code> and a maximum of
@@ -172,6 +173,7 @@
     public void write(byte[] buffer) throws IOException {
     }
 
+
     /**
      * Writes to the transport. See {@link #write(byte[])} for behavior details.
      * @param c character to write to the transport
@@ -180,6 +182,7 @@
     public void write(int c) throws IOException {
     }
 
+
     /**
      * Flushes the write commands to the transport.
      * @throws IOException when there is a problem writing after connection
@@ -187,6 +190,7 @@
     public void flush() throws IOException {
     }
 
+
     /**
      * Closes the connection to the terminal. Note that the resulting failure to read
      * should call {@link TerminalBridge#dispatchDisconnect(boolean)}.  !!!
@@ -196,6 +200,7 @@
         connected = false;
     }
 
+
     /**
      * Tells the transport what dimensions the display is currently
      * @param columns columns of text
@@ -208,144 +213,25 @@
         // do nothing
     }
 
-    public void setOptions(Map<String, String> options) {
-        // do nothing
-    }
-
-    public Map<String, String> getOptions() {
-        return null;
-    }
-
-    public void setCompression(boolean compression) {
-        // do nothing
-    }
-
-    public void setHttpproxy(String httpproxy) {
-        // do nothing
-    }
-
-    public void setUseAuthAgent(String useAuthAgent) {
-        // do nothing
-    }
-
-    public void setEmulation(String emulation) {
-        this.emulation = emulation;
-    }
-
-    public String getEmulation() {
-        return emulation;
-    }
-
-    public void setHost(HostBean host) {
-        this.host = host;
-    }
-
-    public void setBridge(TerminalBridge bridge) {
-        this.bridge = bridge;
-    }
-
-    public void setManager(TerminalManager manager) {
-        this.manager = manager;
-    }
-
-    /**
-     * Whether or not this transport type can forward ports.
-     * @return true on ability to forward ports
-     */
-    public boolean canForwardPorts() {
-        return false;
-    }
-
-    /**
-     * Adds the {@link PortForwardBean} to the list.
-     * @param portForward the port forward bean to add
-     * @return true on successful addition
-     */
-    public boolean addPortForward(PortForwardBean portForward) {
-        return false;
-    }
-
-    /**
-     * Enables a port forward member. After calling this method, the port forward should
-     * be operational iff it could be enabled by the transport.
-     * @param portForward member of our current port forwards list to enable
-     * @return true on successful port forward setup
-     */
-    public boolean enablePortForward(PortForwardBean portForward) {
-        return false;
-    }
-
-    /**
-     * Disables a port forward member. After calling this method, the port forward should
-     * be non-functioning iff it could be disabled by the transport.
-     * @param portForward member of our current port forwards list to enable
-     * @return true on successful port forward tear-down
-     */
-    public boolean disablePortForward(PortForwardBean portForward) {
-        return false;
-    }
-
-    /**
-     * Removes the {@link PortForwardBean} from the available port forwards.
-     * @param portForward the port forward bean to remove
-     * @return true on successful removal
-     */
-    public boolean removePortForward(PortForwardBean portForward) {
-        return false;
-    }
-
-    /**
-     * Gets a list of the {@link PortForwardBean} currently used by this transport.
-     * @return the list of port forwards
-     */
-    public List<PortForwardBean> getPortForwards() {
-        return null;
-    }
-
-    /**
-     * Whether or not this transport type can transfer files.
-     * @return true on ability to transfer files
-     */
-    public boolean canTransferFiles() {
-        return false;
-    }
-
-    /**
-     * Downloads the specified remote file to a local folder.
-     * @param remoteFile The path to the remote file to be downloaded. Must be non-null.
-     * @param localFolder The path to local folder. Null = default external storage folder.
-     * @return true on success, false on failure
-     */
-    public boolean downloadFile(String remoteFile, String localFolder) {
-        return false;
-    }
-
-    /**
-     * Uploads the specified local file to the remote host.
-     * @param localFile The path to the local file to be uploaded. Must be non-null.
-     * @param remoteFolder The path to the remote directory. Null == default remote directory.
-     * @return true on success, false on failure
-     */
-    public boolean uploadFile(String localFile, String remoteFile,
-                              String remoteFolder, String mode) {
-        return false;
-    }
 
     @Override
     public int getDefaultPort() {
         return DEFAULT_PORT;
     }
 
+
     @Override
     public boolean isConnected() {
         return connected;
     }
 
+
     @Override
     public boolean isSessionOpen() {
         return connected;
     }
 
+
     @Override
     public boolean isAuthenticated() {
         return connected;
@@ -362,6 +248,7 @@
         }
     }
 
+
     @Override
     public void getSelectionArgs(Uri uri, Map<String, String> selection) {
         selection.put(HostDatabase.FIELD_HOST_PROTOCOL, PROTOCOL);
@@ -420,10 +307,4 @@
         return false;
     }
 
-
-    @Override
-    public TerminalKeyListener getTerminalKeyListener(TerminalManager manager, TerminalBridge bridge, vt320 buffer, String encoding) {
-        return new TerminalKeyListener(manager, bridge, buffer, encoding);
-    }
-
 }