From 9cb91e60ddc08c0a6d60af83e85182c34270ec32 Mon Sep 17 00:00:00 2001
From: 327632904 <327632904@qq.com>
Date: Sun, 2 Jan 2022 23:24:11 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9EMTConnect=20Client?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DriverMTConnect/DriverMTConnect.csproj | 16 +++
.../DriverMTConnect/MTConnectClient.cs | 102 ++++++++++++++++++
README.md | 92 +++++++++-------
3 files changed, 171 insertions(+), 39 deletions(-)
create mode 100644 Plugins/Drivers/DriverMTConnect/DriverMTConnect.csproj
create mode 100644 Plugins/Drivers/DriverMTConnect/MTConnectClient.cs
diff --git a/Plugins/Drivers/DriverMTConnect/DriverMTConnect.csproj b/Plugins/Drivers/DriverMTConnect/DriverMTConnect.csproj
new file mode 100644
index 0000000..1aef235
--- /dev/null
+++ b/Plugins/Drivers/DriverMTConnect/DriverMTConnect.csproj
@@ -0,0 +1,16 @@
+
+
+
+ net5.0
+ ../../../IoTGateway/bin/Debug/net5.0/drivers
+ true
+
+
+
+
+
+
+
+
+
+
diff --git a/Plugins/Drivers/DriverMTConnect/MTConnectClient.cs b/Plugins/Drivers/DriverMTConnect/MTConnectClient.cs
new file mode 100644
index 0000000..81e70cd
--- /dev/null
+++ b/Plugins/Drivers/DriverMTConnect/MTConnectClient.cs
@@ -0,0 +1,102 @@
+using PluginInterface;
+using System;
+using OpenNETCF.MTConnect;
+namespace DriverMTConnect
+{
+ internal class MTConnectClient : IDriver
+ {
+
+ #region 配置参数
+
+ [ConfigParameter("设备Id")]
+ public Guid DeviceId { get; set; }
+
+ [ConfigParameter("uri")]
+ public string Uri { get; set; }
+
+ [ConfigParameter("超时时间ms")]
+ public uint Timeout { get; set; } = 3000;
+
+ [ConfigParameter("最小通讯周期ms")]
+ public uint MinPeriod { get; set; } = 3000;
+
+ public bool IsConnected { get; set; }
+
+ #endregion
+
+ EntityClient m_client = null;
+
+ public MTConnectClient(Guid deviceId)
+ {
+ DeviceId = deviceId;
+ }
+
+ public bool Close()
+ {
+ try
+ {
+ m_client = null;
+ IsConnected = false;
+ return true;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+
+ }
+
+ public bool Connect()
+ {
+ try
+ {
+ m_client = new EntityClient(Uri);
+ IsConnected = true;
+ }
+ catch (Exception)
+ {
+
+ IsConnected = false;
+ }
+ return IsConnected;
+ }
+
+ public void Dispose()
+ {
+ return;
+ }
+
+ [Method("读MTConnect", description: "读MTConnect ID")]
+ public DriverReturnValueModel ReadById(DriverAddressIoArgModel Ioarg)
+ {
+ var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
+
+ if (IsConnected)
+ {
+ try
+ {
+ var dataValue = m_client.GetDataItemById(Ioarg.Address).Value;
+ ret.Value = dataValue;
+ }
+ catch (Exception ex)
+ {
+ ret.StatusType = VaribaleStatusTypeEnum.Bad;
+ ret.Message = $"读取失败,{ex.Message}";
+ }
+ }
+ else
+ {
+ ret.StatusType = VaribaleStatusTypeEnum.Bad;
+ ret.Message = "连接失败";
+ }
+ return ret;
+ }
+
+ public DriverReturnValueModel Read(DriverAddressIoArgModel Ioarg)
+ {
+ var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
+ return ret;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 8bbe981..e42ed39 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,9 @@
# iotgateway
+
## github地址:[iotgateway](https://github.com/iioter/iotgateway/) https://github.com/iioter/iotgateway
+
## gitee地址:[iotgateway](https://gitee.com/wang_haidong/iotgateway/) https://gitee.com/iioter/iotgateway
+
基于.net5的跨平台物联网网关。通过可视化配置,轻松的连接到你的任何设备和系统(如PLC、扫码枪、CNC、数据库、串口设备、上位机、OPC Server、OPC UA Server、Mqtt Server等),从而与 Thingsboard、IoTSharp或您自己的物联网平台进行双向数据通讯。提供简单的驱动开发接口;当然也可以进行边缘计算。
* 抛砖引玉,共同进步
@@ -18,12 +21,14 @@
* 目前只支持遥测数据上传,后续支持属性的双向通信
* 简单集成了web组态项目
-
# 免责声明
+
## 生产环境使用请做好评估;
+
## 项目中OPCUA相关功能仅用作学习及测试,如使用OPCUA协议请联系OPC基金会进行授权,产生一切纠纷与本项目无关
# 体验
+
1. 在线体验[iotgateway](http://42.193.160.84:518/)后台:http://42.193.160.84:518/
2. 用户名 admin 密码 000000
3. 内置Modbustcp模拟设备 ip 172.17.0.1 port 16051 不要修改,否则连不上
@@ -32,16 +37,17 @@
6. 外网访问测试mqtt服务器,42.193.160.84:1888 admin 000000
7. 外网访问测试opcua服务,opc.tcp://42.193.160.84:62541/Quickstarts/ReferenceServer 匿名访问
8. 想要通过mqtt接收数据,请连接mqttserver:42.193.160.84,1888 admin 000000;订阅topic: v1/gateway/telemetry
-
-
-
-
-
-
-
+ 
+ 
+ 
+ 
+ 
+ 
# 运行
+
## windows主机运行:
+
1. [下载Releasev0.03](https://github.com/iioter/iotgateway/releases/download/v0.03/iotgateway-winx64-v0.03.zip)发布版本
2. [下载.net5](https://dotnet.microsoft.com/en-us/download/dotnet/5.0) sdk或runtime
3. 安装.net5
@@ -49,46 +55,53 @@
5. 访问[iotgateway](http://localhost:518/)后台:http://localhost:518
## linux/amd64,win/amd64 docker运行(官方仓)
+
1. docker run -d -p 518:518 -p 1888:1888 -p 62541:62541 --name iotgateway --restart always 15261671110/iotgateway
-## linux/amd64,win/amd64 docker运行(阿里仓)
-1. docker pull registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway
-2. docker tag registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway 15261671110/iotgateway
-3. docker run -d -p 518:518 -p 1888:1888 -p 62541:62541 --name iotgateway --restart always 15261671110/iotgateway
-
+
+ ## linux/amd64,win/amd64 docker运行(阿里仓)
+2. docker pull registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway
+3. docker tag registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway 15261671110/iotgateway
+4. docker run -d -p 518:518 -p 1888:1888 -p 62541:62541 --name iotgateway --restart always 15261671110/iotgateway
+
## linux/arm docker运行(官方仓)
+
1. docker run -d -p 518:518 -p 1888:1888 -p 62541:62541 --name iotgateway --restart always 15261671110/iotgateway:arm
-## linux/arm docker运行(阿里仓)
-1. docker pull registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway:arm
-2. docker tag registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway:arm 15261671110/iotgateway
-3. docker run -d -p 518:518 -p 1888:1888 -p 62541:62541 --name iotgateway --restart always 15261671110/iotgateway
+
+ ## linux/arm docker运行(阿里仓)
+2. docker pull registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway:arm
+3. docker tag registry.cn-hangzhou.aliyuncs.com/wanghaidong/iotgateway:arm 15261671110/iotgateway
+4. docker run -d -p 518:518 -p 1888:1888 -p 62541:62541 --name iotgateway --restart always 15261671110/iotgateway
## 登入系统
+
1. 用户名 admin,密码 000000
2. 打开发布文件路径下的ReadMe文件夹中的手摸手,按照顺序添加设备进行采集
-# 采集配置
-
-
-
-
-
-
-
-# thingsboard接入教程
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ # 采集配置
+
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+ # thingsboard接入教程
+
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
# 善于假于物
+
1. [WTM(MIT)](https://github.com/dotnetcore/WTM)
2. [OPCUA(OPCUA)](https://github.com/OPCFoundation/UA-.NETStandard)
3. [NModbus4(MIT)](https://github.com/NModbus4/NModbus4)
@@ -98,3 +111,4 @@
7. [EFCore(MIT)](https://github.com/dotnet/efcore)
8. [LayUI(MIT)](https://github.com/sentsin/layui)
9. [SQLite](https://github.com/sqlite/sqlite)
+10. [mtconnect ](https://github.com/ctacke/mtconnect)
From 91eb4e89a24b3df251012839124e58ea500efefb Mon Sep 17 00:00:00 2001
From: 327632904 <327632904@qq.com>
Date: Sun, 2 Jan 2022 23:35:51 +0800
Subject: [PATCH 2/2] =?UTF-8?q?MTConnect=20=E9=A9=B1=E5=8A=A8=E5=86=99?=
=?UTF-8?q?=E5=85=A5DB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
iotgateway.db | Bin 311296 -> 311296 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/iotgateway.db b/iotgateway.db
index a958119aa5e6865f2779690ba569834392e55df5..716cd01a04531ff20176089a2faaa40525a1aa5a 100644
GIT binary patch
delta 1861
zcma)-UuYaf9LIO(_L^<>Uqe!3np|_$3JGP-nc3NY0j0OIyDA}+h^qzDHo-(ZJ+C1~
zQHtIjHVycais0r&P*RG%BqxGP9>n-=@y+zX7b_72$)ku5>fBw8Eecr{hS{0l{ARzO
z@62x-js8ZXza=fIk~S^qlCh}&piO_#S1fDwCX#yNGv=ho2H9W~&~jwiWf+zTfixf%
z^y~n`FbF~qJ8tN^=F~Ina;>)T!tyVleZKeJrw6aBT3M(qm*%V0V5#!P!qUM+>7dsQ
z=_QCKM;IbfBos{$G+|jKVq=OZotuBPQoA?c|K>NOcYrDx7X)L=xNTfBE^sMRMsof4
z+>wV57a%3gIv9I*b1mIm6Q3>Wd39YdZs-r`KWP`$^`zJm2NKj0rGJ~0w8TqlT@Zv@
z@uPB+<+b>fti?xp(DEq@If4!zgtH*NS3j9R
zWP;+7gbxc47GJiwl?PzfW1F{a6tuf_57;#cBLpyv%LbOCWtG%4=1mF={Z{nMmm
zM+CedDLrNlSB0k_Its!tK6U6F>5)Y5xP3?QWk4c$9j}ZhZW&!j}
zH-gBaEW*U}Lf=cCe*g@f&LS*b?E|}cAPDK~An(+hJ;O@e-#^}#!LNnu1rc)t$P+t|
z@*SWTg$xFs6WPe}1BP+DRC#@=!sknfKbSj$P?nwV_Zo96&653?V-rfpc2>Ch&sp~ng%nuc0wr5hGx)E~R#4+
zq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