public static DataTable fillData(DataTable filltable, Sensor[] sensObj) { int count = 0; foreach (Sensor element in sensObj) { DataRow row = filltable.NewRow(); row["sensorID"] = sensObj[count].GetSensId; row["timeStamp"] = DateTime.Now.ToString("HH:mm:sss", new System.Globalization.CultureInfo("en-GB")); row["sensorType"] = sensObj[count].getSensType(); row["sensorValue"] = sensObj[count].GetValue(); filltable.Rows.Add(row); count++; } return filltable; }
public static Sensor[] createSensors() { Sensor[] senObj = new Sensor[nSen]; if (nAna != 0 && nDig != 0) { for (int i = 0; i < nAna; i++) { senObj[i] = new anaSensor(); } for (int j = nAna; j < nAna + nDig; j++) { senObj[j] = new digSensor(); } } return senObj; }