Skip to content

Commit eda960e

Browse files
author
“寧々”
committed
V1.05 Add Confirm Direction Field
1 parent 7d6b721 commit eda960e

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

MiniCarLib/QianCarController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ public virtual void ApplyForLeaveHandler(QianCar car, ApplyForLeaveData data)
243243
public virtual void CarEnterConfirmHandler(QianCar car,CarEnterConfirmData data)
244244
{
245245
car.CurrentPoint = Map[data.PointID];
246+
car.Direction = data.Direction;
246247
car.State = CarState.Idle;
247248
}
248249

MiniCarLib/QianCarData.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ public override void ParseByteData(byte[] data, int offset)
224224
{
225225

226226
}
227+
228+
227229
}
228230

229231
public class ReportCarStateData : QianComData
@@ -354,7 +356,8 @@ public class CarEnterConfirmData : QianComData
354356
{
355357
public byte PointIDLen => (byte)(PointID?.Length ?? 0);
356358
public string PointID { get; set; }
357-
public override byte DataLen => (byte)(PointIDLen + 1);
359+
public byte Direction { get; set; }
360+
public override byte DataLen => (byte)(PointIDLen + 2);
358361

359362
public override DataFunctionType FuncType => DataFunctionType.CarEnterConfirm;
360363

@@ -364,6 +367,7 @@ public override void FillByteData(byte[] data, int offset)
364367
dw.WriteByte(PointIDLen);
365368
if (PointIDLen > 0)
366369
dw.WriteString(PointID, Encoding.ASCII);
370+
dw.WriteByte(Direction);
367371
}
368372

369373
public override void ParseByteData(byte[] data, int offset)
@@ -372,6 +376,7 @@ public override void ParseByteData(byte[] data, int offset)
372376
byte len = dr.ReadByte();
373377
if (len > 0)
374378
PointID = dr.ReadString(len, Encoding.ASCII);
379+
Direction = dr.ReadByte();
375380
}
376381
}
377382

MiniCarLibTester/Form1.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using MiniCarLib.Core;
1414

1515
using System.Text.RegularExpressions;
16+
using System.IO;
1617

1718
namespace MiniCarLibTester
1819
{
@@ -128,6 +129,7 @@ private void button9_Click(object sender, EventArgs e)
128129
{
129130
var ver = Util.GetLibVersion();
130131
textBox1.Text = ver[0].ToString() + "." + ver[1].ToString();
132+
131133
}
132134
}
133135
}

0 commit comments

Comments
 (0)