public void Reset(int time, string t, DataTable dataTable, string qosName, bool retain) { timeInterval = time; topic = t; dataTableMessage = dataTable; mqttClient = MqttClient.Instance(); qoS = StaticResources.NameToQos(qosName); retained = retain; thread = new System.Threading.Thread(AutoPublish); thread.IsBackground = true; }
public bool SetWill(string topic, string message, string qos, bool retained) { if (mqtt == null || mqtt.IsConnected == false) { withWill = true; willTopic = topic; willMessage = message; willQos = StaticResources.NameToQos(qos); willRetained = retained; return(true); } return(false); }
public void Publish(string topic, string message, string name, bool retained) { Publish(topic, message, StaticResources.NameToQos(name), retained); }
public void Subscribe(string topic, string name) { StaticResources.messageQueue.Enqueue("时间:" + DateTime.Now.ToString() + "订阅信息,信息ID为:" + mqtt.Subscribe(topic, StaticResources.NameToQos(name))); }