|
|
@ -1,7 +1,6 @@
|
|
|
|
using System.Net.Sockets;
|
|
|
|
using System.Net.Sockets;
|
|
|
|
using HybirdFrameworkCore.Utils;
|
|
|
|
using HybirdFrameworkCore.Utils;
|
|
|
|
using log4net;
|
|
|
|
using log4net;
|
|
|
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Service.Led;
|
|
|
|
namespace Service.Led;
|
|
|
|
|
|
|
|
|
|
|
@ -92,8 +91,7 @@ public class LedClient
|
|
|
|
{"前进",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x0C,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x4D,0x75,0x6B,0x61,0x00,0x00,0x0D,0x0A, }},
|
|
|
|
{"前进",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x0C,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x4D,0x75,0x6B,0x61,0x00,0x00,0x0D,0x0A, }},
|
|
|
|
{"后退",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x4D,0x75,0x6E,0x64,0x75,0x72,0x00,0x00,0x0D,0x0A, }},
|
|
|
|
{"后退",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x0E,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x4D,0x75,0x6E,0x64,0x75,0x72,0x00,0x00,0x0D,0x0A, }},
|
|
|
|
{"停好了",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x14,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x49,0x74,0x75,0x20,0x64,0x69,0x70,0x61,0x72,0x6B,0x69,0x72,0x00,0x00,0x0D,0x0A,}},
|
|
|
|
{"停好了",new byte[]{ 0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x14,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3B,0x3A,0x49,0x74,0x75,0x20,0x64,0x69,0x70,0x61,0x72,0x6B,0x69,0x72,0x00,0x00,0x0D,0x0A,}},
|
|
|
|
|
|
|
|
|
|
|
|
{"退出重新停车",new byte[]{ 0x55, 0xAA, 0x00, 0x00, 0x01, 0x01, 0x00, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x21, 0x00, 0x25, 0x64, 0x69, 0x73, 0x70, 0x30, 0x3B, 0x3A, 0x4B, 0x65, 0x6C, 0x75, 0x61, 0x72, 0x20, 0x64, 0x61, 0x6E, 0x20, 0x70, 0x61, 0x72, 0x6B, 0x69, 0x72, 0x20, 0x6B, 0x65, 0x6D, 0x62, 0x61, 0x6C, 0x69, 0x00, 0x00, 0x0D, 0x0A, }},
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
@ -107,17 +105,10 @@ public class LedClient
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_ip = ip;
|
|
|
|
_ip = ip;
|
|
|
|
_port = port;
|
|
|
|
_port = port;
|
|
|
|
InitClient();
|
|
|
|
Connect();
|
|
|
|
// Connect();
|
|
|
|
|
|
|
|
return _socket.Connected;
|
|
|
|
return _socket.Connected;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void InitClient()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Task.Run(Connect);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void Connect()
|
|
|
|
private static void Connect()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.Info($"begin connect {_ip}:{_port}");
|
|
|
|
Log.Info($"begin connect {_ip}:{_port}");
|
|
|
@ -129,8 +120,7 @@ public class LedClient
|
|
|
|
|
|
|
|
|
|
|
|
public static bool InnerSend(byte[] bytes)
|
|
|
|
public static bool InnerSend(byte[] bytes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
InitClient();
|
|
|
|
Connect();
|
|
|
|
// Connect();
|
|
|
|
|
|
|
|
if (_socket?.Connected ?? true)
|
|
|
|
if (_socket?.Connected ?? true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_socket?.Send(bytes);
|
|
|
|
_socket?.Send(bytes);
|
|
|
|