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.
 
 
 
 
 

60 lines
2.0 KiB

using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Mirle.Component.API.ProgrammableLogicController.Models
{
/// <summary>
/// 心跳包回報類別
/// </summary>
public class FP041HeartbeatReportDto : CommonMessage
{
/// <summary>
/// 取得心跳包回報
/// </summary>
/// <param name="transName">交易名稱</param>
/// <param name="softwareID">軟體編號</param>
/// <returns>心跳包回報</returns>
public static FP041HeartbeatReportDto Get(TransactionName transName, string softwareID)
{
return new FP041HeartbeatReportDto()
{
Timetick = DateTime.Now,
TransactionName = transName.ToTransactionName(),
SoftwareID = softwareID
};
}
}
/// <summary>
/// 心跳包回應類別
/// </summary>
public class TP042HeartbeatAckDto : CommonMessage
{
/// <summary>
/// 回應代碼
/// </summary>
/// <value>
/// 0 = OK <br/>
/// 1 = NG <br/>
/// </value>
[Required, JsonPropertyName("reply_code"), JsonPropertyOrder(101)]
public ReplyCode ReplyCode { get; set; }
/// <summary>
/// 取得心跳包回應
/// </summary>
/// <param name="transName">交易名稱</param>
/// <param name="softwareID">軟體編號</param>
/// <param name="replyCode">回應代碼</param>
/// <returns>心跳包回應</returns>
public static TP042HeartbeatAckDto Get(TransactionName transName, string softwareID, ReplyCode replyCode)
{
return new TP042HeartbeatAckDto()
{
Timetick = DateTime.Now,
TransactionName = transName.ToTransactionName(),
SoftwareID = softwareID,
ReplyCode = replyCode
};
}
}
}