Compare commits

..

801 Commits

Author SHA1 Message Date
Kimdiego2098
99eef8fb28 更新依赖包 2023-12-06 19:14:42 +08:00
Kimdiego2098
47e7685d39 串口代码整理 2023-12-06 18:54:33 +08:00
Kimdiego2098
b6ea596ade 整理代码 2023-12-06 18:35:52 +08:00
Kimdiego2098
44d60b469b 同步ts 2023-12-06 15:48:55 +08:00
Kimdiego2098
51087408df 同步ts 2023-12-06 15:16:54 +08:00
Kimdiego2098
96226d9e6e 同步ts 2023-12-06 14:56:12 +08:00
Kimdiego2098
28f0f62424 同步ts 2023-12-06 11:35:57 +08:00
Kimdiego2098
2e772a8cd4 同步touchsocket 2023-12-06 09:16:00 +08:00
Kimdiego2098
3fd192f0cf 变量表达式编辑 改为 多行文本框 2023-12-06 07:42:07 +08:00
Kimdiego2098
d16ae81961 更新demo;更新kafka 生成事件; 2023-12-04 20:28:36 +08:00
Kimdiego2098
211a8e093e 更新版本号 2023-12-01 21:23:51 +08:00
Kimdiego2098
84010a51d6 更改方法参数原;现由,分割 2023-12-01 21:22:27 +08:00
Kimdiego2098
e9700ea19b 更新依赖包 2023-12-01 19:55:17 +08:00
Kimdiego2098
e81ec68072 添加解决方案项 2023-11-30 17:44:26 +08:00
Kimdiego2098
6096e97708 modbusDtu更名 2023-11-30 10:47:37 +08:00
Kimdiego2098
6f302b66b4 添加ModbusRtu格式的DTU驱动 2023-11-30 10:16:26 +08:00
Kimdiego2098
b6e41890f7 同步TouchSocket 2023-11-30 10:16:20 +08:00
Kimdiego2098
be5332a048 添加离线后恢复间隔时间选项,添加重试次数选项 2023-11-29 20:47:23 +08:00
Kimdiego2098
4d72aeb0cd 修复种子数据带转义字符串时错误解析的问题 2023-11-29 19:04:56 +08:00
Kimdiego2098
c7c3c35100 补充git漏掉的props文件 2023-11-29 13:37:52 +08:00
Kimdiego2098
2f0df3c552 修复aop拦截不生效的问题,更新版本号,整理props文件 2023-11-29 12:43:05 +08:00
Kimdiego2098
e6effcd921 更新依赖包 2023-11-28 22:06:43 +08:00
Kimdiego2098
cd462b9523 修正导出设备表的sheet名称 2023-11-28 09:30:47 +08:00
Kimdiego2098
7e2e17d38b 整理部分底层代码 2023-11-27 16:17:12 +08:00
Kimdiego2098
665d616a06 整理部分项目项 2023-11-27 11:11:15 +08:00
Kimdiego2098
ced90f5bb9 更新版本号 2023-11-24 14:48:53 +08:00
Kimdiego2098
ca0ddb6cb4 10功能码写入时 修改需判断的crc长度 2023-11-24 14:48:28 +08:00
Kimdiego2098
3d733813e1 修复 modbusTcpDtu 初始化 空指针错误 2023-11-24 09:44:47 +08:00
Kimdiego2098
45ddc0b154 OPCUA插件afterStop方法重写时需执行父类方法 2023-11-23 20:51:08 +08:00
Kimdiego2098
87294497f3 调整网关状态页面 2023-11-23 20:49:35 +08:00
Kimdiego2098
5f45f9c0d0 修改内存缓存mapster选项 2023-11-23 15:22:39 +08:00
Kimdiego2098
7f78c06793 添加kafka的SecurityProtocol与SaslMechanism参数说明 2023-11-22 21:29:08 +08:00
Kimdiego2098
8ea5b7eebc 修复上个提交导致的excel导入产生空指针错误 2023-11-22 20:52:58 +08:00
Kimdiego2098
e49cd511af excel导入导出设备表时,去除多余的字段 2023-11-22 16:09:41 +08:00
Kimdiego2098
15c88646df socktClient重载toString 2023-11-22 15:28:04 +08:00
Kimdiego2098
f47919543d 更新版本号 2023-11-22 14:06:52 +08:00
Kimdiego2098
a95291d9cd 代码文件编码更改 2023-11-22 14:02:41 +08:00
Kimdiego2098
033deb3d29 修复变量上传属性在编辑页面不显示的问题 2023-11-22 13:35:44 +08:00
Kimdiego2098
923994c1f4 修复变量上传属性在编辑页面不显示的问题 2023-11-22 13:30:42 +08:00
Kimdiego2098
3d45b839b4 去除不存在的菜单 2023-11-21 18:19:14 +08:00
Kimdiego2098
55d1efa212 调整循环延时时间限值 2023-11-21 16:27:11 +08:00
Kimdiego2098
21d794a0e5 调试mqtt依赖 2023-11-21 15:07:07 +08:00
Kimdiego2098
614022a78c 去除上传间隔1s限制 2023-11-21 11:46:33 +08:00
Kimdiego2098
c00688e23a 整理代码 2023-11-21 11:41:44 +08:00
Kimdiego2098
5c69917d19 更新依赖 2023-11-21 08:44:47 +08:00
Kimdiego2098
6a5eb75b6c 更新版本号 2023-11-20 23:05:12 +08:00
Kimdiego2098
727c55eaa2 去除treeview 2023-11-20 23:04:54 +08:00
Kimdiego2098
9b03173ec5 去除treeview显示 2023-11-20 22:53:34 +08:00
Kimdiego2098
ab95855d6d 更新版本号 2023-11-20 22:47:18 +08:00
Kimdiego2098
bb84594c6b mqttserver/client插件支持websocket通道,直接对接前端 2023-11-20 22:42:08 +08:00
Kimdiego2098
97392c76b1 mqttserver/client插件支持websocket通道,直接对接前端 2023-11-20 22:33:26 +08:00
Kimdiego2098
53aec2b306 modbusTcpServer最大连接数设为3w 2023-11-20 19:46:07 +08:00
Kimdiego2098
a0a381dc63 更新依赖 2023-11-20 17:35:42 +08:00
Kimdiego2098
4fa95edeec 添加admin-解决方案 2023-11-20 15:38:33 +08:00
Kimdiego2098
b944f1d70e 修复设备curd服务aop失效的问题 2023-11-19 23:30:11 +08:00
Kimdiego2098
0f1a5d0085 更新版本号 2023-11-19 22:32:53 +08:00
Kimdiego2098
e7e10222e7 modbus server 添加是否立即写入内存的选项 2023-11-19 22:32:13 +08:00
Kimdiego2098
87c4fda588 默认开启多标签 2023-11-19 22:31:47 +08:00
Kimdiego2098
0ff820de6f 添加历史报警插件 2023-11-19 22:19:05 +08:00
Kimdiego2098
0dcf55e6d9 修复4.0代码 s7协议未设置适配器导致初始化/读写失败的问题 2023-11-19 21:49:32 +08:00
Kimdiego2098
a69842c910 增加上传插件 缓存基类 2023-11-19 15:20:01 +08:00
Kimdiego2098
318f635e4d 获取插件继承属性时,去除不重写特性的属性 2023-11-19 14:15:58 +08:00
Kimdiego2098
abf0d72316 整理文件 2023-11-18 23:04:51 +08:00
Kimdiego2098
5cd89c8844 整理文件 2023-11-18 23:04:25 +08:00
Kimdiego2098
501c1af38c 整理文件 2023-11-18 23:03:24 +08:00
Kimdiego2098
8526e130d9 整理文件 2023-11-18 23:03:02 +08:00
Kimdiego2098
76fd08eade 整理文件 2023-11-18 23:02:28 +08:00
Kimdiego2098
bfe48ae9d2 整理文件 2023-11-18 23:01:56 +08:00
Kimdiego2098
8547cdba7c 去除不必要的文件 2023-11-18 22:52:26 +08:00
Kimdiego2098
00d0cd631d 去除不必要的文件 2023-11-18 22:50:03 +08:00
Kimdiego2098
04460d13cd 迁移4.0 2023-11-18 22:45:24 +08:00
Kimdiego2098
a17a15e5d7 迁移4.0 2023-11-18 22:43:36 +08:00
Kimdiego2098
bfe2465658 添加停止线程等待时间 2023-11-16 22:32:22 +08:00
Kimdiego2098
4568987785 s7握手失败后,手动关闭连接 2023-11-11 10:26:05 +08:00
Kimdiego2098
c0e5a1419d fix:修复线程阻塞检测触发重启时,后台变量列表不再刷新的问题! 2023-11-10 09:00:50 +08:00
Kimdiego2098
23ac7ab748 历史数据上传成功后,才上传缓存数据 2023-11-09 18:55:56 +08:00
Kimdiego2098
5622dc74a8 update 2023-11-08 16:19:46 +08:00
Kimdiego2098
528986f4f0 发布3.0.1版本 2023-11-03 11:32:13 +08:00
Kimdiego2098
e6b8ff3f91 update touchsocket 2023-11-03 11:27:12 +08:00
Kimdiego2098
3fc3c5296f update touchsocket 2023-11-03 11:19:26 +08:00
Kimdiego2098
f4f2a14a31 不存在插件时,报错内容优化 2023-11-01 14:51:08 +08:00
Kimdiego2098
fa3f464cb6 update webapiClient 2023-11-01 14:21:53 +08:00
Kimdiego2098
bed20538ae 调整Timeout属性为int数据类型 2023-10-31 23:49:46 +08:00
Kimdiego2098
3da461c6e6 更新发布版3.0.0.28 2023-10-31 17:47:07 +08:00
Kimdiego2098
9c73e8452a 更新OPCUAClient,订阅模式适配 分组 2023-10-31 10:55:50 +08:00
Kimdiego2098
750dab69d3 update 2023-10-31 00:24:00 +08:00
Kimdiego2098
702d0da47c tcpservice停止时执行shutdown方法,修复demo发布不显示页面的问题 2023-10-30 21:31:30 +08:00
Kimdiego2098
3a955b1e53 添加部分Pro内容 2023-10-29 19:39:38 +08:00
Kimdiego2098
d408bd93e8 添加部分Pro内容 2023-10-29 19:34:17 +08:00
Kimdiego2098
63fd9eb1de 更新文档 2023-10-28 22:06:58 +08:00
Kimdiego2098
4718ab6ddf 发布3.0.0.27版本;
优化设备线程启停逻辑
添加winform(blazor) demo
部分页面显示内容优化
2023-10-28 22:03:52 +08:00
Kimdiego2098
affd4b3a26 发布3.0.0.27版本;
优化设备线程启停逻辑
添加winform(blazor) demo
部分页面显示内容优化
2023-10-28 22:00:35 +08:00
Kimdiego2098
6a660dbcda 优化设备线程启停逻辑 2023-10-28 21:58:09 +08:00
Kimdiego2098
5ff3af8b48 添加部分Pro内容 2023-10-28 21:21:03 +08:00
Kimdiego2098
9d49070f93 添加winform(blazor) demo 2023-10-28 15:20:12 +08:00
Kimdiego2098
5b3994a1dd 调整pro类库 2023-10-28 10:54:26 +08:00
Diego2098
bb1e62c580 设备状态页面显示优化 2023-10-27 20:19:26 +08:00
Diego2098
29cc776908 状态显示:已退出自动更新 2023-10-27 20:18:57 +08:00
Kimdiego2098
d2ef60b2ec 报文显示限长500 2023-10-27 14:53:19 +08:00
Kimdiego2098
41ea496d41 tcpserver 报文输出 添加 ip端口 提示 2023-10-27 14:41:35 +08:00
Kimdiego2098
c69bb38929 update the tcpserver class and add log output for start and stop 2023-10-27 14:24:26 +08:00
Kimdiego2098
23b3f8494e 优化线程上下文转换 2023-10-26 19:16:24 +08:00
Kimdiego2098
0ff94eec1b 添加ConfigureAwait 2023-10-26 18:06:33 +08:00
Kimdiego2098
f67a638565 优化设备导出逻辑 2023-10-26 15:15:43 +08:00
Kimdiego2098
778cf71c61 优化设备导出逻辑 2023-10-26 15:10:26 +08:00
Kimdiego2098
e2da083b48 3.0.0.25 2023-10-26 13:21:40 +08:00
Kimdiego2098
dcc48c0d4b Merge branch 'master' of https://gitee.com/dotnetchina/ThingsGateway 2023-10-26 13:20:54 +08:00
Kimdiego2098
2446b4a591 3.0.0.25 2023-10-26 13:20:31 +08:00
Kimdiego2098
a973d633c8 update 2023-10-26 13:19:18 +08:00
Kimdiego2098
c3b11e6e0f s7添加错误返回码提示,组包处理 2023-10-26 13:05:06 +08:00
Kimdiego2098
44bec2d99e 增加硬件信息 相关json配置 2023-10-26 10:54:48 +08:00
Kimdiego2098
0d59d0a3f6 更新nuget依赖 2023-10-26 09:37:01 +08:00
Kimdiego2098
ddc8372b09 硬件信息页面添加刷新条件 2023-10-26 09:20:25 +08:00
Kimdiego2098
ea7325f4e0 更新文档 2023-10-25 00:53:27 +08:00
Kimdiego2098
6048f95415 update touchsocket 2023-10-25 00:53:17 +08:00
Kimdiego2098
5682705b8d <Version>3.0.0.24</Version> 2023-10-24 23:48:20 +08:00
Kimdiego2098
6c3b82607d 更改S7协议 设备属性,注意删除了DstTSAP,改为较直观的 机架号/槽位号 2023-10-24 23:47:35 +08:00
Kimdiego2098
486c9f4ebf 添加属性识别 16进制写入 2023-10-24 23:46:50 +08:00
Kimdiego2098
7c8adebf2d 添加nuget依赖包 2023-10-24 20:50:39 +08:00
Kimdiego2098
ce98bb0dc1 更新nuget包 2023-10-24 00:37:46 +08:00
Kimdiego2098
60b49a4296 调整解决方案文件夹 2023-10-24 00:13:03 +08:00
Kimdiego2098
5d0a2ffae0 暂时屏蔽mqttserver 遗留消息错误 2023-10-23 20:51:11 +08:00
Kimdiego2098
bbcf7c722a 调整编码 2023-10-23 20:47:00 +08:00
Kimdiego2098
66574eec6d 调整mqttlog 2023-10-23 20:46:17 +08:00
Kimdiego2098
305df3a42c 调整mqttlog 2023-10-23 20:43:58 +08:00
Kimdiego2098
323c6f4270 添加部分兼容方法 2023-10-22 02:42:16 +08:00
Kimdiego2098
c056b2b14c 添加部分兼容方法 2023-10-22 02:26:18 +08:00
Kimdiego2098
02ebb07fd8 update touchsocket 2023-10-22 02:26:04 +08:00
Kimdiego2098
59db0890c3 调整代码格式 2023-10-21 19:15:26 +08:00
Kimdiego2098
3ea0d9ed3a update touchsocket 2023-10-21 19:08:21 +08:00
Kimdiego2098
0371d11dd5 调整代码格式 2023-10-21 19:03:15 +08:00
Kimdiego2098
12f1ebaee9 调整代码格式 2023-10-21 19:02:58 +08:00
Kimdiego2098
5202cc22d1 3.0.0.23 2023-10-20 21:38:22 +08:00
Kimdiego2098
07a34bdcbf 优化SQLDB实时表模式,插入/更新 2023-10-20 21:38:07 +08:00
Kimdiego2098
27806da4be sqlsugar提示默认中文 2023-10-20 21:37:42 +08:00
Kimdiego2098
a15dd1a3ce update touchsocket 2023-10-20 21:03:29 +08:00
Kimdiego2098
6cc7451c7c 优化 ModbusServer 内存占用 2023-10-20 01:53:48 +08:00
Kimdiego2098
652aeee782 3.0.0.21 2023-10-20 01:19:18 +08:00
Kimdiego2098
8e1e887b8f 优化OPCUAServer,取消注册,提供多url写入 2023-10-20 01:19:05 +08:00
Kimdiego2098
6601a2de64 更新赞助名单 2023-10-19 21:15:35 +08:00
Kimdiego2098
75a42ffc32 更新文档 2023-10-19 20:36:28 +08:00
Kimdiego2098
8a80a52f5f 更新版本:3.0.0.20 2023-10-19 20:27:31 +08:00
Kimdiego2098
b373a434ba 优化modbusServer内存管理 2023-10-19 20:24:39 +08:00
Kimdiego2098
cd78fdafe6 update touchsocket 2023-10-19 20:23:43 +08:00
Kimdiego2098
7a1b4c6db7 update toucksocket 2023-10-18 21:51:49 +08:00
Kimdiego2098
f2c7664033 更新文档 2023-10-18 20:42:10 +08:00
Kimdiego2098
12b295f067 发布驱动包 2023-10-18 18:04:37 +08:00
Diego2098
3ee46da40f !12 【轻量级 PR】:修正心跳事件中的参数
Merge pull request !12 from youthalan/N/A
2023-10-18 06:59:17 +00:00
youthalan
beadaa7212 修正心跳事件中的参数
Signed-off-by: youthalan <youthalan@126.com>
2023-10-18 06:58:03 +00:00
Kimdiego2098
16ef09426f 更新版本号 2023-10-18 13:13:03 +08:00
Kimdiego2098
b8c1f1f5a9 初始化 采集/上传线程时 直接返回线程控制 2023-10-18 13:11:59 +08:00
Kimdiego2098
e027b5cbd6 更新OPCUAClient类库 2023-10-18 13:09:25 +08:00
Kimdiego2098
bf1bd73ad1 更新OPCUAClient类库 2023-10-18 12:45:26 +08:00
Kimdiego2098
86fc95119a 更新OPCUAClient类库 2023-10-18 12:44:58 +08:00
Kimdiego2098
b3a76ea17b 更新版本号与nuget发布 2023-10-18 12:39:42 +08:00
Kimdiego2098
bababd9d53 更新OPCUAClient类库 2023-10-18 12:38:20 +08:00
Diego2098
8cd5180531 !11 补充OPCClient类库事件的缺失文件
Merge pull request !11 from youthalan/N/A
2023-10-18 04:34:34 +00:00
youthalan
f1ccbade8c 补充OPCClient类库事件的缺失文件
Signed-off-by: youthalan <youthalan@126.com>
2023-10-18 04:32:39 +00:00
Diego2098
a66f4b0417 !10 添加连接或断开事件
Merge pull request !10 from youthalan/N/A
2023-10-18 04:20:22 +00:00
youthalan
ff495b2261 修改OPCUAClient类添加连接或断开事件,修改注入时不需要带参数
Signed-off-by: youthalan <youthalan@126.com>
2023-10-18 03:48:05 +00:00
Kimdiego2098
90e5824212 update 3.0.0.16 2023-10-18 00:38:36 +08:00
Kimdiego2098
3d64021062 opcuaClient浏览空间 添加是否显示子变量的选项 2023-10-18 00:36:44 +08:00
Kimdiego2098
fb8ed7428d 更改日志输出内容 2023-10-18 00:15:07 +08:00
Kimdiego2098
bdc273c10a update 3.0.0.15 2023-10-18 00:07:24 +08:00
Kimdiego2098
2d96cffdc7 增加不支持单文件发布的说明 2023-10-17 23:47:24 +08:00
Kimdiego2098
4356fccbcd update tdengineDB plugin 2023-10-17 23:43:48 +08:00
Kimdiego2098
a169fd4ce7 update touchsocket 2023-10-17 23:12:19 +08:00
Kimdiego2098
dcd418139e TD时序库插件,创建时间更改为主键 2023-10-17 23:08:09 +08:00
Kimdiego2098
0cac2062d3 update touchsocket 2023-10-17 23:06:21 +08:00
Kimdiego2098
854c5d4ade 更新nuget包 2023-10-17 21:00:50 +08:00
Kimdiego2098
0f96c6ec84 update SQLDB 2023-10-16 20:50:10 +08:00
Kimdiego2098
b219bd66c1 update touchsocket and other 2023-10-16 20:36:51 +08:00
Kimdiego2098
cb52f2c0b3 3.0.0.13 2023-10-16 17:44:09 +08:00
Kimdiego2098
d3273e03ef 增加关系库存储插件; 2023-10-16 17:40:17 +08:00
Kimdiego2098
afbfd963f3 增加时序库存储插件; 2023-10-16 17:40:13 +08:00
Kimdiego2098
2cd101c5f3 更新pro用户列表 2023-10-16 17:39:14 +08:00
Kimdiego2098
b10bc24dee 3.0.0.12 2023-10-16 08:47:39 +08:00
Kimdiego2098
51a23df861 opcuaclient添加是否加载服务端数据类型的选项 2023-10-16 08:46:46 +08:00
Kimdiego2098
03a0a9dad9 fix:tcpservice dispose err 2023-10-16 08:46:32 +08:00
Diego2098
362c0affbe !9 增加可选择安全订阅
Merge pull request !9 from youthalan/N/A
2023-10-16 00:33:19 +00:00
youthalan
d5b523479f 增加可选择安全订阅,以加快订阅速度
Signed-off-by: youthalan <youthalan@126.com>
2023-10-16 00:26:59 +00:00
Kimdiego2098
7719b8f6d7 更新3.0.0.11 2023-10-15 20:26:18 +08:00
Diego2098
3656c0d524 读取数据类型方法改为批量 2023-10-15 20:21:23 +08:00
Kimdiego2098
8b9e0dd6ea 同步Pro版本 2023-10-13 20:14:35 +08:00
Kimdiego2098
b3921b1037 update touchsocket 2023-10-13 19:16:12 +08:00
Kimdiego2098
d7d96e5dbf update nuget 2023-10-13 16:14:42 +08:00
Kimdiego2098
3934395b7b update 3.0.0.7 2023-10-13 11:54:27 +08:00
Kimdiego2098
04fbe9a529 添加三菱mc 3e帧二进制通讯协议文档 2023-10-13 11:51:51 +08:00
Kimdiego2098
badd6dd9a2 update demo 2023-10-12 18:52:44 +08:00
Kimdiego2098
059082456d 参数名称修改 2023-10-12 14:57:58 +08:00
Kimdiego2098
405b68e22f fix:mqtt保留消息未更新/更新错误 2023-10-12 14:57:36 +08:00
Kimdiego2098
c90bf6692c 3.0.0.6 2023-10-11 16:35:10 +08:00
Kimdiego2098
b5ea5d0cc5 update nuget 2023-10-11 16:28:18 +08:00
Kimdiego2098
243617a1e1 调整代码执行顺序 2023-10-11 16:19:34 +08:00
Kimdiego2098
9e703edd59 update ManageGateway 2023-10-11 10:59:33 +08:00
Kimdiego2098
d6c2cf2810 update ManageGateway 2023-10-11 10:41:09 +08:00
Kimdiego2098
ae7811acfa update 3.0.0.5 2023-10-10 21:09:34 +08:00
Kimdiego2098
e55731c099 fix:modbusRtu写入返回报文缓存逻辑修复 2023-10-10 21:08:42 +08:00
Kimdiego2098
9df5c74da4 update touchsocket 2023-10-10 20:03:40 +08:00
Kimdiego2098
8b75f9f785 update touchsocket 2023-10-10 20:02:15 +08:00
Kimdiego2098
bf12428cf4 fix:signalR razor dispose接口 2023-10-09 18:11:23 +08:00
Kimdiego2098
b551df978b update uaparser 2023-10-09 10:56:22 +08:00
Kimdiego2098
c91d85d2f0 添加MqttRpcDemo 2023-10-07 12:04:17 +08:00
Kimdiego2098
965237fa1f 添加清理日志任务配置参数 2023-10-06 18:28:06 +08:00
Kimdiego2098
24cd9afc06 update 3.0.0.2 2023-10-05 15:32:50 +08:00
Diego2098
602fdefebd update Directory.Build.props 2023-10-05 15:21:51 +08:00
Kimdiego2098
7e7818aa17 修复重启共享通道中的单个设备时,导致通道内其他设备变量异常 2023-10-05 00:34:12 +08:00
Kimdiego2098
27a6023a6a update opcuaclient 2023-10-04 17:12:47 +08:00
Kimdiego2098
3861879900 update opcuaclient 2023-10-04 16:59:15 +08:00
Kimdiego2098
807eeb8351 update nuget 2023-10-04 02:04:09 +08:00
Kimdiego2098
045fa53d58 update 3.0.0.1 2023-10-04 01:42:27 +08:00
Kimdiego2098
69d405ece7 实时报警列表线程同步 2023-10-04 01:27:03 +08:00
Kimdiego2098
d3dc4d0c5b modbusRtu 适配器 过滤干扰头部数据 2023-10-04 01:26:44 +08:00
Kimdiego2098
7beba1188e 更新种子数据 2023-10-04 01:24:34 +08:00
Kimdiego2098
9779ebe12c update windowsService bat 2023-10-03 19:11:42 +08:00
Kimdiego2098
f72cfaa093 update demo 2023-10-03 18:54:01 +08:00
Kimdiego2098
cf8ccafb4a rpc调用提示优化 2023-10-03 18:20:39 +08:00
Kimdiego2098
7fe281b0b8 fix:rpc 特殊方法分类错误 2023-10-03 17:05:49 +08:00
Kimdiego2098
5f70e9574f update demo 2023-10-02 22:37:50 +08:00
Kimdiego2098
4be51923ba update driverDebugPage 2023-10-02 18:34:55 +08:00
Kimdiego2098
a72c78f4a4 update opcuaClient 2023-10-02 18:30:58 +08:00
Diego2098
b4d32a6de1 add s7 wstring addressSign 2023-10-01 16:54:42 +08:00
Diego2098
8a6b2d5daa add s7 wstring addressSign 2023-10-01 16:49:07 +08:00
Diego2098
bebadeef14 更新demo 2023-10-01 13:33:25 +08:00
Kimdiego2098
3551be67f0 update demo csproj 2023-10-01 00:33:33 +08:00
Kimdiego2098
1103950b25 add EncodingMapper 2023-10-01 00:25:04 +08:00
Kimdiego2098
9d06e01cec 更新文档 2023-09-30 23:28:50 +08:00
Kimdiego2098
24be946b7e 默认不启用远程更新 2023-09-30 23:23:44 +08:00
Kimdiego2098
f56d2fc60f 更新readme 2023-09-30 23:09:48 +08:00
Kimdiego2098
9f8356f409 同步3.0.0版本代码 2023-09-30 23:05:53 +08:00
Kimdiego2098
8e6345d938 更新文档 2023-09-26 20:03:58 +08:00
Kimdiego2098
0eac78bd1c 2.1.0.15 2023-09-20 11:50:06 +08:00
Kimdiego2098
21db2502d0 2.1.0.15 2023-09-20 11:47:10 +08:00
Kimdiego2098
38c3492123 添加kafka/mq/iotsharp的间隔上传 2023-09-20 11:46:17 +08:00
Diego2098
6376bff476 fix:上传设备选择驱动时没有正确刷新 2023-09-18 00:10:02 +08:00
Kimdiego2098
38495a3ebc 2.1.0.14 2023-09-15 14:02:15 +08:00
Kimdiego2098
cf00897be2 ExpressionEvaluator改为多实例 2023-09-15 14:01:54 +08:00
Kimdiego2098
da640f24ec 2.1.0.13 2023-09-15 13:23:59 +08:00
Kimdiego2098
ed6a777c42 add dispose() 2023-09-15 13:23:39 +08:00
Kimdiego2098
81af4485d3 2.1.0.12 2023-09-15 13:20:29 +08:00
Kimdiego2098
94d8f0237d 更新多个依赖包版本 2023-09-15 13:19:04 +08:00
Kimdiego2098
c5e579dd38 修复因重复注册cancellationToken.Register导致的内存暴涨! 2023-09-15 13:17:36 +08:00
Kimdiego2098
7865e76ee2 CancellationToken代替CancellationTokenSource传入 2023-09-15 13:16:56 +08:00
Kimdiego2098
4d37212cc0 2.1.0.11 2023-09-11 09:35:24 +08:00
Kimdiego2098
9ca43f0bb4 feat:ManageGatewayWorker part 2023-09-11 09:31:26 +08:00
Kimdiego2098
fe8d262175 feat:ManageGatewayWorker part 2023-09-11 09:09:48 +08:00
Kimdiego2098
493d6e7165 feat:ManageGatewayWorker part 2023-09-11 09:09:03 +08:00
Kimdiego2098
17b630bcd8 TGAPPInfp更名APPInfo 2023-09-11 08:57:13 +08:00
Kimdiego2098
018c5ad3b4 Merge branch 'master' of https://gitee.com/dotnetchina/ThingsGateway 2023-09-11 08:54:01 +08:00
Kimdiego2098
a14b4da977 feat:ManageGatewayWorker part 2023-09-11 08:53:52 +08:00
Diego2098
01b4597cc7 !7 修复无法修改变量值问题
Merge pull request !7 from 如阳如木/master
2023-09-07 10:14:45 +00:00
如阳如木
0b083ccc1c 删除&& LastSetValue?.ToString() != data?.ToString()
Signed-off-by: 如阳如木 <970143933@qq.com>
2023-09-07 08:42:49 +00:00
Kimdiego2098
ca22cb0eae ManageGatewayConfig.json 2023-09-06 17:29:58 +08:00
Kimdiego2098
bcbb8e5f8c fix:_mqttServer null error 2023-09-06 17:27:36 +08:00
Kimdiego2098
bea286cdd4 2.1.0.10 2023-09-06 17:16:28 +08:00
Kimdiego2098
892d2ee8d2 从数据库取原属性 2023-09-06 17:14:24 +08:00
Kimdiego2098
7440608c14 更改变量 最近一次值 为 上次值 2023-09-06 16:44:58 +08:00
Kimdiego2098
6246f0295b 更改 变量最近一次值 为 上次值 2023-09-06 16:44:42 +08:00
Kimdiego2098
53c39d9b43 2.1.0.9 2023-09-06 16:30:50 +08:00
Kimdiego2098
9a50b60031 fix:串口断连/拔出/断电等情况,重新连接 2023-09-06 16:29:48 +08:00
Kimdiego2098
fd74527320 feat:ManageGatewayWorker part 2023-09-06 16:15:38 +08:00
Kimdiego2098
f91fb522ac feat:ManageGatewayWorker part 2023-09-06 16:10:29 +08:00
Kimdiego2098
7019c02b18 feat:ManageGatewayWorker part 2023-09-05 23:59:18 +08:00
Kimdiego2098
94f8422b9b feat:ManageGatewayWorker part 2023-09-05 23:37:02 +08:00
Kimdiego2098
b25c01567a feat:ManageGatewayWorker part 2023-09-05 23:33:02 +08:00
Kimdiego2098
b9329885de 2.1.0.8 2023-09-05 09:19:58 +08:00
Kimdiego2098
ac88c4cff9 fix:PeriodicTimer dispose 2023-09-05 09:17:26 +08:00
Kimdiego2098
9674f2d238 2.1.0.7 2023-09-05 09:06:39 +08:00
Kimdiego2098
38c9ecb6f1 fix:error!the stream dispose 2023-09-05 09:04:34 +08:00
Kimdiego2098
be9e9cdd5a Revert "fix:error!the stearm dispose"
This reverts commit a6d99fe227.
2023-09-05 09:03:49 +08:00
Kimdiego2098
afdaf07446 feat:mqttBroker part 2023-09-05 08:58:49 +08:00
Kimdiego2098
5caaf10225 fix:error!the stearm dispose 2023-09-05 08:57:42 +08:00
Diego2098
daffc3a776 feat:mqttBroker part 2023-09-04 22:34:31 +08:00
Diego2098
34c9748ce5 fix:uploadDeivce复制多个,ID重复问题 2023-09-04 22:11:50 +08:00
Diego2098
f17acbf4d1 刷新后选择行清空 2023-09-04 22:09:26 +08:00
Diego2098
229f56ce2f fix:采集设备线程初始化时更新活跃时间 2023-09-04 20:13:49 +08:00
Diego2098
0847bedc51 fix:特殊情况下无法获取程序集文件修改日期,所以去除 页脚-编译时间显示 2023-09-04 19:49:17 +08:00
Kimdiego2098
9e4546c305 fix:sqlsugar json支持类型改为bigstring 2023-09-04 17:09:38 +08:00
Kimdiego2098
97b01bf26a 更新文档 2023-09-04 15:03:03 +08:00
Kimdiego2098
e7011628d0 恢复Sqlite默认数据库 2023-09-02 19:17:32 +08:00
Kimdiego2098
044ffdecbd fix: page取消注入瞬时服务,改为App.GetService 2023-09-02 19:13:57 +08:00
Kimdiego2098
1a06a3543b feat:mqttBroker part 2023-09-02 13:55:21 +08:00
Kimdiego2098
5fedc0bf1e 更新文档 2023-08-31 09:17:59 +08:00
Kimdiego2098
7a881f867e 更新 变量管理-上传设备筛选功能 2023-08-31 08:58:30 +08:00
Kimdiego2098
dfe73a6cfb 2.1.0.6 2023-08-30 17:19:18 +08:00
Kimdiego2098
45d0fb27ad add windows service create/delete bat 2023-08-30 17:18:35 +08:00
Kimdiego2098
31890af61d update statusPage; 2023-08-30 14:12:50 +08:00
Kimdiego2098
a54b3ecc15 默认检测重连频率为10分钟 2023-08-29 17:56:59 +08:00
Kimdiego2098
c37cd1bd51 2.1.0.5 2023-08-29 17:44:28 +08:00
Kimdiego2098
0e3ee89cbf 添加报文日志入库选项 2023-08-29 17:42:56 +08:00
Kimdiego2098
a049176c14 添加 页脚 编译时间显示 2023-08-29 17:01:46 +08:00
Kimdiego2098
5ef2b0089e 调整导入excel错误提示 2023-08-29 16:45:54 +08:00
Kimdiego2098
1cc4899593 update opcdaclient null error 2023-08-29 15:24:29 +08:00
Kimdiego2098
26d1390be9 update GetBoolValue 2023-08-29 12:40:21 +08:00
Kimdiego2098
dc65584fb3 调整种子文件,增加Pro版本种子文件录入 2023-08-29 09:42:54 +08:00
Kimdiego2098
b3d5a708d5 更新2.1.0.4 2023-08-28 19:31:00 +08:00
Kimdiego2098
904a5d296b 修复串口基类 缓存包 失效错误;完善modbusrtu长度校验 2023-08-28 19:25:22 +08:00
Kimdiego2098
cc82e6a47a 更新touchsocket版本,更新2.1.0.3 2023-08-28 18:12:18 +08:00
Kimdiego2098
a9d02ec854 修复浏览大量节点空间时,BrowseNext方法参数releaseContinuationPoints改为false 2023-08-28 17:44:02 +08:00
Kimdiego2098
6b5a2d3767 修复调试界面-opcuaclient浏览节点展开逻辑错误 2023-08-28 10:51:35 +08:00
Kimdiego2098
10d9060b94 更新小版本2.1.0.2 2023-08-27 17:17:37 +08:00
Kimdiego2098
8441839c01 更新dlt645地址说明 2023-08-27 17:16:59 +08:00
Kimdiego2098
b669f5838f 添加日志查询 时间区间条件 2023-08-27 16:58:45 +08:00
Kimdiego2098
1a942f9ce1 2.1.0.1 2023-08-27 16:31:03 +08:00
Kimdiego2098
ae840758f7 dlt645添加数据标识校验 2023-08-27 16:30:32 +08:00
Kimdiego2098
082c08e5f9 更新dlt645,添加地址/控制码的校验规则 2023-08-27 16:15:51 +08:00
Kimdiego2098
74a43557ab 更新touchsocket 2023-08-27 15:59:57 +08:00
Kimdiego2098
184271789d 更新 Opc.Ua Version="1.4.372.56" 2023-08-27 14:33:24 +08:00
Kimdiego2098
fa61b0cad8 opcda/ua浏览地址空间 初始只加载首层节点 2023-08-27 14:14:47 +08:00
Kimdiego2098
7b197a90d1 opcuaclient浏览地址空间 初始只加载首层节点 2023-08-27 13:06:03 +08:00
Diego2098
62384af2f6 update MqttNetLogger 2023-08-26 21:38:14 +08:00
Diego2098
b466202a1a update MqttNetLogger 2023-08-26 20:40:23 +08:00
Diego2098
7ab38c18d8 添加在线/离线方法参数 2023-08-26 17:18:47 +08:00
Diego2098
39841ee43e 更新opcuaclient 2023-08-26 15:38:22 +08:00
Diego2098
e419800d98 更新opcuaclient,添加checkDomain属性,去除多余代码,更新SelectEndpoint方法 2023-08-26 15:33:03 +08:00
Kimdiego2098
63c99ab69a 更新文档 2023-08-25 19:49:02 +08:00
Kimdiego2098
e2a8fd2279 更新版本2.1.0 2023-08-25 19:45:28 +08:00
Kimdiego2098
bbde520471 更新解决方案 2023-08-25 19:38:47 +08:00
Kimdiego2098
45fb12f98e 更新DLT645文档 2023-08-25 19:33:33 +08:00
Kimdiego2098
4be3dcce50 添加DLT645_2007协议插件 2023-08-25 19:33:08 +08:00
Kimdiego2098
d12a41c769 调整Test位置 2023-08-25 19:32:27 +08:00
Kimdiego2098
ed9a58c9ed 调整非主从协议的状态判断策略;OPCUA去除主动连接 2023-08-25 17:23:00 +08:00
Kimdiego2098
4389cea5a1 crc校验优化 2023-08-22 17:01:10 +08:00
Kimdiego2098
d24854920b OPCUAClient添加是否使用SourceTime的选项 2023-08-22 16:15:34 +08:00
Kimdiego2098
9902443bee 更新文档 2023-08-22 12:21:45 +08:00
Kimdiego2098
8040b2ef16 2.0.9.3 2023-08-22 11:31:36 +08:00
Kimdiego2098
4533680b10 去除mqtt throw an _MqttConnectingFailedException_.报错信息 2023-08-22 11:26:22 +08:00
Kimdiego2098
3b28175135 更新批量写入方法,注意rpc入口参数变化,mqtt等RPC接口参数变化 2023-08-22 11:23:03 +08:00
Kimdiego2098
8e22812265 修正部分代码格式 2023-08-21 19:59:07 +08:00
Kimdiego2098
409bc91b9e 2.0.9.2 2023-08-19 12:08:49 +08:00
Kimdiego2098
61fe543a2a xml 2023-08-19 11:06:05 +08:00
Kimdiego2098
8a949a7e64 修复TcpClient重复释放导致锁异常 2023-08-19 11:05:29 +08:00
Kimdiego2098
b0dc9fb97a mas1.0.2默认中文 2023-08-18 18:36:30 +08:00
Kimdiego2098
83114d1002 更新masa1.0.2 2023-08-18 13:59:17 +08:00
Kimdiego2098
94a25a903f 2.0.9.1 2023-08-18 13:33:45 +08:00
Kimdiego2098
4f402f9e55 修改锁为EasyLock 2023-08-18 12:07:01 +08:00
Kimdiego2098
27bb2e3dcc 代码文件编码统一utf-8 2023-08-18 09:57:03 +08:00
Kimdiego2098
66cc52f6ec 更换DEMO Include为PackageReference 2023-08-17 15:30:35 +08:00
Kimdiego2098
ed1367b116 底层驱动添加netstandard输出 2023-08-17 15:24:07 +08:00
Kimdiego2098
5c055352e4 2.0.8 2023-08-17 10:58:48 +08:00
Kimdiego2098
8dcff5ada1 调整readme,方便copy账密 2023-08-17 10:28:47 +08:00
Kimdiego2098
4b8b23d7d5 优化变量地址输入分割方法;s7读写字符串添加默认编码 2023-08-17 09:50:10 +08:00
Kimdiego2098
e576f6aed3 优化s7读写字符串,更改特殊方法为读写共用 2023-08-16 17:20:20 +08:00
Kimdiego2098
97ab04da91 修复写入返回结果时的解析,0XFF为成功 2023-08-16 15:56:25 +08:00
Kimdiego2098
c6361bb36e 修复s7字符串打包读取 2023-08-16 15:47:37 +08:00
Kimdiego2098
b0b3dc225d 修复s7字符串读取 2023-08-16 15:35:15 +08:00
Kimdiego2098
9cbaba192a 主动释放锁 2023-08-16 14:56:47 +08:00
Kimdiego2098
f511598e13 OPCUA死区不再固定传入 2023-08-16 14:21:19 +08:00
Kimdiego2098
5ffff3b7aa fix: 优化JsonUtils中的获取type语句顺序 2023-08-16 08:59:18 +08:00
Kimdiego2098
24c4fa1c4f OPC系列增加导出excel/导入系统双选项 2023-08-15 17:38:40 +08:00
Kimdiego2098
7f312c1273 OPCUA采集设备写入字符串,不再需要传入双引号 2023-08-15 14:15:39 +08:00
Kimdiego2098
ef5c226c81 历史数据/报警 线程初始化时不再阻塞 2023-08-15 12:12:00 +08:00
Kimdiego2098
3f029cf799 更改ItemGroup Condition条件 2023-08-14 17:36:59 +08:00
Kimdiego2098
5bf64a8bec 传播token;
更新admin解决方案
2023-08-14 16:43:30 +08:00
Kimdiego2098
89f9c537f8 优化适配器解析代码 2023-08-14 14:21:00 +08:00
Kimdiego2098
e8d7f57818 2.0.6 2023-08-13 16:57:12 +08:00
Kimdiego2098
9b42fa78e7 OPCUACClient订阅初始化添加trycatch 2023-08-13 16:29:59 +08:00
Kimdiego2098
96d98e8f39 Merge branch 'master' of https://gitee.com/dotnetchina/ThingsGateway 2023-08-13 15:53:33 +08:00
Kimdiego2098
1f3a281e78 更新opcuaclient,初始读取server类型改为动态读取 2023-08-13 15:50:47 +08:00
Diego2098
dab4b66ee0 更新nuget包 2023-08-12 12:09:50 +08:00
Kimdiego2098
64dd192ddb 修复批量令牌强退失效 2023-08-11 15:15:50 +08:00
Kimdiego2098
b0a5c383d0 中间变量导入时添加标识 2023-08-11 14:15:22 +08:00
Kimdiego2098
4836cc99eb 2.0.5 2023-08-10 18:23:40 +08:00
Kimdiego2098
ba33873354 去除不需要的模板 2023-08-10 16:28:52 +08:00
Kimdiego2098
12c838cab0 修改详情模板 2023-08-10 11:23:18 +08:00
Kimdiego2098
a83a1c83a7 添加自定义详情模板 2023-08-10 10:35:19 +08:00
Kimdiego2098
2234f47170 底层修改:如果连接端口断开,停止等待返回 2023-08-10 10:35:01 +08:00
Kimdiego2098
4bae1b17fc 上传DTO添加 单位 参数 2023-08-10 09:09:09 +08:00
Kimdiego2098
6a7a0e0fa6 调整调试页面 2023-08-09 23:45:53 +08:00
Kimdiego2098
bff987c55f 添加单文件发布配置 2023-08-09 15:12:55 +08:00
Kimdiego2098
e467006913 去除页面多余引号 2023-08-09 13:45:27 +08:00
Kimdiego2098
1d646d4a6d 更新2.0.4 2023-08-09 13:00:10 +08:00
Kimdiego2098
70bd4936a1 更新opcua写入 2023-08-09 12:43:05 +08:00
Kimdiego2098
5ae7add6d2 更新opcua调试页面 2023-08-09 12:01:23 +08:00
Kimdiego2098
02b206ce7c 更新opcua 2023-08-09 11:47:04 +08:00
Kimdiego2098
2ea626a567 修复中间变量导入错误 2023-08-09 09:00:49 +08:00
Kimdiego2098
653909ec11 修正错误注释 2023-08-08 18:09:23 +08:00
Kimdiego2098
1d7c148eaf opcua添加初始化连接错误重试 2023-08-08 18:04:24 +08:00
Kimdiego2098
94a7e130ca 更新readme 2023-08-08 16:14:06 +08:00
Kimdiego2098
609abacdf0 优化大量设备线程重启的耗时 2023-08-08 14:02:00 +08:00
Kimdiego2098
033ff2e49a 2.0.3 2023-08-08 12:59:14 +08:00
Kimdiego2098
00a9bf0641 底层部分方法更改 2023-08-08 12:31:42 +08:00
Kimdiego2098
100f322456 报警/历史值查询时区转换 2023-08-08 09:05:15 +08:00
Kimdiego2098
2251e08d30 时间最小最大值时不再转换时区 2023-08-08 08:39:20 +08:00
Kimdiego2098
14e9beef53 Merge branch 'master' of https://gitee.com/dotnetchina/ThingsGateway 2023-08-08 08:28:37 +08:00
Kimdiego2098
c7cce23d54 默认不启用单用户登录 2023-08-08 08:28:27 +08:00
Diego2098
7becf32352 更新文档 2023-08-07 22:31:51 +08:00
Diego2098
741eda9f4e 去除DateTimeOffset类型 2023-08-07 22:30:38 +08:00
Kimdiego2098
473f51481c 更新文档 2023-08-07 17:38:53 +08:00
Kimdiego2098
684f9bd11b 更新readme 2023-08-07 17:34:32 +08:00
Kimdiego2098
b4b7f0c360 更新文件 2023-08-07 17:24:28 +08:00
Kimdiego2098
cf42d02628 更新文件 2023-08-07 17:16:53 +08:00
Kimdiego2098
cc9a9eab7b 更新文件 2023-08-07 16:56:45 +08:00
Kimdiego2098
784d6abc9b 更新文件 2023-08-07 16:33:36 +08:00
Kimdiego2098
0eafc07184 更新文件 2023-08-07 16:30:23 +08:00
Kimdiego2098
7e9499bd2e 更新文件 2023-08-07 15:46:30 +08:00
Kimdiego2098
d01a52aa95 更新文件 2023-08-07 15:36:49 +08:00
Kimdiego2098
6bcd492980 去除多余解决方案配置 2023-08-07 15:31:22 +08:00
Kimdiego2098
96b15da04b 添加发布脚本 2023-08-07 15:23:53 +08:00
Kimdiego2098
e0f1801693 更新readme 2023-08-07 15:18:42 +08:00
Kimdiego2098
d195ad85c5 更新readme 2023-08-07 15:13:21 +08:00
Kimdiego2098
773f7b6c1b 更新文档 2023-08-07 15:10:42 +08:00
Kimdiego2098
40f29fe399 2.0.0 2023-08-07 15:09:53 +08:00
Kimdiego2098
b19eb117c1 调试更新Blazor代码时不再跳转登录界面 2023-07-25 22:00:27 +08:00
Kimdiego2098
f930ba5eff 取消不必要的错误日志 2023-07-25 20:50:33 +08:00
Kimdiego2098
fbbda6c230 变量值更新错误提示; 2023-07-25 20:48:17 +08:00
Kimdiego2098
47db4968e5 优化大批量excel变量表导入效率 2023-07-25 18:26:48 +08:00
Kimdiego2098
1aff2e518c 删除不必要延时 2023-07-25 16:52:56 +08:00
Kimdiego2098
24134ca49e 发布1.7.6 2023-07-25 14:22:11 +08:00
Kimdiego2098
aadbe05a5e 优化导入excel效率 2023-07-25 14:21:17 +08:00
Kimdiego2098
18eddf4700 添加上传插件获取采集设备属性值的快捷方法 2023-07-23 13:44:37 +08:00
Kimdiego2098
0869ba7e70 Merge branch 'master' of https://gitee.com/dotnetchina/ThingsGateway 2023-07-23 09:59:11 +08:00
Kimdiego2098
cba5db1c53 线程完成时不再需要全局数据移除,有可能会导致偶发全局数据丢失 2023-07-23 09:58:43 +08:00
Kimdiego2098
0aa5430e23 线程完成时不要需要全局数据移除,有可能会导致偶发全局数据丢失 2023-07-23 09:57:03 +08:00
Kimdiego2098
88a91828cb 更新icon包版本 2023-07-23 00:03:46 +08:00
Kimdiego2098
27af89f5fe 更新icon包版本 2023-07-22 23:59:03 +08:00
Kimdiego2098
6f6d483bfe 修改插件日志为自定义日志 2023-07-22 23:34:09 +08:00
Kimdiego2098
915072c191 更新文档 2023-07-22 20:48:29 +08:00
Kimdiego2098
76077b92ae 发布1.7.4 2023-07-22 20:47:26 +08:00
Kimdiego2098
f0d1a527a5 修正错误名称 2023-07-22 20:32:34 +08:00
Kimdiego2098
fdb2a96d1c 添加上传插件最后错误原因 2023-07-22 20:10:45 +08:00
Kimdiego2098
849e3ac187 修复上传设备暂停按钮失效 2023-07-22 19:56:56 +08:00
Kimdiego2098
5c4cf21c59 OPCUAServer 数组维度不再写any;rpc写入添加延时 2023-07-22 17:02:44 +08:00
Kimdiego2098
40ee3e5d9b 更改假死检测间隔5分钟 2023-07-22 11:05:56 +08:00
Kimdiego2098
77a7cc034e 添加OPCUAServer线程间隔配置项,优化最后一次错误提示 2023-07-22 11:03:56 +08:00
Kimdiego2098
82b7881765 支持OPCUAServer数组类型,添加缓存文件存在判断 2023-07-21 21:28:39 +08:00
Kimdiego2098
3515775267 去除OPCUA写入数组维度校验 2023-07-20 17:37:49 +08:00
Kimdiego2098
10e12aa1c1 更新文档 2023-07-20 12:48:13 +08:00
Kimdiego2098
7fb4e62aa3 kafka尝试自动加载c库 2023-07-20 12:40:59 +08:00
Kimdiego2098
2605eaa614 修复中间变量Rpc写入 2023-07-20 10:55:37 +08:00
Kimdiego2098
8e97b4820d ModbusServer添加自定义循环间隔,修复中间变量写入 2023-07-20 10:55:17 +08:00
Kimdiego2098
89af4cdb68 更新文档 2023-07-19 18:02:31 +08:00
Kimdiego2098
6099c1a25a 更新文档 2023-07-19 15:43:28 +08:00
Kimdiego2098
fd23758aea 更改左侧菜单为手风琴效果 2023-07-19 15:00:40 +08:00
Kimdiego2098
8ad0b89db1 更新文档 2023-07-19 14:34:27 +08:00
Kimdiego2098
e7dffa3ff4 修改OPCUAClient心跳频率默认3s 2023-07-18 14:49:27 +08:00
Kimdiego2098
2772b5d2e2 更改OPCUAClient心跳频率为30000 2023-07-18 14:15:02 +08:00
Kimdiego2098
df6d9b5f70 更新1.7.3版本 2023-07-18 12:16:33 +08:00
Kimdiego2098
c9622d6d57 更新masa 稳定版以及其他包 2023-07-18 12:11:37 +08:00
Kimdiego2098
1f0b7c3c7e 修复添加订阅时,值死区过滤逻辑 2023-07-18 11:13:21 +08:00
Kimdiego2098
c12245037e 修复异步锁上下文切换导致OPCUA 心跳事件出错 2023-07-18 09:58:01 +08:00
Kimdiego2098
fe6d2a50a5 修复OPCUAClient调试界面重复输出订阅值 2023-07-18 08:51:27 +08:00
Kimdiego2098
7be84950f8 修改OPCUAClient的心跳频率配置项 2023-07-18 08:48:18 +08:00
Kimdiego2098
ba212da222 添加重启锁 2023-07-17 21:40:47 +08:00
2248356998 qq.com
122b833256 Merge branch 'master' of https://gitee.com/diego2098/thingsgateway-docs 2023-07-17 20:59:53 +08:00
2248356998 qq.com
7c73479041 更新opcua心跳状态日志 2023-07-17 20:59:32 +08:00
Diego2098
151f2e99ae 更新文档 2023-07-16 20:46:16 +08:00
Diego2098
da367e813f 更新授权名单 2023-07-16 20:31:56 +08:00
2248356998 qq.com
9143dfe336 更新文档 2023-07-16 18:27:22 +08:00
2248356998 qq.com
29914d6a72 更新文档 2023-07-16 18:12:55 +08:00
2248356998 qq.com
0dbef72a97 更新文档 2023-07-16 18:07:31 +08:00
2248356998 qq.com
3bb118bfe1 更新文档 2023-07-16 17:49:33 +08:00
2248356998 qq.com
85ce3be077 更新文档 2023-07-16 17:48:22 +08:00
2248356998 qq.com
064c2bf0a8 更新文档 2023-07-16 17:41:52 +08:00
2248356998 qq.com
c96d06ccc5 更新文档 2023-07-16 17:35:04 +08:00
2248356998 qq.com
a658dbb753 更新文档地址 2023-07-16 17:32:49 +08:00
2248356998 qq.com
bf5d5b629e 迁移文档 2023-07-16 17:28:26 +08:00
2248356998 qq.com
241d576519 冗余设备删除后会导致后台出错 2023-07-16 11:36:45 +08:00
2248356998 qq.com
7807e9bdd0 更新readme 2023-07-16 10:28:43 +08:00
2248356998 qq.com
fcbf15fed6 删除无用属性 2023-07-16 09:40:00 +08:00
2248356998 qq.com
cd90a11209 修复1.7.0版本修改导致的mqttrpc映射错误 2023-07-15 22:56:28 +08:00
2248356998 qq.com
ff65707ea2 增加 上传插件的列表分割大小,因为某些情况下传输字节太大会导致失败 2023-07-15 22:42:34 +08:00
2248356998 qq.com
b16026070c 导入提示的当前行显示未初始 2023-07-15 22:35:12 +08:00
2248356998 qq.com
1b5fbf86d8 格式化整理 2023-07-15 22:32:54 +08:00
2248356998 qq.com
5eb1be8101 插件报文截取前200字符,防止页面渲染过多 2023-07-15 20:04:14 +08:00
2248356998 qq.com
6a863cd26a kafka插件增加超时选项 2023-07-15 17:27:35 +08:00
2248356998 qq.com
87ebb7b6c7 历史服务修复变量在线状态显示错误 2023-07-15 15:46:39 +08:00
2248356998 qq.com
1233a74307 发布1.7.2版本 2023-07-15 11:10:29 +08:00
2248356998 qq.com
221890acfb 优化OPCUA错误提示 2023-07-14 17:33:11 +08:00
2248356998 qq.com
687c7e766e OPCUA在取消订阅时应该走读取方法 2023-07-14 17:22:19 +08:00
2248356998 qq.com
ba22c407d3 优化导入excel提示 2023-07-14 16:23:42 +08:00
2248356998 qq.com
a8b9ed56b5 优化导入excel提示 2023-07-14 16:23:35 +08:00
2248356998 qq.com
3004869e19 kafka 插件释放时取消事件注册 2023-07-14 14:35:40 +08:00
2248356998 qq.com
1145853fe1 更改属性说明 2023-07-14 12:23:46 +08:00
2248356998 qq.com
f1617a25b1 添加kafka插件null传播 2023-07-14 10:41:04 +08:00
2248356998 qq.com
932be558d9 opcda JValue转object 2023-07-14 10:14:05 +08:00
2248356998 qq.com
ee3a37d3b9 opcua读取值JValue转为object 2023-07-14 10:04:05 +08:00
2248356998 qq.com
5ac412a582 RabbitMQ,IotSharp添加离线缓存 2023-07-13 19:54:12 +08:00
2248356998 qq.com
1625290bc3 Variable Value数据类型改为object 2023-07-13 18:18:53 +08:00
2248356998 qq.com
1ec169ad49 中间变量页种子ID重复 2023-07-13 17:47:22 +08:00
2248356998 qq.com
53be552e44 复制设备没有及时刷新缓存 2023-07-13 17:38:45 +08:00
2248356998 qq.com
d3a75d46b9 发布1.7.1 2023-07-13 11:19:17 +08:00
2248356998 qq.com
256512c961 代码格式化 2023-07-13 11:18:36 +08:00
2248356998 qq.com
5c12ac5bcc OPCDA增加数组支持,增加写入动态类型支持 2023-07-13 11:16:31 +08:00
2248356998 qq.com
02a2bcb113 优化OPCUA数组类型转换 2023-07-13 09:02:36 +08:00
2248356998 qq.com
1f0a01c725 修复blazor界面null错误 2023-07-12 22:12:11 +08:00
2248356998 qq.com
6ea164ede1 更新ReadMe 2023-07-12 21:33:05 +08:00
2248356998 qq.com
65bae85ecc 删除重复文件 2023-07-12 21:30:41 +08:00
2248356998 qq.com
2fd7dcf4d0 更新nuget包 2023-07-12 21:21:50 +08:00
2248356998 qq.com
aa3bbbe038 V1.7.0发布
1、增加采集通道冗余
2、优化多个界面
3、导出导入功能优化
4、增加中间变量
5、OPCUAClient支持动态类型
6、离线缓存多处覆盖,包含上传插件/历史报警/时序库
7、增加通用调试界面,增加s7调试
8、其他优化
2023-07-12 21:16:38 +08:00
2248356998 qq.com
6cb09a6f95 修复AppDataTable清空MForm模型导致筛选列清空的问题 2023-07-10 13:18:14 +08:00
2248356998 qq.com
45868f05d3 修复写入s7协议 bit值 偏移错误(以byte数据块为准) 2023-07-08 17:01:44 +08:00
2248356998 qq.com
aac7401e20 修复读取s7协议 bit值 偏移错误(以byte数据块为准) 2023-07-08 11:44:57 +08:00
2248356998 qq.com
c2fc290edd 默认添加kafka插件 种子数据 2023-07-07 17:13:00 +08:00
2248356998 qq.com
330357fc36 修复布尔量解析时反转字节导致结果值不符的错误 2023-07-06 14:05:09 +08:00
2248356998 qq.com
f4a3d6a64e null传播 2023-07-03 14:13:00 +08:00
2248356998 qq.com
2e0963ec81 添加x86架构 2023-07-03 10:48:52 +08:00
2248356998 qq.com
897cb6e62a 补充插件实例内容 2023-07-02 19:50:09 +08:00
2248356998 qq.com
80868bd48e blazor组件初始化并行执行,导致sugar单例DB出现线程偶发错误,暂增加copyNew()解决 2023-06-29 16:42:19 +08:00
2248356998 qq.com
b3df78c56f blazor组件初始化并行执行,导致sugar单例DB出现线程偶发错误,暂增加copyNew()解决 2023-06-29 16:36:03 +08:00
2248356998 qq.com
783a4259e3 sqlsugar偶发线程故障,添加copyNew方法 2023-06-28 18:54:45 +08:00
2248356998 qq.com
fcf19b8dc8 登录跳转uri优化 2023-06-28 15:47:35 +08:00
2248356998 qq.com
1f9f89817d 更新开源说明 2023-06-28 10:48:33 +08:00
2248356998 qq.com
7b94da7d85 update openapiUser datatableUI 2023-06-26 19:51:02 +08:00
2248356998 qq.com
164406f6c2 css脚本结果不采用 System.Text.Json.JsonSerializer 2023-06-26 19:44:17 +08:00
2248356998 qq.com
90ef2adc6b OPCUAClient修复当变量为string类型时的数值过滤失败导致添加订阅失效 2023-06-26 19:43:00 +08:00
2248356998 qq.com
d65f10f88b 停用采集设备时,变量获取运行态出错 2023-06-26 16:43:48 +08:00
2248356998 qq.com
dca0ece9e0 登录后跳转原url 2023-06-26 14:46:24 +08:00
2248356998 qq.com
baabc155c8 cookie授权验证失败时返回登录界面 2023-06-26 14:36:41 +08:00
Diego2098
7eb94412d6 更新nuget类库 2023-06-25 18:59:09 +08:00
2248356998 qq.com
0fc8b24f85 添加报警事件None枚举 2023-06-20 13:10:58 +08:00
2248356998 qq.com
88f6ef5b96 修复cpu核心等于1时报错,修正登录错误提示 2023-06-20 09:09:08 +08:00
Diego2098
7442483419 修复modbusServer 初始化错误 2023-06-17 18:14:13 +08:00
2248356998 qq.com
9c61933c04 sugar添加取消令箭 2023-06-15 17:38:36 +08:00
2248356998 qq.com
2b36a99720 增加变量运行态 CollectVariableRuntime 所在设备属性 2023-06-15 16:50:08 +08:00
2248356998 qq.com
c2cfc42ba4 parallel.foreach无序体验不好,退回为foreach 2023-06-14 11:04:09 +08:00
2248356998 qq.com
4f32704e08 update 1.6.1 version 2023-06-13 22:39:47 +08:00
2248356998 qq.com
fccf43685f update nuget package 2023-06-13 22:39:25 +08:00
2248356998 qq.com
39135d81ad update driver messagesui 2023-06-13 22:26:19 +08:00
2248356998 qq.com
ff4b10681e 并行关闭线程 2023-06-12 14:41:08 +08:00
2248356998 qq.com
10b7908fc2 添加mqtt/kafka上传内容显示 2023-06-12 14:40:53 +08:00
2248356998 qq.com
31790da8c6 优化大量变量excel上传的验证过程 2023-06-12 11:35:27 +08:00
2248356998 qq.com
4621201c47 更新文档站点地址 2023-06-11 18:37:50 +08:00
2248356998 qq.com
692ac31dbf 删除docs 2023-06-11 18:22:15 +08:00
2248356998 qq.com
ed1d163d55 更新1.6.0版本 2023-06-11 17:58:57 +08:00
2248356998 qq.com
e931c9040c 缓存最大默认2000 2023-06-11 17:56:34 +08:00
2248356998 qq.com
f23cb48ea4 添加离线缓存大小限制配置 2023-06-11 17:55:03 +08:00
2248356998 qq.com
c3b2b6b07b 上传插件线程等待时间改为10ms 2023-06-11 17:47:16 +08:00
2248356998 qq.com
f89bf590ba 导入变量优化 2023-06-11 17:46:23 +08:00
2248356998 qq.com
fea17dc00b 添加mqttClient离线缓存 2023-06-11 17:45:46 +08:00
2248356998 qq.com
dbb1069920 添加kafka离线缓存 2023-06-11 17:45:27 +08:00
Diego2098
afc4ccfaa9 !6 部分配置会导致SqlServer自动建库失败
Merge pull request !6 from samisgod/master
2023-06-10 06:55:34 +00:00
samisgod
38d55a1c07 fix db init for SqlServer 2023-06-10 14:51:29 +08:00
2248356998 qq.com
5fca29f103 增加pwa 2023-06-09 17:53:41 +08:00
2248356998 qq.com
78f34b2ca4 修复停用验证码时登录失败显示null报错 2023-06-09 17:09:17 +08:00
2248356998 qq.com
8e8028e809 统一文件编码 2023-06-09 15:04:54 +08:00
2248356998 qq.com
8dc70687f8 update solution folder 2023-06-09 14:30:53 +08:00
2248356998 qq.com
fa22f9ee64 upload deviceStatusPage 2023-06-09 10:32:11 +08:00
2248356998 qq.com
b33c0d3f81 update deviceStatusPage 2023-06-09 09:49:03 +08:00
2248356998 qq.com
339009add4 remove dotNET China declaration 2023-06-09 09:10:30 +08:00
2248356998 qq.com
798c823c4b add dotNET China declaration 2023-06-09 09:02:17 +08:00
Diego2098
14ad86f2a3 重启线程时增加运行状态界面空传播防止报错 2023-06-08 21:35:07 +08:00
2248356998 qq.com
a3a714dc17 add upload plugin code description 2023-06-08 17:47:53 +08:00
2248356998 qq.com
e8d8b0d41d 迁移导入变量功能到驱动调试内 2023-06-08 15:11:58 +08:00
2248356998 qq.com
17daad8f89 plugin unload test,but failed 2023-06-08 10:52:39 +08:00
2248356998 qq.com
e178263b3b 更改默认api文档为Knife4j 2023-06-07 20:34:31 +08:00
2248356998 qq.com
4febbc261e 缓存键增加Type-TypeHandle句柄 2023-06-07 18:42:58 +08:00
2248356998 qq.com
ef3a6942fd 修改OPCUA证书路径,增加默认接收不收信任证书与其选项;
OPCDA整理;
2023-06-07 18:03:57 +08:00
2248356998 qq.com
f8ac2be62b 重启线程WebApi修改 2023-06-07 11:32:18 +08:00
2248356998 qq.com
25447c34e5 添加注释提示 2023-06-07 11:28:11 +08:00
2248356998 qq.com
37cdf8fd48 GC策略更改,大量变量实例手动清空以快速内存释放 2023-06-07 11:19:24 +08:00
2248356998 qq.com
ac8e7dc959 上传1.5.1 2023-06-06 19:37:04 +08:00
2248356998 qq.com
8293382840 Merge branch 'master' of https://gitee.com/diego2098/ThingsGateway 2023-06-05 08:33:50 +08:00
Diego2098
d85a3e7743 S7-TCP连接修复死锁 2023-06-02 22:20:21 +08:00
2248356998 qq.com
f3f5ffb5c8 增加KINGVIEW 配置 2023-05-29 01:32:37 +08:00
2248356998 qq.com
99e6702c62 超管用户名称不可更改 2023-05-26 00:14:05 +08:00
2248356998 qq.com
e143c25078 初步添加OPCUAClient调试界面;更新依赖 2023-05-25 23:41:11 +08:00
2248356998 qq.com
3fb67972be OPCUA安全策略添加全部选项 2023-05-25 00:59:21 +08:00
2248356998 qq.com
61c04d4e09 OPCUA安全策略添加全部选项 2023-05-25 00:58:47 +08:00
2248356998 qq.com
b22f728958 添加OPCDAClient调试页面 2023-05-25 00:11:00 +08:00
2248356998 qq.com
112be7e383 修改程序根目录为文件所在目录 2023-05-24 14:37:45 +08:00
2248356998 qq.com
6a7f83fed5 默认添加服务守护支持 2023-05-24 14:32:21 +08:00
2248356998 qq.com
4b9698a735 ModbusServer添加自定义数据类型;修复发布时静态文件路径错误 2023-05-24 12:31:20 +08:00
2248356998 qq.com
ec3d203a6d Add copyright notices 2023-05-23 23:54:28 +08:00
2248356998 qq.com
e77b8f5475 update TGTcpClient 2023-05-23 22:42:48 +08:00
2248356998 qq.com
da8bbd321f 添加Modbus系列插件调试页面;添加Modbus组包解析缓存超时时间; 2023-05-23 20:50:44 +08:00
2248356998 qq.com
98fd011def update HardwareInfoService 2023-05-23 12:04:04 +08:00
2248356998 qq.com
9dccbc5316 nuget更新 2023-05-23 11:59:28 +08:00
2248356998 qq.com
03fa26daf9 硬件界面添加限值防报错 2023-05-23 11:46:19 +08:00
2248356998 qq.com
fbc41e3895 初步添加插件驱动调试页面 2023-05-22 18:50:30 +08:00
2248356998 qq.com
f1a6d0c02c 初步添加插件驱动调试页面 2023-05-22 18:41:09 +08:00
2248356998 qq.com
67f6bb7155 Razor文件格式化清理 2023-05-22 18:40:50 +08:00
2248356998 qq.com
86282f596c 删除调试代码... 2023-05-22 17:09:21 +08:00
2248356998 qq.com
e0f24c795c 更改变量读取间隔限制最低为10ms 2023-05-22 15:17:22 +08:00
2248356998 qq.com
7d44ed860c 明确System.Management版本 2023-05-22 14:51:02 +08:00
2248356998 qq.com
091094a24c 硬件信息获取添加异常拦截 2023-05-22 14:33:30 +08:00
2248356998 qq.com
ba18ee518c update adapter 2023-05-22 12:42:31 +08:00
2248356998 qq.com
513a031691 代码清理 2023-05-21 22:39:33 +08:00
2248356998 qq.com
cc79de1106 优化opcua质量戳提示;添加数据转换基础方法;TCP等待返回时默认断开连接立即返回 2023-05-21 10:51:56 +08:00
2248356998 qq.com
bd90e8efb2 modbus 组包优化 2023-05-20 21:41:16 +08:00
2248356998 qq.com
4bd88ff11d 类型更换 2023-05-20 17:13:14 +08:00
2248356998 qq.com
d27ee61292 可指定OPCUA节点数据类型 2023-05-20 15:40:17 +08:00
2248356998 qq.com
0c20b3345f 更新文档 2023-05-20 13:52:23 +08:00
2248356998 qq.com
0f3c8c7193 添加自定义OPCUAServer数据类型 2023-05-20 12:34:06 +08:00
2248356998 qq.com
16761ec605 导入规则优化,主动抛出名称重复错误 2023-05-19 22:55:53 +08:00
2248356998 qq.com
1069440cda 更改插件时开启刷新设备属性 2023-05-19 22:26:37 +08:00
2248356998 qq.com
60f5702f17 判断OPCUAServer状态时增加tryCatch 2023-05-19 21:27:20 +08:00
2248356998 qq.com
ee70133e47 判断OPCUAServer状态时增加tryCatch 2023-05-19 21:24:56 +08:00
2248356998 qq.com
06a9fdeb2e 优化tcp拆包组包 2023-05-19 20:28:51 +08:00
2248356998 qq.com
f14bd62004 快捷方式null错误 2023-05-19 16:33:57 +08:00
2248356998 qq.com
67cbaf22b7 更新依赖包 2023-05-19 16:23:21 +08:00
2248356998 qq.com
60b166dba2 UDP通讯优化 2023-05-19 16:21:42 +08:00
2248356998 qq.com
66e1647ede 添加链路锁 2023-05-19 14:27:47 +08:00
2248356998 qq.com
a1a35c00a5 分包数量显示错误 2023-05-19 10:13:48 +08:00
2248356998 qq.com
b02e3361c4 Modbus读写锁更新 2023-05-19 10:05:54 +08:00
2248356998 qq.com
2b9ceaa25a Modbus读写锁更新 2023-05-19 09:53:56 +08:00
2248356998 qq.com
109b5a9755 删除sqlsugar旧版本代码,会导致sqlite不兼容 2023-05-19 09:15:32 +08:00
2248356998 qq.com
cc4df86c10 适配mysql;修复写入表达式转换;优化web页面写入体验 2023-05-18 23:38:40 +08:00
2248356998 qq.com
e93532c395 数据库初始化修复 2023-05-18 22:24:27 +08:00
2248356998 qq.com
6ff688326a 数据库连接自动释放 2023-05-18 21:06:06 +08:00
2248356998 qq.com
eda5d2872f 编辑页面添加 变量 允许远程写入选项 2023-05-18 21:03:44 +08:00
2248356998 qq.com
dc88394f5f 修复枚举类型在mysql中类型出错的问题 2023-05-18 20:58:14 +08:00
Diego2098
ec85c9a2c6 修改文件大小限制 2023-05-17 22:29:59 +08:00
Diego2098
1341638556 更新设备读写锁 2023-05-17 22:05:31 +08:00
2248356998 qq.com
4875dfee11 touchSocket修复UDP在windows下重置连接的问题;更新nuget 2023-05-17 16:54:33 +08:00
2248356998 qq.com
d834ba8bd4 代码格式清理 2023-05-17 16:49:25 +08:00
2248356998 qq.com
6191067771 修复CancellationTokenSource未释放导致Linux下偶发内存问题 2023-05-17 16:44:52 +08:00
2248356998 qq.com
6c3a571163 OPCUAServer节点数据类型增加在读取表达式转换后的判断 2023-05-16 09:05:58 +08:00
Diego2098
5efb07e10e ModbusClient添加帧前时间 2023-05-15 22:45:55 +08:00
2248356998 qq.com
b25ec18ce6 修复using作用域导致获取的服务可能被释放的问题 2023-05-15 19:21:35 +08:00
2248356998 qq.com
f3cd281241 nuget更新 2023-05-15 18:55:27 +08:00
2248356998 qq.com
58b93cbf4c mqttClient同步间隔上传的实体类 2023-05-12 18:22:06 +08:00
2248356998 qq.com
57fc0349ff update mqttClient 2023-05-12 16:40:55 +08:00
2248356998 qq.com
d0a2cea772 MqttClient增加间隔上传选项;更改线程循环间隔说明定义 2023-05-12 16:31:57 +08:00
Diego2098
58d5801fb5 update readme 2023-05-10 21:18:43 +08:00
Diego2098
e5f2e59798 增加api控制采集启停等方法 2023-05-10 21:17:34 +08:00
Diego2098
1166921057 提交kafka插件 2023-05-10 21:17:09 +08:00
2248356998 qq.com
aeb49576f2 update readme 2023-05-10 17:49:52 +08:00
2248356998 qq.com
7ef1fecef8 共享链路写入变量修复;Nuget更新 2023-05-10 16:33:59 +08:00
2248356998 qq.com
fd630373b5 更新文档 2023-05-09 17:51:55 +08:00
2248356998 qq.com
d365d8f170 更新文档 2023-05-09 17:47:22 +08:00
2248356998 qq.com
dfa5e1172f OPCUAClient/Server 修改证书有效期为100年 2023-05-09 14:37:18 +08:00
2248356998 qq.com
daf195898a 添加控制台logo 2023-05-08 18:10:07 +08:00
2248356998 qq.com
c61c0a39cf Code Cleanup 2023-05-08 18:03:32 +08:00
2248356998 qq.com
6137e6baa5 add GetSciptValue 2023-05-08 17:45:13 +08:00
2248356998 qq.com
fd16fd9ffe modbus rtu 粘包优化 2023-05-08 15:59:35 +08:00
2248356998 qq.com
2b8bd5f2cc modbus rtu报文粘包优化;共享链路切换延时;上传插件添加报文界面 2023-05-08 15:57:33 +08:00
2248356998 qq.com
d312c2e9e7 plc read with CancellationToken 2023-05-08 13:33:01 +08:00
2248356998 qq.com
578b0d2268 粘包优化 2023-05-08 10:55:16 +08:00
2248356998 qq.com
ffb41b0109 Rpc条件bug修复 2023-05-07 18:06:27 +08:00
2248356998 qq.com
c63fb5d796 OPCUAServer修复匿名登录 2023-05-07 18:06:09 +08:00
2248356998 qq.com
8caee732e8 更新文档 2023-05-07 16:56:41 +08:00
2248356998 qq.com
df5381adce 属性顺序调整 2023-05-05 09:46:11 +08:00
2248356998 qq.com
f34836b7fa 更新文档 2023-05-04 22:58:36 +08:00
2248356998 qq.com
44b459883a update CollectDeviceThread 2023-05-04 10:58:45 +08:00
2248356998 qq.com
14a8592ae3 更新文档 2023-05-02 22:11:55 +08:00
2248356998 qq.com
787d0dce4a 更新1.5.0 2023-05-02 22:06:09 +08:00
2248356998 qq.com
8be05ff93d 1、共享链路支持;
2、设备报文查看;
3、采集线程重构;
2023-05-02 21:58:11 +08:00
2248356998 qq.com
3014af565c mqtt重连锁优化 2023-04-27 11:19:32 +08:00
2248356998 qq.com
315252bdc4 添加常用转换 2023-04-24 17:54:00 +08:00
2248356998 qq.com
c36c3b4607 masa更新 2023-04-24 11:16:28 +08:00
2248356998 qq.com
7d5e939bab 更新包 2023-04-24 09:26:47 +08:00
Diego2098
f75c9d1eed 报警后台服务去除多余接口
Signed-off-by: Diego2098 <2248356998@qq.com>
2023-04-19 00:48:13 +00:00
2248356998 qq.com
38cb9855ea 添加docker文件 2023-04-17 17:39:12 +08:00
2248356998 qq.com
ed8b56d624 单文件发布 2023-04-17 15:13:40 +08:00
2248356998 qq.com
bca48b13ae update SqlSugarConfig 2023-04-17 11:58:41 +08:00
2248356998 qq.com
29426edb05 删除其他信息 2023-04-17 11:05:38 +08:00
2248356998 qq.com
33a2dc687f 验证码更新修复 2023-04-17 09:05:44 +08:00
2248356998 qq.com
e2398a21b2 1、字段null约束修改
2、ModbusServer绑定端口优化
2023-04-16 15:02:09 +08:00
2248356998 qq.com
f19530276e 更新readme 2023-04-16 13:34:29 +08:00
2248356998 qq.com
2b9b92a78c 更新1.4.0
注意Excel导入已不适用以前版本
1、去除动态更新插件
2、改用MiniExcel,支持动态导入,excel配置更简单
3、优化多处界面与后台逻辑,部分方法规范更名
4、修复外网地址获取错误等
2023-04-15 20:48:56 +08:00
2248356998 qq.com
99c55dac10 修复报警文本逻辑 2023-04-11 13:40:13 +08:00
2248356998 qq.com
25667e46f9 1,修复控制台报错(echarts.js问题,已删除)2,多处Dispose修正 2023-04-07 08:48:34 +08:00
2248356998 qq.com
2f4e8f2399 过滤 2023-04-06 14:46:24 +08:00
2248356998 qq.com
9169183769 历史数据库选择为sqlite时查询转换日期错误 2023-04-05 18:04:33 +08:00
2248356998 qq.com
c420f50831 启用开发环境web详细日志,调整App.Razor位置,添加网页ico 2023-04-05 17:14:26 +08:00
2248356998 qq.com
c6c9279ef4 update console/file datetime format 2023-04-05 15:49:00 +08:00
2248356998 qq.com
c125e2991d 更新readme 2023-04-04 18:41:56 +08:00
2248356998 qq.com
5348b19d6a 😀版本1.3.1 2023-04-04 17:55:52 +08:00
2248356998 qq.com
afd426daac 网关软件时间统一UTC 2023-04-04 17:55:15 +08:00
2248356998 qq.com
202c511cfa update iotSharpClient 2023-04-04 11:07:05 +08:00
2248356998 qq.com
651eb295a4 😀 更新1.3.0 2023-04-04 10:15:34 +08:00
2248356998 qq.com
d798aaed33 update iotSharpClient 2023-04-04 09:25:16 +08:00
2248356998 qq.com
63ef347cc9 update iotSharpClient 2023-04-04 09:23:22 +08:00
2248356998 qq.com
3139b2d5a0 IosSharpClient Rpc优化 2023-04-04 09:22:22 +08:00
2248356998 qq.com
2c80bbb244 IotSharp Rpc方法完善 2023-04-04 09:19:48 +08:00
2248356998 qq.com
af06755ada 添加写入多个变量的api方法 2023-04-04 09:18:58 +08:00
2248356998 qq.com
97d6dbaa6c update IotSharpClient 2023-04-03 20:16:38 +08:00
2248356998 qq.com
74cf82a1c7 更新种子 2023-04-03 19:34:12 +08:00
2248356998 qq.com
74634889ab 添加IotSharp插件 2023-04-03 19:30:52 +08:00
2248356998 qq.com
dbe30fcd77 分页显示令牌 2023-04-03 15:29:35 +08:00
2248356998 qq.com
24a7f3a320 后台启动时Furion RootServices NULL值 2023-04-03 15:19:59 +08:00
2248356998 qq.com
d3650f1145 修复不存在采集设备时,初始化报警/历史服务bug 2023-04-03 14:12:56 +08:00
2248356998 qq.com
4801db9050 弹窗消息在SignalR订阅方法中需InvokeAsync 2023-04-03 13:35:14 +08:00
2248356998 qq.com
6445281658 修复规范化结果包装2次导致登录返回结果不正确的问题 2023-04-03 12:45:19 +08:00
2248356998 qq.com
87719f5938 更新演示地址 2023-04-03 10:47:49 +08:00
2248356998 qq.com
5ba1ec433b readme 2023-04-02 18:12:18 +08:00
2248356998 qq.com
7c5b382458 readme 2023-04-02 18:08:56 +08:00
2248356998 qq.com
8960426128 更新readme 2023-04-02 18:05:54 +08:00
2248356998 qq.com
e1d47d5a92 更新readme 2023-04-02 18:05:28 +08:00
2248356998 qq.com
9407c272aa 更新包 2023-04-02 17:10:32 +08:00
2248356998 qq.com
bccbd7b400 添加注释 2023-04-02 16:59:46 +08:00
2248356998 qq.com
a24dc010ec 调整依赖,添加关系图 2023-04-01 17:28:35 +08:00
2248356998 qq.com
c5e5d50fb8 调整依赖,更新版本1.2.1 2023-04-01 15:45:02 +08:00
2248356998 qq.com
be1c520320 整理 2023-04-01 13:57:57 +08:00
2248356998 qq.com
3d18d0f893 😀 OPCUAServer支持历史查询数据 2023-03-31 18:32:55 +08:00
2248356998 qq.com
c3351a38a6 添加ThingsGateway.Foundation注释 2023-03-31 16:25:33 +08:00
2248356998 qq.com
0b86340a8d 硬件信息获取添加延时 2023-03-30 20:51:08 +08:00
2248356998 qq.com
829371b032 脚本显示优化 2023-03-30 19:51:38 +08:00
2248356998 qq.com
b342207bc7 更新文档 2023-03-30 19:39:35 +08:00
2248356998 qq.com
58f4fdced3 mqtt/mq上传 添加上传实体自定义脚本 2023-03-30 19:07:18 +08:00
2248356998 qq.com
253844cbcf 表达式整理 2023-03-30 16:23:03 +08:00
2248356998 qq.com
e2e2b9ffb4 更新版本 2023-03-30 14:12:39 +08:00
2248356998 qq.com
2568042f5f 更新文档 2023-03-30 14:11:16 +08:00
2248356998 qq.com
722edf4b9a readme 2023-03-30 14:06:03 +08:00
2248356998 qq.com
e406d364e4 更新readme,nuget 2023-03-30 14:05:00 +08:00
2248356998 qq.com
31c37f41b2 删除多余代码 2023-03-30 13:53:57 +08:00
2248356998 qq.com
6cd879bbc5 opcua 写入添加用户名日志 2023-03-30 13:32:32 +08:00
2248356998 qq.com
b7974050fe 去除ua数据类型验证 2023-03-30 13:20:26 +08:00
2248356998 qq.com
e9c9d0816e 更新readme 2023-03-30 13:13:44 +08:00
2248356998 qq.com
a437692e1a 类命名错误更改 2023-03-30 13:11:46 +08:00
2248356998 qq.com
2a14d2f3c8 发布文件添加 2023-03-30 13:11:43 +08:00
2248356998 qq.com
559e2d1889 添加OPCUAServer插件,修复个别bug 2023-03-30 13:10:31 +08:00
Diego2098
a1aa919f80 1、OPCUAClient修复客户端证书未自动生成
2、修复异步方法错误使用
2023-03-30 00:15:13 +08:00
2248356998 qq.com
cbccb27a5a 添加部分代码注释 2023-03-29 16:22:01 +08:00
2248356998 qq.com
bbad36d576 驱动支持主机名称 2023-03-29 11:07:21 +08:00
2248356998 qq.com
df6c9d55b5 修复初始化失败导致的一系列问题 2023-03-29 10:53:42 +08:00
2248356998 qq.com
36a1d9c364 上传插件间隔时间修正 2023-03-28 16:40:00 +08:00
2248356998 qq.com
1f3681d5ac 历史变量enable失效 2023-03-28 16:38:29 +08:00
2248356998 qq.com
0159f8e53f 历史报表时间格式改为yyyy-MM-dd HH:mm:ss ffffff 2023-03-28 16:31:53 +08:00
2248356998 qq.com
0432be64fc 采集设备状态判断错误 2023-03-28 16:21:30 +08:00
2248356998 qq.com
481e062961 采集设备状态判断错误 2023-03-28 15:55:01 +08:00
2248356998 qq.com
72b8abdeb6 修复历史保存值 频繁时出现值相同的问题 2023-03-28 15:14:30 +08:00
2248356998 qq.com
7ec3ee41d1 opc 活动时间修正 2023-03-28 14:15:14 +08:00
2248356998 qq.com
b765fa4769 添加写入采集时间的接口,而不是固定DateTime.Now 2023-03-28 14:03:11 +08:00
2248356998 qq.com
06685b162e 更新tcpclient 2023-03-28 13:52:33 +08:00
2248356998 qq.com
7bcad7c424 修复linux 分隔符错误问题 2023-03-28 11:48:16 +08:00
2248356998 qq.com
6e054b3cc6 更改插件文件不存在时的日志信息 2023-03-28 10:21:39 +08:00
2248356998 qq.com
e643f6b0f8 更改项目引用结构 2023-03-28 10:21:23 +08:00
2248356998 qq.com
e44c0f85c2 swagger文档 2023-03-27 19:01:04 +08:00
Iot边缘设备
ea66e968eb !5 添加部署文档
* 添加部署文档
2023-03-27 10:22:30 +00:00
2248356998 qq.com
f7e73d804e 属性/字段缓存获取只包含public 2023-03-27 14:49:09 +08:00
2248356998 qq.com
2ff4df56a1 更新masa-1.0.0-preview.10 2023-03-27 14:27:15 +08:00
2248356998 qq.com
346c45fe0c 优化变量上传属性页 2023-03-27 12:00:10 +08:00
2248356998 qq.com
f98b42a36e 采集设备活动时间应正常刷新 2023-03-27 10:51:54 +08:00
2248356998 qq.com
f77a0a266c 添加设备复制功能 2023-03-27 10:42:02 +08:00
2248356998 qq.com
0be672788f update code collation 2023-03-27 08:49:10 +08:00
2248356998 qq.com
e2e3d11d42 update code collation 2023-03-26 19:48:08 +08:00
2248356998 qq.com
bb127bb567 更新nuget包 2023-03-26 18:52:16 +08:00
2248356998 qq.com
8eb4f89db8 发行1.10版本 2023-03-26 18:10:12 +08:00
2248356998 qq.com
4a87ea3e70 实时数据界面优化 2023-03-26 17:39:05 +08:00
2248356998 qq.com
61115fce99 1、采用异步AutoResetEvent,修复多个设备下采集太慢的问题
2、弃用IntelligentConcurrentQueue(touchsocket集成类)
2023-03-26 17:32:29 +08:00
2248356998 qq.com
4f31120394 1、优化设备状态页,减少signalr刷新所需包大小
2、日志前置等级添加
2023-03-24 18:32:10 +08:00
2248356998 qq.com
b085cd65ce 修复导出表格时,null值报错 2023-03-23 22:09:53 +08:00
2248356998 qq.com
f76ec0721a 导入错误时,忽略大于10行的错误信息显示 2023-03-23 20:01:19 +08:00
2248356998 qq.com
ef3944fbbf 更新readme 2023-03-22 15:29:35 +08:00
2248356998 qq.com
b158fbc0d8 优化log等级、json配置注解 2023-03-22 15:26:42 +08:00
2248356998 qq.com
68f2d66e97 OPCUA写入测试 2023-03-22 14:06:32 +08:00
2248356998 qq.com
0cdd1735bd 设备运行状态页面改为扩展 2023-03-22 13:46:23 +08:00
2248356998 qq.com
70f5ead20b 更新文档 2023-03-22 10:44:44 +08:00
Diego2098
574e5616f8 rbmq插件优化 2023-03-21 23:38:00 +08:00
Diego2098
94fa810590 分包失败提示 2023-03-21 23:28:30 +08:00
Diego2098
37f69da701 设备组列宽调整,补充上传设备组 2023-03-21 23:10:59 +08:00
Diego2098
f2f8448ade 1、更新DataTypeEnum
2、OPCUA写入时需实际数据类型
2023-03-21 22:47:10 +08:00
Diego2098
b357d3fff2 更新Tests 2023-03-21 22:46:12 +08:00
2248356998 qq.com
b417194905 表格无数据时,修改默认宽度 2023-03-21 18:17:18 +08:00
2248356998 qq.com
d8741da20a S7nuget版本 2023-03-21 15:44:50 +08:00
2248356998 qq.com
c469be9a62 masa nuget版本更改 2023-03-21 14:31:36 +08:00
2248356998 qq.com
ff4eb339ef GC策略修改 2023-03-21 14:07:17 +08:00
2248356998 qq.com
78489383c0 更新文档 2023-03-21 14:03:49 +08:00
2248356998 qq.com
f67c1b415f 更新文档 2023-03-21 13:56:14 +08:00
2248356998 qq.com
570c16d921 修改s7属性注释 2023-03-21 13:51:05 +08:00
2248356998 qq.com
c8bc60568a 更新readme 2023-03-21 13:49:10 +08:00
2248356998 qq.com
73de3ba856 更新S7协议插件 2023-03-21 13:45:58 +08:00
2248356998 qq.com
6a69be8537 修改S7特殊方法 2023-03-21 13:41:32 +08:00
2248356998 qq.com
3ee381d505 修改s7 2023-03-21 13:38:43 +08:00
2248356998 qq.com
7ce744e2e4 添加西门子S7协议插件 2023-03-21 13:37:17 +08:00
2248356998 qq.com
b81d21c991 版本恢复 2023-03-21 11:45:18 +08:00
2248356998 qq.com
e9fe0992c6 更新nuget,暂缓链路复用功能 2023-03-20 13:34:59 +08:00
2248356998 qq.com
d5ef9018fa 默认不开启转储 2023-03-20 09:22:11 +08:00
2248356998 qq.com
c2737a7c51 更新opcda文档 2023-03-19 23:18:24 +08:00
2248356998 qq.com
4b6d8733c6 格式清理 2023-03-19 23:12:58 +08:00
2248356998 qq.com
f22a3e0955 修复null值报错 2023-03-19 23:02:08 +08:00
2248356998 qq.com
4b8144a2f7 添加设备组,变量按设备组别搜索 2023-03-19 22:56:02 +08:00
2248356998 qq.com
abac52e23c 更新readme,opcda核心库提示 2023-03-19 20:40:54 +08:00
2248356998 qq.com
9aa089313e 尝试修复中文在mac上乱码 2023-03-19 17:29:01 +08:00
2248356998 qq.com
b18f2c481a 修正中文在mac上乱码 2023-03-19 16:45:14 +08:00
2248356998 qq.com
ec83b9f77b 删除未知文件 2023-03-19 16:35:24 +08:00
2248356998 qq.com
fad5495e02 Merge branch 'master' of https://gitee.com/diego2098/ThingsGateway 2023-03-19 16:34:26 +08:00
2248356998 qq.com
70dec1171e 添加设备组功能 2023-03-19 16:34:15 +08:00
士心
0673a6fce3 !4 修复MacOS环境下,数据库报错的问题
* 修复macos环境下,数据库报错
2023-03-19 08:28:54 +00:00
2248356998 qq.com
8f525b1407 准备更新设备组/变量组功能 2023-03-19 11:49:06 +08:00
2248356998 qq.com
e83a991a4b 更新ReadMe 2023-03-18 17:56:18 +08:00
2248356998 qq.com
c000432a52 1、最后校验失败时应该提示日志
2、暂停时设备状态修正
2023-03-18 17:49:08 +08:00
2248356998 qq.com
c06d2d6927 更新文档 2023-03-18 16:47:29 +08:00
2248356998 qq.com
aa29653a8f ByteBlock实际长度 2023-03-18 16:45:39 +08:00
2248356998 qq.com
3f7e4ad486 修正串口描述类ToString 2023-03-18 16:32:15 +08:00
2248356998 qq.com
0eab546b2f 更新文档 2023-03-18 16:23:23 +08:00
2248356998 qq.com
8830d216d1 更新nuget 2023-03-18 16:16:27 +08:00
2248356998 qq.com
9fa1e3d449 更新readme 2023-03-18 16:15:14 +08:00
2248356998 qq.com
fe5dce7159 添加ModbusRtu种子数据 2023-03-18 16:14:37 +08:00
2248356998 qq.com
952fa31548 添加ModbusRtu插件 2023-03-18 16:14:25 +08:00
2248356998 qq.com
cc058ccc61 添加串口基础类 2023-03-18 16:14:08 +08:00
2248356998 qq.com
bc26ed9701 更新文档 2023-03-17 18:19:14 +08:00
2248356998 qq.com
26135fc1a0 更新文档 2023-03-17 17:52:04 +08:00
2248356998 qq.com
0bd14672ff 种子数据更改 2023-03-17 17:51:58 +08:00
2248356998 qq.com
7c7150cde8 采集检测间隔修改 2023-03-17 17:40:34 +08:00
2248356998 qq.com
b08282b0c1 上传插件添加循环间隔属性 2023-03-17 17:30:06 +08:00
2248356998 qq.com
3bf6e1befc 添加rbmq插件种子数据 2023-03-17 16:30:02 +08:00
2248356998 qq.com
52692371ac rbmq插件文件夹更名 2023-03-17 16:16:23 +08:00
2248356998 qq.com
159ac1d8bb 优化内存queue,修复mqtt插件可能超出字节限制的情况 2023-03-17 16:04:24 +08:00
2248356998 qq.com
7f1ffdbc79 添加rbmq插件 2023-03-17 16:03:44 +08:00
2248356998 qq.com
5fe64931dc 设备禁用时,变量绑定的设备对应选项会显示禁用(灰色) 2023-03-17 11:29:14 +08:00
2248356998 qq.com
ee67855b48 更新readme 2023-03-16 17:33:25 +08:00
2248356998 qq.com
594a97f43f 选择插件时自动更新属性 2023-03-16 17:33:17 +08:00
2248356998 qq.com
7fb435a8b4 更新赞助名单 2023-03-16 11:35:58 +08:00
2248356998 qq.com
01e74d6116 限流服务默认不开启 2023-03-16 09:47:20 +08:00
2248356998 qq.com
b321d75b39 增加简易定时看板 2023-03-15 16:01:54 +08:00
2248356998 qq.com
1e47a45723 更新历史配置说明 2023-03-15 09:11:33 +08:00
Diego2098
88c609e5ef !3 update handbook/docs/05、网关配置/5.5、其他配置.mdx.
Merge pull request !3 from zhubanghao/N/A
2023-03-14 13:39:16 +00:00
zhubanghao
775d1a424e update handbook/docs/05、网关配置/5.5、其他配置.mdx.
Signed-off-by: zhubanghao <58813184@qq.com>
2023-03-14 13:05:33 +00:00
293 changed files with 5423 additions and 4372 deletions

