public Message(PublishArrivedArgs e) { datetime = DateTime.Now; topic = e.Topic; payload = e.Payload.ToString(); name = StaticResources.QosToName(e.QualityOfService); retained = e.Retained ? "是" : "否"; }
private void SetCombobox() { foreach (string name in StaticResources.GetNameEnumerable()) { comboBoxWillQos.Items.Add(name); } comboBoxWillQos.SelectedIndex = 0; this.Focus(); }
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 override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("任务名:" + TaskName + "\r\n"); stringBuilder.Append("运行状态:" + (state ? "运行中" : "停止") + "\r\n"); stringBuilder.Append("推送主题:" + topic + "\r\n"); stringBuilder.Append("服务质量:" + StaticResources.QosToName(qoS)); stringBuilder.Append("是否保留:" + (retained ? "是" : "否") + "\r\n"); return(stringBuilder.ToString()); }
private void InitComboBox() { comboBoxValueType.Items.Add(typeof(string)); comboBoxValueType.Items.Add(typeof(int)); comboBoxValueType.Items.Add(typeof(float)); comboBoxValueType.SelectedIndex = 0; foreach (string name in StaticResources.GetNameEnumerable()) { comboBoxPubQos.Items.Add(name); } comboBoxPubQos.SelectedIndex = 0; this.Focus(); }
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))); }