Пример #1
0
        private void HandleMessage(MqttApplicationMessageReceivedEventArgs eventArgs)
        {
            _commandAdapter.MessageReceive(eventArgs);

            var contract = new MqttValueContract
            {
                Payload                                 = eventArgs.ApplicationMessage.Payload != null?Encoding.UTF8.GetString(eventArgs.ApplicationMessage.Payload) : null,
                                              Topic     = eventArgs.ApplicationMessage.Topic,
                                              TimeStamp = DateTime.Now
            };

            _mqttMessageCacheProvider.StoreIncomingMessage(contract);
            _valueProvider.SetValue(contract);
        }
Пример #2
0
 public void SetValue(string topic, MqttValueContract value)
 {
     _values[topic] = value;
 }
Пример #3
0
 public void SetValue(MqttValueContract value)
 {
     _values[value.Topic] = value;
 }