添加占位符

master
CZ 4 months ago
parent 25f1122e7d
commit 34ba107429

@ -20,7 +20,7 @@ public class Encoder : MessageToByteEncoder<BaseMsg>
{
byte[] bytes = obj.ToBytes();
byte[] result =
{ 0, bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], 0, 0, 0, 0 };
{ 88, bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], 0, 0, 0, 0 };
output.WriteBytes(result);
}
}

@ -17,6 +17,6 @@ public class VinMsgHandler : SimpleChannelInboundHandler<VinMsg>, IBaseHandler
{
Log.Info($"receive VinMsg={JsonConvert.SerializeObject(msg)}");
var server = TBoxServerMgr.Server;
if (server != null) server.VinMsgs[msg.Seq] = msg;
if (server != null) server.VinMsgs[msg.Seq-1] = msg;
}
}

@ -9,6 +9,13 @@ public class LockMsg : BaseMsg
/// </summary>
[Property(32, 2)]
public byte Lock { get; set; }
[Property(40, 8)] public byte B2 { get; set; }
[Property(48, 8)] public byte B3 { get; set; }
[Property(56, 8)] public byte B4 { get; set; }
[Property(64, 8)] public byte B5 { get; set; }
[Property(72, 8)] public byte B6 { get; set; }
[Property(80, 8)] public byte B7 { get; set; }
[Property(88, 8)] public byte B8 { get; set; }
public LockMsg(byte @lock)
{

@ -9,6 +9,13 @@ public class RestartMsg : BaseMsg
/// </summary>
[Property(32, 2)]
public byte Restart { get; set; }
[Property(40, 8)] public byte B2 { get; set; }
[Property(48, 8)] public byte B3 { get; set; }
[Property(56, 8)] public byte B4 { get; set; }
[Property(64, 8)] public byte B5 { get; set; }
[Property(72, 8)] public byte B6 { get; set; }
[Property(80, 8)] public byte B7 { get; set; }
[Property(88, 8)] public byte B8 { get; set; }
public RestartMsg(byte restart)
{

@ -41,7 +41,7 @@ public class TBoxServer : TcpServer<IBaseHandler, Decoder, Encoder>
public TotalMileMsg TotalMileMsg { get; set; }
public VersionMsg VersionMsg { get; set; }
public RestartMsg RestartMsg { get; set; }
public Msg.TBox.VinMsg[] VinMsgs { get; set; } = new Msg.TBox.VinMsg[3];
public Msg.TBox.VinMsg[] VinMsgs { get; } = new Msg.TBox.VinMsg[3];
#endregion

@ -12,6 +12,7 @@ public class TBoxServerMgr
if (Server == null)
{
Server = AppInfo.Container.Resolve<TBoxServer>();
Server.LogLevel = 0;
Server.Start(port);
}
}

@ -98,8 +98,8 @@ foreach (var s in list.Split(";"))
AppInfo.Container = app.Services.GetAutofacRoot();
var listen = builder.Configuration.GetSection("Listen");
CarServerMgr.InitServer(int.Parse(listen.GetSection("Port").Value ?? "5588"));
//var listen = builder.Configuration.GetSection("Listen");
//CarServerMgr.InitServer(int.Parse(listen.GetSection("Port").Value ?? "5588"));
var tBoxListen = builder.Configuration.GetSection("TBoxListen");
TBoxServerMgr.InitTBoxServer(int.Parse(tBoxListen.GetSection("Port").Value ?? "9999"));

Loading…
Cancel
Save