Beispiel #1
0
 private void OnApplicationMessageReceived(MqttApplicationMessageReceivedEventArgs e)
 {
     _mqttService.Publish(new MqttPublishParameters
     {
         Topic   = e.ApplicationMessage.Topic,
         Payload = e.ApplicationMessage.Payload,
         QualityOfServiceLevel = e.ApplicationMessage.QualityOfServiceLevel,
         Retain = e.ApplicationMessage.Retain
     });
 }
Beispiel #2
0
        public void publish(PythonDictionary parameters)
        {
            if (parameters == null) throw new ArgumentNullException(nameof(parameters));

            var topic = Convert.ToString(parameters.get("topic"));
            var payload = parameters.get("payload", new byte[0]);
            var qos = Convert.ToInt32(parameters.get("qos", 0));
            var retain = Convert.ToBoolean(parameters.get("retain", false));

            _mqttService.Publish(new MqttPublishParameters
            {
                Topic = topic,
                Payload = ConvertPayload(payload),
                QualityOfServiceLevel = (MqttQualityOfServiceLevel)qos,
                Retain = retain
            });
        }