View File

@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<Version>4.0.0.8</Version>
<LangVersion>latest</LangVersion>
<Authors>Diego</Authors>
<Product>ThingsGateway</Product>
<Copyright>© 2023-present Diego</Copyright>
<RepositoryUrl>https://gitee.com/diego2098/ThingsGateway</RepositoryUrl>
<SignAssembly>True</SignAssembly>
<DelaySign>False</DelaySign>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
</PropertyGroup>
</Project>

View File

@@ -82,6 +82,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{97B23D8B-C6C0-4746-A21F-C7B49354B284}"
ProjectSection(SolutionItems) = preProject
..\.gitignore = ..\.gitignore
Directory.Build.props = Directory.Build.props
..\README.md = ..\README.md
EndProjectSection
EndProject

View File

@@ -1,17 +1,7 @@
<Project>
<Import Project="$(SolutionDir)\Directory.Build.props" />
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<Version>4.0.0.3</Version>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>Diego</Authors>
<Product>ThingsGateway</Product>
<Copyright>© 2023-present Diego</Copyright>
<RepositoryUrl>https://gitee.com/diego2098/ThingsGateway</RepositoryUrl>
<SignAssembly>True</SignAssembly>
<DelaySign>False</DelaySign>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
</PropertyGroup>

View File

@@ -27,12 +27,12 @@ namespace ThingsGateway.Admin.ApiController;
[Route("Swagger")]
public class SwaggerController : IDynamicApiController, IScoped
{
private readonly ConfigService _configService;
private readonly IConfigService _configService;
/// <summary>
/// <inheritdoc cref="SwaggerController"/>
/// </summary>
/// <param name="sysConfigService"></param>
public SwaggerController(ConfigService sysConfigService)
public SwaggerController(IConfigService sysConfigService)
{
_configService = sysConfigService;
}

View File

@@ -79,7 +79,7 @@
Swagger登录授权服务
</summary>
</member>
<member name="M:ThingsGateway.Admin.ApiController.SwaggerController.#ctor(ThingsGateway.Admin.Application.ConfigService)">
<member name="M:ThingsGateway.Admin.ApiController.SwaggerController.#ctor(ThingsGateway.Admin.Application.IConfigService)">
<summary>
<inheritdoc cref="T:ThingsGateway.Admin.ApiController.SwaggerController"/>
</summary>

View File

@@ -96,7 +96,7 @@ public class OperDispatchProxy : AspectDispatchProxy, IDispatchProxy
/// <exception cref="NotImplementedException"></exception>
public override async Task InvokeAsync(MethodInfo method, object[] args)
{
var desc = method.GetActualCustomAttribute<OperDescAttribute>(Target);
var desc = method.GetActualCustomAttribute<OperDescAttribute>(Target, true);
if (desc == null)
{
var task = method.Invoke(Target, args) as Task;
@@ -134,7 +134,7 @@ public class OperDispatchProxy : AspectDispatchProxy, IDispatchProxy
/// <exception cref="NotImplementedException"></exception>
public override async Task<T> InvokeAsyncT<T>(MethodInfo method, object[] args)
{
var desc = method.GetActualCustomAttribute<OperDescAttribute>(Target);
var desc = method.GetActualCustomAttribute<OperDescAttribute>(Target, true);
if (desc == null)
{
var taskT = method.Invoke(Target, args) as Task<T>;

View File

@@ -83,7 +83,7 @@ public class OpenApiSessionService : DbRepository<OpenApiUser>, IOpenApiSessionS
var verificatInfos = await _verificatService.GetVerificatIdAsync(it.Id);
if (verificatInfos != null)
{
OpenApiSessionService.GetVerificatInfos(ref verificatInfos);//获取剩余时间
GetVerificatInfos(ref verificatInfos);//获取剩余时间
it.VerificatCount = verificatInfos.Count;//令牌数量
it.VerificatSignList = verificatInfos;//令牌列表
}

View File

@@ -73,7 +73,7 @@ public class SessionService : DbRepository<SysUser>, ISessionService
var verificatInfos = await _verificatService.GetVerificatIdAsync(it.Id);
if (verificatInfos != null)
{
SessionService.GetVerificatInfos(ref verificatInfos);//获取剩余时间
GetVerificatInfos(ref verificatInfos);//获取剩余时间
it.VerificatCount = verificatInfos.Count;//令牌数量
it.VerificatSignList = verificatInfos;//令牌列表

View File

@@ -12,7 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\ThingsGateway.Admin.Core\ThingsGateway.Admin.Core.csproj" />
<PackageReference Include="MiniExcel" Version="1.31.2" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.6" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.7" />
</ItemGroup>
</Project>

View File

@@ -10,6 +10,8 @@
//------------------------------------------------------------------------------
#endregion
using System.Text.RegularExpressions;
using ThingsGateway.Foundation.Extension.String;
namespace ThingsGateway.Admin.Application;
@@ -34,7 +36,8 @@ public class SeedDataUtil
if (!string.IsNullOrEmpty(dataString))//如果有内容
{
//字段没有数据的替换成null
dataString = dataString.Replace("\"\"", "null");
dataString = Regex.Replace(dataString, "\\\"[^\"]+?\\\": \\\"\\\"", match => match.Value.Replace("\"\"", "null"));
//dataString = dataString.Replace("\"\"", "null");
//将json字符串转为实体这里extjson可以正常转换为字符串
var seedDataRecord = Newtonsoft.Json.JsonConvert.DeserializeObject<SeedDataRecords<T>>(dataString);

View File

@@ -37,7 +37,7 @@ namespace ThingsGateway.Admin.Blazor
{
try
{
var data = await _serviceScope.ServiceProvider.GetService<UserCenterService>().GetLoginDefaultRazorAsync(UserManager.UserId);
var data = await _serviceScope.ServiceProvider.GetService<IUserCenterService>().GetLoginDefaultRazorAsync(UserManager.UserId);
var sameLevelMenus = await _serviceScope.ServiceProvider.GetService<IResourceService>().GetaMenuAndSpaListAsync();
if (NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsolutePath == "/Login" || NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsolutePath == "/")
NavigationManager.NavigateTo(sameLevelMenus.FirstOrDefault(a => a.Id == data)?.Component ?? "index", true);

View File

@@ -39,26 +39,26 @@ public partial class Config
}
private async Task AddCallAsync(ConfigAddInput input)
{
await _serviceScope.ServiceProvider.GetService<ConfigService>().AddAsync(input);
await _serviceScope.ServiceProvider.GetService<IConfigService>().AddAsync(input);
}
private async Task DeleteCallAsync(IEnumerable<SysConfig> sysConfigs)
{
await _serviceScope.ServiceProvider.GetService<ConfigService>().DeleteAsync(sysConfigs.Select(a => a.Id).ToArray());
await _serviceScope.ServiceProvider.GetService<IConfigService>().DeleteAsync(sysConfigs.Select(a => a.Id).ToArray());
}
private async Task EditCallAsync(ConfigEditInput sysConfigs)
{
await _serviceScope.ServiceProvider.GetService<ConfigService>().EditAsync(sysConfigs);
await _serviceScope.ServiceProvider.GetService<IConfigService>().EditAsync(sysConfigs);
}
private async Task OnSaveAsync()
{
await _serviceScope.ServiceProvider.GetService<ConfigService>().EditBatchAsync(_sysConfig);
await _serviceScope.ServiceProvider.GetService<IConfigService>().EditBatchAsync(_sysConfig);
await _mainLayout.StateHasChangedAsync();
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
}
private async Task<ISqlSugarPagedList<SysConfig>> QueryCallAsync(ConfigPageInput input)
{
return await _serviceScope.ServiceProvider.GetService<ConfigService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<IConfigService>().PageAsync(input);
}
}

View File

@@ -45,23 +45,23 @@ public partial class Menu
private async Task AddCallAsync(MenuAddInput input)
{
input.ParentId = _search.ParentId;
await _serviceScope.ServiceProvider.GetService<MenuService>().AddAsync(input);
await _serviceScope.ServiceProvider.GetService<IMenuService>().AddAsync(input);
await NavChangeAsync();
}
private async Task ButtonAddCallAsync(ButtonAddInput input)
{
input.ParentId = _buttonParentId;
await _serviceScope.ServiceProvider.GetService<ButtonService>().AddAsync(input);
await _serviceScope.ServiceProvider.GetService<IButtonService>().AddAsync(input);
}
private async Task ButtonDeleteCallAsync(IEnumerable<SysResource> input)
{
await _serviceScope.ServiceProvider.GetService<ButtonService>().DeleteAsync(input.Select(a => a.Id).ToArray());
await _serviceScope.ServiceProvider.GetService<IButtonService>().DeleteAsync(input.Select(a => a.Id).ToArray());
}
private async Task ButtonEditCallAsync(ButtonEditInput input)
{
await _serviceScope.ServiceProvider.GetService<ButtonService>().EditAsync(input);
await _serviceScope.ServiceProvider.GetService<IButtonService>().EditAsync(input);
}
@@ -85,7 +85,7 @@ public partial class Menu
private async Task<ISqlSugarPagedList<SysResource>> ButtonQueryCallAsync(ButtonPageInput input)
{
input.ParentId = _buttonParentId;
var data = await _serviceScope.ServiceProvider.GetService<ButtonService>().PageAsync(input);
var data = await _serviceScope.ServiceProvider.GetService<IButtonService>().PageAsync(input);
return data;
}
@@ -96,13 +96,13 @@ public partial class Menu
private async Task DeleteCallAsync(IEnumerable<SysResource> input)
{
await _serviceScope.ServiceProvider.GetService<MenuService>().DeleteAsync(input.Select(a => a.Id).ToArray());
await _serviceScope.ServiceProvider.GetService<IMenuService>().DeleteAsync(input.Select(a => a.Id).ToArray());
await NavChangeAsync();
}
private async Task EditCallAsync(MenuEditInput input)
{
await _serviceScope.ServiceProvider.GetService<MenuService>().EditAsync(input);
await _serviceScope.ServiceProvider.GetService<IMenuService>().EditAsync(input);
await NavChangeAsync();
}
@@ -123,7 +123,7 @@ public partial class Menu
}
private async Task<ISqlSugarPagedList<SysResource>> QueryCallAsync(MenuPageInput input)
{
var data = await _serviceScope.ServiceProvider.GetService<MenuService>().TreeAsync(input);
var data = await _serviceScope.ServiceProvider.GetService<IMenuService>().TreeAsync(input);
return data.ToPagedList(input);
}

View File

@@ -32,13 +32,13 @@ public partial class OpenApiSession
var confirm = await PopupService.OpenConfirmDialogAsync("警告", "确定 ?");
if (confirm)
{
await _serviceScope.ServiceProvider.GetService<OpenApiSessionService>().ExitSessionAsync(id);
await _serviceScope.ServiceProvider.GetService<IOpenApiSessionService>().ExitSessionAsync(id);
}
}
private async Task<ISqlSugarPagedList<OpenApiSessionOutput>> SessionQueryCallAsync(OpenApiSessionPageInput input)
{
return await _serviceScope.ServiceProvider.GetService<OpenApiSessionService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<IOpenApiSessionService>().PageAsync(input);
}
private async Task ShowVerificatListAsync(List<VerificatInfo> verificatInfos)
@@ -56,7 +56,7 @@ public partial class OpenApiSession
VerificatIds = verificats.Select(it => it.Id).ToList(),
Id = verificats.First().UserId
};
await _serviceScope.ServiceProvider.GetService<OpenApiSessionService>().ExitVerificatAsync(send);
await _serviceScope.ServiceProvider.GetService<IOpenApiSessionService>().ExitVerificatAsync(send);
_verificatInfos.RemoveWhere(it => send.VerificatIds.Contains(it.Id));
}

View File

@@ -32,17 +32,17 @@ public partial class OpenApiUserR
private async Task AddCallAsync(OpenApiUserAddInput input)
{
await _serviceScope.ServiceProvider.GetService<OpenApiUserService>().AddAsync(input);
await _serviceScope.ServiceProvider.GetService<IOpenApiUserService>().AddAsync(input);
}
private async Task DeleteCallAsync(IEnumerable<OpenApiUser> users)
{
await _serviceScope.ServiceProvider.GetService<OpenApiUserService>().DeleteAsync(users.Select(a => a.Id).ToArray());
await _serviceScope.ServiceProvider.GetService<IOpenApiUserService>().DeleteAsync(users.Select(a => a.Id).ToArray());
}
private async Task EditCallAsync(OpenApiUserEditInput users)
{
await _serviceScope.ServiceProvider.GetService<OpenApiUserService>().EditAsync(users);
await _serviceScope.ServiceProvider.GetService<IOpenApiUserService>().EditAsync(users);
}
private List<OpenApiPermissionTreeSelector> GetRouters()
@@ -58,7 +58,7 @@ public partial class OpenApiUserR
OpenApiUserGrantPermissionInput userGrantRoleInput = new();
userGrantRoleInput.Id = _choiceUserId;
userGrantRoleInput.PermissionList = _rolesChoice.Select(it => it.ApiRoute).ToList();
await _serviceScope.ServiceProvider.GetService<OpenApiUserService>().GrantRoleAsync(userGrantRoleInput);
await _serviceScope.ServiceProvider.GetService<IOpenApiUserService>().GrantRoleAsync(userGrantRoleInput);
_isShowRoles = false;
await _datatable?.QueryClickAsync();
}
@@ -70,7 +70,7 @@ public partial class OpenApiUserR
}
private async Task<ISqlSugarPagedList<OpenApiUser>> QueryCallAsync(OpenApiUserPageInput input)
{
return await _serviceScope.ServiceProvider.GetService<OpenApiUserService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<IOpenApiUserService>().PageAsync(input);
}
private async Task UserStatusChangeAsync(OpenApiUser context, bool enable)
@@ -78,9 +78,9 @@ public partial class OpenApiUserR
try
{
if (enable)
await _serviceScope.ServiceProvider.GetService<OpenApiUserService>().EnableUserAsync(context.Id);
await _serviceScope.ServiceProvider.GetService<IOpenApiUserService>().EnableUserAsync(context.Id);
else
await _serviceScope.ServiceProvider.GetService<OpenApiUserService>().DisableUserAsync(context.Id);
await _serviceScope.ServiceProvider.GetService<IOpenApiUserService>().DisableUserAsync(context.Id);
}
finally
{

View File

@@ -47,7 +47,7 @@ public partial class Oplog
var confirm = await PopupService.OpenConfirmDialogAsync("删除", "确定 ?");
if (confirm)
{
await _serviceScope.ServiceProvider.GetService<OperateLogService>().DeleteAsync(_categoryFilters.Select(it => it.Value).ToArray());
await _serviceScope.ServiceProvider.GetService<IOperateLogService>().DeleteAsync(_categoryFilters.Select(it => it.Value).ToArray());
await _datatable?.QueryClickAsync();
}
}
@@ -68,6 +68,6 @@ public partial class Oplog
input.Account = _search.Account;
input.Category = _search.Category;
input.ExeStatus = _search.ExeStatus;
return await _serviceScope.ServiceProvider.GetService<OperateLogService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<IOperateLogService>().PageAsync(input);
}
}

