1 package net.anyflow.lannister.message; 2 3 import io.netty.handler.codec.mqtt.MqttVersion; 4 5 public class ConnectOptions { 6 private MqttVersion version; 7 private String clientId; 8 private String userName; 9 private String password; 10 private boolean cleanSession; 11 private Message will; 12 private int keepAliveTimeSeconds; 13 14 public ConnectOptions() { 15 this.version = MqttVersion.MQTT_3_1_1; 16 this.clientId = null; 17 this.cleanSession = true; 18 this.will = null; 19 this.userName = null; 20 this.password = null; 21 this.keepAliveTimeSeconds = 120; 22 } 23 24 public ConnectOptions(MqttVersion version, String clientId, boolean cleanSession, Message will, String userName, 25 String password, int keepAliveTimeSeconds) { 26 this.version = version; 27 this.clientId = clientId; 28 this.cleanSession = cleanSession; 29 this.will = will; 30 this.userName = userName; 31 this.password = password; 32 this.keepAliveTimeSeconds = keepAliveTimeSeconds; 33 } 34 35 public MqttVersion version() { 36 return version; 37 } 38 39 public void version(MqttVersion version) { 40 this.version = version; 41 } 42 43 public String clientId() { 44 return clientId; 45 } 46 47 public void clientId(String clientId) { 48 this.clientId = clientId; 49 } 50 51 public String userName() { 52 return userName; 53 } 54 55 public void userName(String userName) { 56 this.userName = userName; 57 } 58 59 public String password() { 60 return password; 61 } 62 63 public void password(String password) { 64 this.password = password; 65 } 66 67 public boolean cleanSession() { 68 return cleanSession; 69 } 70 71 public void cleanSession(boolean cleanSession) { 72 this.cleanSession = cleanSession; 73 } 74 75 public Message will() { 76 return will; 77 } 78 79 public void will(Message will) { 80 this.will = will; 81 } 82 83 public int keepAliveTimeSeconds() { 84 return keepAliveTimeSeconds; 85 } 86 87 public void keepAliveTimeSeconds(int keepAliveTimeSeconds) { 88 this.keepAliveTimeSeconds = keepAliveTimeSeconds; 89 } 90 }