Ejemplo n.º 1
0
        public IList <MetricValue> Read()
        {
            if (l_metricCollection.Count <= 0)
            {
                return(null);
            }
            List <MetricValue> metricList = new List <MetricValue>();

            while (l_metricCollection.Count > 0)
            {
                OpcMetric data = null;
                try
                {
                    data = l_metricCollection.Take();
                }
                catch (InvalidOperationException) { }

                if (data != null)
                {
                    MetricValue metricValue = new MetricValue()
                    {
                        TypeName         = "gauge",
                        TypeInstanceName = "gauge",
                        //Interval = data.Measurement.mo
                        HostName           = "localhost",
                        PluginInstanceName = "OpcUaPluginInstance",
                        PluginName         = "OpcUaPlugin",
                        Extension          = data.JsonString()
                    };
                    metricList.Add(metricValue);
                }
            }
            l_logger.DebugFormat("Read {0} items.", metricList.Count);
            return(metricList);
        }