LanYinWsMessage.cs
4.75 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
using System.Text.Json.Serialization;
namespace Rcs.Cyaninetech.Models
{
/// <summary>
/// WebSocket 订阅请求
/// @author zzy
/// </summary>
public class LanYinWsSubscribeRequest
{
[JsonPropertyName("action")]
public string Action { get; set; } = "subscribe";
[JsonPropertyName("data")]
public List<string> Data { get; set; } = new();
}
/// <summary>
/// WebSocket 消息基类
/// @author zzy
/// </summary>
public class LanYinWsMessage
{
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
}
/// <summary>
/// WebSocket 消息(泛型)
/// @author zzy
/// </summary>
public class LanYinWsMessage<T> : LanYinWsMessage
{
[JsonPropertyName("data")]
public T? Data { get; set; }
}
/// <summary>
/// 机器人状态数据
/// @author zzy
/// </summary>
public class LanYinRobotStatus
{
[JsonPropertyName("headerId")]
public int HeaderId { get; set; }
[JsonPropertyName("timestamp")]
public long Timestamp { get; set; }
[JsonPropertyName("version")]
public string Version { get; set; } = string.Empty;
[JsonPropertyName("manufacturer")]
public string Manufacturer { get; set; } = string.Empty;
[JsonPropertyName("serialNumber")]
public string SerialNumber { get; set; } = string.Empty;
[JsonPropertyName("orderId")]
public string OrderId { get; set; } = string.Empty;
[JsonPropertyName("driving")]
public bool Driving { get; set; }
[JsonPropertyName("paused")]
public bool Paused { get; set; }
[JsonPropertyName("batteryState")]
public LanYinBatteryState? BatteryState { get; set; }
[JsonPropertyName("operatingMode")]
public string OperatingMode { get; set; } = string.Empty;
[JsonPropertyName("errors")]
public List<LanYinError> Errors { get; set; } = new();
[JsonPropertyName("position")]
public LanYinPosition? Position { get; set; }
[JsonPropertyName("agvStatus")]
public string AgvStatus { get; set; } = string.Empty;
}
public class LanYinBatteryState
{
[JsonPropertyName("batteryCharge")]
public int BatteryCharge { get; set; }
[JsonPropertyName("charging")]
public bool Charging { get; set; }
}
public class LanYinError
{
[JsonPropertyName("errorType")]
public string ErrorType { get; set; } = string.Empty;
[JsonPropertyName("errorLevel")]
public string ErrorLevel { get; set; } = string.Empty;
[JsonPropertyName("errorDescription")]
public string ErrorDescription { get; set; } = string.Empty;
}
public class LanYinPosition
{
[JsonPropertyName("x")]
public double X { get; set; }
[JsonPropertyName("y")]
public double Y { get; set; }
[JsonPropertyName("rad")]
public double Rad { get; set; }
}
/// <summary>
/// 机器人信息数据
/// @author zzy
/// </summary>
public class LanYinRobotInfo
{
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
[JsonPropertyName("ip")]
public string Ip { get; set; } = string.Empty;
[JsonPropertyName("alias")]
public string Alias { get; set; } = string.Empty;
[JsonPropertyName("map_id")]
public string MapId { get; set; } = string.Empty;
[JsonPropertyName("robot_type")]
public string RobotType { get; set; } = string.Empty;
[JsonPropertyName("scheduling_status")]
public string SchedulingStatus { get; set; } = string.Empty;
[JsonPropertyName("operation_status")]
public string OperationStatus { get; set; } = string.Empty;
[JsonPropertyName("task_status")]
public string TaskStatus { get; set; } = string.Empty;
[JsonPropertyName("running_status")]
public string RunningStatus { get; set; } = string.Empty;
[JsonPropertyName("current_battery")]
public int CurrentBattery { get; set; }
[JsonPropertyName("auto_charging")]
public bool AutoCharging { get; set; } = false;
[JsonPropertyName("current_task")]
public string CurrentTask { get; set; } = string.Empty;
[JsonPropertyName("error_code")]
public List<int> ErrorCode { get; set; } = new();
}
/// <summary>
/// 机器人实时路径数据
/// @author zzy
/// </summary>
public class LanYinRobotRealtimePath : Dictionary<string, List<List<double>>>
{
}
}