|
|
|
@ -217,6 +217,14 @@ namespace IoTNode.DeviceServices.FBee
|
|
|
|
|
ex.PrintStack();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in Clients)
|
|
|
|
|
{
|
|
|
|
|
if (!gateways.Any(o => o.Number == item.Key))
|
|
|
|
|
{
|
|
|
|
|
Clients.Remove(item.Key, out TcpClientWrapper value);
|
|
|
|
|
value.Client.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -290,12 +298,19 @@ namespace IoTNode.DeviceServices.FBee
|
|
|
|
|
|
|
|
|
|
private void Handle(string sn, byte[] data)
|
|
|
|
|
{
|
|
|
|
|
var length = 2 + data[1];
|
|
|
|
|
if (data.Length > length)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Handle(sn, data.Skip(length).ToArray());
|
|
|
|
|
var length = 2 + data[1];
|
|
|
|
|
if (data.Length > length)
|
|
|
|
|
{
|
|
|
|
|
Handle(sn, data.Skip(length).ToArray());
|
|
|
|
|
}
|
|
|
|
|
this.HandleInternal(sn, data.Take(length).ToArray());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ex.PrintStack();
|
|
|
|
|
}
|
|
|
|
|
this.HandleInternal(sn, data.Take(length).ToArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HandleInternal(string sn, byte[] data)
|
|
|
|
@ -1373,7 +1388,7 @@ namespace IoTNode.DeviceServices.FBee
|
|
|
|
|
tempBytes.AddRange(item.Value);
|
|
|
|
|
tempBytes.Add(0x00);
|
|
|
|
|
tempBytes.Add(0x00);
|
|
|
|
|
var electricity = BitConverter.ToUInt64(tempBytes.ToArray()) / 10000f;
|
|
|
|
|
var electricity = BitConverter.ToInt64(tempBytes.ToArray()) / 10000f;
|
|
|
|
|
this.UpdateData(deviceRepo, device, device.CreateData(Keys.Electricity, electricity.ToString("f2"), DeviceDataType.Float, "电量", "kWh", timestamp: timestamp));
|
|
|
|
|
}
|
|
|
|
|
else if (item.Key == 0x050b)
|
|
|
|
|