启动充电

zw
smartwyy 5 months ago
parent 3bd1a56865
commit e8430eb96b

@ -118,6 +118,7 @@ public class ModbusTcpMaster
if (result.IsSuccess) return result.Content; if (result.IsSuccess) return result.Content;
return null; return null;
} }
public bool WriteValue<T>(ModbusProperty<T> property) public bool WriteValue<T>(ModbusProperty<T> property)

@ -18,6 +18,7 @@ using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Service.Cloud.Handler; using Service.Cloud.Handler;
using Service.Cloud.Msg; using Service.Cloud.Msg;
using Service.Cloud.Msg.Cloud.Req;
using Service.Cloud.Msg.Host.Req; using Service.Cloud.Msg.Host.Req;
namespace Service.Cloud.Client; namespace Service.Cloud.Client;
@ -56,8 +57,15 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
public string? AesKey { get; set; } public string? AesKey { get; set; }
public bool Authed { get; set; }
#endregion #endregion
#region Cmd
public CarCanStart? CarCanStart { get; set; }
#endregion
private IMqttClient? MqttClient; private IMqttClient? MqttClient;

@ -0,0 +1,20 @@
using Newtonsoft.Json;
using Service.Cloud.Client;
using Service.Cloud.Common;
using Service.Cloud.Msg.Cloud.Req;
namespace Service.Cloud.Handler;
public class CarCanStartHandler : IBaseHandler
{
public bool CanHandle(string cmd)
{
return CloudConst.carCanStart == cmd;
}
public void Handle(string t)
{
CarCanStart? carCanStart = JsonConvert.DeserializeObject<CarCanStart>(t);
CloudClientMgr.CloudClient.CarCanStart = carCanStart;
}
}

@ -1,7 +1,7 @@
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Autofac.Attribute;
using Newtonsoft.Json; using Newtonsoft.Json;
using Service.Cloud.Client;
using Service.Cloud.Common; using Service.Cloud.Common;
using Service.Cloud.Msg;
using Service.Cloud.Msg.Cloud.Resp; using Service.Cloud.Msg.Cloud.Resp;
namespace Service.Cloud.Handler; namespace Service.Cloud.Handler;
@ -13,6 +13,10 @@ public class SignInRespHandler : IBaseHandler
public void Handle(string t) public void Handle(string t)
{ {
SignInResp? signInResp = JsonConvert.DeserializeObject<SignInResp>(t); SignInResp? signInResp = JsonConvert.DeserializeObject<SignInResp>(t);
if (signInResp != null)
{
CloudClientMgr.CloudClient.Authed = signInResp.re == 0;
}
} }
public bool CanHandle(string cmd) public bool CanHandle(string cmd)

@ -10,7 +10,7 @@ namespace Service.Cloud.Msg.Cloud.Req
/// <summary> /// <summary>
/// 1 云平台下发车辆开始换电指令 /// 1 云平台下发车辆开始换电指令
/// </summary> /// </summary>
public class PowerChangeCommand public class CarCanStart
{ {
/// <summary> /// <summary>
/// 订单号 /// 订单号
Loading…
Cancel
Save