|
@@ -491,7 +491,7 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
}
|
|
}
|
|
|
|
|
|
StartOrResumeSendThread();
|
|
StartOrResumeSendThread();
|
|
- StartOrResumeSetParamThread();
|
|
|
|
|
|
+ //StartOrResumeSetParamThread();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1001,7 +1001,7 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if (cjt._cmdType == ParamCmdType.WriteNetParam)
|
|
|
|
|
|
+ else //if (cjt._cmdType == ParamCmdType.WriteNetParam)
|
|
{
|
|
{
|
|
if (cjt._controlCode == 0xA4)
|
|
if (cjt._controlCode == 0xA4)
|
|
{
|
|
{
|
|
@@ -1049,6 +1049,9 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
clientInfo.DestNumber = psp.DestNumber;
|
|
clientInfo.DestNumber = psp.DestNumber;
|
|
clientInfo.SourceNumber = psp.SourceNumber;
|
|
clientInfo.SourceNumber = psp.SourceNumber;
|
|
server.SetExtra(clientInfo.ConnId, clientInfo);
|
|
server.SetExtra(clientInfo.ConnId, clientInfo);
|
|
|
|
+
|
|
|
|
+ // 启动设参线程
|
|
|
|
+ StartOrResumeSetParamThread();
|
|
}
|
|
}
|
|
|
|
|
|
insourcingData.CellMonitor = cm;
|
|
insourcingData.CellMonitor = cm;
|
|
@@ -1243,7 +1246,7 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if (cjt._cmdType == ParamCmdType.WriteNetParam)
|
|
|
|
|
|
+ else //if (cjt._cmdType == ParamCmdType.WriteNetParam)
|
|
{
|
|
{
|
|
// 设参参返回指令
|
|
// 设参参返回指令
|
|
if (cjt._controlCode == 0xA4)
|
|
if (cjt._controlCode == 0xA4)
|
|
@@ -1339,7 +1342,7 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
else if ("CD_PSController".Equals(insourcingData.Type))
|
|
else if ("CD_PSController".Equals(insourcingData.Type))
|
|
{
|
|
{
|
|
// 读参返回数据
|
|
// 读参返回数据
|
|
- if ("1".Equals(insourcingData.DataType))
|
|
|
|
|
|
+ if ("0".Equals(insourcingData.DataType))
|
|
{
|
|
{
|
|
// 解析参数数据包并展示参数信息
|
|
// 解析参数数据包并展示参数信息
|
|
DeviceControlForm.showParamData(insourcingData.Data);
|
|
DeviceControlForm.showParamData(insourcingData.Data);
|
|
@@ -1397,8 +1400,9 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
{
|
|
{
|
|
// 获取所有链接ID
|
|
// 获取所有链接ID
|
|
IntPtr[] allConnIds = server.GetAllConnectionIDs();
|
|
IntPtr[] allConnIds = server.GetAllConnectionIDs();
|
|
- if (allConnIds == null || allConnIds.Length > 0)
|
|
|
|
|
|
+ if (allConnIds == null || allConnIds.Length == 0)
|
|
{
|
|
{
|
|
|
|
+ AddMsg($" > 设参时没有链接,线程挂起", lbErrorData);
|
|
setParamThread.Suspend();
|
|
setParamThread.Suspend();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1407,15 +1411,18 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
ClientInfo clientInfo = (ClientInfo)server.GetExtra(connId);
|
|
ClientInfo clientInfo = (ClientInfo)server.GetExtra(connId);
|
|
if (clientInfo == null)
|
|
if (clientInfo == null)
|
|
{
|
|
{
|
|
|
|
+ //AddMsg($" > 设参时链接信息为空:{connId}", lbErrorData);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
// 如果链接中数据包是最后一包进行下发设参和校时指令
|
|
// 如果链接中数据包是最后一包进行下发设参和校时指令
|
|
if (!clientInfo.IsEnd)
|
|
if (!clientInfo.IsEnd)
|
|
{
|
|
{
|
|
|
|
+ //AddMsg($" > [{clientInfo.ConnId},OnSend] -> {clientInfo.IpAddress}:{clientInfo.Port} {clientInfo.SourceNumber} CD_CellMonitor 设参时不是最后一包", lbErrorData);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
if (clientInfo.TranDevice == null)
|
|
if (clientInfo.TranDevice == null)
|
|
{
|
|
{
|
|
|
|
+ //AddMsg($" > [{clientInfo.ConnId},OnSend] -> {clientInfo.IpAddress}:{clientInfo.Port} {clientInfo.SourceNumber} CD_CellMonitor 设参时不是没有设备信息", lbErrorData);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
Dictionary<string, string> trandevice = clientInfo.TranDevice;
|
|
Dictionary<string, string> trandevice = clientInfo.TranDevice;
|
|
@@ -1548,6 +1555,7 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
remoteTask.GetTaskList(id, name);
|
|
remoteTask.GetTaskList(id, name);
|
|
if (remoteTask.Tasklist == null || remoteTask.Tasklist.Count == 0)
|
|
if (remoteTask.Tasklist == null || remoteTask.Tasklist.Count == 0)
|
|
{
|
|
{
|
|
|
|
+ //AddMsg($" > [{clientInfo.ConnId},OnSend] -> {clientInfo.IpAddress}:{clientInfo.Port} {clientInfo.SourceNumber} CD_CellMonitor 设参时没有设参指令,校时关机", lbErrorData);
|
|
// 没有设参指令则校时关机
|
|
// 没有设参指令则校时关机
|
|
TimingShutDown(clientInfo);
|
|
TimingShutDown(clientInfo);
|
|
return;
|
|
return;
|
|
@@ -1577,6 +1585,7 @@ namespace NB_IOT_TCP_HP_SOCKET
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ AddMsg($" > [{clientInfo.ConnId},OnSend] -> {clientInfo.IpAddress}:{clientInfo.Port} {clientInfo.SourceNumber} ({buffer3.Length} bytes) CD_CellMonitor下发设参打包成功 \n {BitConverter.ToString(buffer3, 0, buffer3.Length).Replace("-", " ")} ", lbErrorData);
|
|
// 下发设参数
|
|
// 下发设参数
|
|
bool sendFlag = server.Send(clientInfo.ConnId, buffer3, buffer3.Length);
|
|
bool sendFlag = server.Send(clientInfo.ConnId, buffer3, buffer3.Length);
|
|
// 发送成功更新发送次数和发送时间
|
|
// 发送成功更新发送次数和发送时间
|