|
|
|
@ -135,17 +135,20 @@ namespace FBeeService
|
|
|
|
|
device.Endpoint = endpoint;
|
|
|
|
|
device.ProfileId = profileId;
|
|
|
|
|
device.DeviceId = deviceId;
|
|
|
|
|
device.Status = ms.ReadByte();
|
|
|
|
|
device.SwitchState = ms.ReadByte();
|
|
|
|
|
device.NameLength = ms.ReadByte();
|
|
|
|
|
device.CName = ms.ReadASIIString(device.NameLength);
|
|
|
|
|
device.Online = ms.ReadByte();
|
|
|
|
|
if (device.NameLength > 0)
|
|
|
|
|
{
|
|
|
|
|
device.CName = ms.ReadASIIString(device.NameLength);
|
|
|
|
|
}
|
|
|
|
|
device.IsOnline = ms.ReadByte();
|
|
|
|
|
device.IEEE = ms.ReadHexString(8);
|
|
|
|
|
device.SNLength = ms.ReadByte();
|
|
|
|
|
device.RawSN = ms.ReadHexString(device.SNLength);
|
|
|
|
|
device.ZoneType = ms.ReadByte();
|
|
|
|
|
device.Power = ms.ReadByte();
|
|
|
|
|
device.ZoneType = ms.ReadInt();
|
|
|
|
|
device.Battery = ms.ReadByte();
|
|
|
|
|
device.EpCount = ms.ReadByte();
|
|
|
|
|
device.Data = ms.ReadHexString(4);
|
|
|
|
|
device.Safe = ms.ReadHexString(2);
|
|
|
|
|
device.RawValue = BitConverter.ToString(data);
|
|
|
|
|
deviceRepo.SaveChanges();
|
|
|
|
|
}
|
|
|
|
@ -164,7 +167,7 @@ namespace FBeeService
|
|
|
|
|
using (var scope = _applicationServices.CreateScope())
|
|
|
|
|
{
|
|
|
|
|
var repo = scope.ServiceProvider.GetService<IRepository<FBeeDevice>>();
|
|
|
|
|
var device = repo.ReadOnlyTable().FirstOrDefault(o => o.Online != 0 && o.IEEE == ieee);
|
|
|
|
|
var device = repo.ReadOnlyTable().FirstOrDefault(o => o.IsOnline != 0 && o.IEEE == ieee);
|
|
|
|
|
var address = device.Address;
|
|
|
|
|
var list = new List<byte>();
|
|
|
|
|
list.Add(0x0c);
|
|
|
|
@ -197,7 +200,7 @@ namespace FBeeService
|
|
|
|
|
list.Add(0x02);
|
|
|
|
|
list.AddRange(address.HexToBytes());
|
|
|
|
|
list.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
|
|
|
|
|
list.Add(0x01);
|
|
|
|
|
list.Add((byte)device.Endpoint);
|
|
|
|
|
list.AddRange(new byte[] { 0x00, 0x00 });
|
|
|
|
|
list.Add(status);
|
|
|
|
|
this.Write(sn, RequestType.x82, list);
|
|
|
|
@ -224,7 +227,7 @@ namespace FBeeService
|
|
|
|
|
var device = deviceRepo.Table().FirstOrDefault(o => o.Sn == sn && o.Address == address);
|
|
|
|
|
if (device != null)
|
|
|
|
|
{
|
|
|
|
|
device.Power = ms.ReadInt();
|
|
|
|
|
device.SwitchState = ms.ReadInt();
|
|
|
|
|
deviceRepo.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -412,7 +415,15 @@ namespace FBeeService
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
propDataLength = Convert.ToInt32(Regex.Match(propDataType.GetName(), @"\d+").Groups[1].Value);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
propDataLength = Convert.ToInt32(Regex.Match(propDataType.GetName(), @"(\d+)$").Groups[1].Value);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(ex.ToString());
|
|
|
|
|
propDataLength = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|