X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=others%2Flede-gui%2Fsrc%2Fmain%2Fjava%2Fcom%2Fexample%2Flede2%2FSSH.java;h=94380535f5c7bc3690d1f904618529a808c3e09e;hb=00922a5779ecade450c3cabc756f850dbe528095;hp=203ba796376c1da7ca871d730716ccd53dae3835;hpb=79298f7386842b764e79f806a56bf67c7b88aaaa;p=iot2.git diff --git a/others/lede-gui/src/main/java/com/example/lede2/SSH.java b/others/lede-gui/src/main/java/com/example/lede2/SSH.java index 203ba79..9438053 100644 --- a/others/lede-gui/src/main/java/com/example/lede2/SSH.java +++ b/others/lede-gui/src/main/java/com/example/lede2/SSH.java @@ -34,13 +34,13 @@ import java.util.List; public class SSH extends AsyncTask> { // variables used for connection - Session session; - Channel channel; - ChannelExec ce; + private Session session; + private Channel channel; + private ChannelExec ce; // in this project, we supposed we use fixed host, username, password - String host; - String username; - String password; + private String host; + private String username; + private String password; // host, username, password initialize @Override @@ -57,8 +57,7 @@ public class SSH extends AsyncTask> { https://stackoverflow.com/questions/25789245/how-to-get-jsch-shell-command-output-in-string */ - - // open the conenction using username, password, and hostname + // open the connection using username, password, and hostname public boolean open() throws JSchException { JSch jSch = new JSch(); @@ -148,9 +147,9 @@ public class SSH extends AsyncTask> { cmd = MainActivity.DEF_CHANGE_DEFAULT_SCRIPT + " " + params[0]; } else if(params[0].substring(0,3).equals("-co")) { // ./connect_device.sh -co cmd = MainActivity.DEF_CONNECT_DEVICE_SCRIPT + " " + params[0]; - } else if(params[0].substring(0,3).equals("-dn")) { // ./register_device.sh -dn + } else if(params[0].substring(0,3).equals("-dn")) { // ./register_device.sh -dn cmd = MainActivity.DEF_REGISTER_DEVICE_SCRIPT + " " + params[0]; - } else if(params[0].substring(0,3).equals("-ln")) { // ./register_device.sh -ln + } else if(params[0].substring(0,3).equals("-ln")) { // ./register_device.sh -ln // below block is a little different from others cause it needs to get output from the router try { // try open the connection