Exemple #1
0
        static void dumpSensor(YSensor sensor)
        {
            string fmt = "dd MMM yyyy hh:mm:ss,fff";

            Console.WriteLine("Using DataLogger of " + sensor.get_friendlyName());
            YDataSet dataset = sensor.get_recordedData(0, 0);

            Console.WriteLine("loading summary... ");
            dataset.loadMore();
            YMeasure summary = dataset.get_summary();
            String   line    =
                String.Format("from {0} to {1} : min={2:0.00}{5} avg={3:0.00}{5}  max={4:0.00}{5}",
                              summary.get_startTimeUTC_asDateTime().ToString(fmt),
                              summary.get_endTimeUTC_asDateTime().ToString(fmt), summary.get_minValue(),
                              summary.get_averageValue(), summary.get_maxValue(), sensor.get_unit());

            Console.WriteLine(line);
            Console.Write("loading details :   0%");
            int progress = 0;

            do
            {
                progress = dataset.loadMore();
                Console.Write(String.Format("\b\b\b\b{0,3:##0}%", progress));
            } while(progress < 100);
            Console.WriteLine("");
            List <YMeasure> details = dataset.get_measures();

            foreach (YMeasure m in details)
            {
                Console.WriteLine(
                    String.Format("from {0} to {1} : min={2:0.00}{5} avg={3:0.00}{5}  max={4:0.00}{5}",
                                  m.get_startTimeUTC_asDateTime().ToString(fmt),
                                  m.get_endTimeUTC_asDateTime().ToString(fmt), m.get_minValue(), m.get_averageValue(),
                                  m.get_maxValue(), sensor.get_unit()));
            }
        }
        private List <YMeasure> LoadQT(string hwid)
        {
            YQt      qt       = YQt.FindQt(hwid);
            YDataSet dataset  = qt.get_recordedData(0, 0);
            int      progress = 0;

            do
            {
                progress = dataset.loadMore();
            } while(progress < 100);


            Console.WriteLine("Using DataLogger of " + qt.get_friendlyName());
            YMeasure        summary = dataset.get_summary();
            List <YMeasure> res_bad = dataset.get_measures();
            List <YMeasure> res     = new List <YMeasure>();

            foreach (YMeasure m in res_bad)
            {
                if (m.get_startTimeUTC() > 100)
                {
                    res.Add(m);
                }
            }


            String line = String.Format("from {0} to {1} : min={2:0.00} avg={3:0.00}  max={4:0.00}",
                                        summary.get_startTimeUTC_asDateTime().ToString(fmt), summary.get_endTimeUTC_asDateTime().ToString(fmt), summary.get_minValue(), summary.get_averageValue(), summary.get_maxValue()
                                        );

            Console.WriteLine(line);
            return(res);
        }