You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.4 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2025 WenJY 保留所有权利。
* CLR版本4.0.30319.42000
* 机器名称Mr.Wen's MacBook Pro
* 命名空间Sln.Iot.Business
* 唯一标识8BCBBC2D-F2EB-45A3-9DBA-24217C772093
*
* 创建者WenJY
* 电子邮箱:
* 创建时间2025-05-07 13:44:30
* 版本V1.0.0
* 描述:
*
*--------------------------------------------------------------------
* 修改人:
* 时间:
* 修改说明:
*
* 版本V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using System;
using Sln.Iot.Business.@base;
using Sln.Iot.Common;
using Sln.Iot.Config;
using Sln.Iot.Model.dto;
using Sln.Iot.Serilog;
using Sln.Iot.Socket.Adapter;
using TouchSocket.Core;
using TouchSocket.Sockets;
namespace Sln.Iot.Business
{
/// <summary>
/// 校时指令
/// </summary>
public class CheckTimeBusiness:BaseBusiness
{
public CheckTimeBusiness(SerilogHelper logger, AppConfig appConfig, StringChange stringChange) : base(logger, appConfig, stringChange)
{
}
public override FilterResult BufferAnalysis(ISocketClient client, BufferRequestInfo requestInfo, int bodyLength)
{
ResponsePack sendResponsePackInfo = new ResponsePack()
{
m_MessageType = 0x08,
m_PackLen = new byte[] {0x00, 0x06}
};
base.GetMessagePack(ref sendResponsePackInfo,requestInfo.buffer);
DateTime currentTime = DateTime.Now;
byte[] timeBuffer = new byte[]
{
base._stringChange.HexStrTorbytes(currentTime.ToString("ss"))[0],
base._stringChange.HexStrTorbytes(currentTime.ToString("mm"))[0],
base._stringChange.HexStrTorbytes(currentTime.ToString("HH"))[0],
base._stringChange.HexStrTorbytes(currentTime.ToString("dd"))[0],
base._stringChange.HexStrTorbytes(currentTime.ToString("MM"))[0],
base._stringChange.HexStrTorbytes(currentTime.ToString("yy"))[0],
};
base.SendMessageAsync(client, sendResponsePackInfo,timeBuffer);
return FilterResult.Success;
}
public override void ResponseHandle(ISocketClient client, byte[] buffer)
{
//校时指令通过业务数据返回
}
}
}