@Override
	public void enumerate(String uid, String connectedUid, char position,
			short[] hardwareVersion, short[] firmwareVersion,
			int deviceIdentifier, short enumerationType) {

		// configure bricks on first connect (ENUMERATION_TYPE_CONNECTED) 
		// or configure bricks if enumerate was raised externally (ENUMERATION_TYPE_AVAILABLE)
		if (enumerationType == IPConnection.ENUMERATION_TYPE_CONNECTED
				|| enumerationType == IPConnection.ENUMERATION_TYPE_AVAILABLE) {
			
			// configure master brick
			if (deviceIdentifier == BrickMaster.DEVICE_IDENTIFIER) {
				master = new BrickMaster(uid, ipcon);
				try {
					master.setWifiPowerMode(BrickMaster.WIFI_POWER_MODE_LOW_POWER);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			
			// configure IR
			if(deviceIdentifier == BrickletDistanceIR.DEVICE_IDENTIFIER){
				ir = new BrickletDistanceIR(uid, ipcon);
				try {
				ir.setDebouncePeriod(1000);
		        ir.addDistanceReachedListener(this);
		        if(thresholdSet){
		        	ir.setDistanceCallbackThreshold('<', (short)(threshold), (short)0);
		        }
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}
	}