View File

@@ -41,17 +41,17 @@ public partial class Role
private async Task AddCallAsync(RoleAddInput input)
{
await _serviceScope.ServiceProvider.GetService<RoleService>().AddAsync(input);
await _serviceScope.ServiceProvider.GetService<IRoleService>().AddAsync(input);
}
private async Task DeleteCallAsync(IEnumerable<SysRole> sysRoles)
{
await _serviceScope.ServiceProvider.GetService<RoleService>().DeleteAsync(sysRoles.Select(a => a.Id).ToArray());
await _serviceScope.ServiceProvider.GetService<IRoleService>().DeleteAsync(sysRoles.Select(a => a.Id).ToArray());
await _mainLayout.StateHasChangedAsync();
}
private async Task EditCallAsync(RoleEditInput input)
{
await _serviceScope.ServiceProvider.GetService<RoleService>().EditAsync(input);
await _serviceScope.ServiceProvider.GetService<IRoleService>().EditAsync(input);
await _mainLayout.StateHasChangedAsync();
}
private async Task OnRoleHasResuorcesSaveAsync(ModalActionEventArgs args)
@@ -62,7 +62,7 @@ public partial class Role
var data = new List<SysResource>();
userGrantRoleInput.Id = _choiceRoleId;
userGrantRoleInput.GrantInfoList = _roleHasResuorces;
await _serviceScope.ServiceProvider.GetService<RoleService>().GrantResourceAsync(userGrantRoleInput);
await _serviceScope.ServiceProvider.GetService<IRoleService>().GrantResourceAsync(userGrantRoleInput);
_isShowResuorces = false;
}
catch (Exception ex)
@@ -79,7 +79,7 @@ public partial class Role
GrantUserInput userGrantRoleInput = new();
userGrantRoleInput.Id = _choiceRoleId;
userGrantRoleInput.GrantInfoList = _usersChoice.Select(it => it.Id).ToList();
await _serviceScope.ServiceProvider.GetService<RoleService>().GrantUserAsync(userGrantRoleInput);
await _serviceScope.ServiceProvider.GetService<IRoleService>().GrantUserAsync(userGrantRoleInput);
_isShowUsers = false;
}
catch (Exception ex)
@@ -92,19 +92,19 @@ public partial class Role
private async Task<ISqlSugarPagedList<SysRole>> QueryCallAsync(RolePageInput input)
{
return await _serviceScope.ServiceProvider.GetService<RoleService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<IRoleService>().PageAsync(input);
}
private async Task ResuorceInitAsync()
{
_resTreeSelectors = (await _serviceScope.ServiceProvider.GetService<ResourceService>().GetRoleGrantResourceMenusAsync());
_roleHasResuorces = (await _serviceScope.ServiceProvider.GetService<RoleService>().OwnResourceAsync(_choiceRoleId))?.GrantInfoList;
_roleHasResuorces = (await _serviceScope.ServiceProvider.GetService<IRoleService>().OwnResourceAsync(_choiceRoleId))?.GrantInfoList;
}
private async Task<List<UserSelectorOutput>> UserInitAsync()
{
_allUsers = await _serviceScope.ServiceProvider.GetService<SysUserService>().UserSelectorAsync(_searchKey);
var data = await _serviceScope.ServiceProvider.GetService<RoleService>().OwnUserAsync(_choiceRoleId);
_allUsers = await _serviceScope.ServiceProvider.GetService<ISysUserService>().UserSelectorAsync(_searchKey);
var data = await _serviceScope.ServiceProvider.GetService<IRoleService>().OwnUserAsync(_choiceRoleId);
_usersChoice = _allUsers.Where(a => data.Contains(a.Id)).ToList();
return _allUsers;
}

