Skip to content

Commit

Permalink
quotes when creating wifi networks (fixes #185) (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sriharsha-Singam authored and dogi committed Feb 26, 2019
1 parent b2923a8 commit fd5bf51
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,12 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
default:
break;
}

}
}

private void wifiOn(Bundle bundle){

initialActivity.sendMessage("treehouses wifi "+bundle.getString("SSID")+" "+bundle.getString("PWD"));
initialActivity.sendMessage("treehouses wifi \""+bundle.getString("SSID")+"\" \""+bundle.getString("PWD")+"\"");

// WifiManager wifi = (WifiManager) getContext().getApplicationContext().getSystemService(WIFI_SERVICE);
// WifiConfiguration wc = new WifiConfiguration();
Expand Down Expand Up @@ -180,26 +179,26 @@ private void wifiOn(Bundle bundle){
}
private void hotspotOn (Bundle bundle){
if(bundle.getString("HPWD").equals("")){
initialActivity.sendMessage("treehouses ap "+bundle.getString("hotspotType")+" "+bundle.getString("HSSID"));
initialActivity.sendMessage("treehouses ap \""+bundle.getString("hotspotType")+"\" \""+bundle.getString("HSSID")+"\"");
}else{
initialActivity.sendMessage("treehouses ap "+bundle.getString("hotspotType")+" "+bundle.getString("HSSID")+" "+bundle.getString("HPWD"));
initialActivity.sendMessage("treehouses ap \""+bundle.getString("hotspotType")+"\" \""+bundle.getString("HSSID")+"\" \""+bundle.getString("HPWD")+"\"");
}
}
private void ethernetOn(Bundle bundle){
initialActivity.sendMessage("treehouses ethernet "+bundle.getString("ip")+" "+bundle.getString("mask")+" "+bundle.getString("gateway")+" "+bundle.getString("dns"));
initialActivity.sendMessage("treehouses ethernet \""+bundle.getString("ip")+"\" \""+bundle.getString("mask")+"\" \""+bundle.getString("gateway")+"\" \""+bundle.getString("dns")+"\"");
}

private void bridgeOn(Bundle bundle){
String overallMessage = "treehouses bridge "+(bundle.getString("essid"))+" "+bundle.getString("hssid")+" ";
String overallMessage = "treehouses bridge \""+(bundle.getString("essid"))+"\" \""+bundle.getString("hssid")+"\" ";

if(TextUtils.isEmpty(bundle.getString("password"))){
overallMessage+="\"\"";
}else{
overallMessage+=bundle.getString("password");
overallMessage+="\""+bundle.getString("password")+"\"";
}
overallMessage+=" ";
if(!TextUtils.isEmpty(bundle.getString("hpassword"))){
overallMessage+=bundle.getString("hpassword");
overallMessage+="\""+bundle.getString("hpassword")+"\"";
}
Log.e("NetworkFragment","Bridge RPI Message = "+overallMessage);
initialActivity.sendMessage(overallMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
Bundle bundle = data.getExtras();
String type = bundle.getString("type");
if(type.equals("rename")){
initialActivity.sendMessage("treehouses rename "+bundle.getString("hostname"));
initialActivity.sendMessage("treehouses rename \""+bundle.getString("hostname")+"\"");
}else if(type.equals("container")){
initialActivity.sendMessage("treehouses container "+bundle.getString("container"));
initialActivity.sendMessage("treehouses container \""+bundle.getString("container")+"\"");
}else if(type.equals("chPass")){
initialActivity.sendMessage("treehouses password "+bundle.getString("password"));
initialActivity.sendMessage("treehouses password \""+bundle.getString("password")+"\"");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:3.3.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit fd5bf51

Please sign in to comment.