Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC30-AutoInOutStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 456a558d
由
gujlg
编写于
2019-05-21 16:28:44 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修改无法接收的问题
1 个父辈
7781a023
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
36 行删除
source/DeviceLibrary/DeviceLibrary/IO/AIOBOX/BLL.cs
source/DeviceLibrary/DeviceLibrary/IO/AIOBOX/BLL2.cs
source/DeviceLibrary/DeviceLibrary/IO/AIOBOX/BLL.cs
查看文件 @
456a558
...
@@ -36,7 +36,7 @@ namespace Asa.IOModule
...
@@ -36,7 +36,7 @@ namespace Asa.IOModule
private
List
<
string
>
_logRxTx
;
//日志
private
List
<
string
>
_logRxTx
;
//日志
//private List<byte[]> _send; //发送的命令
//private List<byte[]> _send; //发送的命令
private
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
_send
;
private
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
_send
;
private
List
<
byte
[
]>
_receive
;
//接收的数据
private
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
_receive
;
//接收的数据
private
Thread
tSend
;
//发送命令处理
private
Thread
tSend
;
//发送命令处理
private
Thread
tReceive
;
//接收信息处理
private
Thread
tReceive
;
//接收信息处理
...
@@ -118,9 +118,8 @@ namespace Asa.IOModule
...
@@ -118,9 +118,8 @@ namespace Asa.IOModule
_sta
=
new
Box_Sta
[
32
];
_sta
=
new
Box_Sta
[
32
];
_log
=
new
List
<
string
>();
_log
=
new
List
<
string
>();
_logRxTx
=
new
List
<
string
>();
_logRxTx
=
new
List
<
string
>();
//_send = new List<byte[]>();
_send
=
new
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
();
_send
=
new
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
();
_receive
=
new
List
<
byte
[
]>
();
_receive
=
new
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
();
Type
=
Box_Type
.
DIO_32
;
Type
=
Box_Type
.
DIO_32
;
tReconn
=
new
Thread
(
new
ThreadStart
(
Reconn
));
tReconn
=
new
Thread
(
new
ThreadStart
(
Reconn
));
...
@@ -290,11 +289,8 @@ namespace Asa.IOModule
...
@@ -290,11 +289,8 @@ namespace Asa.IOModule
_unrevd
=
0
;
_unrevd
=
0
;
_unrevdRemote
=
0
;
_unrevdRemote
=
0
;
_flag
=
0
;
_flag
=
0
;
//_send.Clear();
_send
=
new
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
();
while
(
_send
.
TryDequeue
(
out
byte
[]
aa
))
_receive
=
new
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
byte
[
]>
();
{
}
_receive
.
Clear
();
_log
.
Clear
();
_log
.
Clear
();
_logRxTx
.
Clear
();
_logRxTx
.
Clear
();
...
@@ -597,27 +593,14 @@ namespace Asa.IOModule
...
@@ -597,27 +593,14 @@ namespace Asa.IOModule
{
{
while
(
true
)
while
(
true
)
{
{
if
(
_receive
.
Count
>
0
)
if
(
_receive
.
TryDequeue
(
out
byte
[]
buff
)
)
{
{
if
(
_receive
[
0
]
!=
null
)
if
(
buff
[
7
]
==
1
)
{
ReadDO
(
buff
);
if
(
_receive
[
0
][
7
]
==
1
)
else
if
(
buff
[
7
]
==
2
)
ReadDO
(
_receive
[
0
]);
ReadDI
(
buff
);
else
if
(
_receive
[
0
][
7
]
==
2
)
else
if
(
buff
[
7
]
==
5
)
ReadDI
(
_receive
[
0
]);
ReadSingle
(
buff
);
else
if
(
_receive
[
0
][
7
]
==
5
)
ReadSingle
(
_receive
[
0
]);
if
(
LogOut
)
{
byte
[]
bb
=
new
byte
[
2
];
bb
[
0
]
=
_receive
[
0
][
1
];
bb
[
1
]
=
_receive
[
0
][
0
];
ushort
flag
=
BitConverter
.
ToUInt16
(
bb
,
0
);
_logRxTx
.
Remove
(
flag
+
","
+
_receive
[
0
][
7
]);
}
_receive
.
RemoveAt
(
0
);
}
}
}
Thread
.
Sleep
(
10
);
Thread
.
Sleep
(
10
);
}
}
...
@@ -943,7 +926,7 @@ namespace Asa.IOModule
...
@@ -943,7 +926,7 @@ namespace Asa.IOModule
int
len
=
_client
.
Receive
(
bb
);
int
len
=
_client
.
Receive
(
bb
);
byte
[]
buff
=
new
byte
[
len
];
byte
[]
buff
=
new
byte
[
len
];
Array
.
Copy
(
bb
,
buff
,
len
);
Array
.
Copy
(
bb
,
buff
,
len
);
_receive
.
Add
(
buff
);
_receive
.
Enqueue
(
buff
);
_unrevd
=
0
;
_unrevd
=
0
;
}
}
_unrevd
+=
NET_SLEEP
;
_unrevd
+=
NET_SLEEP
;
...
...
source/DeviceLibrary/DeviceLibrary/IO/AIOBOX/BLL2.cs
查看文件 @
456a558
...
@@ -593,14 +593,17 @@ namespace Asa.IOModule
...
@@ -593,14 +593,17 @@ namespace Asa.IOModule
/// </summary>
/// </summary>
private
void
Receive
()
private
void
Receive
()
{
{
while
(
_receive
.
TryDequeue
(
out
byte
[]
buff
)
)
while
(
true
)
{
{
if
(
buff
[
7
]
==
1
)
if
(
_receive
.
TryDequeue
(
out
byte
[]
buff
))
ReadDO
(
buff
);
{
else
if
(
buff
[
7
]
==
2
)
if
(
buff
[
7
]
==
1
)
ReadDI
(
buff
);
ReadDO
(
buff
);
else
if
(
buff
[
7
]
==
5
)
else
if
(
buff
[
7
]
==
2
)
{
}
ReadDI
(
buff
);
else
if
(
buff
[
7
]
==
5
)
{
}
}
Thread
.
Sleep
(
10
);
Thread
.
Sleep
(
10
);
}
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论