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.
63 lines
2.2 KiB
63 lines
2.2 KiB
using Infrastructure.Domain;
|
|
using Infrastructure.Extensions;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace Application.Domain.Entities
|
|
{
|
|
public class FBeeDevice : BaseEntity
|
|
{
|
|
public int DataType { get; set; }
|
|
public int DataLength { get; set; }
|
|
public string Address { get; set; }
|
|
public int Endpoint { get; set; }
|
|
public int ProfileId { get; set; }
|
|
public int DeviceId { get; set; }
|
|
public int Status { get; set; }
|
|
public int NameLength { get; set; }
|
|
public string RawName { get; set; }
|
|
public int Online { get; set; }
|
|
public string IEEE { get; set; }
|
|
public int SNLength { get; set; }
|
|
public string RawSN { get; set; }
|
|
public int ZoneType { get; set; }
|
|
public int Power { get; set; }
|
|
public string Data { get; set; }
|
|
public string Safe { get; set; }
|
|
public string RawValue { get; set; }
|
|
|
|
//
|
|
public string Sn { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
public string Number { get; set; }
|
|
public string Icon { get; set; }
|
|
public int CategoryNumber { get; set; }
|
|
public string CategoryName { get; set; }
|
|
|
|
public void Update(byte[] data)
|
|
{
|
|
using (var ms = new MemoryStream(data))
|
|
{
|
|
this.DataType = ms.ReadByte();
|
|
this.DataLength = ms.ReadByte();
|
|
this.Address = ms.ReadHexString(2);
|
|
this.Endpoint = ms.ReadByte();
|
|
this.ProfileId = ms.ReadInt();
|
|
this.DeviceId = ms.ReadInt();
|
|
this.Status = ms.ReadByte();
|
|
this.NameLength = ms.ReadByte();
|
|
this.RawName = ms.ReadASIIString(this.NameLength);
|
|
this.Online = ms.ReadByte();
|
|
this.IEEE = ms.ReadHexString(8);
|
|
this.SNLength = ms.ReadByte();
|
|
this.RawSN = ms.ReadHexString(this.SNLength);
|
|
this.ZoneType = ms.ReadByte();
|
|
this.Power = ms.ReadByte();
|
|
this.Data = ms.ReadHexString(4);
|
|
this.Safe = ms.ReadHexString(2);
|
|
this.RawValue = BitConverter.ToString(data);
|
|
}
|
|
}
|
|
}
|
|
} |