app/src/main/java/com/example/dannyboy/smartguitarapp/MainActivity.java
private void updateVariablesFromTextBoxes() {
		WifiManager wifi = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
		if(!wifi.isWifiEnabled()){
			DebugLog.d(TAG, "No Wi-Fi connection!");
			return;
		}
		if(ipEditText.getText().toString().matches("")){
			controllerIP = ipEditText.getHint().toString();//"192.168.2.100";
		}else{
			controllerIP = ipEditText.getText().toString();
		}
		if(portEditText.getText().toString().matches("")){
			controllerPort = portEditText.getHint().toString();//"10080";
		}else{
			controllerPort = portEditText.getText().toString();
		}
		// The (256-controllerTime) was defined in the project 1st iteration. See how the controller translates this to keep the LEDs on to understand this better.
		if(tempoEditText.getText().toString().matches("")){
			controllerTime = 256-Integer.parseInt( tempoEditText.getHint().toString());
		}else{
			controllerTime = 256-Integer.parseInt( tempoEditText.getText().toString());
			if (controllerTime <= 0) {
				DebugLog.d(TAG, "Tempo cannot be bigger than 256, setting controllerTime to 127");
				controllerTime = 127;
			}
		}
	}
/**
	 * Updates the application parameters by the text field in the application that were filled by the user
	 */
Updates the application parameters by the text field in the application that were filled by the user
Updates the application parameters by the text field in the application that were filled by the user
private void updateVariablesFromTextBoxes() {
		WifiManager wifi = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
		if(!wifi.isWifiEnabled()){
			DebugLog.d(TAG, "No Wi-Fi connection!");
			return;
		}
		if(ipEditText.getText().toString().matches("")){
			controllerIP = ipEditText.getHint().toString();
		}else{
			controllerIP = ipEditText.getText().toString();
		}
		if(portEditText.getText().toString().matches("")){
			controllerPort = portEditText.getHint().toString();
		}else{
			controllerPort = portEditText.getText().toString();
		}
		if(tempoEditText.getText().toString().matches("")){
			controllerTime = 256-Integer.parseInt( tempoEditText.getHint().toString());
		}else{
			controllerTime = 256-Integer.parseInt( tempoEditText.getText().toString());
			if (controllerTime <= 0) {
				DebugLog.d(TAG, "Tempo cannot be bigger than 256, setting controllerTime to 127");
				controllerTime = 127;
			}
		}
	}
private void updateVariablesFromTextBoxes ( ) { WifiManager wifi = ( WifiManager ) getApplicationContext ( ) . getSystemService ( Context . WIFI_SERVICE ) ; if ( ! wifi . isWifiEnabled ( ) ) { DebugLog . d ( TAG , "No Wi-Fi connection!" ) ; return ; } if ( ipEditText . getText ( ) . toString ( ) . matches ( "" ) ) { controllerIP = ipEditText . getHint ( ) . toString ( ) ; } else { controllerIP = ipEditText . getText ( ) . toString ( ) ; } if ( portEditText . getText ( ) . toString ( ) . matches ( "" ) ) { controllerPort = portEditText . getHint ( ) . toString ( ) ; } else { controllerPort = portEditText . getText ( ) . toString ( ) ; } if ( tempoEditText . getText ( ) . toString ( ) . matches ( "" ) ) { controllerTime = 256 - Integer . parseInt ( tempoEditText . getHint ( ) . toString ( ) ) ; } else { controllerTime = 256 - Integer . parseInt ( tempoEditText . getText ( ) . toString ( ) ) ; if ( controllerTime <= 0 ) { DebugLog . d ( TAG , "Tempo cannot be bigger than 256, setting controllerTime to 127" ) ; controllerTime = 127 ; } } }
Updates the application parameters by the text field in the application that were filled by the user
Updates the application parameters by the text field in the application that were filled by the user
//"192.168.2.100"; //"10080"; // The (256-controllerTime) was defined in the project 1st iteration. See how the controller translates this to keep the LEDs on to understand this better.