From a251442d9fc088b3d8cf74d20b959f0f6103b095 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 14 九月 2020 17:42:10 +0800
Subject: [PATCH] 20200914
---
HDL_ON/DriverLayer/Control_Bus.cs | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/HDL_ON/DriverLayer/Control_Bus.cs b/HDL_ON/DriverLayer/Control_Bus.cs
index 8a81269..b73abd8 100644
--- a/HDL_ON/DriverLayer/Control_Bus.cs
+++ b/HDL_ON/DriverLayer/Control_Bus.cs
@@ -1,14 +1,11 @@
锘縰sing System;
using System.Collections.Generic;
-using System.Net.Sockets;
using System.Text;
using HDL_ON.DAL;
using HDL_ON.DAL.Net;
using HDL_ON.Entity;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using Shared;
-using Shared.Net;
namespace HDL_ON
{
@@ -39,7 +36,6 @@
DeviceID = deviceID,
AddData = gatewayBytes,
}, sendCount, false);
- MainPage.Log(command.ToString() + "::" + CommonPage.EndPoint.ToString());
}
public static byte[] ReadGatewayIPAddress()
@@ -84,7 +80,6 @@
else
{
bool isExit = false;
-
for (int i = 0, len = usefullBytes.Length; i < len; i++)
{
if (i % 2 == 0)
@@ -97,17 +92,16 @@
}
}
}
-
if (!isExit)
{
//涓嶅瓨鍦紝浠h〃娌℃敹鍒版湰鏈虹殑鍙戦�侊紝缁х画鍥炲
SenRemark(sendStr);
}
-
}
-
}
- catch { }
+ catch (Exception ex) {
+ Console.WriteLine($"鍥炲bus鎼滅储寮傚父 : {ex.Message}");
+ }
}
/// <summary>
@@ -509,9 +503,24 @@
void managerSendCount(object o)
{
add();
- if (CommonPage.IsRemote)
+ if (MainPage.IsRemote)
{
- 鈥� }
+ System.Console.WriteLine("杩滅▼鍙戦�佹暟鎹�:" + SendFlag);
+ Mqtt_Cloud.MqttRemoteSend(Packet.Bytes);
+ Packet.FlagDateTime = DateTime.Now;
+ Packet.HaveSendCount--;
+ //杩欓噷鏄噸鍙戜袱娆�
+ while (Packet.HaveSendCount < 3)
+ {
+ if (Packet.FlagDateTime.AddMilliseconds(1000).Ticks <= System.DateTime.Now.Ticks)
+ {
+ Mqtt_Cloud.MqttRemoteSend(Packet.Bytes);
+ System.Console.WriteLine("閲嶅彂杩滅▼鍙戦�佹暟鎹�:" + SendFlag);
+ Packet.FlagDateTime = DateTime.Now;
+ Packet.HaveSendCount++;
+ }
+ System.Threading.Thread.Sleep(100);
+ }鈥� allDone.Set();鈥� }
else
{
//Bus socket鏃犳硶鎺у埗锛岄噸鍚満鍒�
@@ -801,10 +810,10 @@
{
try
{
- var sendJob = new JObject { { "vendor_code", "HDL" }, { "command", "search" } };
+ var sendJob = new JObject {{ "command", "search" } };
var SearchGateway = JsonConvert.SerializeObject(sendJob);
var SearchGatewayPayload = Encoding.ASCII.GetBytes(SearchGateway);
- Packet = new Packet(SearchGatewayPayload, CommonPage.GetGatewayIP_EndPoint);
+ Packet = new Packet(SearchGatewayPayload, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("224.0.168.188"), 6688));
System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(managerSendCount));
thread.IsBackground = true;
thread.Start(Packet);
--
Gitblit v1.8.0