| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | |
|
| | 4 | | namespace ReFlex.Core.Calibration.Util |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Represents the result of a calibration process. |
| | 8 | | /// The Mapping from the realworld values to the display values. |
| | 9 | | /// </summary> |
| | 10 | | public struct Calibration |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Gets or sets the source values. |
| | 14 | | /// </summary> |
| | 15 | | /// <value> |
| | 16 | | /// The source values. |
| | 17 | | /// </value> |
| 0 | 18 | | public List<int[]> SourceValues { get; set; } |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Gets or sets the target values. |
| | 22 | | /// </summary> |
| | 23 | | /// <value> |
| | 24 | | /// The target values. |
| | 25 | | /// </value> |
| 0 | 26 | | public List<int[]> TargetValues { get; set; } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Gets or sets the upper threshold. |
| | 30 | | /// </summary> |
| | 31 | | /// <value> |
| | 32 | | /// The upper threshold. |
| | 33 | | /// </value> |
| 0 | 34 | | public int UpperThreshold { get; set; } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Gets or sets the lower threshold. |
| | 38 | | /// </summary> |
| | 39 | | /// <value> |
| | 40 | | /// The lower threshold. |
| | 41 | | /// </value> |
| 0 | 42 | | public int LowerThreshold { get; set; } |
| | 43 | |
|
| | 44 | | /// <summary> |
| | 45 | | /// Stores the time of the last Update (for update performance / usability reasons |
| | 46 | | /// </summary> |
| 0 | 47 | | public List<DateTime> LastUpdated { get; set; } |
| | 48 | |
|
| | 49 | | public string GetCalibrationValuesString() |
| 0 | 50 | | { |
| 0 | 51 | | var result = $"===== {nameof(Calibration)} ====={Environment.NewLine}"; |
| 0 | 52 | | result += $" {nameof(LowerThreshold)}: {LowerThreshold} | "; |
| 0 | 53 | | result += $" {nameof(UpperThreshold)}: {UpperThreshold}{Environment.NewLine}"; |
| | 54 | |
|
| 0 | 55 | | result += $" {nameof(SourceValues)}: {Environment.NewLine}"; |
| | 56 | |
|
| 0 | 57 | | SourceValues.ForEach(val => |
| 0 | 58 | | { |
| 0 | 59 | | result += " ["; |
| 0 | 60 | | Array.ForEach(val, current => result += $" {current} |"); |
| 0 | 61 | | result = result.TrimEnd('|'); |
| 0 | 62 | | result += $"]{Environment.NewLine}"; |
| 0 | 63 | | }); |
| | 64 | |
|
| 0 | 65 | | result += $" {nameof(TargetValues)}: {Environment.NewLine}"; |
| | 66 | |
|
| 0 | 67 | | TargetValues.ForEach(val => |
| 0 | 68 | | { |
| 0 | 69 | | result += " ["; |
| 0 | 70 | | Array.ForEach(val, current => result += $" {current} |"); |
| 0 | 71 | | result = result.TrimEnd('|'); |
| 0 | 72 | | result += $"]{Environment.NewLine}"; |
| 0 | 73 | | }); |
| | 74 | |
|
| 0 | 75 | | result += $" {nameof(LastUpdated)}: [ "; |
| | 76 | |
|
| 0 | 77 | | LastUpdated.ForEach(val => |
| 0 | 78 | | { |
| 0 | 79 | | result += $" {val} |"; |
| 0 | 80 | | result = result.TrimEnd('|'); |
| 0 | 81 | | }); |
| | 82 | |
|
| 0 | 83 | | result += $" ]{Environment.NewLine}"; |
| | 84 | |
|
| 0 | 85 | | return result; |
| 0 | 86 | | } |
| | 87 | | } |
| | 88 | | } |