Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 public void Publish(string topic, string message, string name, bool retained)
 {
     Publish(topic, message, StaticResources.NameToQos(name), retained);
 }
Ejemplo n.º 4
0
 public void Subscribe(string topic, string name)
 {
     StaticResources.messageQueue.Enqueue("时间:" + DateTime.Now.ToString() +
                                          "订阅信息,信息ID为:" +
                                          mqtt.Subscribe(topic, StaticResources.NameToQos(name)));
 }