View File

@@ -37,14 +37,14 @@ public partial class Session
var confirm = await PopupService.OpenConfirmDialogAsync("警告", "确定 ?");
if (confirm)
{
await _serviceScope.ServiceProvider.GetService<SessionService>().ExitSessionAsync(id);
await _serviceScope.ServiceProvider.GetService<ISessionService>().ExitSessionAsync(id);
}
}
private async Task<ISqlSugarPagedList<SessionOutput>> SessionQueryCallAsync(SessionPageInput input)
{
return await _serviceScope.ServiceProvider.GetService<SessionService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<ISessionService>().PageAsync(input);
}
private async Task ShowVerificatListAsync(List<VerificatInfo> verificatInfos)
@@ -62,7 +62,7 @@ public partial class Session
VerificatIds = verificats.Select(it => it.Id).ToList(),
Id = verificats.First().UserId
};
await _serviceScope.ServiceProvider.GetService<SessionService>().ExitVerificatAsync(send);
await _serviceScope.ServiceProvider.GetService<ISessionService>().ExitVerificatAsync(send);
_verificatInfos.RemoveWhere(it => send.VerificatIds.Contains(it.Id));
}

View File

@@ -28,23 +28,23 @@ public partial class Spa
private async Task AddCallAsync(SpaAddInput input)
{
await _serviceScope.ServiceProvider.GetService<SpaService>().AddAsync(input);
await _serviceScope.ServiceProvider.GetService<ISpaService>().AddAsync(input);
await _mainLayout.StateHasChangedAsync();
}
private async Task DeleteCallAsync(IEnumerable<SysResource> input)
{
await _serviceScope.ServiceProvider.GetService<SpaService>().DeleteAsync(input.Select(a => a.Id).ToArray());
await _serviceScope.ServiceProvider.GetService<ISpaService>().DeleteAsync(input.Select(a => a.Id).ToArray());
await _mainLayout.StateHasChangedAsync();
}
private async Task EditCallAsync(SpaEditInput input)
{
await _serviceScope.ServiceProvider.GetService<SpaService>().EditAsync(input);
await _serviceScope.ServiceProvider.GetService<ISpaService>().EditAsync(input);
await _mainLayout.StateHasChangedAsync();
}
private async Task<ISqlSugarPagedList<SysResource>> QueryCallAsync(SpaPageInput input)
{
return await _serviceScope.ServiceProvider.GetService<SpaService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<ISpaService>().PageAsync(input);
}
}

