package com.example.bpa.modbus4j;

/**
 * Modebus 链接参数
 */
public class ModbusParam {
    public String host;
    public int port = 502;
    public boolean encapsulated;
    public int timeout = 500;
    public int retries = 2;
    public boolean keepAlive = true;
    public boolean connected = false;

    public ModbusParam() {
    }

    public ModbusParam setHost(String host) {
        this.host = host;
        return this;
    }

    public ModbusParam setPort(int port) {
        this.port = port;
        return this;
    }

    public ModbusParam setEncapsulated(boolean encapsulated) {
        this.encapsulated = encapsulated;
        return this;
    }

    public ModbusParam setTimeout(int timeout) {
        this.timeout = timeout;
        return this;
    }

    public ModbusParam setRetries(int retries) {
        this.retries = retries;
        return this;
    }

    public ModbusParam setConnected(boolean connected) {
        this.connected = connected;
        return this;
    }

    public ModbusParam setKeepAlive(boolean keepAlive) {
        this.keepAlive = keepAlive;
        return this;
    }
}
