예제 #1
0
        // Timer tick event
        private void Tmr_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            // store gps location first time around
            if (!_gpsInitialDataStored && GpsEnabled)
            {
                string[] tmp = _gps.ProduceData();
                _data.InsertData(tmp[0], tmp[1], tmp[2]);
                _gpsInitialDataStored = true;
            }

            // store data from VOC
            string[] voc = _aqs.ProduceVOCData();
            string[] co2 = _aqs.ProduceCO2Data();
            _data.InsertData(voc[0], voc[1], voc[2]);
            _data.InsertData(co2[0], co2[1], co2[2]);

            // store data from all sensors
            foreach (VintHub vintHub in _savedVintHubs)
            {
                foreach (PhidgetSensor sensor in vintHub.AllSensors)
                {
                    if (sensor.SensorType != "None")
                    {
                        if (sensor.SensorType == "Humidity/Air Temperature")
                        {
                            MyHumidityAirTemperatureSensor humiditySensor = (MyHumidityAirTemperatureSensor)sensor;
                            string[] humidity = humiditySensor.ProduceHumidityData();
                            string[] temp     = humiditySensor.ProduceAirTemperatureData();

                            _data.InsertData(humidity[0], humidity[1], humidity[2]);
                            _data.InsertData(temp[0], temp[1], temp[2]);
                        }
                        else
                        {
                            string[] tmp = sensor.ProduceData();
                            _data.InsertData(tmp[0], tmp[1], tmp[2]);
                        }
                    }
                }
            }
        }