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.
56 lines
1023 B
56 lines
1023 B
using HybirdFrameworkCore.Autofac.Attribute;
|
|
using HybirdFrameworkCore.AutoTask;
|
|
using log4net;
|
|
using Service.Charger.Client;
|
|
using Service.Charger.Server;
|
|
|
|
namespace Service.Charger.MyTask;
|
|
|
|
[Scope]
|
|
public class QueryBatteryInfoTask : ITask
|
|
{
|
|
private volatile bool _stop;
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(QueryBatteryInfoTask));
|
|
|
|
public string Name()
|
|
{
|
|
return "QueryBatteryInfo";
|
|
}
|
|
|
|
public int Interval()
|
|
{
|
|
return 1000;
|
|
}
|
|
|
|
public void Handle()
|
|
{
|
|
try
|
|
{
|
|
foreach (var (key, client) in ServerMgr.Dictionary)
|
|
{
|
|
client.SendQueryBattery();
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Error(e);
|
|
}
|
|
|
|
}
|
|
|
|
public bool Stoped()
|
|
{
|
|
return _stop;
|
|
}
|
|
|
|
public void Stop()
|
|
{
|
|
_stop = true;
|
|
}
|
|
|
|
public void ResetStop()
|
|
{
|
|
_stop = false;
|
|
}
|
|
}
|