namespace BinaryProtocol.Models.Constants
{
public enum Protocol001MessageType : byte
{
/// <summary>
/// 震动事件
/// </summary>
ShockEvent = 3,
/// <summary>
/// 温度事件
/// </summary>
TemperatureEvent = 4,
/// <summary>
/// 其他事件
/// </summary>
OtherEvent = 5
}
}
namespace BinaryProtocol.Models.Constants
{
public enum ProtocolType : byte
{
/// <summary>
/// 协议1
/// </summary>
Protocol001 = 1,
/// <summary>
/// 协议2
/// </summary>
Protocol002 = 2,
/// <summary>
/// 协议3
/// </summary>
Protocol003 = 3
}
}
using System;
namespace BinaryProtocol.Models.Events
{
/// <summary>
/// 震动事件
/// </summary>
public class ShockEvent
{
/// <summary>
/// 设备Id
/// </summary>
public string DeviceId { get; set; }
/// <summary>
/// 发生时间
/// </summary>
public DateTime Time { get; set; }
}
}
using System;
using BinaryProtocol.Core.Attributes;
using BinaryProtocol.Core.Models;
namespace BinaryProtocol.Models.Events
{
/// <summary>
/// 温度事件
/// </summary>
public class TemperatureEvent:IMessageEntity
{
/// <summary>
/// 设备Id
/// </summary>
[FieldIndex(15)]
public string DeviceId { get; set; }
/// <summary>
/// 温度
/// </summary>
[FieldIndex(2)]
public int Temperature { get; set; }
/// <summary>
/// 发生时间
/// </summary>
[FieldIndex(3)]
public DateTime Time { get; set; }
/// <summary>
/// 备注
/// </summary>
[FieldIndex(4)]
public string Note { get; set; }
[FieldIndex(5)]
public short Field5 { get; set; }
[FieldIndex(6)]
public byte Field6 { get; set; }
[FieldIndex(7)]
public float Field7 { get; set; }
[FieldIndex(8)]
public double Field8 { get; set; }
[FieldIndex(9)]
public bool Field10 { get; set; }
[FieldIndex(10)]
public char Field11 { get; set; }
[FieldIndex(11)]
public long Field12 { get; set; }
[FieldIndex(12)]
public sbyte Field13 { get; set; }
[FieldIndex(13)]
public uint Field14 { get; set; }
[FieldIndex(14)]
public ulong Field15 { get; set; }
[FieldIndex(1)]
public ushort Field16 { get; set; }
}
}