diff --git a/Common/lib/HybirdFrameworkCore.dll b/Common/lib/HybirdFrameworkCore.dll
index b3f2f85..36f9605 100644
Binary files a/Common/lib/HybirdFrameworkCore.dll and b/Common/lib/HybirdFrameworkCore.dll differ
diff --git a/Common/lib/HybirdFrameworkDriver.dll b/Common/lib/HybirdFrameworkDriver.dll
index 66c5b7a..9b51aae 100644
Binary files a/Common/lib/HybirdFrameworkDriver.dll and b/Common/lib/HybirdFrameworkDriver.dll differ
diff --git a/ConsoleStarter/ConsoleStarter.csproj b/ConsoleStarter/ConsoleStarter.csproj
index cf3347c..dae4541 100644
--- a/ConsoleStarter/ConsoleStarter.csproj
+++ b/ConsoleStarter/ConsoleStarter.csproj
@@ -26,7 +26,7 @@
-
+
Always
diff --git a/ConsoleStarter/Program.cs b/ConsoleStarter/Program.cs
index 19fc46a..4893745 100644
--- a/ConsoleStarter/Program.cs
+++ b/ConsoleStarter/Program.cs
@@ -7,8 +7,8 @@ internal class Program
{
public static void Main(string[] args)
{
- XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\log4net.xml"));
+ XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\log4net.config"));
var exportDb = new ExportDb();
exportDb.Export();
}
-}
\ No newline at end of file
+}
diff --git a/ConsoleStarter/log4net.xml b/ConsoleStarter/log4net.config
similarity index 100%
rename from ConsoleStarter/log4net.xml
rename to ConsoleStarter/log4net.config
diff --git a/Service/Car/Handler/ElecMsgHandler.cs b/Service/Car/Handler/ElecMsgHandler.cs
index 15a4b34..0e54d2d 100644
--- a/Service/Car/Handler/ElecMsgHandler.cs
+++ b/Service/Car/Handler/ElecMsgHandler.cs
@@ -4,6 +4,7 @@ using HybirdFrameworkDriver.Session;
using log4net;
using Service.Car.Msg.Car.Req;
using Service.Car.Msg.Host.Resp;
+using Service.Car.Server;
namespace Service.Car.Handler;
@@ -24,7 +25,7 @@ public class ElecMsgHandler : SimpleChannelInboundHandler, IBaseHandler
protected override void ChannelRead0(IChannelHandlerContext ctx, ElecMsg msg)
{
Log.Info($"receive ElecMsg = {msg}");
- IoSession? ioSession = SessionMgr.GetSession(msg.CarNo);
+ IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(msg.CarNo);
ioSession?.BusinessMap.AddOrUpdate("ElecMsg", msg, ((s, o) => msg));
ioSession?.BusinessMap.AddOrUpdate("Connected", true, ((s, o) => true));
diff --git a/Service/Car/Handler/HeartBeatMsgHandler.cs b/Service/Car/Handler/HeartBeatMsgHandler.cs
index 03eb7d4..1f3f0f8 100644
--- a/Service/Car/Handler/HeartBeatMsgHandler.cs
+++ b/Service/Car/Handler/HeartBeatMsgHandler.cs
@@ -27,15 +27,15 @@ public class HeartBeatMsgHandler : SimpleChannelInboundHandler, IB
{
Log.Info($"receive HeartBeatMsg = {msg}");
- IoSession? ioSession = SessionMgr.GetSession(ctx.Channel.Id.ToString());
+ IoSession? ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(ctx.Channel.Id.ToString());
if (ioSession != null && ioSession.Key != msg.CarNo)
{
- SessionMgr.ChangeSessionKey(ioSession, msg.CarNo);
+ CarServerMgr.CarServer?.SessionMgr.ChangeSessionKey(ioSession, msg.CarNo);
}
if (ioSession == null)
{
- ioSession = SessionMgr.GetSession(msg.CarNo);
+ ioSession = CarServerMgr.CarServer?.SessionMgr.GetSession(msg.CarNo);
}
ioSession.BusinessMap.AddOrUpdate("HeartBeatMsg", msg, ((s, o) => msg));
diff --git a/Service/TBox/Codec/Decoder.cs b/Service/TBox/Codec/Decoder.cs
new file mode 100644
index 0000000..f96dfc3
--- /dev/null
+++ b/Service/TBox/Codec/Decoder.cs
@@ -0,0 +1,49 @@
+using DotNetty.Buffers;
+using DotNetty.Codecs;
+using DotNetty.Transport.Channels;
+using HybirdFrameworkCore.Utils;
+using log4net;
+using Service.TBox.Msg;
+using Service.TBox.Msg.TBox;
+
+namespace Service.TBox.Codec;
+
+public class Decoder : ByteToMessageDecoder
+{
+ //TODO 实际开发时去掉
+ public static Queue Msgs { get; set; } = new();
+ //TODO 实际开发时去掉
+ public static Queue BytesQueue { get; set; } = new();
+
+ private static readonly ILog Log = LogManager.GetLogger(typeof(Decoder));
+
+ private readonly int _fixedLength = 18;
+
+ protected override void Decode(IChannelHandlerContext context, IByteBuffer input, List