package org.eclipse.paho.mqttv5.client;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import org.eclipse.paho.mqttv5.client.internal.NetworkModuleService;
import org.eclipse.paho.mqttv5.client.util.Debug;
import org.eclipse.paho.mqttv5.common.MqttMessage;
import org.eclipse.paho.mqttv5.common.packet.MqttProperties;
import org.eclipse.paho.mqttv5.common.packet.UserProperty;
import org.eclipse.paho.mqttv5.common.util.MqttTopicValidator;

/* JADX INFO: loaded from: classes2.dex */
public class MqttConnectionOptions {
    private static final String CLIENT_ID_PREFIX = "paho";
    private Map<String, String> customWebSocketHeaders;
    private byte[] password;
    private SocketFactory socketFactory;
    private String userName;
    private String[] serverURIs = null;
    private boolean automaticReconnect = false;
    private int automaticReconnectMinDelay = 1;
    private int automaticReconnectMaxDelay = 120;
    private boolean useSubscriptionIdentifiers = true;
    private int keepAliveInterval = 60;
    private int connectionTimeout = 30;
    private boolean httpsHostnameVerificationEnabled = true;
    private int maxReconnectDelay = 128000;
    private boolean sendReasonMessages = false;
    MqttProperties willMessageProperties = new MqttProperties();
    private int mqttVersion = 5;
    private boolean cleanStart = true;
    private String willDestination = null;
    private MqttMessage willMessage = null;
    private Long sessionExpiryInterval = null;
    private Integer receiveMaximum = null;
    private Long maximumPacketSize = null;
    private Integer topicAliasMaximum = null;
    private Boolean requestResponseInfo = null;
    private Boolean requestProblemInfo = null;
    private List<UserProperty> userProperties = null;
    private String authMethod = null;
    private byte[] authData = null;
    private Properties sslClientProps = null;
    private HostnameVerifier sslHostnameVerifier = null;
    private int executorServiceTimeout = 1;

    public MqttProperties getConnectionProperties() {
        MqttProperties mqttProperties = new MqttProperties();
        mqttProperties.setSessionExpiryInterval(this.sessionExpiryInterval);
        mqttProperties.setReceiveMaximum(this.receiveMaximum);
        mqttProperties.setMaximumPacketSize(this.maximumPacketSize);
        mqttProperties.setTopicAliasMaximum(this.topicAliasMaximum);
        mqttProperties.setRequestResponseInfo(this.requestResponseInfo);
        mqttProperties.setRequestProblemInfo(this.requestProblemInfo);
        mqttProperties.setUserProperties(this.userProperties);
        mqttProperties.setAuthenticationMethod(this.authMethod);
        mqttProperties.setAuthenticationData(this.authData);
        return mqttProperties;
    }

    public MqttProperties getWillMessageProperties() {
        return this.willMessageProperties;
    }

    public void setWillMessageProperties(MqttProperties mqttProperties) {
        this.willMessageProperties = mqttProperties;
    }

    public int getMqttVersion() {
        return this.mqttVersion;
    }

    public String getUserName() {
        return this.userName;
    }

    public void setUserName(String str) {
        this.userName = str;
    }

    public byte[] getPassword() {
        return this.password;
    }

    public void setPassword(byte[] bArr) {
        this.password = bArr;
    }

    public String getWillDestination() {
        return this.willDestination;
    }

    public MqttMessage getWillMessage() {
        return this.willMessage;
    }

    public void setWill(String str, MqttMessage mqttMessage) {
        if (str == null || mqttMessage == null || mqttMessage.getPayload() == null) {
            throw new IllegalArgumentException();
        }
        MqttTopicValidator.validate(str, false, true);
        this.willDestination = str;
        this.willMessage = mqttMessage;
        mqttMessage.setMutable(false);
    }

    public boolean isCleanStart() {
        return this.cleanStart;
    }

    public void setCleanStart(boolean z) {
        this.cleanStart = z;
    }

    public int getKeepAliveInterval() {
        return this.keepAliveInterval;
    }

    public void setKeepAliveInterval(int i) {
        if (i < 0) {
            throw new IllegalArgumentException();
        }
        this.keepAliveInterval = i;
    }

    public int getConnectionTimeout() {
        return this.connectionTimeout;
    }

    public void setConnectionTimeout(int i) {
        if (i < 0) {
            throw new IllegalArgumentException();
        }
        this.connectionTimeout = i;
    }

    public int getMaxReconnectDelay() {
        return this.maxReconnectDelay;
    }

    public void setMaxReconnectDelay(int i) {
        this.maxReconnectDelay = i;
    }

    public String[] getServerURIs() {
        return this.serverURIs;
    }

    public void setServerURIs(String[] strArr) {
        for (String str : strArr) {
            NetworkModuleService.validateURI(str);
        }
        this.serverURIs = (String[]) strArr.clone();
    }

    public boolean isAutomaticReconnect() {
        return this.automaticReconnect;
    }

    public void setAutomaticReconnect(boolean z) {
        this.automaticReconnect = z;
    }

