|
|
|
@ -123,7 +123,7 @@ public class LedClient
|
|
|
|
|
public static Dictionary<string, byte[]> Dictionary = new Dictionary<string, byte[]>()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//{"欢迎光临换电站!(正在营业)",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x3D,0x00,0x00,0x00,0x3D,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x53,0x65,0x6C,0x61,0x6D,0x61,0x74,0x20,0x64,0x61,0x74,0x61,0x6E,0x67,0x20,0x64,0x69,0x20,0x73,0x74,0x61,0x73,0x69,0x75,0x6E,0x20,0x70,0x65,0x72,0x74,0x75,0x6B,0x61,0x72,0x61,0x6E,0x20,0x62,0x61,0x74,0x65,0x72,0x61,0x69,0x21,0x20,0x28,0x54,0x75,0x74,0x75,0x70,0x29,0x00,0x00,0x0D,0x0A,}},
|
|
|
|
|
{"欢迎光临换电站!(正在营业)",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x3D,0x00,0x00,0x00,0x3D,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x53,0x65,0x6C,0x61,0x6D,0x61,0x74,0x20,0x64,0x61,0x74,0x61,0x6E,0x67,0x20,0x64,0x69,0x20,0x73,0x74,0x61,0x73,0x69,0x75,0x6E,0x20,0x70,0x65,0x72,0x74,0x75,0x6B,0x61,0x72,0x61,0x6E,0x20,0x62,0x61,0x74,0x65,0x72,0x61,0x69,0x21,0x20,0x28,0x54,0x75,0x74,0x75,0x70,0x29,0x00,0x00,0x0D,0x0A,}},
|
|
|
|
|
//{"标签读写失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x26,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x47,0x61,0x67,0x61,0x6C,0x20,0x6D,0x65,0x6D,0x62,0x61,0x63,0x61,0x20,0x61,0x74,0x61,0x75,0x20,0x6D,0x65,0x6E,0x75,0x6C,0x69,0x73,0x20,0x74,0x61,0x67,0x00,0x00,0x0D,0x0A,}},
|
|
|
|
|
//{"车辆连接失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x1F,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x4B,0x6F,0x6E,0x65,0x6B,0x73,0x69,0x20,0x6B,0x65,0x6E,0x64,0x61,0x72,0x61,0x61,0x6E,0x20,0x67,0x61,0x67,0x61,0x6C,0x00,0x00,0x0D,0x0A,}},
|
|
|
|
|
//{"云端校验失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x1E,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x56,0x65,0x72,0x69,0x66,0x69,0x6B,0x61,0x73,0x69,0x20,0x63,0x6C,0x6F,0x75,0x64,0x20,0x67,0x61,0x67,0x61,0x6C,0x00,0x00,0x0D,0x0A,}},
|
|
|
|
@ -182,7 +182,7 @@ public class LedClient
|
|
|
|
|
private static int _port = 10000;
|
|
|
|
|
|
|
|
|
|
private static DateTime LastestSendTime;
|
|
|
|
|
private static string LastestKey=InfoEnum.SwapInfo.IDEI.GetLed();
|
|
|
|
|
private static string LastestKey=InfoEnum.SwapInfo.WelcomeInfo.GetLed();
|
|
|
|
|
|
|
|
|
|
private static byte[] Heart = new byte[]
|
|
|
|
|
{
|
|
|
|
@ -220,7 +220,7 @@ public class LedClient
|
|
|
|
|
{
|
|
|
|
|
var now = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
if ((now - LastestSendTime).TotalSeconds > 3)
|
|
|
|
|
if ((now - LastestSendTime).TotalSeconds > 5)
|
|
|
|
|
{
|
|
|
|
|
SendMsgByKey(LastestKey);
|
|
|
|
|
}
|
|
|
|
@ -265,8 +265,8 @@ public class LedClient
|
|
|
|
|
}
|
|
|
|
|
catch (SocketException ex)
|
|
|
|
|
{
|
|
|
|
|
_socket.Close();
|
|
|
|
|
Connect();
|
|
|
|
|
// _socket.Close();
|
|
|
|
|
// Connect();
|
|
|
|
|
Log.Error($"Failed to send data. Reason: {ex.Message}");
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
@ -301,7 +301,7 @@ public class LedClient
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
count++;
|
|
|
|
|
if (count > 5)
|
|
|
|
|
if (count > 10)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|