public void publish(MqttMessage message) { client.Publish(message.Topic, message.Message, message.QosLevel, message.Retain); }
public MessPublishEventArgs(MqttMessage message, bool dupFlag) { this.Message = message; this.DupFlag = dupFlag; }
private void Client_MqttMsgPublishReceived(object sender, uPLibrary.Networking.M2Mqtt.Messages.MqttMsgPublishEventArgs e) { MqttMessage m = new MqttMessage(e.Topic, e.Message, e.QosLevel, e.Retain); var t = new MqttTopic(e.Topic, e.QosLevel, true); AddTopic(t); if (OnMessageArrived != null) OnMessageArrived(this, new MessPublishEventArgs(m, e.DupFlag)); }
public void SendMessages(object state) { Console.WriteLine("send commande"); SanSensNetProtocol a = new SanSensNetProtocol(); byte[] buff = a.Encode_SendCommand(7, 54, 215); string publishtopic = ConfigurationManager.AppSettings["publishCommands_topic"]; MqttMessage mess = new MqttMessage(publishtopic, buff, 1, false); mqtt.publish(mess); }