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.
163 lines
6.1 KiB
163 lines
6.1 KiB
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Mirle.Component.API.AutomatedGuideVehicleController.Models
|
|
{
|
|
/// <summary>
|
|
/// Class fro set mission status request
|
|
/// </summary>
|
|
public class SetMissionStatusRequestDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// Mission sequence of task
|
|
/// </summary>
|
|
[Required, StringLength(6), JsonPropertyName("mission_sequence"), JsonPropertyOrder(101)]
|
|
public string MissionSequence { get; set; }
|
|
/// <summary>
|
|
/// task command
|
|
/// </summary>
|
|
/// <value>
|
|
/// pause <br/>
|
|
/// resume <br/>
|
|
/// cancel <br/>
|
|
/// </value>
|
|
[Required, StringLength(6), JsonPropertyName("command"), JsonPropertyOrder(102)]
|
|
public string Command { get; set; }
|
|
/// <summary>
|
|
/// Get set misssion status request data object
|
|
/// </summary>
|
|
/// <param name="protocolVersion">Automated guide vehicle controller protocol version</param>
|
|
/// <param name="sequence">Message sequence number</param>
|
|
/// <param name="missionSequence">Mission sequence of task</param>
|
|
/// <returns>Set mission status request data object</returns>
|
|
public static SetMissionStatusRequestDto Get(string protocolVersion, string sequence, string missionSequence)
|
|
{
|
|
return new SetMissionStatusRequestDto()
|
|
{
|
|
ProtocolVersion = protocolVersion,
|
|
Sequence = sequence,
|
|
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
Priority = "1",
|
|
MissionSequence = missionSequence,
|
|
Command = "cancel"
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Class for set mission status reply
|
|
/// </summary>
|
|
public class SetMissionStatusReplyDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// Reply of result
|
|
/// </summary>
|
|
/// <value>
|
|
/// ACK <br/>
|
|
/// NG <br/>
|
|
/// </value>
|
|
[Required, StringLength(3), JsonPropertyName("reply"), JsonPropertyOrder(101)]
|
|
public string Reply { get; set; }
|
|
/// <summary>
|
|
/// Mission sequnce of task
|
|
/// </summary>
|
|
[Required, StringLength(6), JsonPropertyName("mission_sequence"), JsonPropertyOrder(102)]
|
|
public string MissionSequence { get; set; }
|
|
/// <summary>
|
|
/// Failed reason when reply is NG
|
|
/// </summary>
|
|
[StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(103)]
|
|
public string Reason { get; set; }
|
|
/// <summary>
|
|
/// Get set mission status reply data object
|
|
/// </summary>
|
|
/// <param name="protocolVersion">Automated guide vehicle controller protocol version</param>
|
|
/// <param name="sequence">Message sequnce number</param>
|
|
/// <param name="priority">Message priority</param>
|
|
/// <param name="missionSequnce">Mission sequnce of task</param>
|
|
/// <param name="reply">Reply of result</param>
|
|
/// <param name="reason">失敗原因</param>
|
|
/// <returns>Set mission status reply data object</returns>
|
|
/// <remarks>reply : true = ACK, false = NG</remarks>
|
|
public static SetMissionStatusReplyDto Get(string protocolVersion, string sequence, string priority, string missionSequnce, bool reply, string reason = "NA")
|
|
{
|
|
return new SetMissionStatusReplyDto()
|
|
{
|
|
ProtocolVersion = protocolVersion,
|
|
Sequence = sequence,
|
|
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
Priority = priority,
|
|
Reply = reply ? "ACK" : "NG",
|
|
MissionSequence = missionSequnce,
|
|
Reason = reason
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Class for set mission status result
|
|
/// </summary>
|
|
public class SetMissionStatusResultDto : CommonMessage
|
|
{
|
|
/// <summary>
|
|
/// Mission sequnce of task
|
|
/// </summary>
|
|
[Required, StringLength(6), JsonPropertyName("mission_sequence"), JsonPropertyOrder(101)]
|
|
public string MissionSequence { get; set; }
|
|
/// <summary>
|
|
/// Task command
|
|
/// </summary>
|
|
/// <value>
|
|
/// pause <br/>
|
|
/// resume <br/>
|
|
/// cancel <br/>
|
|
/// </value>
|
|
[Required, StringLength(6), JsonPropertyName("command"), JsonPropertyOrder(102)]
|
|
public string Command { get; set; }
|
|
/// <summary>
|
|
/// Action result
|
|
/// </summary>
|
|
/// <value>
|
|
/// OK <br/>
|
|
/// NG <br/>
|
|
/// </value>
|
|
[Required, StringLength(2), JsonPropertyName("result"), JsonPropertyOrder(103)]
|
|
public string Result { get; set; }
|
|
/// <summary>
|
|
/// 失敗理由
|
|
/// </summary>
|
|
[StringLength(255), JsonPropertyName("reason"), JsonPropertyOrder(104)]
|
|
public string Reason { get; set; }
|
|
}
|
|
/// <summary>
|
|
/// 控制任務回應類別
|
|
/// </summary>
|
|
public class SetMissionStatusAckDto : 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="sequnce">訊息流水號</param>
|
|
/// <param name="priority">訊息優先權</param>
|
|
/// <returns>控制任務回應</returns>
|
|
public static SetMissionStatusAckDto Get(string protocolVersion, string sequnce, string priority)
|
|
{
|
|
return new SetMissionStatusAckDto()
|
|
{
|
|
ProtocolVersion = protocolVersion,
|
|
Sequence = sequnce,
|
|
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
Priority = priority,
|
|
Ack = "OK"
|
|
};
|
|
}
|
|
}
|
|
}
|