Esempio n. 1
0
 public MqttParcel(string topic, MqttPayload payload, QoS qos, bool retained )
 {
   this.topic = topic;
   this.payload = payload;
   this.qos = qos;
   this.retained = retained;
 }
 /// <summary>
 /// Constructs a ExtendedAckArrivedArgs object
 /// </summary>
 /// <param name="messageID">Message id</param>
 /// <param name="commondID">Message type id</param>
 /// <param name="status">Message commond status</param>
 /// <param name="payload">Message data</param>
 public ExtendedAckArrivedArgs(ulong messageID, int commondID, int status, MqttPayload payload)
 {
     _messageID = messageID;
     _commondID = commondID;
     _status = status;
     _payload = payload;
 }
Esempio n. 3
0
 public MqttParcel(string topic, MqttPayload payload, QoS qos, bool retained)
 {
     this.topic    = topic;
     this.payload  = payload;
     this.qos      = qos;
     this.retained = retained;
 }
Esempio n. 4
0
 public MqttParcel(string topic, byte[] payload, QoS qos, bool retained)
 {
     this.topic    = topic;
     this.payload  = new MqttPayload(payload, 0);
     this.qos      = qos;
     this.retained = retained;
 }
Esempio n. 5
0
 public MqttParcel(string topic, byte[] payload, QoS qos, bool retained)
 {
   this.topic = topic;
   this.payload = new MqttPayload(payload,0);
   this.qos = qos;
   this.retained = retained;
 }
Esempio n. 6
0
 /// <summary>
 /// Constructs a PublishArrivedArgs object
 /// </summary>
 /// <param name="topic">Source of message</param>
 /// <param name="payload">Message body</param>
 /// <param name="retained">Whether or not the message is retained</param>
 public PublishArrivedArgs(string topic, MqttPayload payload, bool retained, QoS qos)
 {
     _topic    = topic;
     _payload  = payload;
     _retained = retained;
     _qos      = qos;
 }
Esempio n. 7
0
 /// <summary>
 /// Constructs a ExtendedAckArrivedArgs object
 /// </summary>
 /// <param name="messageID">Message id</param>
 /// <param name="commondID">Message type id</param>
 /// <param name="status">Message commond status</param>
 /// <param name="payload">Message data</param>
 public ExtendedAckArrivedArgs(ulong messageID, int commondID, int status, MqttPayload payload)
 {
     _messageID = messageID;
     _commondID = commondID;
     _status    = status;
     _payload   = payload;
 }
Esempio n. 8
0
 /// <summary>
 /// Constructs a PublishArrivedArgs object
 /// </summary>
 /// <param name="topic">Source of message</param>
 /// <param name="payload">Message body</param>
 /// <param name="retained">Whether or not the message is retained</param>
 public PublishArrivedArgs(string topic, MqttPayload payload, bool retained, QoS qos)
 {
   _topic = topic;
   _payload = payload;
   _retained = retained;
   _qos = qos;
 }
Esempio n. 9
0
 public int Publish(string topic, MqttPayload payload, QoS qos, bool retained)
 {
     if (manager.IsConnected)
     {
         ushort messID = MessageID;
         manager.SendMessage(new MqttPublishMessage(messID, topic, payload.TrimmedBuffer, qos, retained));
         return(messID);
     }
     else
     {
         throw new MqttNotConnectedException("You need to connect to a broker before trying to Publish");
     }
 }
Esempio n. 10
0
        public ulong Publish2(string topic, MqttPayload payload, QoS qos, int ttl, string apn_json)
        {
            if (manager.IsConnected)
            {
                ulong messID = MessageID;

                manager.SendMessage(new MqttExtendedackMessage(messID, topic, payload.TrimmedBuffer, qos, ttl, apn_json));
                return(messID);
            }
            else
            {
                throw new MqttNotConnectedException("You need to connect to a broker before trying to Publish");
            }
        }
Esempio n. 11
0
 public int Publish(string topic, MqttPayload payload, QoS qos, bool retained)
 {
     if (manager.IsConnected)
     {
         // Reset the PINGREQ timer as this publish will reset the server's counter
         if (keepAliveTimer != null)
         {
             int kmillis = 1000 * _keepAlive;
             keepAliveTimer.Change(kmillis, kmillis);
         }
         ushort messID = MessageID;
         manager.SendMessage(new MqttPublishMessage(messID, topic, payload.TrimmedBuffer, qos, retained));
         return(messID);
     }
     else
     {
         throw new MqttNotConnectedException("You need to connect to a broker before trying to Publish");
     }
 }
Esempio n. 12
0
 public ulong Publish(string topic, MqttPayload payload, QoS qos, bool retained)
 {
     if (manager.IsConnected)
     {
         ulong messID = MessageID;
         manager.SendMessage(new MqttPublishMessage(messID, topic, payload.TrimmedBuffer, qos, retained));
         // Reset the PINGREQ timer after the message is sent
         // as this publish will reset the server's counter.
         // But don't reset it before you successfully send this msgs
         if (keepAliveTimer != null)
         {
             int kmillis = 1000 * _keepAlive;
             keepAliveTimer.Change(kmillis, kmillis);
         }
         return(messID);
     }
     else
     {
         throw new MqttNotConnectedException("You need to connect to a broker before trying to Publish");
     }
 }