View File

@@ -35,17 +35,17 @@ public partial class User
private async Task AddCallAsync(UserAddInput input)
{
await _serviceScope.ServiceProvider.GetService<SysUserService>().AddAsync(input);
await _serviceScope.ServiceProvider.GetService<ISysUserService>().AddAsync(input);
}
private async Task DeleteCallAsync(IEnumerable<SysUser> users)
{
await _serviceScope.ServiceProvider.GetService<SysUserService>().DeleteAsync(users.Select(a => a.Id).ToArray());
await _serviceScope.ServiceProvider.GetService<ISysUserService>().DeleteAsync(users.Select(a => a.Id).ToArray());
await _mainLayout.StateHasChangedAsync();
}
private async Task EditCallAsync(UserEditInput users)
{
await _serviceScope.ServiceProvider.GetService<SysUserService>().EditAsync(users);
await _serviceScope.ServiceProvider.GetService<ISysUserService>().EditAsync(users);
await _mainLayout.StateHasChangedAsync();
}
@@ -56,7 +56,7 @@ public partial class User
UserGrantRoleInput userGrantRoleInput = new();
userGrantRoleInput.Id = _choiceUserId;
userGrantRoleInput.RoleIdList = _rolesChoice.Select(it => it.Id).ToList();
await _serviceScope.ServiceProvider.GetService<SysUserService>().GrantRoleAsync(userGrantRoleInput);
await _serviceScope.ServiceProvider.GetService<ISysUserService>().GrantRoleAsync(userGrantRoleInput);
_isShowRoles = false;
}
catch (Exception ex)
@@ -68,20 +68,20 @@ public partial class User
}
private async Task<ISqlSugarPagedList<SysUser>> QueryCallAsync(UserPageInput input)
{
return await _serviceScope.ServiceProvider.GetService<SysUserService>().PageAsync(input);
return await _serviceScope.ServiceProvider.GetService<ISysUserService>().PageAsync(input);
}
private async Task ResetPasswordAsync(SysUser sysUser)
{
await _serviceScope.ServiceProvider.GetService<SysUserService>().ResetPasswordAsync(sysUser.Id);
await _serviceScope.ServiceProvider.GetService<ISysUserService>().ResetPasswordAsync(sysUser.Id);
await PopupService.EnqueueSnackbarAsync(new("成功", AlertTypes.Success));
await _mainLayout.StateHasChangedAsync();
}
private async Task RoleInitAsync()
{
_allRoles = await _serviceScope.ServiceProvider.GetService<RoleService>().RoleSelectorAsync();
var data = await _serviceScope.ServiceProvider.GetService<RoleService>().GetRoleIdListByUserIdAsync(_choiceUserId);
_allRoles = await _serviceScope.ServiceProvider.GetService<IRoleService>().RoleSelectorAsync();
var data = await _serviceScope.ServiceProvider.GetService<IRoleService>().GetRoleIdListByUserIdAsync(_choiceUserId);
_rolesChoice = _allRoles.Where(a => data.Contains(a.Id)).ToList();
}
private async Task UserStatusChangeAsync(SysUser context, bool enable)
@@ -89,9 +89,9 @@ public partial class User
try
{
if (enable)
await _serviceScope.ServiceProvider.GetService<SysUserService>().EnableUserAsync(context.Id);
await _serviceScope.ServiceProvider.GetService<ISysUserService>().EnableUserAsync(context.Id);
else
await _serviceScope.ServiceProvider.GetService<SysUserService>().DisableUserAsync(context.Id);
await _serviceScope.ServiceProvider.GetService<ISysUserService>().DisableUserAsync(context.Id);
}
finally
{

View File

@@ -44,14 +44,14 @@ public partial class UserCenter
async Task OnDefaultRazorSaveAsync()
{
await _serviceScope.ServiceProvider.GetService<UserCenterService>().UpdateUserDefaultRazorAsync(UserManager.UserId, _defaultMenuId);
await _serviceScope.ServiceProvider.GetService<IUserCenterService>().UpdateUserDefaultRazorAsync(UserManager.UserId, _defaultMenuId);
await _mainLayout.StateHasChangedAsync();
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
}
async Task OnShortcutSaveAsync()
{
await _serviceScope.ServiceProvider.GetService<UserCenterService>().UpdateWorkbenchAsync(_menusChoice);
await _serviceScope.ServiceProvider.GetService<IUserCenterService>().UpdateWorkbenchAsync(_menusChoice);
await _mainLayout.StateHasChangedAsync();
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
}
@@ -62,7 +62,7 @@ public partial class UserCenter
{
//验证成功,操作业务
_passwordInfoInput.Id = UserResoures.CurrentUser.Id;
await _serviceScope.ServiceProvider.GetService<UserCenterService>().EditPasswordAsync(_passwordInfoInput);
await _serviceScope.ServiceProvider.GetService<IUserCenterService>().EditPasswordAsync(_passwordInfoInput);
await _mainLayout.StateHasChangedAsync();
await PopupService.EnqueueSnackbarAsync("成功,将重新登录", AlertTypes.Success);
await Task.Delay(2000);
@@ -72,7 +72,7 @@ public partial class UserCenter
async Task OnUpdateUserInfoAsync()
{
await _serviceScope.ServiceProvider.GetService<UserCenterService>().UpdateUserInfoAsync(_updateInfoInput);
await _serviceScope.ServiceProvider.GetService<IUserCenterService>().UpdateUserInfoAsync(_updateInfoInput);
await _mainLayout.StateHasChangedAsync();
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
}

View File

@@ -56,7 +56,7 @@ public partial class Vislog
var confirm = await PopupService.OpenConfirmDialogAsync("删除", "确定 ?");
if (confirm)
{
await _serviceScope.ServiceProvider.GetService<VisitLogService>().DeleteAsync(_categoryFilters.Select(it => it.Value).ToArray());
await _serviceScope.ServiceProvider.GetService<IVisitLogService>().DeleteAsync(_categoryFilters.Select(it => it.Value).ToArray());
await _datatable?.QueryClickAsync();
}
}
@@ -74,7 +74,7 @@ public partial class Vislog
private async Task<ISqlSugarPagedList<SysVisitLog>> QueryCallAsync(VisitLogPageInput input)
{
var data = await _serviceScope.ServiceProvider.GetService<VisitLogService>().PageAsync(input);
var data = await _serviceScope.ServiceProvider.GetService<IVisitLogService>().PageAsync(input);
return data;
}
}

View File

@@ -1,12 +1,12 @@
#region copyright
#region copyright
//------------------------------------------------------------------------------
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊȫ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD>Diego<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><EFBFBD>Ŀ<EFBFBD>ԴЭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD>
// GiteeԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://gitee.com/diego2098/ThingsGateway
// GithubԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://github.com/kimdiego2098/ThingsGateway
// ʹ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>https://diego2098.gitee.io/thingsgateway-docs/
// QQȺ<EFBFBD><EFBFBD>605534569
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
// 使用文档:https://diego2098.gitee.io/thingsgateway-docs/
// QQ群:605534569
//------------------------------------------------------------------------------
#endregion
@@ -16,8 +16,7 @@ using Masa.Blazor.Presets;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics;
using Microsoft.Extensions.Hosting;
using ThingsGateway.Foundation.Extension.String;
@@ -44,7 +43,7 @@ public partial class Login
/// <inheritdoc/>
protected override async Task OnParametersSetAsync()
{
if (Debugger.IsAttached)
if (App.WebHostEnvironment.IsDevelopment())
{
_loginModel.Account = "superAdmin";
_password = "111111";
@@ -54,7 +53,7 @@ public partial class Login
_configTitle = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_TITLE))?.ConfigValue;
_configRemark = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_REMARK))?.ConfigValue;
_showCaptcha = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_CAPTCHA_OPEN))?.ConfigValue?.ToBool(false) == true;
_welcome = "<EFBFBD><EFBFBD>ӭʹ<EFBFBD><EFBFBD>" + _configTitle + "!";
_welcome = "欢迎使用" + _configTitle + "!";
await base.OnParametersSetAsync();
}
@@ -102,14 +101,14 @@ public partial class Login
await _captcha.RefreshCode();
}
await PopupService.EnqueueSnackbarAsync(new("<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + ": " + ret.Msg.ToString(), AlertTypes.Error));
await PopupService.EnqueueSnackbarAsync(new("登录错误" + ": " + ret.Msg.ToString(), AlertTypes.Error));
}
else
{
await PopupService.EnqueueSnackbarAsync(new("<EFBFBD><EFBFBD>¼<EFBFBD>ɹ<EFBFBD>", AlertTypes.Success));
await PopupService.EnqueueSnackbarAsync(new("登录成功", AlertTypes.Success));
await Task.Delay(500);
var userId = await _serviceScope.ServiceProvider.GetService<SysUserService>().GetIdByAccountAsync(_loginModel.Account);
var data = await _serviceScope.ServiceProvider.GetService<UserCenterService>().GetLoginDefaultRazorAsync(userId);
var userId = await _serviceScope.ServiceProvider.GetService<ISysUserService>().GetIdByAccountAsync(_loginModel.Account);
var data = await _serviceScope.ServiceProvider.GetService<IUserCenterService>().GetLoginDefaultRazorAsync(userId);
var sameLevelMenus = await _serviceScope.ServiceProvider.GetService<ResourceService>().GetaMenuAndSpaListAsync();
if (_NavigationManager.ToAbsoluteUri(_NavigationManager.Uri).AbsolutePath == "/Login" || _NavigationManager.ToAbsoluteUri(_NavigationManager.Uri).AbsolutePath == "/")
await _ajaxService.GotoAsync(sameLevelMenus.FirstOrDefault(a => a.Id == data)?.Component ?? "index");
@@ -124,7 +123,7 @@ public partial class Login
await _captcha.RefreshCode();
}
await PopupService.EnqueueSnackbarAsync(new("<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", AlertTypes.Error));
await PopupService.EnqueueSnackbarAsync(new("登录错误", AlertTypes.Error));
}
}
private async Task<string> RefreshCode()

View File

@@ -1,12 +1,12 @@
#region copyright
#region copyright
//------------------------------------------------------------------------------
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊȫ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD>Diego<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><EFBFBD>Ŀ<EFBFBD>ԴЭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD>
// GiteeԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://gitee.com/diego2098/ThingsGateway
// GithubԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://github.com/kimdiego2098/ThingsGateway
// ʹ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>https://diego2098.gitee.io/thingsgateway-docs/
// QQȺ<EFBFBD><EFBFBD>605534569
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
// 使用文档:https://diego2098.gitee.io/thingsgateway-docs/
// QQ群:605534569
//------------------------------------------------------------------------------
#endregion
@@ -16,7 +16,7 @@ using ThingsGateway.Foundation.Extension.String;
namespace ThingsGateway.Admin.Blazor;
public partial class MainLayout
public partial class MainLayout : IDisposable
{
private List<SysResource> _breadcrumbSysResources = new();
private string _configCopyRight = "";
@@ -43,16 +43,23 @@ public partial class MainLayout
private IServiceScopeFactory _serviceScopeFactory { get; set; }
[Inject]
private UserResoures _userResoures { get; set; }
public void Dispose()
{
_serviceScope.Dispose();
}
/// <summary>
/// ҳ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>
/// 页面刷新
/// </summary>
/// <returns></returns>
public async Task StateHasChangedAsync()
{
_configCopyRight = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_COPYRIGHT)).ConfigValue;
_configTitle = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_TITLE)).ConfigValue;
_configCopyRightUrl = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_COPYRIGHT_URL)).ConfigValue;
_configPageTab = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_PAGETAB)).ConfigValue.ToBool(true);
var configService = _serviceScope.ServiceProvider.GetService<IConfigService>();
_configCopyRight = (await configService.GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_COPYRIGHT)).ConfigValue;
_configTitle = (await configService.GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_TITLE)).ConfigValue;
_configCopyRightUrl = (await configService.GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_COPYRIGHT_URL)).ConfigValue;
_configPageTab = (await configService.GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_PAGETAB)).ConfigValue.ToBool(true);
await _userResoures.InitUserAsync();
await _userResoures.InitMenuAsync();

View File

@@ -24,7 +24,6 @@ public class Startup : AppStartup
public void ConfigureServices(IServiceCollection services)
{
services.ThingsGatewayComponentsConfigureServices();
services.AddScoped<UserResoures>();
}

View File

@@ -3,6 +3,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.0" />
<PackageReference Include="Masa.Blazor.SomethingSkia" Version="1.2.2" />
</ItemGroup>

View File

@@ -35,6 +35,7 @@ public class Startup : AppStartup
{
WorkerId = 4// 取值范围0~63
});
services.ThingsGatewayCoreConfigureServices();
services.AddComponent<LoggingConsoleComponent>();//启动控制台日志格式化组件
ThingsGateway.Core.TypeExtensions.DefaultFuncs.Add(a => a.GetCustomAttribute<SqlSugar.SugarColumn>()?.ColumnDescription);

View File

@@ -5,8 +5,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.5" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.122" />
<PackageReference Include="Furion.Pure" Version="4.9.1.11" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.1.11" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.11" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.126" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>

View File

@@ -56,6 +56,7 @@ public abstract class BaseComponentBase : ComponentBase, IDisposable
/// </summary>
public virtual void Dispose()
{
_serviceScope.Dispose();
}
/// <summary>

View File

@@ -19,7 +19,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace ThingsGateway.Components;
public static class ConfigureService
public static class ServiceExtensions
{
/// <inheritdoc/>
public static void ThingsGatewayComponentsConfigureServices(this IServiceCollection services)
@@ -65,9 +65,7 @@ public static class ConfigureService
{ nameof(MTimeline), new Dictionary<string, object>() { { nameof(MTimeline.Dense), true } } },
{ nameof(MToolbar), new Dictionary<string, object>() { { nameof(MToolbar.Dense), true } } },
{ "MTreeview", new Dictionary<string, object>() { { "Dense", true } } },
{ nameof(PImageCaptcha), new Dictionary<string, object>() { { nameof(PImageCaptcha.Dense), true } } }
{ "PImageCaptcha", new Dictionary<string, object>() { { "Dense", true } } }
};
options.ConfigureTheme(theme =>
@@ -98,6 +96,7 @@ public static class ConfigureService
services.AddScoped<InitTimezone>();
services.AddScoped<AjaxService>();
services.AddScoped<CookieStorage>();
services.AddScoped<IDefaultTimezoneOffsetAccessor, DefaultTimezoneOffsetAccessor>();
}
}

View File

@@ -1,4 +1,4 @@
#region copyright
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
@@ -10,15 +10,12 @@
//------------------------------------------------------------------------------
#endregion
namespace ThingsGateway.Foundation.Serial;
namespace ThingsGateway.Components;
/// <summary>
/// 字节事件
/// </summary>
public class SerialReceivedEventArgs : TouchSocketEventArgs
public class DefaultTimezoneOffsetAccessor : IDefaultTimezoneOffsetAccessor
{
/// <summary>
/// 数据块
/// </summary>
public ByteBlock UserToken { get; set; }
}
public TimeSpan GetTimezoneOffsetResult()
{
return TimeSpan.FromHours(8);
}
}

View File

@@ -0,0 +1,8 @@

namespace ThingsGateway.Components
{
public interface IDefaultTimezoneOffsetAccessor
{
TimeSpan GetTimezoneOffsetResult();
}
}

View File

@@ -10,9 +10,6 @@
//------------------------------------------------------------------------------
#endregion
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace ThingsGateway.Components;
/// <summary>
@@ -43,17 +40,11 @@ public class InitTimezone : IDisposable
/// <param name="jsRuntime"></param>
/// <param name="storage"></param>
/// <param name="serviceProvider"></param>
public InitTimezone(IJSRuntime jsRuntime, CookieStorage storage, IServiceProvider serviceProvider)
public InitTimezone(IJSRuntime jsRuntime, CookieStorage storage, IDefaultTimezoneOffsetAccessor defaultTimezoneOffsetAccessor)
{
IHttpContextAccessor httpContextAccessor = serviceProvider.GetService<IHttpContextAccessor>();
_jsRuntime = jsRuntime;
_storage = storage;
var httpContext = httpContextAccessor?.HttpContext;
if (httpContext is not null)
{
var timezoneOffsetResult = httpContext.Request.Cookies[_timezoneOffsetKey];
_timezoneOffset = TimeSpan.FromMinutes(Convert.ToDouble(timezoneOffsetResult));
}
_timezoneOffset = defaultTimezoneOffsetAccessor.GetTimezoneOffsetResult();
}
/// <summary>
/// 获取Web客户端时差

View File

@@ -3,7 +3,6 @@
<ItemGroup>
<PackageReference Include="Masa.Blazor" Version="1.2.2" />
<PackageReference Include="Masa.Blazor.SomethingSkia" Version="1.2.2" />
</ItemGroup>
<ItemGroup>

View File

