diff --git a/Service/TBox/Msg/TBox/LockStatusMsg.cs b/Service/TBox/Msg/TBox/LockStatusMsg.cs index 4814475..a68c2b8 100644 --- a/Service/TBox/Msg/TBox/LockStatusMsg.cs +++ b/Service/TBox/Msg/TBox/LockStatusMsg.cs @@ -4,5 +4,11 @@ namespace Service.TBox.Msg.TBox; public class LockStatusMsg : BaseMsg { + /// + /// 0:未解锁未上锁 + /// 1:解锁成功 + /// 2:上锁成功 + /// 3:无效数据 + /// [Property(32, 2)] public byte LockStatus { get; set; } } diff --git a/Service/TBox/Server/TBoxServer.cs b/Service/TBox/Server/TBoxServer.cs index 0c22fbc..fb3cb5b 100644 --- a/Service/TBox/Server/TBoxServer.cs +++ b/Service/TBox/Server/TBoxServer.cs @@ -189,11 +189,65 @@ public class TBoxServer : TcpServer return null; } + public string? BatteryNo() + { + byte leng = BatteryOneSn.Length; + if (leng > 8) + { + byte[] bytes = new byte[leng]; + + List lstByte = new List(); + lstByte.Add(BatteryOneSn.Sn1); + lstByte.Add(BatteryOneSn.Sn2); + lstByte.Add(BatteryOneSn.Sn3); + lstByte.Add(BatteryOneSn.Sn4); + lstByte.Add(BatteryOneSn.Sn5); + lstByte.Add(BatteryOneSn.Sn6); + lstByte.Add(BatteryTwoSn.Sn1); + lstByte.Add(BatteryTwoSn.Sn2); + lstByte.Add(BatteryTwoSn.Sn3); + lstByte.Add(BatteryTwoSn.Sn4); + lstByte.Add(BatteryTwoSn.Sn5); + lstByte.Add(BatteryTwoSn.Sn6); + lstByte.Add(BatteryTwoSn.Sn7); + lstByte.Add(BatteryThreeSn.Sn1); + lstByte.Add(BatteryThreeSn.Sn2); + lstByte.Add(BatteryThreeSn.Sn3); + lstByte.Add(BatteryThreeSn.Sn4); + lstByte.Add(BatteryThreeSn.Sn5); + lstByte.Add(BatteryThreeSn.Sn6); + lstByte.Add(BatteryThreeSn.Sn7); + lstByte.Add(BatteryFourSn.Sn1); + lstByte.Add(BatteryFourSn.Sn2); + lstByte.Add(BatteryFourSn.Sn3); + lstByte.Add(BatteryFourSn.Sn4); + lstByte.Add(BatteryFourSn.Sn5); + lstByte.Add(BatteryFourSn.Sn6); + lstByte.Add(BatteryFourSn.Sn7); + + for (int i = 0; i < leng; i++) + { + bytes[i] = lstByte[i]; + } + + if (BatteryOneSn.Sn1 != 0 && BatteryOneSn.Sn2 != 0 + && BatteryOneSn.Sn3 != 0 && BatteryOneSn.Sn4 != 0 + && BatteryOneSn.Sn5 != 0 && BatteryOneSn.Sn6 != 0 + && BatteryTwoSn.Sn1 != 0 && BatteryTwoSn.Sn2 != 0 + && BatteryTwoSn.Sn3 != 0 && BatteryTwoSn.Sn4 != 0 + && BatteryTwoSn.Sn5 != 0 && BatteryTwoSn.Sn6 != 0) + { + return Encoding.ASCII.GetString(bytes); + } + } + + return null; + } + #endregion public void Reset() { - StopSendLock(); StopSendVin(); @@ -223,4 +277,4 @@ public class TBoxServer : TcpServer } #endregion -} +} \ No newline at end of file diff --git a/WebStarter/Controllers/TBoxController.cs b/WebStarter/Controllers/TBoxController.cs index c76197c..e2ef006 100644 --- a/WebStarter/Controllers/TBoxController.cs +++ b/WebStarter/Controllers/TBoxController.cs @@ -77,6 +77,7 @@ public class TBoxController : ControllerBase VersionMsg = TBoxServerMgr.Server?.VersionMsg, RestartMsg = TBoxServerMgr.Server?.RestartMsg, Vin = TBoxServerMgr.Server?.ReadVin(), + BatteryNo = TBoxServerMgr.Server?.BatteryNo(), CarConnected = TBoxServerMgr.Server != null && TBoxServerMgr.Server.Connected, TBoxConnected = TBoxServerMgr.Server != null }; diff --git a/WebStarter/Dto/Resp/TBoxInfo.cs b/WebStarter/Dto/Resp/TBoxInfo.cs index 5b43d45..fedc388 100644 --- a/WebStarter/Dto/Resp/TBoxInfo.cs +++ b/WebStarter/Dto/Resp/TBoxInfo.cs @@ -19,6 +19,7 @@ public class TBoxInfo public VersionMsg VersionMsg { get; set; } public RestartMsg RestartMsg { get; set; } public String Vin { get; set; } + public String BatteryNo { get; set; } public bool CarConnected { get; set; } public bool TBoxConnected { get; set; } }