You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
5.7 KiB
167 lines
5.7 KiB
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Mirle.Component.API.AutomatedGuideVehicleController.Models
|
|
{
|
|
/// <summary>
|
|
/// 詢問車況請求類別
|
|
/// </summary>
|
|
public class SetAmrHealthRequestDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// AMR名稱或車號
|
|
/// </summary>
|
|
[Required, JsonPropertyName("amr"), JsonPropertyOrder(101)]
|
|
public string Amr { get; set; }
|
|
/// <summary>
|
|
/// 取得詢問車況請求
|
|
/// </summary>
|
|
/// <param name="protocolVersion">通訊協議版本</param>
|
|
/// <param name="sequence">訊息流水號</param>
|
|
/// <param name="priority">訊息優先權</param>
|
|
/// <param name="amr">AMR名稱或車號</param>
|
|
/// <returns>詢問車況請求</returns>
|
|
public static SetAmrHealthRequestDto Get(string protocolVersion, string sequence, string priority, string amr)
|
|
{
|
|
return new SetAmrHealthRequestDto()
|
|
{
|
|
ProtocolVersion = protocolVersion,
|
|
Sequence = sequence,
|
|
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
Priority = priority,
|
|
Amr = amr
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 詢問車況回應類別
|
|
/// </summary>
|
|
public class SetAmrHealthReplyDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 指令確認結果
|
|
/// </summary>
|
|
/// <value>
|
|
/// ACK <br/>
|
|
/// NG <br/>
|
|
/// </value>
|
|
[Required, StringLength(3), JsonPropertyName("reply"), JsonPropertyOrder(101)]
|
|
public string Reply { get; set; }
|
|
/// <summary>
|
|
/// 失敗理由
|
|
/// </summary>
|
|
[StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(102)]
|
|
public string Reason { get; set; }
|
|
/// <summary>
|
|
/// 取得詢問車況回應
|
|
/// </summary>
|
|
/// <param name="protocolVersion">通訊協議版本</param>
|
|
/// <param name="sequence">訊息流水號</param>
|
|
/// <param name="priority">訊息優先權</param>
|
|
/// <param name="reply">回應結果</param>
|
|
/// <param name="reason">失敗原因</param>
|
|
/// <returns>詢問車況回應</returns>
|
|
/// <remarks>reply : true = ACK, false = NG</remarks>
|
|
public static SetAmrHealthReplyDto Get(string protocolVersion, string sequence, string priority, bool reply, string reason = "NA")
|
|
{
|
|
return new SetAmrHealthReplyDto()
|
|
{
|
|
ProtocolVersion = protocolVersion,
|
|
Sequence = sequence,
|
|
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
Priority = priority,
|
|
Reply = reply ? "ACK" : "NG",
|
|
Reason = reason
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 詢問車輛狀況回報類別
|
|
/// </summary>
|
|
public class SetAmrHealthResultDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// AMR名稱或車號
|
|
/// </summary>
|
|
[Required, JsonPropertyName("amr"), JsonPropertyOrder(101)]
|
|
public string Amr { get; set; }
|
|
/// <summary>
|
|
/// 健康情報
|
|
/// </summary>
|
|
[JsonPropertyName("health"), JsonPropertyOrder(102)]
|
|
public Health Health { get; set; }
|
|
}
|
|
/// <summary>
|
|
/// 車輛健康狀況類別
|
|
/// </summary>
|
|
public class Health
|
|
{
|
|
/// <summary>
|
|
/// 運動狀態
|
|
/// </summary>
|
|
/// <value>
|
|
/// running <br/>
|
|
/// collision stop <br/>
|
|
/// avoidance stop <br/>
|
|
/// pause stop <br/>
|
|
/// charging stop <br/>
|
|
/// working stop <br/>
|
|
/// standby stop <br/>
|
|
/// </value>
|
|
[StringLength(13), JsonPropertyName("motion")]
|
|
public string Motion { get; set; }
|
|
/// <summary>
|
|
/// 電池電量資訊 (%)
|
|
/// </summary>
|
|
[StringLength(4), JsonPropertyName("battery_level")]
|
|
public string BatteryLevel { get; set; }
|
|
/// <summary>
|
|
/// 電池電壓資訊 (V)
|
|
/// </summary>
|
|
[StringLength(4), JsonPropertyName("battery_voltage")]
|
|
public string BatteryVoltage { get; set; }
|
|
/// <summary>
|
|
/// 車輛行進速度 (m/s)
|
|
/// </summary>
|
|
[StringLength(3), JsonPropertyName("velocity")]
|
|
public string Velocity { get; set; }
|
|
/// <summary>
|
|
/// 車輛行走公里數 (m)
|
|
/// </summary>
|
|
[StringLength(5), JsonPropertyName("odometry")]
|
|
public string Odometry { get; set; }
|
|
}
|
|
/// <summary>
|
|
/// 詢問車輛狀況回應類別
|
|
/// </summary>
|
|
public class SetAmrHealthAckDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// 回應
|
|
/// </summary>
|
|
/// <value>
|
|
/// OK
|
|
/// </value>
|
|
[Required, StringLength(2), JsonPropertyName("ack"), JsonPropertyOrder(101)]
|
|
public string Ack { get; set; }
|
|
/// <summary>
|
|
/// 取得詢問車輛狀況回應
|
|
/// </summary>
|
|
/// <param name="protocolVersion">通訊協議版本</param>
|
|
/// <param name="sequence">訊息流水號</param>
|
|
/// <param name="priority">訊息優先權</param>
|
|
/// <returns>詢問車輛狀況回應</returns>
|
|
public static SetAmrHealthAckDto Get(string protocolVersion, string sequence, string priority)
|
|
{
|
|
return new SetAmrHealthAckDto()
|
|
{
|
|
ProtocolVersion = protocolVersion,
|
|
Sequence = sequence,
|
|
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
Priority = priority,
|
|
Ack = "OK"
|
|
};
|
|
}
|
|
}
|
|
}
|