Esempio n. 13
0
 public ulong Publish2Alias(string alias, MqttPayload payload, QoS qos, int ttl, string apn_json)
 {
     return Publish2(",yta/" + alias, payload, qos, ttl, apn_json);
 }
Esempio n. 14
0
 public void Connect(string willTopic, QoS willQoS, MqttPayload willMsg, bool willRetain, bool cleanStart)
 {
     DoConnect(new MqttConnectMessage(
                   _clientID, _username, _password, _keepAlive, willTopic, willMsg.TrimmedBuffer, willQoS, willRetain, cleanStart
                   ));
 }
Esempio n. 15
0
 public int Publish(string topic, MqttPayload payload, QoS qos, bool retained)
 {
     if (manager.IsConnected)
     {
         ushort messID = MessageID;
         manager.SendMessage(new MqttPublishMessage(messID, topic, payload.TrimmedBuffer, qos, retained));
         return messID;
     }
     else
     {
         throw new MqttNotConnectedException("You need to connect to a broker before trying to Publish");
     }
 }
Esempio n. 16
0
 public void Connect(string username, string password,string willTopic, QoS willQoS, MqttPayload willMsg, bool willRetain, bool cleanStart)
 {
     DoConnect(new MqttConnectMessage(
       _clientID, _keepAlive,username,password, willTopic, willMsg.TrimmedBuffer, willQoS, willRetain, cleanStart
     ));
 }
Esempio n. 17
0
 public void Connect(string willTopic, QoS willQoS, MqttPayload willMsg, bool willRetain)
 {
     DoConnect(new MqttConnectMessage(
     _clientID, _keepAlive, willTopic, willMsg.TrimmedBuffer, willQoS, willRetain, false
       ));
 }
Esempio n. 18
0
 public void Connect(string username, string password, string willTopic, QoS willQoS, MqttPayload willMsg, bool willRetain)
 {
     DoConnect(new MqttConnectMessage(
                   _clientID, _keepAlive, username, password, willTopic, willMsg.TrimmedBuffer, willQoS, willRetain, false
                   ));
 }
Esempio n. 19
0
        public ulong PublishWithToken(string topic, string token, MqttPayload payload, QoS qos, bool retained)
        {
            string topicWithToken = ",yam" + token + "_" + topic;

            return(Publish(topicWithToken, payload, qos, retained));
        }
Esempio n. 20
0
        public ulong PublishToAliasWithToken(string alias, string token, MqttPayload payload, QoS qos, bool retained)
        {
            string AliasWithToken = ",yam" + token + "_" + ",yta/" + alias;

            return(Publish(AliasWithToken, payload, qos, retained));
        }
Esempio n. 21
0
 public ulong Publish2Alias(string alias, MqttPayload payload, QoS qos, int ttl, string apn_json)
 {
     return(Publish2(",yta/" + alias, payload, qos, ttl, apn_json));
 }
Esempio n. 22
0
 public ulong PublishToAlias(string alias, MqttPayload payload, QoS qos, bool retained)
 {
     return(Publish(",yta/" + alias, payload, qos, retained));
 }
Esempio n. 23
0
        public ulong Publish2WithToken(string topic, string token, MqttPayload payload, QoS qos, int ttl, string apn_json)
        {
            string topicWithToken = ",yam" + token + "_" + topic;

            return(Publish2(topicWithToken, payload, qos, ttl, apn_json));
        }
Esempio n. 24
0
 public ulong PublishToAlias(string alias, MqttPayload payload, QoS qos, bool retained)
 {
     return Publish(",yta/" + alias, payload, qos, retained);
 }
Esempio n. 25
0
        public ulong Publish2ToAliasWithToken(string alias, string token, MqttPayload payload, QoS qos, int ttl, string apn_json)
        {
            string AliasWithToken = ",yam" + token + "_" + ",yta/" + alias;

            return(Publish2(AliasWithToken, payload, qos, ttl, apn_json));
        }
Esempio n. 26
0
        public ulong Publish2(string topic, MqttPayload payload, QoS qos, int ttl, string apn_json)
        {
            if (manager.IsConnected)
            {
                ulong messID = MessageID;

                manager.SendMessage(new MqttExtendedackMessage(messID, topic, payload.TrimmedBuffer, qos, ttl, apn_json));
                return messID;
            }
            else
            {
                throw new MqttNotConnectedException("You need to connect to a broker before trying to Publish");
            }
        }
Esempio n. 27
0
 public ulong Publish(string topic, MqttPayload payload, QoS qos, bool retained)
 {
     if (manager.IsConnected)
     {
         // Reset the PINGREQ timer as this publish will reset the server's counter
         if (keepAliveTimer != null)
         {
             int kmillis = 1000 * _keepAlive;
             keepAliveTimer.Change(kmillis, kmillis);
         }
         ulong messID = MessageID;
         manager.SendMessage(new MqttPublishMessage(messID, topic, payload.TrimmedBuffer, qos, retained));
         return messID;
     }
     else
     {
         throw new MqttNotConnectedException("You need to connect to a broker before trying to Publish");
     }
 }