@@ -10,8 +10,6 @@
//------------------------------------------------------------------------------
#endregion
using Furion.DependencyInjection;
using Mapster;
using Microsoft.Extensions.Caching.Memory;
@@ -23,8 +21,9 @@ namespace ThingsGateway.Core;
/// <summary>
/// 系统内存缓存
/// </summary>
public class MemoryCache : ISingleton
public class MemoryCache
{
public static MemoryCache Instance { get; private set; } = new();
private const string intervalStr = "---___---";
private readonly Microsoft.Extensions.Caching.Memory.MemoryCache _memoryCache = new(new MemoryCacheOptions());
private readonly Microsoft.Extensions.Caching.Memory.MemoryCache _prefixmemoryCache = new(new MemoryCacheOptions());

View File

@@ -10,20 +10,15 @@
//------------------------------------------------------------------------------
#endregion
using Furion;
using Microsoft.Extensions.DependencyInjection;
namespace ThingsGateway.Core;
/// <summary>
/// Startup
/// </summary>
[AppStartup(9999)]
public class Startup : AppStartup
public static class ServiceExtensions
{
public void ConfigureServices(IServiceCollection services)
/// <inheritdoc/>
public static void ThingsGatewayCoreConfigureServices(this IServiceCollection services)
{
services.AddSingleton(a => MemoryCache.Instance);
}
}

View File

@@ -10,8 +10,6 @@
//------------------------------------------------------------------------------
#endregion
using Furion;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
@@ -90,7 +88,7 @@ public static class TypeExtensions
public static string GetDescription(this Type modelType, string name, Func<MemberInfo, string> func = null)
{
var cacheKey = $"{nameof(GetDescription)}-{CultureInfo.CurrentUICulture.Name}-{modelType.FullName}-{name}-{modelType.TypeHandle.Value}";
var str = App.GetService<MemoryCache>().GetOrCreate(cacheKey, entry =>
var str = MemoryCache.Instance.GetOrCreate(cacheKey, entry =>
{
string dn = default;
{

View File

@@ -1,8 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Furion.Pure" Version="4.9.1.5" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.1.5" />
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@@ -1,14 +1,7 @@
<Project>
<Import Project="$(SolutionDir)\Directory.Build.props" />
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<Version>4.0.0.3</Version>
<LangVersion>latest</LangVersion>
<Authors>Diego</Authors>
<Product>ThingsGateway</Product>
<Copyright>© 2023-present Diego</Copyright>
<RepositoryUrl>https://gitee.com/diego2098/ThingsGateway</RepositoryUrl>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
</PropertyGroup>

View File

@@ -12,6 +12,8 @@
using Photino.Blazor;
using ThingsGateway.Core;
namespace ThingsGateway.Foundation.Demo;
internal class Program
@@ -23,11 +25,10 @@ internal class Program
var appBuilder = PhotinoBlazorAppBuilder.CreateDefault(args);
Serve.RunNative();
appBuilder.RootComponents.Add<App>("#app");
appBuilder.Services.ThingsGatewayComponentsConfigureServices();
appBuilder.Services.ThingsGatewayCoreConfigureServices();
var app = appBuilder.Build();
app.MainWindow.SetTitle("ThingsGateway.Foundation.Demo");
app.MainWindow.SetIconFile("wwwroot/favicon.ico");

View File

@@ -12,6 +12,9 @@
using Microsoft.AspNetCore.Components;
using ThingsGateway.Components;
namespace ThingsGateway.Foundation.Demo;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
/// <summary>

View File

@@ -18,10 +18,10 @@
<MCard Flat Class="pa-2 my-1" Style="width:100%">
<div class="mb-4">通道配置</div>
<MRow Justify="JustifyTypes.Start" Align="AlignTypes.Center">
<MTextField Style="max-width:100px" Class="ma-1" Outlined Label=@(_serialProperty.Description(x => x.PortName)) Dense HideDetails="@("auto")" @bind-Value=@_serialProperty.PortName />
<MTextField Style="max-width:100px" Class="ma-1" Outlined Label=@(_serialProperty.Description(x => x.BaudRate)) Dense HideDetails="@("auto")" @bind-Value=@_serialProperty.BaudRate />
<MTextField Style="max-width:100px" Class="ma-1" Outlined Label=@(_serialProperty.Description(x => x.DataBits)) Dense HideDetails="@("auto")" @bind-Value=@_serialProperty.DataBits />
<MSelect Class="ma-1 " Style="max-width:200px" Outlined @bind-Value="_serialProperty.Parity" Label="@(_serialProperty.Description(x => x.Parity))"
<MTextField Style="max-width:100px" Class="ma-1" Outlined Label=@(_serialPortOption.Description(x => x.PortName)) Dense HideDetails="@("auto")" @bind-Value=@_serialPortOption.PortName />
<MTextField Style="max-width:100px" Class="ma-1" Outlined Label=@(_serialPortOption.Description(x => x.BaudRate)) Dense HideDetails="@("auto")" @bind-Value=@_serialPortOption.BaudRate />
<MTextField Style="max-width:100px" Class="ma-1" Outlined Label=@(_serialPortOption.Description(x => x.DataBits)) Dense HideDetails="@("auto")" @bind-Value=@_serialPortOption.DataBits />
<MSelect Class="ma-1 " Style="max-width:200px" Outlined @bind-Value="_serialPortOption.Parity" Label="@(_serialPortOption.Description(x => x.Parity))"
Items=@(typeof(Parity).GetEnumList())
MenuProps="@(props => { props.Auto = true; props.OffsetY = true; })"
ItemText=@((u) =>u.Description)
@@ -29,7 +29,7 @@
HideDetails=@("auto") Height="30"
Dense>
</MSelect>
<MSelect Class="ma-1 " Style="max-width:200px" Outlined @bind-Value="_serialProperty.StopBits" Label="@(_serialProperty.Description(x => x.StopBits))"
<MSelect Class="ma-1 " Style="max-width:200px" Outlined @bind-Value="_serialPortOption.StopBits" Label="@(_serialPortOption.Description(x => x.StopBits))"
Items=@(typeof(StopBits).GetEnumList())
MenuProps="@(props => { props.Auto = true; props.OffsetY = true; })"
ItemText=@((u) =>u.Description)

View File

@@ -13,39 +13,39 @@
namespace ThingsGateway.Foundation.Demo;
/// <inheritdoc/>
public partial class SerialSessionPage : IDisposable
public partial class SerialPortClientPage : IDisposable
{
/// <summary>
/// 日志输出
/// </summary>
public Action<LogLevel, object, string, Exception> LogAction;
private readonly SerialProperty _serialProperty = new();
private readonly SerialPortOption _serialPortOption = new();
private TouchSocketConfig _config;
private SerialSession _serialSession { get; set; } = new();
private SerialPortClient _serialPortClient { get; set; } = new();
/// <summary>
/// <inheritdoc/>
/// </summary>
public void Dispose()
{
_serialSession.SafeDispose();
_serialPortClient.SafeDispose();
}
/// <summary>
/// 获取对象
/// </summary>
/// <returns></returns>
public SerialSession GetSerialSession()
public SerialPortClient GetSerialPortClient()
{
_config ??= new TouchSocketConfig();
var LogMessage = new LoggerGroup() { LogLevel = LogLevel.Trace };
LogMessage.AddLogger(new EasyLogger(LogOut) { LogLevel = LogLevel.Trace });
_config.ConfigureContainer(a => a.RegisterSingleton<ILog>(LogMessage));
_config.SetSerialProperty(_serialProperty);
_config.SetSerialPortOption(_serialPortOption);
//载入配置
_serialSession.Setup(_config);
return _serialSession;
_serialPortClient.Setup(_config);
return _serialPortClient;
}
internal void StateHasChangedAsync()
{
@@ -63,7 +63,7 @@ public partial class SerialSessionPage : IDisposable
var LogMessage = new LoggerGroup() { LogLevel = LogLevel.Trace };
LogMessage.AddLogger(new EasyLogger(LogOut) { LogLevel = LogLevel.Trace });
_config.ConfigureContainer(a => a.RegisterSingleton<ILog>(LogMessage));
_serialSession.Setup(_config);
_serialPortClient.Setup(_config);
}
base.OnAfterRender(firstRender);
}
@@ -80,8 +80,8 @@ public partial class SerialSessionPage : IDisposable
{
try
{
_serialSession.Close();
await GetSerialSession().ConnectAsync();
_serialPortClient.Close();
await GetSerialPortClient().ConnectAsync();
}
catch (Exception ex)
{
@@ -93,7 +93,7 @@ public partial class SerialSessionPage : IDisposable
{
try
{
_serialSession.Close();
_serialPortClient.Close();
}
catch (Exception ex)
{

View File

@@ -16,6 +16,6 @@ global using System.Threading.Tasks;
global using ThingsGateway.Components;
global using ThingsGateway.Foundation.Core;
global using ThingsGateway.Foundation.Serial;
global using ThingsGateway.Foundation.SerialPorts;
global using ThingsGateway.Foundation.Sockets;

View File

@@ -19,7 +19,7 @@
@using Masa.Blazor;
@namespace ThingsGateway.Foundation.Demo
<SerialSessionPage @ref=_serialSessionPage></SerialSessionPage>
<SerialPortClientPage @ref=_serialPortClientPage></SerialPortClientPage>
<MCard Flat Class="pa-2 my-1" Style="width:100%">
<div class="mb-4">驱动配置</div>

View File

@@ -17,9 +17,9 @@ namespace ThingsGateway.Foundation.Demo;
public partial class DLT645_2007DebugPage
{
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private SerialSessionPage _serialSessionPage;
private SerialPortClientPage _serialPortClientPage;
private DriverDebugUIPage _driverDebugUIPage;
private ThingsGateway.Foundation.Adapter.DLT645.DLT645_2007 _plc;
/// <summary>
@@ -37,15 +37,15 @@ public partial class DLT645_2007DebugPage
//链路基础配置项
var config = new TouchSocketConfig();
config
.SetSerialProperty(new SerialProperty() //串口链路才需要
.SetSerialPortOption(new SerialPortOption() //串口链路才需要
{
PortName = "COM1"
});
var serialSession = new SerialSession();//链路对象
serialSession.Setup(config);
var serialPortClient = new SerialPortClient();//链路对象
serialPortClient.Setup(config);
//创建协议对象,构造函数需要传入对应链路对象
DLT645_2007 plc = new(serialSession)//传入链路
DLT645_2007 plc = new(serialPortClient)//传入链路
{
//协议配置
DataFormat = DataFormat.ABCD,
@@ -69,9 +69,9 @@ public partial class DLT645_2007DebugPage
""", "csharp"));
if (_serialSessionPage != null)
_serialSessionPage.LogAction = _driverDebugUIPage.LogOut;
_plc = new ThingsGateway.Foundation.Adapter.DLT645.DLT645_2007(_serialSessionPage.GetSerialSession());
if (_serialPortClientPage != null)
_serialPortClientPage.LogAction = _driverDebugUIPage.LogOut;
_plc = new ThingsGateway.Foundation.Adapter.DLT645.DLT645_2007(_serialPortClientPage.GetSerialPortClient());
_driverDebugUIPage.Plc = _plc;
//初始化

View File

@@ -17,7 +17,7 @@ namespace ThingsGateway.Foundation.Demo;
public partial class DLT645_2007OverTcpDebugPage
{
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private TcpClientPage _tcpClientPage;
private DriverDebugUIPage _driverDebugUIPage;

View File

@@ -40,7 +40,9 @@
Dense>
</MSelect>
<MCheckbox Class="ma-1" Style="max-width:200px" Label=@(_plc.Description(x => x.IsRtu)) Dense HideDetails="@("auto")" @bind-Value=@_plc.IsRtu></MCheckbox>
<MCheckbox Class="ma-1" Style="max-width:200px" Label=@(_plc.Description(x => x.IsCheckMessageId)) Dense HideDetails="@("auto")" @bind-Value=@_plc.IsCheckMessageId></MCheckbox>
<MCheckbox Class="ma-1" Style="max-width:200px" Label=@(_plc.Description(x => x.Crc16CheckEnable)) Dense HideDetails="@("auto")" @bind-Value=@_plc.Crc16CheckEnable></MCheckbox>
}
</MRow>

View File

@@ -13,9 +13,9 @@
namespace ThingsGateway.Foundation.Demo;
/// <summary>
/// ModbusTcpDtuDebugPage
/// ModbusDtuDebugPage
/// </summary>
public partial class ModbusTcpDtuDebugPage
public partial class ModbusDtuDebugPage
{
/// <summary>
/// TcpServerPage
@@ -23,7 +23,7 @@ public partial class ModbusTcpDtuDebugPage
private TcpServerPage _tcpServerPage;
private DriverDebugUIPage _driverDebugUIPage;
private ThingsGateway.Foundation.Adapter.Modbus.ModbusTcpDtu _plc;
private ThingsGateway.Foundation.Adapter.Modbus.ModbusDtu _plc;
/// <summary>
/// <inheritdoc/>
@@ -70,7 +70,7 @@ public partial class ModbusTcpDtuDebugPage
if (_tcpServerPage != null)
_tcpServerPage.LogAction = _driverDebugUIPage.LogOut;
_plc = new ThingsGateway.Foundation.Adapter.Modbus.ModbusTcpDtu(_tcpServerPage.GetTcpServer());
_plc = new ThingsGateway.Foundation.Adapter.Modbus.ModbusDtu(_tcpServerPage.GetTcpServer());
_driverDebugUIPage.Plc = _plc;
//载入配置
StateHasChanged();

View File

@@ -19,7 +19,7 @@
@using Masa.Blazor;
@namespace ThingsGateway.Foundation.Demo
<SerialSessionPage @ref=_serialSessionPage></SerialSessionPage>
<SerialPortClientPage @ref=_serialPortClientPage></SerialPortClientPage>
<MCard Flat Class="pa-2 my-1" Style="width:100%">
<div class="mb-4">驱动配置</div>

View File

@@ -19,9 +19,9 @@ namespace ThingsGateway.Foundation.Demo;
public partial class ModbusRtuDebugPage
{
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private SerialSessionPage _serialSessionPage;
private SerialPortClientPage _serialPortClientPage;
private readonly List<(string Code, string Language)> _sections = new();
private DriverDebugUIPage _driverDebugUIPage;
@@ -41,15 +41,15 @@ public partial class ModbusRtuDebugPage
//链路基础配置项
var config = new TouchSocketConfig();
config
.SetSerialProperty(new SerialProperty() //串口链路才需要
.SetSerialPortOption(new SerialPortOption() //串口链路才需要
{
PortName = "COM1"
});
var serialSession = new SerialSession();//链路对象
serialSession.Setup(config);
var serialPortClient = new SerialPortClient();//链路对象
serialPortClient.Setup(config);
//创建协议对象,构造函数需要传入对应链路对象
ModbusRtu plc = new(serialSession)//传入链路
ModbusRtu plc = new(serialPortClient)//传入链路
{
//协议配置
DataFormat = DataFormat.ABCD,
@@ -72,9 +72,9 @@ public partial class ModbusRtuDebugPage
""", "csharp"));
if (_serialSessionPage != null)
_serialSessionPage.LogAction = _driverDebugUIPage.LogOut;
_plc = new ThingsGateway.Foundation.Adapter.Modbus.ModbusRtu(_serialSessionPage.GetSerialSession());
if (_serialPortClientPage != null)
_serialPortClientPage.LogAction = _driverDebugUIPage.LogOut;
_plc = new ThingsGateway.Foundation.Adapter.Modbus.ModbusRtu(_serialPortClientPage.GetSerialPortClient());
_driverDebugUIPage.Plc = _plc;
//载入配置
StateHasChanged();

View File

@@ -19,7 +19,7 @@ namespace ThingsGateway.Foundation.Demo;
public partial class ModbusRtuOverTcpDebugPage
{
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private TcpClientPage _tcpClientPage;
private DriverDebugUIPage _driverDebugUIPage;

View File

@@ -17,7 +17,7 @@ namespace ThingsGateway.Foundation.Demo;
public partial class ModbusRtuOverUdpDebugPage
{
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private UdpSessionPage _udpSessionPage;
private DriverDebugUIPage _driverDebugUIPage;

View File

@@ -19,7 +19,7 @@
@using Masa.Blazor;
@namespace ThingsGateway.Foundation.Demo
<SerialSessionPage @ref=_serialSessionPage></SerialSessionPage>
<SerialPortClientPage @ref=_serialPortClientPage></SerialPortClientPage>
<MCard Flat Class="pa-2 my-1" Style="width:100%">
<div class="mb-4">驱动配置</div>

View File

@@ -17,9 +17,9 @@ namespace ThingsGateway.Foundation.Demo;
public partial class ModbusSerialServerDebugPage
{
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private SerialSessionPage _serialSessionPage;
private SerialPortClientPage _serialPortClientPage;
private DriverDebugUIPage _driverDebugUIPage;
private ThingsGateway.Foundation.Adapter.Modbus.ModbusSerialServer _plc;
@@ -39,15 +39,15 @@ public partial class ModbusSerialServerDebugPage
//链路基础配置项
var config = new TouchSocketConfig();
config
.SetSerialProperty(new SerialProperty() //串口链路才需要
.SetSerialPortOption(new SerialPortOption() //串口链路才需要
{
PortName = "COM1"
});
var serialSession = new SerialSession();//链路对象
serialSession.Setup(config);
var serialPortClient = new SerialPortClient();//链路对象
serialPortClient.Setup(config);
//创建协议对象,构造函数需要传入对应链路对象
ModbusSerialServer plc = new(serialSession)//传入链路
ModbusSerialServer plc = new(serialPortClient)//传入链路
{
//协议配置
DataFormat = DataFormat.ABCD,
@@ -70,9 +70,9 @@ public partial class ModbusSerialServerDebugPage
""", "csharp"));
if (_serialSessionPage != null)
_serialSessionPage.LogAction = _driverDebugUIPage.LogOut;
_plc = new ThingsGateway.Foundation.Adapter.Modbus.ModbusSerialServer(_serialSessionPage.GetSerialSession());
if (_serialPortClientPage != null)
_serialPortClientPage.LogAction = _driverDebugUIPage.LogOut;
_plc = new ThingsGateway.Foundation.Adapter.Modbus.ModbusSerialServer(_serialPortClientPage.GetSerialPortClient());
_driverDebugUIPage.Plc = _plc;
//载入配置
StateHasChanged();

View File

@@ -21,7 +21,7 @@ public partial class ModbusTcpDebugPage
private ThingsGateway.Foundation.Adapter.Modbus.ModbusTcp _plc;
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private TcpClientPage _tcpClientPage;
/// <summary>

View File

@@ -17,7 +17,7 @@ namespace ThingsGateway.Foundation.Demo;
public partial class ModbusUdpDebugPage
{
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private UdpSessionPage _udpSessionPage;
private DriverDebugUIPage _driverDebugUIPage;

View File

@@ -23,7 +23,7 @@
@using ThingsGateway.Foundation.Core;
@using ThingsGateway.Foundation.Adapter.OPCDA.Da;
@using ThingsGateway.Foundation.Extension;
@using ThingsGateway.Foundation.Serial;
@using ThingsGateway.Foundation.SerialPorts;
@using Masa.Blazor

View File

@@ -20,8 +20,6 @@ using Microsoft.JSInterop;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using ThingsGateway.Foundation.Adapter.OPCDA;
using ThingsGateway.Foundation.Adapter.OPCDA.Da;
@@ -45,6 +43,7 @@ public partial class OPCDAClientDebugPage : IDisposable
{
_plc.SafeDispose();
opcDAClientPage.SafeDispose();
base.Dispose();
}
/// <inheritdoc/>
@@ -105,7 +104,7 @@ public partial class OPCDAClientDebugPage : IDisposable
await PopupService.EnqueueSnackbarAsync("无可用变量", AlertTypes.Warning);
return;
}
await _serviceScope.ServiceProvider.GetService<CollectDeviceService>().AddAsync(data?.Item1);
await _serviceScope.ServiceProvider.GetService<ICollectDeviceService>().AddAsync(data?.Item1);
await _serviceScope.ServiceProvider.GetService<VariableService>().AddBatchAsync(data?.Item2);
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
}
@@ -151,7 +150,7 @@ public partial class OPCDAClientDebugPage : IDisposable
/// <returns></returns>
public async Task DownDeviceExportAsync(CollectDevice data)
{
using var memoryStream = await _serviceScope.ServiceProvider.GetService<CollectDeviceService>().ExportFileAsync(new List<CollectDevice>() { data });
using var memoryStream = await _serviceScope.ServiceProvider.GetService<ICollectDeviceService>().ExportFileAsync(new List<CollectDevice>() { data });
using var streamRef = new DotNetStreamReference(stream: memoryStream);
JSObjectReference ??= await JSRuntime.LoadModuleAsync("js/downloadFileFromStream");
await JSObjectReference.InvokeVoidAsync("downloadFileFromStream", $"设备导出{DateTimeExtensions.CurrentDateTime.ToFileDateTimeFormat()}.xlsx", streamRef);

View File

@@ -25,7 +25,7 @@
@using ThingsGateway.Foundation.Core;
@using ThingsGateway.Foundation.Adapter.OPCUA;
@using ThingsGateway.Foundation.Extension;
@using ThingsGateway.Foundation.Serial;
@using ThingsGateway.Foundation.SerialPorts;
@using Masa.Blazor

View File

@@ -96,7 +96,7 @@ public partial class OPCUAClientDebugPage
await PopupService.EnqueueSnackbarAsync("无可用变量", AlertTypes.Warning);
return;
}
await _serviceScope.ServiceProvider.GetService<CollectDeviceService>().AddAsync(data.Item1);
await _serviceScope.ServiceProvider.GetService<ICollectDeviceService>().AddAsync(data.Item1);
await _serviceScope.ServiceProvider.GetService<VariableService>().AddBatchAsync(data.Item2);
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
}
@@ -141,7 +141,7 @@ public partial class OPCUAClientDebugPage
/// <returns></returns>
public async Task DownDeviceExportAsync(CollectDevice data)
{
using var memoryStream = await _serviceScope.ServiceProvider.GetService<CollectDeviceService>().ExportFileAsync(new List<CollectDevice>() { data });
using var memoryStream = await _serviceScope.ServiceProvider.GetService<ICollectDeviceService>().ExportFileAsync(new List<CollectDevice>() { data });
using var streamRef = new DotNetStreamReference(stream: memoryStream);
JSObjectReference ??= await JSRuntime.LoadModuleAsync("js/downloadFileFromStream");
await JSObjectReference.InvokeVoidAsync("downloadFileFromStream", $"设备导出{DateTimeExtensions.CurrentDateTime.ToFileDateTimeFormat()}.xlsx", streamRef);

View File

@@ -20,7 +20,7 @@
@using ThingsGateway.Foundation.Adapter.Siemens;
@using ThingsGateway.Foundation.Core;
@using ThingsGateway.Foundation.Extension;
@using ThingsGateway.Foundation.Serial;
@using ThingsGateway.Foundation.SerialPorts;
@using Masa.Blazor

View File

@@ -21,7 +21,7 @@ public partial class SiemensDebugPage
private ThingsGateway.Foundation.Adapter.Siemens.SiemensS7PLC _plc;
/// <summary>
/// SerialSessionPage
/// SerialPortClientPage
/// </summary>
private TcpClientPage _tcpClientPage;
/// <summary>

View File

@@ -10,8 +10,6 @@
//------------------------------------------------------------------------------
#endregion
using System.Collections.Generic;
namespace ThingsGateway.Foundation.Demo;
public partial class MainLayout
@@ -105,16 +103,16 @@ public partial class MainLayout
"Title": "OPCUAClient"
}
]
},
{
"Title": "Mqtt",
"Children": [
{
"Href": "/MqttClient",
"Title": "MqttClient"
}
]
}
//{
// "Title": "Mqtt",
// "Children": [
// {
// "Href": "/MqttClient",
// "Title": "MqttClient"
// }
// ]
//}
]

View File

@@ -25,5 +25,5 @@
@using System.Net.Http.Json
@using System.IO;
@using System.Text.Json;
@using ThingsGateway.Foundation.Serial;
@using ThingsGateway.Foundation.SerialPorts;
@using ThingsGateway.Foundation.Sockets;

View File

@@ -14,9 +14,9 @@ using Microsoft.AspNetCore.Components.WebView.WindowsForms;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics;
using System.Threading.Tasks;
using ThingsGateway.Components;
using ThingsGateway.Core;
namespace ThingsGateway.Foundation.Demo.Winform
{
@@ -26,14 +26,12 @@ namespace ThingsGateway.Foundation.Demo.Winform
{
InitializeComponent();
IServiceCollection services = null;
IServiceCollection services = new ServiceCollection();
Serve.RunNative(a =>
{
services = a;
services.AddWindowsFormsBlazorWebView();
services.ThingsGatewayComponentsConfigureServices();
});
services.AddWindowsFormsBlazorWebView();
services.ThingsGatewayComponentsConfigureServices();
services.ThingsGatewayCoreConfigureServices();
blazorWebView1.HostPage = "wwwroot/index.html";
blazorWebView1.Services = services.BuildServiceProvider();

View File

@@ -7,6 +7,7 @@
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<None Remove="favicon.ico" />
</ItemGroup>

View File

@@ -1,16 +1,14 @@
<Project>
<Import Project="$(SolutionDir)\Directory.Build.props" />
<!--如果编译net45报错无支持用一下方法添加net45包-->
<!--VS顶部菜单栏 -> 视图 -> 其他 -> 程序包控制台
Install-Package Microsoft.NETFramework.ReferenceAssemblies.net45
-->
<PropertyGroup>
<Version>4.0.0.3</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<TargetFrameworks>net45;netstandard2.0;net6.0;net8.0;</TargetFrameworks>
<Description>
ThingsGateway.Foundation是工业设备通讯类库归属于ThingsGateway边缘网关项目说明文档https://diego2098.gitee.io/thingsgateway-docs/
</Description>
<Authors>Diego</Authors>
<Product>ThingsGateway</Product>
<Copyright>© 2023-present Diego</Copyright>
<RepositoryUrl>https://gitee.com/diego2098/ThingsGateway</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSource>true</EmbedUntrackedSource>
<EmbedAllSources>true</EmbedAllSources>
@@ -22,17 +20,11 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://diego2098.gitee.io/thingsgateway-docs/</PackageProjectUrl>
<PackageTags>ThingsGateway;Diego;dotNET China;Blazor;设备采集;边缘网关</PackageTags>
<SignAssembly>True</SignAssembly>
<DelaySign>False</DelaySign>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
<PackageOutputPath>..\..\nupkgs</PackageOutputPath>
<AssemblyOriginatorKeyFile>..\..\..\snks/ThingsGateway.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

View File

@@ -16,13 +16,13 @@ namespace ThingsGateway.Foundation.Adapter.DLT645;
/// <summary>
/// DLT645_2007
/// </summary>
public class DLT645_2007 : ReadWriteDevicesSerialSessionBase, IDLT645_2007
public class DLT645_2007 : ReadWriteDevicesSerialPortClientBase, IDLT645_2007
{
/// <summary>
/// DLT645_2007
/// </summary>
/// <param name="serialSession"></param>
public DLT645_2007(SerialSession serialSession) : base(serialSession)
/// <param name="serialPortClient"></param>
public DLT645_2007(SerialPortClient serialPortClient) : base(serialPortClient)
{
ThingsGatewayBitConverter = new DLT645_2007BitConverter(EndianType.Big);
RegisterByteLength = 2;
@@ -62,7 +62,7 @@ public class DLT645_2007 : ReadWriteDevicesSerialSessionBase, IDLT645_2007
{
EnableFEHead = EnableFEHead
};
SerialSession.SetDataHandlingAdapter(dataHandleAdapter);
SerialPortClient.SetDataHandlingAdapter(dataHandleAdapter);
}
@@ -106,7 +106,7 @@ public class DLT645_2007 : ReadWriteDevicesSerialSessionBase, IDLT645_2007
public override OperResult Write(string address, bool[] value, CancellationToken cancellationToken = default) => Write(address, value.ToString(), cancellationToken);
/// <inheritdoc/>
public override Task<OperResult> WriteAsync(string address, byte[] value, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public override Task<OperResult> WriteAsync(string address, byte[] value, CancellationToken cancellationToken = default) => Task.FromResult(new OperResult());
/// <inheritdoc/>
public override Task<OperResult> WriteAsync(string address, uint value, CancellationToken cancellationToken = default) => WriteAsync(address, value.ToString(), cancellationToken);
/// <inheritdoc/>
@@ -125,7 +125,7 @@ public class DLT645_2007 : ReadWriteDevicesSerialSessionBase, IDLT645_2007
public override Task<OperResult> WriteAsync(string address, int value, CancellationToken cancellationToken = default) => WriteAsync(address, value.ToString(), cancellationToken);
/// <inheritdoc/>
public override Task<OperResult> WriteAsync(string address, bool[] value, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public override Task<OperResult> WriteAsync(string address, bool[] value, CancellationToken cancellationToken = default) => Task.FromResult(new OperResult());
#region

View File

@@ -106,7 +106,7 @@ public class DLT645_2007OverTcp : ReadWriteDevicesTcpClientBase, IDLT645_2007
public override OperResult Write(string address, bool[] value, CancellationToken cancellationToken = default) => Write(address, value.ToString(), cancellationToken);
/// <inheritdoc/>
public override Task<OperResult> WriteAsync(string address, byte[] value, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public override Task<OperResult> WriteAsync(string address, byte[] value, CancellationToken cancellationToken = default) => Task.FromResult(new OperResult());
/// <inheritdoc/>
public override Task<OperResult> WriteAsync(string address, uint value, CancellationToken cancellationToken = default) => WriteAsync(address, value.ToString(), cancellationToken);
/// <inheritdoc/>
@@ -125,7 +125,7 @@ public class DLT645_2007OverTcp : ReadWriteDevicesTcpClientBase, IDLT645_2007
public override Task<OperResult> WriteAsync(string address, int value, CancellationToken cancellationToken = default) => WriteAsync(address, value.ToString(), cancellationToken);
/// <inheritdoc/>
public override Task<OperResult> WriteAsync(string address, bool[] value, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public override Task<OperResult> WriteAsync(string address, bool[] value, CancellationToken cancellationToken = default) => Task.FromResult(new OperResult());
#region

View File

@@ -17,5 +17,5 @@ global using System.Threading;
global using System.Threading.Tasks;
global using ThingsGateway.Foundation.Core;
global using ThingsGateway.Foundation.Serial;
global using ThingsGateway.Foundation.SerialPorts;
global using ThingsGateway.Foundation.Sockets;

View File

@@ -17,5 +17,5 @@ global using System.Threading;
global using System.Threading.Tasks;
global using ThingsGateway.Foundation.Core;
global using ThingsGateway.Foundation.Serial;
global using ThingsGateway.Foundation.SerialPorts;
global using ThingsGateway.Foundation.Sockets;

View File

@@ -14,14 +14,14 @@ using System.ComponentModel;
namespace ThingsGateway.Foundation.Adapter.Modbus;
/// <inheritdoc/>
public class ModbusTcpDtu : ReadWriteDevicesTcpServerBase
public class ModbusDtu : ReadWriteDevicesTcpServerBase
{
/// <inheritdoc/>
public ModbusTcpDtu(TcpService tcpService) : base(tcpService)
public ModbusDtu(TcpService tcpService) : base(tcpService)
{
ThingsGatewayBitConverter = new ThingsGatewayBitConverter(EndianType.Big);
RegisterByteLength = 2;
ModbusTcpDtuPlugin modbusTcpSalvePlugin = new ModbusTcpDtuPlugin();
ModbusDtuPlugin modbusTcpSalvePlugin = new ModbusDtuPlugin();
tcpService.Config.ConfigurePlugins(a =>
{
a.Add(modbusTcpSalvePlugin);
@@ -35,6 +35,18 @@ public class ModbusTcpDtu : ReadWriteDevicesTcpServerBase
[Description("检测事务标识符")]
public bool IsCheckMessageId { get; set; }
/// <summary>
/// 是否Rtu格式
/// </summary>
[Description("是否Rtu格式")]
public bool IsRtu { get; set; }
/// <summary>
/// Crc校验
/// </summary>
[Description("Crc校验")]
public bool Crc16CheckEnable { get; set; } = true;
/// <summary>
/// 站号
/// </summary>
@@ -92,23 +104,49 @@ public class ModbusTcpDtu : ReadWriteDevicesTcpServerBase
{
if (socketClient != default)
{
ModbusTcpDataHandleAdapter dataHandleAdapter = new()
{
IsCheckMessageId = IsCheckMessageId,
CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout)
};
socketClient.SetDataHandlingAdapter(dataHandleAdapter);
}
else
{
foreach (var item in TcpService.GetClients())
if (!IsRtu)
{
ModbusTcpDataHandleAdapter dataHandleAdapter = new()
{
IsCheckMessageId = IsCheckMessageId,
CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout)
};
item.SetDataHandlingAdapter(dataHandleAdapter);
socketClient.SetDataHandlingAdapter(dataHandleAdapter);
}
else
{
ModbusRtuDataHandleAdapter dataHandleAdapter = new()
{
Crc16CheckEnable = Crc16CheckEnable,
CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout)
};
socketClient.SetDataHandlingAdapter(dataHandleAdapter);
}
}
else
{
//只适配第一个
var item = TcpService.GetClients().FirstOrDefault();
if (item != null)
{
if (!IsRtu)
{
ModbusTcpDataHandleAdapter dataHandleAdapter = new()
{
IsCheckMessageId = IsCheckMessageId,
CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout)
};
item.SetDataHandlingAdapter(dataHandleAdapter);
}
else
{
ModbusRtuDataHandleAdapter dataHandleAdapter = new()
{
Crc16CheckEnable = Crc16CheckEnable,
CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout)
};
item.SetDataHandlingAdapter(dataHandleAdapter);
}
}
}
}
@@ -187,7 +225,7 @@ public class ModbusTcpDtu : ReadWriteDevicesTcpServerBase
if (TcpService.TryGetSocketClient($"ID={id}", out var client))
{
SetDataAdapter(client);
return SendThenReturn<ModbusTcpMessage>(command, cancellationToken, client);
return SendThenReturn<MessageBase>(command, cancellationToken, client);
}
else
{
@@ -200,7 +238,7 @@ public class ModbusTcpDtu : ReadWriteDevicesTcpServerBase
if (TcpService.TryGetSocketClient($"ID={id}", out var client))
{
SetDataAdapter(client);
return await SendThenReturnAsync<ModbusTcpMessage>(command, cancellationToken, client);
return await SendThenReturnAsync<MessageBase>(command, cancellationToken, client);
}
else if (TcpService.SocketClients.Count == 1)
{
@@ -208,13 +246,13 @@ public class ModbusTcpDtu : ReadWriteDevicesTcpServerBase
if (client1 != null)
{
SetDataAdapter(client1);
return await SendThenReturnAsync<ModbusTcpMessage>(command, cancellationToken, client1);
return await SendThenReturnAsync<MessageBase>(command, cancellationToken, client1);
}
}
return new OperResult<byte[]>("客户端未连接");
}
internal class ModbusTcpDtuPlugin : PluginBase, ITcpReceivingPlugin
internal class ModbusDtuPlugin : PluginBase, ITcpReceivingPlugin
{
public async Task OnTcpReceiving(ITcpClientBase client, ByteBlockEventArgs e)
{

View File

@@ -134,21 +134,19 @@ internal class ModbusHelper
if (response[1] >= 0x80)//错误码
return new OperResult<byte[], FilterResult>(GetDescriptionByErrorCode(response[2])) { Content2 = FilterResult.Success };
if (response[1] <= 0x05)
if (response[1] <= 0x04)
{
if ((response.Length < response[2] + 5))
return new OperResult<byte[], FilterResult>("数据长度不足" + response.ToHexString()) { Content2 = FilterResult.Cache };
}
else
{
if ((response.Length < 8))
return new OperResult<byte[], FilterResult>("数据长度不足" + response.ToHexString()) { Content2 = FilterResult.Cache };
}
var data = response.SelectMiddle(0, response[2] != 0 ? response[2] + 5 : 8);
var data = response.SelectMiddle(0, response[1] <= 0x04 ? response[2] != 0 ? response[2] + 5 : 8 : 8);
if (crcCheck && !CRC16Utils.CheckCRC16(data))
return new OperResult<byte[], FilterResult>("Crc校验失败" + DataTransUtil.ByteToHexString(data, ' ')) { Content2 = FilterResult.Success };
return GetModbusData(send, data.RemoveLast(2));

View File

@@ -16,13 +16,13 @@ namespace ThingsGateway.Foundation.Adapter.Modbus;
/// <summary>
/// ModbusRtu
/// </summary>
public class ModbusRtu : ReadWriteDevicesSerialSessionBase
public class ModbusRtu : ReadWriteDevicesSerialPortClientBase
{
/// <summary>
/// ModbusRtu
/// </summary>
/// <param name="serialSession"></param>
public ModbusRtu(SerialSession serialSession) : base(serialSession)
/// <param name="serialPortClient"></param>
public ModbusRtu(SerialPortClient serialPortClient) : base(serialPortClient)
{
ThingsGatewayBitConverter = new ThingsGatewayBitConverter(EndianType.Big);
RegisterByteLength = 2;
@@ -93,7 +93,7 @@ public class ModbusRtu : ReadWriteDevicesSerialSessionBase
Crc16CheckEnable = Crc16CheckEnable,
CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout)
};
SerialSession.SetDataHandlingAdapter(dataHandleAdapter);
SerialPortClient.SetDataHandlingAdapter(dataHandleAdapter);
}
/// <inheritdoc/>

View File

@@ -19,7 +19,7 @@ namespace ThingsGateway.Foundation.Adapter.Modbus;
/// </summary>
internal class ModbusTcpDataHandleAdapter : ReadWriteDevicesSingleStreamDataHandleAdapter<ModbusTcpMessage>
{
private readonly IncrementCount easyIncrementCount = new(ushort.MaxValue);
private readonly IncrementCount _incrementCount = new(ushort.MaxValue);
/// <summary>
/// 检测事务标识符
@@ -39,7 +39,7 @@ internal class ModbusTcpDataHandleAdapter : ReadWriteDevicesSingleStreamDataHand
/// <inheritdoc/>
public override byte[] PackCommand(byte[] command)
{
return ModbusHelper.AddModbusTcpHead(command, (ushort)easyIncrementCount.GetCurrentValue());
return ModbusHelper.AddModbusTcpHead(command, (ushort)_incrementCount.GetCurrentValue());
}
/// <inheritdoc/>

View File

@@ -18,7 +18,7 @@ namespace ThingsGateway.Foundation.Adapter.Modbus;
/// </summary>
internal class ModbusUdpDataHandleAdapter : ReadWriteDevicesUdpDataHandleAdapter<ModbusTcpMessage>
{
private readonly IncrementCount easyIncrementCount = new(ushort.MaxValue);
private readonly IncrementCount _incrementCount = new(ushort.MaxValue);
/// <summary>
/// 检测事务标识符
@@ -38,7 +38,7 @@ internal class ModbusUdpDataHandleAdapter : ReadWriteDevicesUdpDataHandleAdapter
/// <inheritdoc/>
public override byte[] PackCommand(byte[] command)
{
return ModbusHelper.AddModbusTcpHead(command, (ushort)easyIncrementCount.GetCurrentValue());
return ModbusHelper.AddModbusTcpHead(command, (ushort)_incrementCount.GetCurrentValue());
}
/// <inheritdoc/>

View File

@@ -16,10 +16,10 @@ namespace ThingsGateway.Foundation.Adapter.Modbus;
/// <summary>
/// <inheritdoc/>
/// </summary>
public class ModbusSerialServer : ReadWriteDevicesSerialSessionBase, IModbusServer
public class ModbusSerialServer : ReadWriteDevicesSerialPortClientBase, IModbusServer
{
/// <inheritdoc/>
public ModbusSerialServer(SerialSession serialSession) : base(serialSession)
public ModbusSerialServer(SerialPortClient serialPortClient) : base(serialPortClient)
{
ThingsGatewayBitConverter = new ThingsGatewayBitConverter(EndianType.Big);
RegisterByteLength = 2;
@@ -130,7 +130,7 @@ public class ModbusSerialServer : ReadWriteDevicesSerialSessionBase, IModbusServ
{
ModbusSerialServerDataHandleAdapter dataHandleAdapter = new();
dataHandleAdapter.CacheTimeout = TimeSpan.FromMilliseconds(CacheTimeout);
SerialSession.SetDataHandlingAdapter(dataHandleAdapter);
SerialPortClient.SetDataHandlingAdapter(dataHandleAdapter);
}
@@ -165,7 +165,7 @@ public class ModbusSerialServer : ReadWriteDevicesSerialSessionBase, IModbusServ
}
/// <inheritdoc/>
protected override async Task Received(SerialSession client, ReceivedDataEventArgs e)
protected override async Task Received(SerialPortClient client, ReceivedDataEventArgs e)
{
try
{

View File

@@ -253,11 +253,11 @@
ModbusRtu
</summary>
</member>
<member name="M:ThingsGateway.Foundation.Adapter.Modbus.ModbusRtu.#ctor(ThingsGateway.Foundation.Serial.SerialSession)">
<member name="M:ThingsGateway.Foundation.Adapter.Modbus.ModbusRtu.#ctor(ThingsGateway.Foundation.SerialPorts.SerialPortClient)">
<summary>
ModbusRtu
</summary>
<param name="serialSession"></param>
<param name="serialPortClient"></param>
</member>
<member name="P:ThingsGateway.Foundation.Adapter.Modbus.ModbusRtu.Crc16CheckEnable">
<summary>

View File

@@ -143,7 +143,7 @@ public interface IReadWrite : IDisposable
/// <param name="cancellationToken">取消令箭</param>
/// <param name="senderClient">传入改参数时,将新建等待线程</param>
/// <returns></returns>
T SendThenReturn<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>, new();
T SendThenReturn<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>;
/// <summary>
/// 异步发送并返回结果
@@ -153,7 +153,7 @@ public interface IReadWrite : IDisposable
/// <param name="cancellationToken">取消令箭</param>
/// <param name="senderClient">传入改参数时,将新建等待线程</param>
/// <returns></returns>
Task<T> SendThenReturnAsync<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>, new();
Task<T> SendThenReturnAsync<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>;
/// <summary>
/// 发送获取数据

View File

@@ -148,7 +148,7 @@ public abstract class ReadWriteDevicesBase : IReadWrite
public abstract void Send(byte[] command, string id = default);
/// <inheritdoc/>
public virtual T SendThenReturn<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>, new()
public virtual T SendThenReturn<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>
{
var item = command;
if (FrameTime != 0)
@@ -157,7 +157,7 @@ public abstract class ReadWriteDevicesBase : IReadWrite
return (T)result.RequestInfo;
}
/// <inheritdoc/>
public virtual async Task<T> SendThenReturnAsync<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>, new()
public virtual async Task<T> SendThenReturnAsync<T>(byte[] command, CancellationToken cancellationToken, ISenderClient senderClient = default) where T : OperResult<byte[]>
{
var item = command;
await Task.Delay(FrameTime, cancellationToken);

View File

@@ -10,33 +10,34 @@
//------------------------------------------------------------------------------
#endregion
namespace ThingsGateway.Foundation.Core;
/// <summary>
/// 串口读写设备
/// </summary>
public abstract class ReadWriteDevicesSerialSessionBase : ReadWriteDevicesBase
public abstract class ReadWriteDevicesSerialPortClientBase : ReadWriteDevicesBase
{
/// <summary>
/// <inheritdoc cref="ReadWriteDevicesSerialSessionBase"/>
/// <inheritdoc cref="ReadWriteDevicesSerialPortClientBase"/>
/// </summary>
/// <param name="serialSession"></param>
public ReadWriteDevicesSerialSessionBase(SerialSession serialSession)
/// <param name="serialPortClient"></param>
public ReadWriteDevicesSerialPortClientBase(SerialPortClient serialPortClient)
{
SerialSession = serialSession;
WaitingClientEx = SerialSession.CreateWaitingClient(new() { });
SerialSession.Received -= Received;
SerialSession.Connecting -= Connecting;
SerialSession.Connected -= Connected;
SerialSession.Disconnecting -= Disconnecting;
SerialSession.Disconnected -= Disconnected;
SerialSession.Connecting += Connecting;
SerialSession.Connected += Connected;
SerialSession.Disconnecting += Disconnecting;
SerialSession.Disconnected += Disconnected;
SerialSession.Received += Received;
SerialPortClient = serialPortClient;
WaitingClientEx = SerialPortClient.CreateWaitingClient(new() { });
SerialPortClient.Received -= Received;
SerialPortClient.Connecting -= Connecting;
SerialPortClient.Connected -= Connected;
SerialPortClient.Disconnecting -= Disconnecting;
SerialPortClient.Disconnected -= Disconnected;
SerialPortClient.Connecting += Connecting;
SerialPortClient.Connected += Connected;
SerialPortClient.Disconnecting += Disconnecting;
SerialPortClient.Disconnected += Disconnected;
SerialPortClient.Received += Received;
Logger = SerialSession.Logger;
Logger = SerialPortClient.Logger;
}
/// <summary>
/// 接收解析
@@ -44,88 +45,88 @@ public abstract class ReadWriteDevicesSerialSessionBase : ReadWriteDevicesBase
/// <param name="client"></param>
/// <param name="e"></param>
/// <returns></returns>
protected virtual Task Received(SerialSession client, ReceivedDataEventArgs e)
protected virtual Task Received(SerialPortClient client, ReceivedDataEventArgs e)
{
return EasyTask.CompletedTask;
}
/// <inheritdoc/>
public override ChannelEnum ChannelEnum => ChannelEnum.SerialSession;
public override ChannelEnum ChannelEnum => ChannelEnum.SerialPortClient;
/// <summary>
/// 串口管理对象
/// </summary>
public SerialSession SerialSession { get; }
public SerialPortClient SerialPortClient { get; }
/// <summary>
/// 默认WaitingClientEx
/// </summary>
public virtual IWaitingClient<SerialSession> WaitingClientEx { get; }
public virtual IWaitingClient<SerialPortClient> WaitingClientEx { get; }
/// <inheritdoc/>
public override bool IsConnected()
{
return SerialSession?.CanSend == true;
return SerialPortClient?.CanSend == true;
}
/// <inheritdoc/>
public override void Connect(CancellationToken cancellationToken)
{
SerialSession.Connect();
SerialPortClient.Connect();
}
/// <inheritdoc/>
public override Task ConnectAsync(CancellationToken cancellationToken)
{
return SerialSession.ConnectAsync();
return SerialPortClient.ConnectAsync();
}
/// <inheritdoc/>
public override void Disconnect()
{
if (CascadeDisposal && IsConnected())
SerialSession.Close();
SerialPortClient.Close();
}
/// <inheritdoc/>
public override void Dispose()
{
Disconnect();
SerialSession.Received -= Received;
SerialSession.Connecting -= Connecting;
SerialSession.Connected -= Connected;
SerialSession.Disconnecting -= Disconnecting;
SerialSession.Disconnected -= Disconnected;
if (CascadeDisposal && !SerialSession.DisposedValue)
SerialSession.SafeDispose();
SerialPortClient.Received -= Received;
SerialPortClient.Connecting -= Connecting;
SerialPortClient.Connected -= Connected;
SerialPortClient.Disconnecting -= Disconnecting;
SerialPortClient.Disconnected -= Disconnected;
if (CascadeDisposal && !SerialPortClient.DisposedValue)
SerialPortClient.SafeDispose();
}
/// <inheritdoc/>
public override string ToString()
{
return SerialSession.SerialProperty.ToString();
return SerialPortClient.ToString();
}
private async Task Connected(ISerialSession client, ConnectedEventArgs e)
private async Task Connected(ISerialPortClient client, ConnectedEventArgs e)
{
Logger?.Debug(client.SerialProperty.ToString() + "连接成功");
Logger?.Debug(client.ToString() + "连接成功");
SetDataAdapter();
await EasyTask.CompletedTask;
}
private async Task Connecting(ISerialSession client, SerialConnectingEventArgs e)
private async Task Connecting(ISerialPortClient client, SerialConnectingEventArgs e)
{
Logger?.Debug(client.SerialProperty.ToString() + "正在连接");
Logger?.Debug(client.ToString() + "正在连接");
await EasyTask.CompletedTask;
}
private async Task Disconnected(ISerialSessionBase client, DisconnectEventArgs e)
private async Task Disconnected(ISerialPortClient client, DisconnectEventArgs e)
{
Logger?.Debug(client.SerialProperty.ToString() + "断开连接-" + e.Message);
Logger?.Debug(client.ToString() + "断开连接-" + e.Message);
await EasyTask.CompletedTask;
}
private async Task Disconnecting(ISerialSessionBase client, DisconnectEventArgs e)
private async Task Disconnecting(ISerialPortClient client, DisconnectEventArgs e)
{
Logger?.Debug(client.SerialProperty.ToString() + "正在主动断开连接-" + e.Message);
Logger?.Debug(client.ToString() + "正在主动断开连接-" + e.Message);
await EasyTask.CompletedTask;
}
@@ -150,6 +151,6 @@ public abstract class ReadWriteDevicesSerialSessionBase : ReadWriteDevicesBase
/// <inheritdoc/>
public override void Send(byte[] command, string id = default)
{
SerialSession.Send(command);
SerialPortClient.Send(command);
}
}

View File

@@ -53,8 +53,7 @@ public abstract class ReadWriteDevicesTcpServerBase : ReadWriteDevicesBase
/// <inheritdoc/>
public override Task ConnectAsync(CancellationToken cancellationToken)
{
Connect(cancellationToken);
return EasyTask.CompletedTask;
return TcpService.StartAsync();
}
/// <inheritdoc/>

View File

@@ -48,7 +48,7 @@ public abstract class ReadWriteDevicesUdpSessionBase : ReadWriteDevicesBase
/// <inheritdoc/>
public override Task ConnectAsync(CancellationToken cancellationToken)
{
return Task.FromResult(UdpSession.Start());
return UdpSession.StartAsync();
}
/// <inheritdoc/>
@@ -69,7 +69,7 @@ public abstract class ReadWriteDevicesUdpSessionBase : ReadWriteDevicesBase
/// <inheritdoc/>
public override string ToString()
{
return UdpSession.RemoteIPHost.ToString();
return UdpSession.RemoteIPHost?.ToString();
}
/// <inheritdoc/>

View File

@@ -29,6 +29,7 @@ public abstract class ReadWriteDevicesSingleStreamDataHandleAdapter<TRequest> :
public ReadWriteDevicesSingleStreamDataHandleAdapter()
{
Request = GetInstance();
CacheTimeoutEnable = true;
}
/// <inheritdoc/>
public override bool CanSendRequestInfo => false;

View File

@@ -53,7 +53,7 @@ public abstract class ReadWriteDevicesUdpDataHandleAdapter<TRequest> : UdpDataHa
/// <inheritdoc/>
public override string ToString()
{
return (Owner as UdpSession)?.RemoteIPHost.ToString();
return (Owner as UdpSession)?.RemoteIPHost?.ToString();
}
/// <summary>
@@ -83,11 +83,11 @@ public abstract class ReadWriteDevicesUdpDataHandleAdapter<TRequest> : UdpDataHa
var allBytes = byteBlock.ToArray(0, byteBlock.Len);
Logger?.Trace($"{FoundationConst.LogMessageHeader}{ToString()}- 接收:{(IsHexData ? allBytes.ToHexString(' ') : Encoding.UTF8.GetString(allBytes))}");
if (Request?.SendBytes == null)
{
GoReceived(remoteEndPoint, byteBlock, null);
return;
}
//if (Request?.SendBytes == null)
//{
// GoReceived(remoteEndPoint, byteBlock, null);
// return;
//}
byte[] header = new byte[] { };
if (Request.HeadBytesLength > 0)
{

View File

@@ -22,7 +22,7 @@ public enum ChannelEnum
/// <inheritdoc/>
TcpClient = 1,
/// <inheritdoc/>
SerialSession = 2,
SerialPortClient = 2,
/// <inheritdoc/>
UdpSession = 4,
/// <inheritdoc/>

View File

@@ -421,6 +421,74 @@ public static class StringExtensions
{
return value.IsNullOrEmpty() ? defaultValue : ushort.TryParse(value, out var n) ? n : defaultValue;
}
/// <summary>
/// ToDouble
/// </summary>
/// <returns></returns>
public static double ToDouble(this object value, double defaultValue = 0)
{
if (value is Double d)
{
return Double.IsNaN(d) ? defaultValue : (Double)d;
}
var str = value?.ToString();
if (str.IsNullOrEmpty())
{
return (double)defaultValue;
}
else
{
if (value is bool boolValue)
{
return boolValue ? 1 : 0;
}
return (double)(double.TryParse(str, out var n) ? n : defaultValue);
}
}
/// <summary>
/// ToDecimal
/// </summary>
/// <returns></returns>
public static decimal ToDecimal(this object value, int defaultValue = 0)
{
if (value is Double d)
{
return Double.IsNaN(d) ? defaultValue : (Decimal)d;
}
var str = value?.ToString();
if (str.IsNullOrEmpty())
{
return defaultValue;
}
else
{
if (value is bool boolValue)
{
return boolValue ? 1 : 0;
}
return Decimal.TryParse(str, out var n) ? n : defaultValue;
}
}
/// <summary>
/// ToInt
/// </summary>
/// <returns></returns>
public static int ToInt(this object value, int defaultValue = 0)
{
if (value == null || value.ToString().IsNullOrEmpty())
{
return defaultValue;
}
else
{
if (value is bool boolValue)
{
return boolValue ? 1 : 0;
}
return int.TryParse(value.ToString(), out int n) ? n : defaultValue;
}
}
/// <summary>
/// 用 正则表达式 判断字符是不是汉字

View File

@@ -1,48 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
using System.IO.Ports;
namespace ThingsGateway.Foundation.Serial;
/// <summary>
/// Connecting
/// </summary>
/// <typeparam name="TClient"></typeparam>
/// <param name="client"></param>
/// <param name="e"></param>
public delegate Task SerialConnectingEventHandler<TClient>(TClient client, SerialConnectingEventArgs e);
/// <summary>
/// 客户端连接事件。
/// </summary>
public class SerialConnectingEventArgs : MsgPermitEventArgs
{
/// <summary>
/// 构造函数
/// </summary>
/// <param name="serialPort"></param>
public SerialConnectingEventArgs(SerialPort serialPort)
{
this.SerialPort = serialPort;
this.IsPermitOperation = true;
}
/// <summary>
/// 客户端Id。该Id的赋值仅在服务器适用。
/// </summary>
public string Id { get; set; }
/// <summary>
/// 新初始化的通信器
/// </summary>
public SerialPort SerialPort { get; private set; }
}

View File

@@ -1,38 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
namespace ThingsGateway.Foundation.Serial;
/// <summary>
/// 串口附加属性
/// </summary>
public static class SerialConfigExtension
{
/// <summary>
/// 串口属性
/// </summary>
public static readonly DependencyProperty<SerialProperty> SerialProperty =
DependencyProperty<SerialProperty>.Register("SerialProperty", new());
/// <summary>
/// 设置串口
/// </summary>
/// <param name="config"></param>
/// <param name="value"></param>
/// <returns></returns>
public static TouchSocketConfig SetSerialProperty(this TouchSocketConfig config, SerialProperty value)
{
config.SetValue(SerialProperty, value);
return config;
}
}

View File

@@ -1,58 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
using System.IO.Ports;
namespace ThingsGateway.Foundation.Serial;
/// <summary>
/// SocketExtension
/// </summary>
public static class SerialPortExtensions
{
/// <summary>
/// 会使用同步锁,保证所有数据上缓存区。
/// </summary>
/// <param name="serialPort"></param>
/// <param name="buffer"></param>
/// <param name="offset"></param>
/// <param name="length"></param>
public static void AbsoluteSend(this SerialPort serialPort, byte[] buffer, int offset, int length)
{
lock (serialPort)
{
serialPort.Write(buffer, offset, length);
}
}
/// <summary>
/// 尝试关闭<see cref="SerialPort"/>。不会抛出异常。
/// </summary>
/// <param name="serialPort"></param>
public static void TryClose(this SerialPort serialPort)
{
lock (serialPort)
{
try
{
if (serialPort.IsOpen)
{
serialPort.Close();
}
}
catch
{
}
}
}
}

View File

@@ -1,36 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
namespace ThingsGateway.Foundation.Serial;
/// <summary>
/// <inheritdoc cref="ISerialSessionBase"/>
/// </summary>
public interface ISerialSession : ISerialSessionBase, IClientSender, IPluginObject, ISetupConfigObject
{
/// <summary>
/// 成功打开串口
/// </summary>
ConnectedEventHandler<ISerialSession> Connected { get; set; }
/// <summary>
/// 准备连接串口的时候
/// </summary>
SerialConnectingEventHandler<ISerialSession> Connecting { get; set; }
/// <summary>
/// 连接串口
/// </summary>
/// <exception cref="Exception"></exception>
ISerialSession Connect();
}

View File

@@ -1,66 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
using System.IO.Ports;
namespace ThingsGateway.Foundation.Serial;
/// <summary>
/// 串口连接接口。
/// </summary>
public interface ISerialSessionBase : ISenderClient, IClient, ISender, IDefaultSender, IPluginObject, IRequsetInfoSender, IConfigObject, IOnlineClient
{
/// <summary>
/// 是否允许自由调用<see cref="SetDataHandlingAdapter"/>进行赋值。
/// </summary>
bool CanSetDataHandlingAdapter { get; }
/// <summary>
/// 数据处理适配器
/// </summary>
SingleStreamDataHandlingAdapter DataHandlingAdapter { get; }
/// <summary>
/// 断开连接
/// </summary>
DisconnectEventHandler<ISerialSessionBase> Disconnected { get; set; }
/// <summary>
/// 即将断开连接(仅主动断开时有效)。
/// <para>
/// </para>
/// </summary>
DisconnectEventHandler<ISerialSessionBase> Disconnecting { get; set; }
/// <summary>
/// 主通信器
/// </summary>
SerialPort MainSerialPort { get; }
/// <summary>
/// 串口描述
/// </summary>
SerialProperty SerialProperty { get; }
/// <summary>
/// 关闭客户端。
/// </summary>
/// <param name="msg"></param>
/// <exception cref="Exception"></exception>
void Close(string msg = TouchSocketCoreUtility.Empty);
/// <summary>
/// 设置数据处理适配器
/// </summary>
/// <param name="adapter"></param>
void SetDataHandlingAdapter(SingleStreamDataHandlingAdapter adapter);
}

View File

@@ -1,388 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
using System.IO.Ports;
namespace ThingsGateway.Foundation.Serial;
internal sealed class InternalSerialCore : SerialCore
{
}
/// <summary>
/// Serial核心
/// </summary>
public class SerialCore : IDisposable, ISender
{
/// <summary>
/// 最小缓存尺寸
/// </summary>
public int MinBufferSize { get; set; } = 1024 * 10;
/// <summary>
/// 最大缓存尺寸
/// </summary>
public int MaxBufferSize { get; set; } = 1024 * 1024 * 10;
#region
/// <summary>
/// 同步根
/// </summary>
public readonly object SyncRoot = new object();
private long m_bufferRate;
private bool m_online => m_serialPort?.IsOpen == true;
private int m_receiveBufferSize = 1024 * 10;
private ValueCounter m_receiveCounter;
private int m_sendBufferSize = 1024 * 10;
private ValueCounter m_sendCounter;
private readonly EasyLock m_semaphoreForSend = new EasyLock();
private SerialPort m_serialPort;
#endregion
/// <summary>
/// Tcp核心
/// </summary>
public SerialCore()
{
this.m_receiveCounter = new ValueCounter
{
Period = TimeSpan.FromSeconds(1),
OnPeriod = this.OnReceivePeriod
};
this.m_sendCounter = new ValueCounter
{
Period = TimeSpan.FromSeconds(1),
OnPeriod = this.OnSendPeriod
};
}
/// <summary>
/// 析构函数
/// </summary>
~SerialCore()
{
this.SafeDispose();
}
/// <inheritdoc/>
public bool CanSend => this.m_online;
/// <summary>
/// 当中断Tcp的时候。当为<see langword="true"/>时,意味着是调用<see cref="Close(string)"/>。当为<see langword="false"/>时,则是其他中断。
/// </summary>
public Action<SerialCore, bool, string> OnBreakOut { get; set; }
/// <summary>
/// 当发生异常的时候
/// </summary>
public Action<SerialCore, Exception> OnException { get; set; }
/// <summary>
/// 在线状态
/// </summary>
public bool Online { get => this.m_online; }
/// <summary>
/// UserToken
/// </summary>
public ByteBlock UserToken { get; set; }
/// <summary>
/// 当收到数据的时候
/// </summary>
public Action<SerialCore, ByteBlock> OnReceived { get; set; }
/// <summary>
/// 接收缓存池,运行时的值会根据流速自动调整
/// </summary>
public int ReceiveBufferSize
{
get => this.m_receiveBufferSize;
}
/// <summary>
/// 接收计数器
/// </summary>
public ValueCounter ReceiveCounter { get => this.m_receiveCounter; }
/// <summary>
/// 发送缓存池,运行时的值会根据流速自动调整
/// </summary>
public int SendBufferSize
{
get => this.m_sendBufferSize;
}
/// <summary>
/// 发送计数器
/// </summary>
public ValueCounter SendCounter { get => this.m_sendCounter; }
/// <summary>
/// SerialPort
/// </summary>
public SerialPort MainSerialPort { get => this.m_serialPort; }
/// <summary>
/// 开始以Iocp方式接收
/// </summary>
public virtual void BeginIocpReceive()
{
var byteBlock = BytePool.Default.GetByteBlock(this.ReceiveBufferSize);
this.UserToken = byteBlock;
byteBlock.SetLength(0);
if (this.m_serialPort.BytesToRead > 0)
{
this.m_bufferRate += 2;
this.ProcessReceived();
}
m_serialPort.DataReceived += MainSerialPort_DataReceived;
}
private void MainSerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
try
{
this.m_bufferRate = 1;
this.ProcessReceived();
}
catch (Exception ex)
{
this.PrivateBreakOut(false, ex.ToString());
}
}
/// <summary>
/// 请求关闭
/// </summary>
/// <param name="msg"></param>
public virtual void Close(string msg)
{
this.PrivateBreakOut(true, msg);
}
/// <summary>
/// 释放对象
/// </summary>
public void Dispose()
{
GC.SuppressFinalize(this);
UserToken.SafeDispose();
}
/// <summary>
/// 重置环境,并设置新的<see cref="m_serialPort"/>。
/// </summary>
/// <param name="socket"></param>
public virtual void Reset(SerialPort socket)
{
if (socket is null)
{
throw new ArgumentNullException(nameof(socket));
}
if (!socket.IsOpen)
{
throw new Exception("新的SerialPort必须在连接状态。");
}
this.Reset();
this.m_serialPort = socket;
}
/// <summary>
/// 重置环境。
/// </summary>
public virtual void Reset()
{
this.m_receiveCounter.Reset();
this.m_sendCounter.Reset();
this.m_serialPort = null;
this.OnReceived = null;
this.OnBreakOut = null;
this.UserToken = null;
this.m_bufferRate = 1;
this.m_receiveBufferSize = this.MinBufferSize;
this.m_sendBufferSize = this.MinBufferSize;
}
/// <summary>
/// 判断,当不在连接状态时触发异常。
/// </summary>
/// <exception cref="NotConnectedException"></exception>
protected void ThrowIfNotConnected()
{
if (!this.m_online)
{
throw new NotConnectedException();
}
}
/// <summary>
/// 发送数据。
/// <para>
/// 内部会根据是否启用Ssl进行直接发送还是Ssl发送。
/// </para>
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
/// <param name="length"></param>
public virtual void Send(byte[] buffer, int offset, int length)
{
this.ThrowIfNotConnected();
try
{
this.m_semaphoreForSend.Wait();
this.m_serialPort.Write(buffer, offset, length);
this.m_sendCounter.Increment(length);
}
finally
{
this.m_semaphoreForSend.Release();
}
}
/// <summary>
/// 异步发送数据。
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
/// <param name="length"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public virtual async Task SendAsync(byte[] buffer, int offset, int length)
{
this.ThrowIfNotConnected();
try
{
await this.m_semaphoreForSend.WaitAsync();
this.m_serialPort.Write(buffer, offset, length);
this.m_sendCounter.Increment(length);
}
finally
{
this.m_semaphoreForSend.Release();
}
}
/// <summary>
/// 当中断Tcp时。
/// </summary>
/// <param name="manual">当为<see langword="true"/>时,意味着是调用<see cref="Close(string)"/>。当为<see langword="false"/>时,则是其他中断。</param>
/// <param name="msg"></param>
protected virtual void BreakOut(bool manual, string msg)
{
this.OnBreakOut?.Invoke(this, manual, msg);
}
/// <summary>
/// 当发生异常的时候
/// </summary>
/// <param name="ex"></param>
protected virtual void Exception(Exception ex)
{
this.OnException?.Invoke(this, ex);
}
/// <summary>
/// 当收到数据的时候
/// </summary>
/// <param name="byteBlock"></param>
protected virtual void Received(ByteBlock byteBlock)
{
this.OnReceived?.Invoke(this, byteBlock);
}
private void HandleBuffer(ByteBlock byteBlock)
{
try
{
this.m_receiveCounter.Increment(byteBlock.Length);
this.Received(byteBlock);
}
catch (Exception ex)
{
this.Exception(ex);
}
finally
{
byteBlock.Dispose();
}
}
private void OnReceivePeriod(long value)
{
this.m_receiveBufferSize = Math.Max(TouchSocketUtility.HitBufferLength(value), this.MinBufferSize);
if (this.MainSerialPort != null && !MainSerialPort.IsOpen)
{
this.MainSerialPort.ReadBufferSize = this.m_receiveBufferSize;
}
}
private void OnSendPeriod(long value)
{
this.m_sendBufferSize = Math.Max(TouchSocketUtility.HitBufferLength(value), this.MinBufferSize);
if (this.MainSerialPort != null && !MainSerialPort.IsOpen)
{
this.MainSerialPort.WriteBufferSize = this.m_sendBufferSize;
}
}
private void PrivateBreakOut(bool manual, string msg)
{
lock (this.SyncRoot)
{
if (this.m_online)
{
this.BreakOut(manual, msg);
}
}
}
private void ProcessReceived()
{
if (!this.m_online)
{
UserToken?.SafeDispose();
return;
}
if (m_serialPort.BytesToRead > 0)
{
var byteBlock = UserToken;
byte[] buffer = BytePool.Default.Rent(m_serialPort.BytesToRead);
int num = m_serialPort.Read(buffer, 0, m_serialPort.BytesToRead);
byteBlock.Write(buffer, 0, num);
byteBlock.SetLength(num);
this.HandleBuffer(byteBlock);
try
{
var newByteBlock = BytePool.Default.GetByteBlock((int)Math.Min(this.ReceiveBufferSize * this.m_bufferRate, this.MaxBufferSize));
newByteBlock.SetLength(0);
UserToken = newByteBlock;
if (m_serialPort.BytesToRead > 0)
{
this.m_bufferRate += 2;
this.ProcessReceived();
}
}
catch (Exception ex)
{
this.PrivateBreakOut(false, ex.ToString());
}
}
}
}

View File

@@ -1,53 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
using System.ComponentModel;
using System.IO.Ports;
namespace ThingsGateway.Foundation.Serial;
/// <summary>
/// 串口属性
/// </summary>
public class SerialProperty
{
/// <summary>
/// COM
/// </summary>
[Description("COM口")]
public string PortName { get; set; } = "COM1";
/// <summary>
/// 波特率
/// </summary>
[Description("波特率")]
public int BaudRate { get; set; } = 9600;
/// <summary>
/// 数据位
/// </summary>
[Description("数据位")]
public int DataBits { get; set; } = 8;
/// <summary>
/// 校验位
/// </summary>
[Description("校验位")]
public Parity Parity { get; set; } = Parity.None;
/// <summary>
/// 停止位
/// </summary>
[Description("停止位")]
public StopBits StopBits { get; set; } = StopBits.One;
/// <inheritdoc/>
public override string ToString()
{
return $"{PortName}[{BaudRate},{DataBits},{StopBits},{Parity}]";
}
}

View File

@@ -1,749 +0,0 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
using System.IO.Ports;
namespace ThingsGateway.Foundation.Serial;
/// <inheritdoc cref="SerialSessionBase"/>
public class SerialSession : SerialSessionBase
{
/// <summary>
/// 接收到数据
/// </summary>
public ReceivedEventHandler<SerialSession> Received { get; set; }
/// <inheritdoc/>
protected override Task ReceivedData(ReceivedDataEventArgs e)
{
if (this.Received != null)
{
return this.Received.Invoke(this, e);
}
return base.ReceivedData(e);
}
}
/// <summary>
/// 串口管理
/// </summary>
public class SerialSessionBase : SetupConfigObject, ISerialSession
{
static readonly Protocol SerialPort = new("SerialSession");
/// <summary>
/// 构造函数
/// </summary>
public SerialSessionBase()
{
this.Protocol = SerialPort;
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <returns></returns>
public override string ToString()
{
return SerialProperty?.ToString();
}
#region
private DelaySender m_delaySender;
private bool m_online => MainSerialPort?.IsOpen == true;
private readonly EasyLock m_semaphore = new();
private readonly InternalSerialCore m_serialCore = new();
#endregion
#region
/// <inheritdoc/>
public ConnectedEventHandler<ISerialSession> Connected { get; set; }
/// <inheritdoc/>
public SerialConnectingEventHandler<ISerialSession> Connecting { get; set; }
/// <inheritdoc/>
public DisconnectEventHandler<ISerialSessionBase> Disconnected { get; set; }
/// <inheritdoc/>
public DisconnectEventHandler<ISerialSessionBase> Disconnecting { get; set; }
private async Task PrivateOnConnected(ConnectedEventArgs o)
{
await this.OnConnected(o);
}
/// <summary>
/// 已经建立连接
/// </summary>
/// <param name="e"></param>
protected virtual async Task OnConnected(ConnectedEventArgs e)
{
try
{
if (this.Connected != null)
{
await this.Connected.Invoke(this, e);
if (e.Handled)
{
return;
}
}
await this.PluginsManager.RaiseAsync(nameof(ITcpConnectedPlugin.OnTcpConnected), this, e);
}
catch (Exception ex)
{
this.Logger.Log(LogLevel.Error, this, $"在事件{nameof(this.Connected)}中发生错误。", ex);
}
}
private async Task PrivateOnConnecting(SerialConnectingEventArgs e)
{
if (this.CanSetDataHandlingAdapter)
{
this.SetDataHandlingAdapter(this.Config.GetValue(TouchSocketConfigExtension.TcpDataHandlingAdapterProperty).Invoke());
}
await this.OnConnecting(e);
}
/// <summary>
/// 准备连接的时候,此时并未建立连接
/// </summary>
/// <param name="e"></param>
protected virtual async Task OnConnecting(SerialConnectingEventArgs e)
{
try
{
if (this.Connecting != null)
{
await this.Connecting.Invoke(this, e);
if (e.Handled)
{
return;
}
}
await this.PluginsManager.RaiseAsync(nameof(ITcpConnectingPlugin.OnTcpConnecting), this, e);
}
catch (Exception ex)
{
this.Logger.Log(LogLevel.Error, this, $"在事件{nameof(this.OnConnecting)}中发生错误。", ex);
}
}
private async Task PrivateOnDisconnected(object obj)
{
this.m_receiver?.TryInputReceive(default, default);
await this.OnDisconnected((DisconnectEventArgs)obj);
}
/// <summary>
/// 断开连接。在客户端未设置连接状态时,不会触发
/// </summary>
/// <param name="e"></param>
protected virtual async Task OnDisconnected(DisconnectEventArgs e)
{
try
{
if (this.Disconnected != null)
{
await this.Disconnected.Invoke(this, e).ConfigureAwait(false);
if (e.Handled)
{
return;
}
}
await this.PluginsManager.RaiseAsync(nameof(ITcpDisconnectedPlugin.OnTcpDisconnected), this, e).ConfigureAwait(false);
}
catch (Exception ex)
{
this.Logger.Log(LogLevel.Error, this, $"在事件{nameof(this.Disconnected)}中发生错误。", ex);
}
}
private async Task PrivateOnDisconnecting(object obj)
{
await this.OnDisconnecting((DisconnectEventArgs)obj);
}
/// <summary>
/// 即将断开连接(仅主动断开时有效)。
/// </summary>
/// <param name="e"></param>
protected virtual async Task OnDisconnecting(DisconnectEventArgs e)
{
try
{
if (this.Disconnecting != null)
{
await this.Disconnecting.Invoke(this, e).ConfigureAwait(false);
if (e.Handled)
{
return;
}
}
await this.PluginsManager.RaiseAsync(nameof(ITcpDisconnectingPlugin.OnTcpDisconnecting), this, e).ConfigureAwait(false);
}
catch (Exception ex)
{
this.Logger.Log(LogLevel.Error, this, $"在事件{nameof(this.Disconnecting)}中发生错误。", ex);
}
}
#endregion
#region
/// <inheritdoc/>
public DateTime LastReceivedTime => this.GetSerialCore().ReceiveCounter.LastIncrement;
/// <inheritdoc/>
public DateTime LastSendTime => this.GetSerialCore().SendCounter.LastIncrement;
/// <inheritdoc/>
public virtual bool CanSetDataHandlingAdapter => true;
/// <inheritdoc/>
public SingleStreamDataHandlingAdapter DataHandlingAdapter { get; private set; }
/// <inheritdoc/>
public SerialProperty SerialProperty { get; private set; }
/// <inheritdoc/>
public SerialPort MainSerialPort { get; private set; }
/// <inheritdoc/>
public bool Online { get => this.m_online; }
/// <inheritdoc/>
public bool CanSend => this.m_online;
/// <inheritdoc/>
public Protocol Protocol { get; set; }
#endregion
#region
/// <inheritdoc/>
public virtual void Close(string msg = TouchSocketCoreUtility.Empty)
{
lock (this.GetSerialCore())
{
if (this.m_online)
{
Task.Factory.StartNew(this.PrivateOnDisconnecting, new DisconnectEventArgs(true, msg));
this.MainSerialPort.TryClose();
this.BreakOut(true, msg);
}
}
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
{
lock (this.GetSerialCore())
{
if (this.m_online)
{
Task.Factory.StartNew(this.PrivateOnDisconnecting, new DisconnectEventArgs(true, $"{nameof(Dispose)}主动断开"));
this.BreakOut(true, $"{nameof(Dispose)}主动断开");
}
}
base.Dispose(disposing);
}
#endregion
#region Connect
/// <summary>
/// 打开串口
/// </summary>
protected void Open()
{
try
{
ThrowIfDisposed();
this.m_semaphore.Wait();
if (this.m_online)
{
return;
}
if (this.DisposedValue)
{
throw new ObjectDisposedException(this.GetType().FullName);
}
if (this.Config == null)
{
throw new ArgumentNullException(nameof(this.Config), "配置文件不能为空。");
}
var serialProperty = this.Config.GetValue(SerialConfigExtension.SerialProperty) ?? throw new ArgumentNullException("串口配置不能为空。");
this.MainSerialPort.SafeDispose();
var serialPort = CreateSerial(serialProperty);
this.PrivateOnConnecting(new(serialPort)).ConfigureAwait(false).GetAwaiter().GetResult();
serialPort.Open();
this.SetSerialPort(serialPort);
this.BeginReceive();
this.PrivateOnConnected(new()).ConfigureAwait(false).GetAwaiter().GetResult();
}
finally
{
this.m_semaphore.Release();
}
}
private void BeginReceive()
{
this.GetSerialCore().BeginIocpReceive();
}
/// <inheritdoc/>
public virtual ISerialSession Connect()
{
this.Open();
return this;
}
/// <inheritdoc/>
public async Task<ISerialSession> ConnectAsync()
{
return await Task.Run(() =>
{
return this.Connect();
});
}
#endregion Connect
#region Receiver
private Receiver m_receiver;
/// <inheritdoc/>
public IReceiver CreateReceiver()
{
return this.m_receiver ??= new Receiver(this);
}
/// <inheritdoc/>
public void ClearReceiver()
{
this.m_receiver = null;
}
#endregion
private void SerialCoreBreakOut(SerialCore core, bool manual, string msg)
{
this.BreakOut(manual, msg);
}
/// <summary>
/// BreakOut。
/// </summary>
/// <param name="manual"></param>
/// <param name="msg"></param>
protected void BreakOut(bool manual, string msg)
{
lock (this.GetSerialCore())
{
if (this.m_online)
{
this.MainSerialPort.SafeDispose();
this.m_delaySender.SafeDispose();
this.DataHandlingAdapter.SafeDispose();
Task.Factory.StartNew(this.PrivateOnDisconnected, new DisconnectEventArgs(manual, msg));
}
}
}
private SerialCore GetSerialCore()
{
this.ThrowIfDisposed();
return this.m_serialCore ?? throw new ObjectDisposedException(this.GetType().Name);
}
/// <inheritdoc/>
public virtual void SetDataHandlingAdapter(SingleStreamDataHandlingAdapter adapter)
{
if (!this.CanSetDataHandlingAdapter)
{
throw new Exception($"不允许自由调用{nameof(SetDataHandlingAdapter)}进行赋值。");
}
this.SetAdapter(adapter);
}
private void PrivateHandleReceivedData(ByteBlock byteBlock, IRequestInfo requestInfo)
{
if (this.m_receiver != null)
{
if (this.m_receiver.TryInputReceive(byteBlock, requestInfo))
{
return;
}
}
this.ReceivedData(new ReceivedDataEventArgs(byteBlock, requestInfo)).GetFalseAwaitResult();
}
/// <summary>
/// 当收到适配器处理的数据时。
/// </summary>
/// <param name="e"></param>
/// <returns>如果返回<see langword="true"/>则表示数据已被处理,且不会再向下传递。</returns>
protected virtual Task ReceivedData(ReceivedDataEventArgs e)
{
return this.PluginsManager.RaiseAsync(nameof(ITcpReceivedPlugin.OnTcpReceived), this, e);
}
/// <summary>
/// 当即将发送时,如果覆盖父类方法,则不会触发插件。
/// </summary>
/// <param name="buffer">数据缓存区</param>
/// <param name="offset">偏移</param>
/// <param name="length">长度</param>
/// <returns>返回值表示是否允许发送</returns>
protected virtual async Task<bool> SendingData(byte[] buffer, int offset, int length)
{
if (this.PluginsManager.GetPluginCount(nameof(ITcpSendingPlugin.OnTcpSending)) > 0)
{
var args = new SendingEventArgs(buffer, offset, length);
await this.PluginsManager.RaiseAsync(nameof(ITcpSendingPlugin.OnTcpSending), this, args).ConfigureAwait(false);
return args.IsPermitOperation;
}
return true;
}
/// <inheritdoc/>
protected override void LoadConfig(TouchSocketConfig config)
{
this.SerialProperty = config.GetValue(SerialConfigExtension.SerialProperty);
this.Logger ??= this.Container.Resolve<ILog>();
}
/// <summary>
/// 设置适配器,该方法不会检验<see cref="CanSetDataHandlingAdapter"/>的值。
/// </summary>
/// <param name="adapter"></param>
protected void SetAdapter(SingleStreamDataHandlingAdapter adapter)
{
this.ThrowIfDisposed();
if (adapter is null)
{
throw new ArgumentNullException(nameof(adapter));
}
if (this.Config != null)
{
adapter.Config(this.Config);
}
adapter.Logger = this.Logger;
adapter.OnLoaded(this);
adapter.ReceivedCallBack = this.PrivateHandleReceivedData;
adapter.SendCallBack = this.DefaultSend;
adapter.SendAsyncCallBack = this.DefaultSendAsync;
this.DataHandlingAdapter = adapter;
}
private static SerialPort CreateSerial(SerialProperty serialProperty)
{
SerialPort serialPort = new(serialProperty.PortName, serialProperty.BaudRate, serialProperty.Parity, serialProperty.DataBits, serialProperty.StopBits)
{
DtrEnable = true,
RtsEnable = true
};
return serialPort;
}
#region
#region
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="requestInfo"></param>
/// <exception cref="NotConnectedException"></exception>
/// <exception cref="OverlengthException"></exception>
/// <exception cref="Exception"></exception>
public void Send(IRequestInfo requestInfo)
{
if (this.DisposedValue)
{
return;
}
if (this.DataHandlingAdapter == null)
{
throw new ArgumentNullException(nameof(this.DataHandlingAdapter), TouchSocketResource.NullDataAdapter.GetDescription());
}
if (!this.DataHandlingAdapter.CanSendRequestInfo)
{
throw new NotSupportedException($"当前适配器不支持对象发送。");
}
this.DataHandlingAdapter.SendInput(requestInfo);
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="buffer"><inheritdoc/></param>
/// <param name="offset"><inheritdoc/></param>
/// <param name="length"><inheritdoc/></param>
/// <exception cref="NotConnectedException"><inheritdoc/></exception>
/// <exception cref="OverlengthException"><inheritdoc/></exception>
/// <exception cref="Exception"><inheritdoc/></exception>
public virtual void Send(byte[] buffer, int offset, int length)
{
if (this.DataHandlingAdapter == null)
{
throw new ArgumentNullException(nameof(this.DataHandlingAdapter), TouchSocketResource.NullDataAdapter.GetDescription());
}
this.DataHandlingAdapter.SendInput(buffer, offset, length);
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="transferBytes"><inheritdoc/></param>
/// <exception cref="NotConnectedException"><inheritdoc/></exception>
/// <exception cref="OverlengthException"><inheritdoc/></exception>
/// <exception cref="Exception"><inheritdoc/></exception>
public virtual void Send(IList<ArraySegment<byte>> transferBytes)
{
if (this.DataHandlingAdapter == null)
{
throw new ArgumentNullException(nameof(this.DataHandlingAdapter), TouchSocketResource.NullDataAdapter.GetDescription());
}
if (this.DataHandlingAdapter.CanSplicingSend)
{
this.DataHandlingAdapter.SendInput(transferBytes);
}
else
{
var length = 0;
foreach (var item in transferBytes)
{
length += item.Count;
}
using (var byteBlock = new ByteBlock(length))
{
foreach (var item in transferBytes)
{
byteBlock.Write(item.Array, item.Offset, item.Count);
}
this.DataHandlingAdapter.SendInput(byteBlock.Buffer, 0, byteBlock.Len);
}
}
}
#endregion
#region
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
/// <param name="length"></param>
/// <exception cref="NotConnectedException"></exception>
/// <exception cref="OverlengthException"></exception>
/// <exception cref="Exception"></exception>
public virtual Task SendAsync(byte[] buffer, int offset, int length)
{
this.ThrowIfDisposed();
if (this.DataHandlingAdapter == null)
{
throw new ArgumentNullException(nameof(this.DataHandlingAdapter), TouchSocketResource.NullDataAdapter.GetDescription());
}
return this.DataHandlingAdapter.SendInputAsync(buffer, offset, length);
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="requestInfo"></param>
/// <exception cref="NotConnectedException"></exception>
/// <exception cref="OverlengthException"></exception>
/// <exception cref="Exception"></exception>
public virtual Task SendAsync(IRequestInfo requestInfo)
{
this.ThrowIfDisposed();
if (this.DataHandlingAdapter == null)
{
throw new ArgumentNullException(nameof(this.DataHandlingAdapter), TouchSocketResource.NullDataAdapter.GetDescription());
}
if (!this.DataHandlingAdapter.CanSendRequestInfo)
{
throw new NotSupportedException($"当前适配器不支持对象发送。");
}
return this.DataHandlingAdapter.SendInputAsync(requestInfo);
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="transferBytes"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public virtual Task SendAsync(IList<ArraySegment<byte>> transferBytes)
{
this.ThrowIfDisposed();
if (this.DataHandlingAdapter == null)
{
throw new ArgumentNullException(nameof(this.DataHandlingAdapter), TouchSocketResource.NullDataAdapter.GetDescription());
}
if (this.DataHandlingAdapter.CanSplicingSend)
{
return this.DataHandlingAdapter.SendInputAsync(transferBytes);
}
else
{
var length = 0;
foreach (var item in transferBytes)
{
length += item.Count;
}
using (var byteBlock = new ByteBlock(length))
{
foreach (var item in transferBytes)
{
byteBlock.Write(item.Array, item.Offset, item.Count);
}
return this.DataHandlingAdapter.SendInputAsync(byteBlock.Buffer, 0, byteBlock.Len);
}
}
}
#endregion
/// <inheritdoc/>
public void DefaultSend(byte[] buffer, int offset, int length)
{
if (this.SendingData(buffer, offset, length).GetFalseAwaitResult())
{
if (this.m_delaySender != null)
{
this.m_delaySender.Send(new QueueDataBytes(buffer, offset, length));
return;
}
this.GetSerialCore().Send(buffer, offset, length);
}
}
/// <inheritdoc/>
public async Task DefaultSendAsync(byte[] buffer, int offset, int length)
{
if (await this.SendingData(buffer, offset, length))
{
await this.GetSerialCore().SendAsync(buffer, offset, length);
}
}
#endregion
#region
private void SetSerialPort(SerialPort serialPort)
{
if (serialPort == null)
{
return;
}
this.MainSerialPort = serialPort;
this.SerialProperty ??= new();
this.SerialProperty.Parity = serialPort.Parity;
this.SerialProperty.PortName = serialPort.PortName;
this.SerialProperty.StopBits = serialPort.StopBits;
this.SerialProperty.DataBits = serialPort.DataBits;
this.SerialProperty.BaudRate = serialPort.BaudRate;
var delaySenderOption = this.Config.GetValue(TouchSocketConfigExtension.DelaySenderProperty);
if (delaySenderOption != null)
{
this.m_delaySender = new DelaySender(delaySenderOption, this.MainSerialPort.AbsoluteSend);
}
this.m_serialCore.Reset(serialPort);
this.m_serialCore.OnReceived = this.HandleReceived;
this.m_serialCore.OnBreakOut = this.SerialCoreBreakOut;
if (this.Config.GetValue(TouchSocketConfigExtension.MinBufferSizeProperty) is int minValue)
{
this.m_serialCore.MinBufferSize = minValue;
}
if (this.Config.GetValue(TouchSocketConfigExtension.MaxBufferSizeProperty) is int maxValue)
{
this.m_serialCore.MaxBufferSize = maxValue;
}
}
private void HandleReceived(SerialCore core, ByteBlock byteBlock)
{
try
{
if (this.DisposedValue)
{
return;
}
if (this.ReceivingData(byteBlock).GetFalseAwaitResult())
{
return;
}
if (this.DataHandlingAdapter == null)
{
this.Logger.Error(this, TouchSocketResource.NullDataAdapter.GetDescription());
return;
}
this.DataHandlingAdapter.ReceivedInput(byteBlock);
}
catch (Exception ex)
{
this.Logger.Log(LogLevel.Error, this, "在处理数据时发生错误", ex);
}
}
/// <summary>
/// 当收到原始数据
/// </summary>
/// <param name="byteBlock"></param>
/// <returns>如果返回<see langword="true"/>则表示数据已被处理,且不会再向下传递。</returns>
protected virtual Task<bool> ReceivingData(ByteBlock byteBlock)
{
if (this.PluginsManager.GetPluginCount(nameof(ITcpReceivingPlugin.OnTcpReceiving)) > 0)
{
return this.PluginsManager.RaiseAsync(nameof(ITcpReceivingPlugin.OnTcpReceiving), this, new ByteBlockEventArgs(byteBlock));
}
return Task.FromResult(false);
}
#endregion
}

View File

@@ -20,6 +20,5 @@ global using System.Threading.Tasks;
global using ThingsGateway.Foundation.Core;
global using ThingsGateway.Foundation.Http;
global using ThingsGateway.Foundation.Rpc;
global using ThingsGateway.Foundation.Serial;
global using ThingsGateway.Foundation.SerialPorts;
global using ThingsGateway.Foundation.Sockets;

View File

@@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0;net6.0;net8.0;</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net45'">

View File

@@ -15,7 +15,7 @@ namespace ThingsGateway.Foundation.Core
/// <summary>
/// 具有设置配置的对象接口
/// </summary>
public interface ISetupConfigObject : IConfigObject, IPluginObject
public interface ISetupConfigObject : IConfigObject, IPluginObject, IResolverObject
{
/// <summary>
/// 配置设置项
@@ -23,5 +23,12 @@ namespace ThingsGateway.Foundation.Core
/// <param name="config"></param>
/// <exception cref="Exception"></exception>
void Setup(TouchSocketConfig config);
/// <summary>
/// 异步配置设置项
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
Task SetupAsync(TouchSocketConfig config);
}
}

View File

@@ -23,10 +23,10 @@ namespace ThingsGateway.Foundation.Core
public override TouchSocketConfig Config => this.m_config;
/// <inheritdoc/>
public IContainer Container { get; private set; }
public IResolver Resolver { get; private set; }
/// <inheritdoc/>
public IPluginsManager PluginsManager { get; private set; }
public IPluginManager PluginManager { get; private set; }
/// <inheritdoc/>
public void Setup(TouchSocketConfig config)
@@ -40,11 +40,27 @@ namespace ThingsGateway.Foundation.Core
this.BuildConfig(config);
this.PluginsManager?.Raise(nameof(ILoadingConfigPlugin.OnLoadingConfig), this, new ConfigEventArgs(config));
this.PluginManager?.Raise(nameof(ILoadingConfigPlugin.OnLoadingConfig), this, new ConfigEventArgs(config));
this.LoadConfig(this.Config);
this.PluginsManager?.Raise(nameof(ILoadedConfigPlugin.OnLoadedConfig), this, new ConfigEventArgs(config));
this.PluginManager?.Raise(nameof(ILoadedConfigPlugin.OnLoadedConfig), this, new ConfigEventArgs(config));
}
/// <inheritdoc/>
public async Task SetupAsync(TouchSocketConfig config)
{
if (config == null)
{
throw new ArgumentNullException(nameof(config));
}
this.ThrowIfDisposed();
this.BuildConfig(config);
await this.PluginManager.RaiseAsync(nameof(ILoadingConfigPlugin.OnLoadingConfig), this, new ConfigEventArgs(config)).ConfigureFalseAwait();
this.LoadConfig(config);
//return EasyTask.CompletedTask;
await this.PluginManager.RaiseAsync(nameof(ILoadedConfigPlugin.OnLoadedConfig), this, new ConfigEventArgs(config)).ConfigureFalseAwait();
}
/// <summary>
/// 加载配置
/// </summary>
@@ -56,47 +72,48 @@ namespace ThingsGateway.Foundation.Core
private void BuildConfig(TouchSocketConfig config)
{
this.m_config = config;
this.m_config = config ?? throw new ArgumentNullException(nameof(config));
if (!config.TryGetValue(TouchSocketCoreConfigExtension.ContainerProperty, out var container))
if (!config.TryGetValue(TouchSocketCoreConfigExtension.ResolverProperty, out var resolver))
{
container = new Container();
if (!config.TryGetValue(TouchSocketCoreConfigExtension.RegistratorProperty, out var registrator))
{
registrator = new Container();
}
if (!registrator.IsRegistered(typeof(ILog)))
{
registrator.RegisterSingleton<ILog>(new LoggerGroup());
}
if (config.GetValue(TouchSocketCoreConfigExtension.ConfigureContainerProperty) is Action<IRegistrator> actionContainer)
{
actionContainer.Invoke(registrator);
}
resolver = registrator.BuildResolver();
}
if (!container.IsRegistered(typeof(ILog)))
IPluginManager pluginManager;
if ((!this.Config.GetValue(TouchSocketCoreConfigExtension.NewPluginManagerProperty)) && resolver.IsRegistered<IPluginManager>())
{
container.RegisterSingleton<ILog, LoggerGroup>();
}
if (!(config.GetValue(TouchSocketCoreConfigExtension.PluginsManagerProperty) is IPluginsManager pluginsManager))
{
pluginsManager = new PluginsManager(container);
}
if (container.IsRegistered(typeof(IPluginsManager)))
{
pluginsManager = container.Resolve<IPluginsManager>();
pluginManager = resolver.Resolve<IPluginManager>();
}
else
{
container.RegisterSingleton<IPluginsManager>(pluginsManager);
pluginManager = new PluginManager(resolver);
}
if (config.GetValue(TouchSocketCoreConfigExtension.ConfigureContainerProperty) is Action<IContainer> actionContainer)
if (this.Config.GetValue(TouchSocketCoreConfigExtension.ConfigurePluginsProperty) is Action<IPluginManager> actionPluginManager)
{
actionContainer.Invoke(container);
pluginManager.Enable = true;
actionPluginManager.Invoke(pluginManager);
}
if (config.GetValue(TouchSocketCoreConfigExtension.ConfigurePluginsProperty) is Action<IPluginsManager> actionPluginsManager)
{
pluginsManager.Enable = true;
actionPluginsManager.Invoke(pluginsManager);
}
this.Logger ??= resolver.Resolve<ILog>();
this.Logger ??= container.Resolve<ILog>();
this.Container = container;
this.PluginsManager = pluginsManager;
this.PluginManager = pluginManager;
this.Resolver = resolver;
}
}
}

Some files were not shown because too many files have changed in this diff Show More