All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.glxn.qrgen.core.scheme.EnterpriseWifi Maven / Gradle / Ivy

There is a newer version: 3.3.18-20230117
Show newest version
package net.glxn.qrgen.core.scheme;

import static net.glxn.qrgen.core.scheme.SchemeUtil.getParameters;

import java.util.Map;

/**
 * Encodes a Wifi connection containing a username / password scheme for
 * authentication, format is:
 * WIFI:S:SSID;U:USER;P:PSK;E:EAP;PH:PHASE;;
 */
public class EnterpriseWifi extends Wifi {

	public static final String USER = "U";
	public static final String EAP = "E";
	public static final String PHASE = "PH";

	private String user;
	private String eap;
	private String phase;

	public EnterpriseWifi() {
		super();
	}

	public EnterpriseWifi withUser(String user) {
		this.user = user;
		return this;
	}

	public void setUser(String user) {
		withUser(user);
	}

	public String getUser() {
		return user;
	}

	public EnterpriseWifi withEap(String eap) {
		this.eap = eap;
		return this;
	}

	public void setEap(String eap) {
		withEap(eap);
	}

	public String getEap() {
		return eap;
	}

	public EnterpriseWifi withPhase(String phase) {
		this.phase = phase;
		return this;
	}

	public void setPhase(String phase) {
		withPhase(phase);
	}

	public String getPhase() {
		return phase;
	}

	@Override
	public Schema parseSchema(String code) {
		if (code == null || !code.startsWith(WIFI_PROTOCOL_HEADER)) {
			throw new IllegalArgumentException("this is not a valid WIFI code: " + code);
		}
		Map parameters = getParameters(code.substring(WIFI_PROTOCOL_HEADER.length()), "(?




© 2015 - 2025 Weber Informatics LLC | Privacy Policy