Exemple #1
0
 public List<Tuple<SensorTypes, double>> GetCurrentDataFromPool(IClientMessenger clientMessenger)
 {
     // Send request to server
     var request = new GetPoolDataRequestMsg(_session.UserName, _session.TokenString, false, _session.SelectedPool.Item1);
     var response = (GetPoolDataResponseMsg) clientMessenger.SendMessage(request);
     return response.SensorList.Select(sensor => new Tuple<SensorTypes, double>(sensor.Item1, sensor.Item2.LastOrDefault())).ToList();
 }
Exemple #2
0
 public List<Tuple<SensorTypes, List<double>>> GetHistoricDataFromPool(IClientMessenger clientMessenger, int numberOfDays)
 {
     // Send request to server
     var request = new GetPoolDataRequestMsg(_session.UserName, _session.TokenString, false, _session.SelectedPool.Item1, numberOfDays);
     var response = (GetPoolDataResponseMsg)clientMessenger.SendMessage(request);
     return response.SensorList;
 }
Exemple #3
0
        public void ReloadPools(IClientMessenger clientMessenger)
        {
            // Send request to server
            var poolRequest = new GetPoolDataRequestMsg(_session.UserName, _session.TokenString, true);
            var response = (GetPoolDataResponseMsg) clientMessenger.SendMessage(poolRequest);

            // Store pools in session
            _session.Pools = response.AllPoolNamesListTuple;
        }
		private Message ResponseForGetPoolDataRequest(GetPoolDataRequestMsg message)
		{
			if (message.GetAllNamesOnly)
			{
				// Generate pools
				var pools = new List<Tuple<string, bool>> ();
				pools.Add(new Tuple<string, bool>("Min sjove pool", false));
				pools.Add(new Tuple<string, bool>("Lasses pool", false));
				pools.Add(new Tuple<string, bool>("Min slemme pool", false));

				return new GetPoolDataResponseMsg (null, pools);
			}
			else
			{
				// Generate readings
				var readings = new List<Tuple<SensorTypes, List<double>>>();
				readings.Add(new Tuple<SensorTypes, List<double>>(SensorTypes.Temperature, new List<double>(){30.7, 31.5, 32.2, 35.2, 35.2, 32.1, 32.0, 30.1, 30.0, 32.1, 32.5, 34.2, 33.2, 36.0, 35.0}));
				readings.Add(new Tuple<SensorTypes, List<double>>(SensorTypes.Humidity, new List<double>(){51, 50, 55, 65, 72, 70, 74, 72, 68, 66, 58, 54, 56, 52, 56}));
				readings.Add(new Tuple<SensorTypes, List<double>>(SensorTypes.Ph, new List<double>(){7.1, 7.0, 7.2, 7.5, 7.3, 7.2, 7.1, 7.0, 7.2, 7.1, 7.0, 6.4, 6.8, 7.0, 7.2}));
				readings.Add(new Tuple<SensorTypes, List<double>>(SensorTypes.Chlorine, new List<double>(){1.8, 1.7, 1.8, 1.6, 1.4, 1.8, 1.8, 1.7, 1.8, 2.2, 1.9, 1.8, 2.2, 1.9, 1.8 }));

				return new GetPoolDataResponseMsg(readings, null);
			}
		}