blob: 691ff47bb447d060b0931297964bc1fd9b55e2fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Serialization;
using Tango.PMR.ColorLab;
namespace Tango.BL.Entities
{
public partial class Cat : CatBase
{
/// <summary>
/// Parses the protobuf calibration data structure from the binary CAT data.
/// </summary>
/// <returns></returns>
public CalibrationData GetCalibrationData()
{
return CalibrationData.Parser.ParseFrom(Data);
}
/// <summary>
/// Formats and sets the CAT <see cref="CatBase.Data"/> property.
/// </summary>
/// <param name="data">The data.</param>
public void PutCalibrationData(CalibrationData data)
{
Data = data.ToBytes();
}
/// <summary>
/// Creates the demo calibration data.
/// </summary>
/// <param name="liquidType">Type of the liquid.</param>
/// <returns></returns>
public static CalibrationData CreateDemoCalibrationData(PMR.ColorLab.LiquidType liquidType)
{
CalibrationData data = new CalibrationData();
data.LiquidType = liquidType;
for (int i = 0; i < 201; i+=10)
{
data.CalibrationPoints.Add(new CalibrationPoint()
{
X = i,
Y = i,
});
}
return data;
}
/// <summary>
/// Creates a cloned version of this CAT and assigns it to the specified machine.
/// </summary>
/// <param name="machine">The machine.</param>
/// <returns></returns>
public Cat Clone(Machine machine)
{
var cloned = base.Clone();
cloned.Machine = machine;
return cloned;
}
/// <summary>
/// Initializes a new instance of the <see cref="Cat" /> class.
/// </summary>
public Cat() : base()
{
}
}
}
|