1234567891011121314151617181920212223242526272829303132 |
- using ProGauge_StartItaliana_Probe.MessageEntity.Outgoing;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ProGauge_StartItaliana_Probe.MessageEntity.Incoming
- {
- public class TemperatureResponse
- {
- /// <summary>
- /// The first number is always 0.
- /// Then you have temperature in 10th of degree starting from the bottom side
- /// position in the probe up to the top. Each temperature is signed number
- /// in case the temperature is negative.
- /// </summary>
- public IReadOnlyList<double> Values { get; private set; }
- /// <summary>
- ///
- /// </summary>
- /// <param name="raw">Each number is referred to a temperature sensor inside the probe.</param>
- public static TemperatureResponse Parse(byte[] raw)
- {
- var response = new TemperatureResponse();
- var msg = Encoding.ASCII.GetString(raw);
- var parts = msg.Split(' ');
- response.Values = parts.Select(p => double.Parse(p)).ToList();
- return response;
- }
- }
- }
|