Mercurial > 510Connectbot
annotate src/com/five_ten_sg/connectbot/transport/AbsTransport.java @ 111:6a0ad4d384ea
add debugging for function keys
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 18 Jun 2014 13:00:19 -0700 |
parents | 6802f1cd1add |
children | 77ac18bc1b2f |
rev | line source |
---|---|
0 | 1 /* |
2 * ConnectBot: simple, powerful, open-source SSH client for Android | |
3 * Copyright 2007 Kenny Root, Jeffrey Sharkey | |
4 * | |
5 * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 * you may not use this file except in compliance with the License. | |
7 * You may obtain a copy of the License at | |
8 * | |
9 * http://www.apache.org/licenses/LICENSE-2.0 | |
10 * | |
11 * Unless required by applicable law or agreed to in writing, software | |
12 * distributed under the License is distributed on an "AS IS" BASIS, | |
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 * See the License for the specific language governing permissions and | |
15 * limitations under the License. | |
16 */ | |
17 | |
18 package com.five_ten_sg.connectbot.transport; | |
19 | |
20 import java.io.IOException; | |
21 import java.util.List; | |
22 import java.util.Map; | |
23 | |
24 import com.five_ten_sg.connectbot.bean.HostBean; | |
25 import com.five_ten_sg.connectbot.bean.PortForwardBean; | |
26 import com.five_ten_sg.connectbot.service.TerminalBridge; | |
29
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
27 import com.five_ten_sg.connectbot.service.TerminalKeyListener; |
0 | 28 import com.five_ten_sg.connectbot.service.TerminalManager; |
29 import android.content.Context; | |
30 import android.net.Uri; | |
43
6b0f1ece1d91
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
42
diff
changeset
|
31 import android.util.Log; |
29
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
32 import de.mud.terminal.vt320; |
0 | 33 |
34 /** | |
35 * @author Kenny Root | |
36 * | |
37 */ | |
38 public abstract class AbsTransport { | |
44
959ebe0247b5
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
43
diff
changeset
|
39 protected String TAG; |
959ebe0247b5
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
43
diff
changeset
|
40 protected TerminalManager manager; |
959ebe0247b5
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
43
diff
changeset
|
41 protected TerminalBridge bridge; |
91
33eb63352be5
remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents:
69
diff
changeset
|
42 protected String homeDirectory; |
44
959ebe0247b5
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
43
diff
changeset
|
43 protected HostBean host; |
45
80dcebe51af2
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
44
diff
changeset
|
44 protected vt320 buffer = null; |
44
959ebe0247b5
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
43
diff
changeset
|
45 protected String emulation; |
0 | 46 |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
47 class vt320Default extends vt320 { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
48 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
49 public void debug(String s) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
50 Log.d(TAG, s); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
51 } |
69
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
52 |
100 | 53 // monitor injecting a field |
54 @Override | |
55 public void setField(int l, int c, char [] data) { | |
56 byte[] b = new byte[data.length]; | |
57 int i; | |
58 for (i=0; i<b.length; i++) { | |
59 b[i] = (byte)(data[i] & 0x00ff); | |
60 } | |
102 | 61 write(b); |
100 | 62 } |
63 | |
69
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
64 // terminal key listener sending to the host |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
65 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
66 public void write(byte[] b) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
67 try { |
43
6b0f1ece1d91
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
42
diff
changeset
|
68 if (bridge.monitor != null) bridge.monitor.hostData(b); |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
69 |
43
6b0f1ece1d91
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
42
diff
changeset
|
70 AbsTransport.this.write(b); |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
71 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
72 catch (IOException e) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
73 Log.e(TAG, "Problem writing outgoing data in vt320() thread", e); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
74 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
75 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
76 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
77 public void write(int b) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
78 try { |
43
6b0f1ece1d91
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
42
diff
changeset
|
79 if (bridge.monitor != null) bridge.monitor.hostData(b); |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
80 |
43
6b0f1ece1d91
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
42
diff
changeset
|
81 AbsTransport.this.write(b); |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
82 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
83 catch (IOException e) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
84 Log.e(TAG, "Problem writing outgoing data in vt320() thread", e); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
85 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
86 } |
69
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
87 |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
88 // We don't use telnet sequences. |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
89 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
90 public void sendTelnetCommand(byte cmd) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
91 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
92 // We don't want remote to resize our window. |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
93 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
94 public void setWindowSize(int c, int r) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
95 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
96 // play beep noise |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
97 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
98 public void beep() { |
47
a3fd10a8c0de
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
45
diff
changeset
|
99 if ((bridge.parent != null) && (bridge.parent.isShown())) |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
100 manager.playBeep(); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
101 else |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
102 manager.sendActivityNotification(host); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
103 } |
69
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
104 |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
105 // test for changed screen contents |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
106 @Override |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
107 public void testChanged() { |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
108 if (bridge.monitor != null) bridge.monitor.testChanged(); |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
109 } |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
110 // relay socket writing to the screen |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
111 // bridge.monitor placement of new characters |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
112 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
113 public void putChar(int c, int l, char ch, int attributes) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
114 if (bridge.monitor != null) bridge.monitor.screenChanged(l, c); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
115 |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
116 super.putChar(c, l, ch, attributes); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
117 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
118 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
119 public void insertChar(int c, int l, char ch, int attributes) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
120 if (bridge.monitor != null) bridge.monitor.screenChanged(l, l, c, width - 1); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
121 |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
122 super.insertChar(c, l, ch, attributes); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
123 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
124 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
125 public void insertLine(int l, int n, boolean scrollDown) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
126 if (bridge.monitor != null) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
127 if (scrollDown) bridge.monitor.screenChanged(l, height - 1, 0, width - 1); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
128 else bridge.monitor.screenChanged(0, l, 0, width - 1); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
129 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
130 |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
131 super.insertLine(l, n, scrollDown); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
132 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
133 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
134 public void deleteLine(int l) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
135 if (bridge.monitor != null) bridge.monitor.screenChanged(l, height - 1, 0, width - 1); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
136 |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
137 super.deleteLine(l); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
138 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
139 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
140 public void deleteChar(int c, int l) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
141 if (bridge.monitor != null) bridge.monitor.screenChanged(l, l, c, width - 1); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
142 |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
143 super.deleteChar(c, l); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
144 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
145 @Override |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
146 public void setCursorPosition(int c, int l) { |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
147 if (bridge.monitor != null) bridge.monitor.cursorMove(l, c); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
148 |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
149 super.setCursorPosition(c, l); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
150 } |
69
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
151 |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
152 // monitor setField() |
294435151b0c
use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents:
47
diff
changeset
|
153 |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
154 }; |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
155 |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
156 |
0 | 157 public AbsTransport() {} |
158 | |
159 /** | |
160 * @return protocol part of the URI | |
161 */ | |
162 public static String getProtocolName() { | |
163 return "unknown"; | |
164 } | |
165 | |
166 /** | |
167 * Encode the current transport into a URI that can be passed via intent calls. | |
168 * @return URI to host | |
169 */ | |
11 | 170 public abstract Uri getUri(String input); |
171 | |
0 | 172 |
173 /** | |
174 * Causes transport to connect to the target host. After connecting but before a | |
175 * session is started, must call back to {@link TerminalBridge#onConnected()}. | |
176 * After that call a session may be opened. | |
177 */ | |
178 public abstract void connect(); | |
179 | |
180 /** | |
181 * Checks if read() will block. If there are no bytes remaining in | |
182 * the underlying transport, return true. | |
183 */ | |
184 public abstract boolean willBlock(); | |
185 | |
186 /** | |
187 * Reads from the transport. Transport must support reading into a byte array | |
188 * <code>buffer</code> at the start of <code>offset</code> and a maximum of | |
189 * <code>length</code> bytes. If the remote host disconnects, throw an | |
190 * {@link IOException}. | |
191 * @param buffer byte buffer to store read bytes into | |
192 * @param offset where to start writing in the buffer | |
193 * @param length maximum number of bytes to read | |
194 * @return number of bytes read | |
195 * @throws IOException when remote host disconnects | |
196 */ | |
197 public abstract int read(byte[] buffer, int offset, int length) throws IOException; | |
198 | |
199 /** | |
200 * Writes to the transport. If the host is not yet connected, simply return without | |
201 * doing anything. An {@link IOException} should be thrown if there is an error after | |
202 * connection. | |
203 * @param buffer bytes to write to transport | |
204 * @throws IOException when there is a problem writing after connection | |
205 */ | |
206 public abstract void write(byte[] buffer) throws IOException; | |
207 | |
208 /** | |
209 * Writes to the transport. See {@link #write(byte[])} for behavior details. | |
210 * @param c character to write to the transport | |
211 * @throws IOException when there is a problem writing after connection | |
212 */ | |
213 public abstract void write(int c) throws IOException; | |
214 | |
215 /** | |
216 * Flushes the write commands to the transport. | |
217 * @throws IOException when there is a problem writing after connection | |
218 */ | |
219 public abstract void flush() throws IOException; | |
220 | |
221 /** | |
222 * Closes the connection to the terminal. Note that the resulting failure to read | |
223 * should call {@link TerminalBridge#dispatchDisconnect(boolean)}. | |
224 */ | |
225 public abstract void close(); | |
226 | |
227 /** | |
228 * Tells the transport what dimensions the display is currently | |
229 * @param columns columns of text | |
230 * @param rows rows of text | |
231 * @param width width in pixels | |
232 * @param height height in pixels | |
233 */ | |
234 public abstract void setDimensions(int columns, int rows, int width, int height); | |
235 | |
236 public void setOptions(Map<String, String> options) { | |
237 // do nothing | |
238 } | |
239 | |
240 public Map<String, String> getOptions() { | |
241 return null; | |
242 } | |
243 | |
244 public void setCompression(boolean compression) { | |
245 // do nothing | |
246 } | |
247 | |
248 public void setHttpproxy(String httpproxy) { | |
249 // do nothing | |
250 } | |
251 | |
252 public void setUseAuthAgent(String useAuthAgent) { | |
253 // do nothing | |
254 } | |
255 | |
256 public String getEmulation() { | |
257 return emulation; | |
258 } | |
259 | |
47
a3fd10a8c0de
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
45
diff
changeset
|
260 protected vt320 setupTransportBuffer() { |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
261 int scrollback = (host.getWantSession()) ? manager.getScrollback() : 0; |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
262 buffer.setBufferSize(scrollback); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
263 buffer.setDisplay(bridge); |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
264 return buffer; |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
265 } |
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
266 |
47
a3fd10a8c0de
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
45
diff
changeset
|
267 public vt320 getTransportBuffer() { |
a3fd10a8c0de
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
45
diff
changeset
|
268 buffer = new vt320Default(); |
a3fd10a8c0de
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
45
diff
changeset
|
269 return setupTransportBuffer(); |
a3fd10a8c0de
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
45
diff
changeset
|
270 } |
a3fd10a8c0de
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
45
diff
changeset
|
271 |
91
33eb63352be5
remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents:
69
diff
changeset
|
272 public void setLinks(TerminalManager manager, TerminalBridge bridge, String homeDirectory, HostBean host, String emulation) { |
33eb63352be5
remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents:
69
diff
changeset
|
273 this.manager = manager; |
33eb63352be5
remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents:
69
diff
changeset
|
274 this.bridge = bridge; |
33eb63352be5
remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents:
69
diff
changeset
|
275 this.homeDirectory = homeDirectory; |
33eb63352be5
remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents:
69
diff
changeset
|
276 this.host = host; |
33eb63352be5
remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents:
69
diff
changeset
|
277 this.emulation = emulation; |
0 | 278 } |
279 | |
280 /** | |
281 * Whether or not this transport type can forward ports. | |
282 * @return true on ability to forward ports | |
283 */ | |
284 public boolean canForwardPorts() { | |
285 return false; | |
286 } | |
287 | |
288 /** | |
289 * Adds the {@link PortForwardBean} to the list. | |
290 * @param portForward the port forward bean to add | |
291 * @return true on successful addition | |
292 */ | |
293 public boolean addPortForward(PortForwardBean portForward) { | |
294 return false; | |
295 } | |
296 | |
297 /** | |
298 * Enables a port forward member. After calling this method, the port forward should | |
299 * be operational iff it could be enabled by the transport. | |
300 * @param portForward member of our current port forwards list to enable | |
301 * @return true on successful port forward setup | |
302 */ | |
303 public boolean enablePortForward(PortForwardBean portForward) { | |
304 return false; | |
305 } | |
306 | |
307 /** | |
308 * Disables a port forward member. After calling this method, the port forward should | |
309 * be non-functioning iff it could be disabled by the transport. | |
310 * @param portForward member of our current port forwards list to enable | |
311 * @return true on successful port forward tear-down | |
312 */ | |
313 public boolean disablePortForward(PortForwardBean portForward) { | |
314 return false; | |
315 } | |
316 | |
317 /** | |
318 * Removes the {@link PortForwardBean} from the available port forwards. | |
319 * @param portForward the port forward bean to remove | |
320 * @return true on successful removal | |
321 */ | |
322 public boolean removePortForward(PortForwardBean portForward) { | |
323 return false; | |
324 } | |
325 | |
326 /** | |
327 * Gets a list of the {@link PortForwardBean} currently used by this transport. | |
328 * @return the list of port forwards | |
329 */ | |
330 public List<PortForwardBean> getPortForwards() { | |
331 return null; | |
332 } | |
333 | |
334 /** | |
335 * Whether or not this transport type can transfer files. | |
336 * @return true on ability to transfer files | |
337 */ | |
338 public boolean canTransferFiles() { | |
339 return false; | |
340 } | |
341 | |
342 /** | |
343 * Downloads the specified remote file to a local folder. | |
344 * @param remoteFile The path to the remote file to be downloaded. Must be non-null. | |
345 * @param localFolder The path to local folder. Null = default external storage folder. | |
346 * @return true on success, false on failure | |
347 */ | |
348 public boolean downloadFile(String remoteFile, String localFolder) { | |
349 return false; | |
350 } | |
351 | |
352 /** | |
353 * Uploads the specified local file to the remote host. | |
354 * @param localFile The path to the local file to be uploaded. Must be non-null. | |
355 * @param remoteFolder The path to the remote directory. Null == default remote directory. | |
356 * @return true on success, false on failure | |
357 */ | |
358 public boolean uploadFile(String localFile, String remoteFile, | |
359 String remoteFolder, String mode) { | |
360 return false; | |
361 } | |
362 | |
363 | |
364 /** | |
365 * @return int default port for protocol | |
366 */ | |
367 public abstract int getDefaultPort(); | |
31
139394237973
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
30
diff
changeset
|
368 public abstract boolean isConnected(); |
139394237973
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
30
diff
changeset
|
369 public abstract boolean isSessionOpen(); |
139394237973
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
30
diff
changeset
|
370 public abstract boolean isAuthenticated(); |
0 | 371 |
372 /** | |
373 * @param username | |
374 * @param hostname | |
375 * @param port | |
376 * @return | |
377 */ | |
378 public abstract String getDefaultNickname(String username, String hostname, int port); | |
379 | |
380 /** | |
381 * @param uri | |
382 * @param selectionKeys | |
383 * @param selectionValues | |
384 */ | |
385 public abstract void getSelectionArgs(Uri uri, Map<String, String> selection); | |
386 | |
387 /** | |
388 * @param uri | |
389 * @return | |
390 */ | |
391 public abstract HostBean createHost(Uri uri); | |
392 | |
393 /** | |
394 * @param context context containing the correct resources | |
395 * @return string that hints at the format for connection | |
396 */ | |
11 | 397 public abstract String getFormatHint(Context context); |
0 | 398 |
399 /** | |
29
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
400 * @return do we use the network |
0 | 401 */ |
402 public abstract boolean usesNetwork(); | |
29
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
403 |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
404 /** |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
405 * @return do we need a relay object to read from the transport |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
406 * and send the data into the vt320 buffer |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
407 */ |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
408 public boolean needsRelay() { |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
409 return true; |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
410 } |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
411 |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
412 /** |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
413 * @return a key listener |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
414 */ |
31
139394237973
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
30
diff
changeset
|
415 public TerminalKeyListener getTerminalKeyListener() { |
42
7ac846a07ed4
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
31
diff
changeset
|
416 return new TerminalKeyListener(manager, bridge, buffer, host.getEncoding()); |
29
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
417 } |
017eeed8332c
start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents:
11
diff
changeset
|
418 |
0 | 419 } |