public void MqttReceivedData(object sender, MQQTDataReceivedEventArgs e)
        {
            if ((NewReading != null) && (e.newData.Location == Location))
            {
                NewReading(this,
                    new Reading
                    {
                        Location = e.newData.Location,
                        PublicName = this.PublicName,
                        SensorType = e.newData.SensorType,
                        Value = e.newData.Value
                    });

                foreach (var sensor in Sensors.Values)
                {
                    if (e.newData.SensorType == sensor.Type)
                    {
                        sensor.MqttReceivedData(sender, e);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void MqttReceivedData(object sender, MQQTDataReceivedEventArgs e)
        {
            //the offline info arrives at Location as for now for a location we may have several sensors
            //we put them all offline no matter the type
            if (e.newData.Offline)
            {
                ReceivedOffline(e.newData);
                return;
            }

            if (e.newData.SensorType == Type)
            {
                NewDataReceived(e.newData);
                Update(e.newData);
            }
        }