    public void setAutomaticReconnectDelay(int i, int i2) {
        this.automaticReconnectMinDelay = i;
        this.automaticReconnectMaxDelay = i2;
    }

    public int getAutomaticReconnectMinDelay() {
        return this.automaticReconnectMinDelay;
    }

    public int getAutomaticReconnectMaxDelay() {
        return this.automaticReconnectMaxDelay;
    }

    public Long getSessionExpiryInterval() {
        return this.sessionExpiryInterval;
    }

    public void setSessionExpiryInterval(Long l) {
        this.sessionExpiryInterval = l;
    }

    public Integer getReceiveMaximum() {
        return this.receiveMaximum;
    }

    public void setReceiveMaximum(Integer num) {
        if (num != null && (num.intValue() == 0 || num.intValue() > 65535)) {
            throw new IllegalArgumentException();
        }
        this.receiveMaximum = num;
    }

    public Long getMaximumPacketSize() {
        return this.maximumPacketSize;
    }

    public void setMaximumPacketSize(Long l) {
        this.maximumPacketSize = l;
    }

    public Integer getTopicAliasMaximum() {
        return this.topicAliasMaximum;
    }

    public void setTopicAliasMaximum(Integer num) {
        if (num != null && num.intValue() > 65535) {
            throw new IllegalArgumentException();
        }
        this.topicAliasMaximum = num;
    }

    public Boolean getRequestResponseInfo() {
        return this.requestResponseInfo;
    }

    public void setRequestResponseInfo(boolean z) {
        this.requestResponseInfo = Boolean.valueOf(z);
    }

    public Boolean getRequestProblemInfo() {
        return this.requestProblemInfo;
    }

    public void setRequestProblemInfo(boolean z) {
        this.requestProblemInfo = Boolean.valueOf(z);
    }

    public List<UserProperty> getUserProperties() {
        return this.userProperties;
    }

    public void setUserProperties(List<UserProperty> list) {
        this.userProperties = list;
    }

    public String getAuthMethod() {
        return this.authMethod;
    }

    public void setAuthMethod(String str) {
        this.authMethod = str;
    }

    public byte[] getAuthData() {
        return this.authData;
    }

    public void setAuthData(byte[] bArr) {
        this.authData = bArr;
    }

    public SocketFactory getSocketFactory() {
        return this.socketFactory;
    }

    public void setSocketFactory(SocketFactory socketFactory) {
        this.socketFactory = socketFactory;
    }

    public Properties getSSLProperties() {
        return this.sslClientProps;
    }

    public void setSSLProperties(Properties properties) {
        this.sslClientProps = properties;
    }

    public HostnameVerifier getSSLHostnameVerifier() {
        return this.sslHostnameVerifier;
    }

    public void setSSLHostnameVerifier(HostnameVerifier hostnameVerifier) {
        this.sslHostnameVerifier = hostnameVerifier;
    }

    public boolean useSubscriptionIdentifiers() {
        return this.useSubscriptionIdentifiers;
    }

    public void setUseSubscriptionIdentifiers(boolean z) {
        this.useSubscriptionIdentifiers = z;
    }

    public boolean isHttpsHostnameVerificationEnabled() {
        return this.httpsHostnameVerificationEnabled;
    }

    public void setHttpsHostnameVerificationEnabled(boolean z) {
        this.httpsHostnameVerificationEnabled = z;
    }

    public Properties getDebug() {
        Properties properties = new Properties();
        properties.put("MqttVersion", Integer.valueOf(getMqttVersion()));
        properties.put("CleanStart", Boolean.valueOf(isCleanStart()));
        properties.put("ConTimeout", Integer.valueOf(getConnectionTimeout()));
        properties.put("KeepAliveInterval", Integer.valueOf(getKeepAliveInterval()));
        properties.put("UserName", getUserName() == null ? "null" : getUserName());
        properties.put("WillDestination", getWillDestination() == null ? "null" : getWillDestination());
        if (getSocketFactory() == null) {
            properties.put("SocketFactory", "null");
        } else {
            properties.put("SocketFactory", getSocketFactory());
        }
        if (getSSLProperties() == null) {
            properties.put("SSLProperties", "null");
        } else {
            properties.put("SSLProperties", getSSLProperties());
        }
        return properties;
    }

    public void setCustomWebSocketHeaders(Map<String, String> map) {
        this.customWebSocketHeaders = Collections.unmodifiableMap(map);
    }

    public Map<String, String> getCustomWebSocketHeaders() {
        return this.customWebSocketHeaders;
    }

    public String toString() {
        return Debug.dumpProperties(getDebug(), "Connection options");
    }

    public boolean isSendReasonMessages() {
        return this.sendReasonMessages;
    }

    public void setSendReasonMessages(boolean z) {
        this.sendReasonMessages = z;
    }

    public int getExecutorServiceTimeout() {
        return this.executorServiceTimeout;
    }

    public void setExecutorServiceTimeout(int i) {
        this.executorServiceTimeout = i;
    }
}
