public static SensorDataContainer ExportSensorData(SensorData data) {
      SensorDataContainer sdc = null;
      try {
           sdc = new SensorDataContainer() { Sensor = data };
      } catch (Exception) {
           throw;
      }
      return(sdc);
 }
 public void PutSensorData(string nodeId, string power, string motion) {
      int nodeId0;
      if (int.TryParse(nodeId, out nodeId0)) {
           SensorData sd;
           float power0;
           bool motion0;
           if (!this._sensors.ContainsKey(nodeId0) || this._sensors[nodeId0] == null) {
                this._sensors[nodeId0] = new SensorDataSet();
           }
           if (!float.TryParse(power, out power0)) {
                power0 = 0;
           }
           if (!bool.TryParse(motion, out motion0)) {
                motion0 = false;
           }
           sd = new SensorData() { NodeId = nodeId0, PowerLevel = power0, HasMotion = motion0, TimeStamp = DateTime.Now };
           DataAccess.SensorDataAccess.SaveSensorData(sd);
           //this._sensors[nodeId0].Add(sd);
      }
 }
 public SensorDataContainer GetSensorData(string nodeId) {
      int nodeId0;
      if (int.TryParse(nodeId, out nodeId0)) {
           SensorData sd = DataAccess.SensorDataAccess.GetLatestNode(nodeId0);
           if (sd == null) {
                sd = new SensorData() { PowerLevel = 0 };
           } else {
                sd.PowerLevel = sd.PowerLevel / 100;
           }
           return SensorData.ExportSensorData(sd);
      }
      return null;
 }