master
xjl 2 months ago
parent 7ae6189eda
commit 5c5e6177b8

@ -42,7 +42,9 @@ public class HeartBeatMsgHandler : SimpleChannelInboundHandler<HeartBeatMsg>, IB
ioSession.BusinessMap.AddOrUpdate("HeartBeatMsg", msg, ((s, o) => msg));
ioSession?.BusinessMap.AddOrUpdate("Connected", true, ((s, o) => true));
HeartBeatMsgResp resp = new HeartBeatMsgResp(CarServerMgr.CarServer.StationStatus)
byte stationStatus = msg.CarNo == CarServerMgr.CarServer.VIN ? CarServerMgr.CarServer.StationStatus :(byte)1;
HeartBeatMsgResp resp = new HeartBeatMsgResp(stationStatus)
{
CarNo = msg.CarNo
};

@ -15,7 +15,7 @@ namespace Service.Car.Msg.Car.Req
[Property(248, 192)]
public string BatteryCode { get; set; }
/// <summary>
/// 电池编码
/// 电池厂家
/// </summary>
[Property(340, 8)]
public byte BatteryManufacturer { get; set; }

@ -24,8 +24,9 @@ public class CarServer : TcpServer<IBaseHandler, Decoder, Encoder>
/// 1 待机 2 换电
/// </summary>
public byte StationStatus { get; set; } = 1;
public string VIN { get; set; };
public CarServer() : base()
{
this.ChannelInActiveAction = Clean;

@ -156,6 +156,28 @@ public class CarController : ControllerBase{
return CarServerMgr.CarServer.UnLockMsgPair.GetResp(TimeSpan.FromSeconds(5))?.Result == 0;
}
/// <summary>
/// 设置心跳返回信息
/// </summary>
/// <param name="status">
/// 1 换电站待机
/// 2 开始换电
/// 3 换电进行中
/// 4 换电完成
/// 5 换电站故障</param>
/// <returns></returns>
[HttpGet("Vin/{VIN}/SetStatus/{status}")]
public bool SetStatus(string VIN, byte status)
{
if (CarServerMgr.CarServer != null)
{
CarServerMgr.CarServer.VIN = VIN;
CarServerMgr.CarServer.StationStatus = status;
return true;
}
return false;
}
/// <summary>
/// 结算
/// </summary>

Loading…
Cancel
Save