diff --git a/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 b/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 index b0c4795..93dff26 100644 Binary files a/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 and b/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/IoTGateway/v16/.suo b/.vs/IoTGateway/v16/.suo index 9f0983e..5dc9db6 100644 Binary files a/.vs/IoTGateway/v16/.suo and b/.vs/IoTGateway/v16/.suo differ diff --git a/IoTGateway/Properties/PublishProfiles/FolderProfile.pubxml.user b/IoTGateway/Properties/PublishProfiles/FolderProfile.pubxml.user index 95754c8..2cc8a7f 100644 --- a/IoTGateway/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/IoTGateway/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -5,6 +5,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>E:\workbench\iotgateway\IoTGateway\bin\Release\net5.0\publish\ - True|2021-12-24T11:18:19.0736393Z;True|2021-12-24T16:46:49.1192015+08:00;True|2021-12-24T16:23:28.9214784+08:00;True|2021-12-24T15:20:08.6401847+08:00;True|2021-12-17T19:11:07.1655146+08:00;True|2021-12-12T14:11:08.8380502+08:00; + True|2022-01-16T05:59:48.3664224Z;True|2021-12-24T19:18:19.0736393+08:00;True|2021-12-24T16:46:49.1192015+08:00;True|2021-12-24T16:23:28.9214784+08:00;True|2021-12-24T15:20:08.6401847+08:00;True|2021-12-17T19:11:07.1655146+08:00;True|2021-12-12T14:11:08.8380502+08:00; \ No newline at end of file diff --git a/Plugins/Drivers/DriverAllenBradley/AllenBradley.cs b/Plugins/Drivers/DriverAllenBradley/AllenBradley.cs index 05b6bd3..f56512a 100644 --- a/Plugins/Drivers/DriverAllenBradley/AllenBradley.cs +++ b/Plugins/Drivers/DriverAllenBradley/AllenBradley.cs @@ -96,46 +96,102 @@ namespace DriverAllenBradley switch (ioarg.ValueType) { case PluginInterface.DataTypeEnum.Bit: - ret.Value = plc.ReadBoolean(ioarg.Address).Value == true ? 1 : 0; + var resultBit = plc.ReadBoolean(ioarg.Address); + if (resultBit.IsSucceed) + ret.Value = resultBit.Value == true ? 1 : 0; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Bool: - ret.Value = plc.ReadBoolean(ioarg.Address).Value; + var resultBool = plc.ReadBoolean(ioarg.Address); + if (resultBool.IsSucceed) + ret.Value = resultBool.Value == true ? 1 : 0; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.UByte: - ret.Value = plc.ReadByte(ioarg.Address).Value; + var resultUByte = plc.ReadByte(ioarg.Address); + if (resultUByte.IsSucceed) + ret.Value = resultUByte.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Byte: - ret.Value = (sbyte)plc.ReadByte(ioarg.Address).Value; + var resultByte = plc.ReadByte(ioarg.Address); + if (resultByte.IsSucceed) + ret.Value = (sbyte)resultByte.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint16: - ret.Value =plc.ReadUInt16(ioarg.Address).Value; + var resultUint = plc.ReadUInt16(ioarg.Address); + if (resultUint.IsSucceed) + ret.Value = resultUint.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int16: - ret.Value = plc.ReadInt16(ioarg.Address).Value; + var resultInt = plc.ReadInt16(ioarg.Address); + if (resultInt.IsSucceed) + ret.Value = resultInt.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint32: - ret.Value =plc.ReadUInt32(ioarg.Address).Value; + var resultUint32 = plc.ReadUInt32(ioarg.Address); + if (resultUint32.IsSucceed) + ret.Value = resultUint32.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int32: - ret.Value = plc.ReadInt32(ioarg.Address).Value; + var resultInt32 = plc.ReadInt32(ioarg.Address); + if (resultInt32.IsSucceed) + ret.Value = resultInt32.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Float: - ret.Value = plc.ReadFloat(ioarg.Address).Value; + var resultFloat = plc.ReadFloat(ioarg.Address); + if (resultFloat.IsSucceed) + ret.Value = resultFloat.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Double: - ret.Value = plc.ReadDouble(ioarg.Address).Value; + var resultDouble = plc.ReadDouble(ioarg.Address); + if (resultDouble.IsSucceed) + ret.Value = resultDouble.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint64: - ret.Value = plc.ReadUInt64(ioarg.Address).Value; + var resultUint64 = plc.ReadUInt64(ioarg.Address); + if (resultUint64.IsSucceed) + ret.Value = resultUint64.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int64: - ret.Value = plc.ReadInt64(ioarg.Address).Value; + var resultInt64 = plc.ReadInt64(ioarg.Address); + if (resultInt64.IsSucceed) + ret.Value = resultInt64.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.AsciiString: - ret.Value = plc.ReadString(ioarg.Address); + var resultIntAsciiStr = plc.ReadString(ioarg.Address); + if (resultIntAsciiStr.IsSucceed) + ret.Value = resultIntAsciiStr.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Utf8String: - ret.Value = plc.ReadString(ioarg.Address); + var resultIntUtf8Str = plc.ReadString(ioarg.Address); + if (resultIntUtf8Str.IsSucceed) + ret.Value = resultIntUtf8Str.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; default: break; diff --git a/Plugins/Drivers/DriverMitsubishi/Mitsubishi.cs b/Plugins/Drivers/DriverMitsubishi/Mitsubishi.cs index fae7134..6633a4d 100644 --- a/Plugins/Drivers/DriverMitsubishi/Mitsubishi.cs +++ b/Plugins/Drivers/DriverMitsubishi/Mitsubishi.cs @@ -100,46 +100,102 @@ namespace DriverMitsubishi switch (ioarg.ValueType) { case PluginInterface.DataTypeEnum.Bit: - ret.Value = plc.ReadBoolean(ioarg.Address).Value == true ? 1 : 0; + var resultBit = plc.ReadBoolean(ioarg.Address); + if (resultBit.IsSucceed) + ret.Value = resultBit.Value == true ? 1 : 0; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Bool: - ret.Value = plc.ReadBoolean(ioarg.Address).Value; + var resultBool = plc.ReadBoolean(ioarg.Address); + if (resultBool.IsSucceed) + ret.Value = resultBool.Value == true ? 1 : 0; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.UByte: - ret.Value = plc.ReadByte(ioarg.Address).Value; + var resultUByte = plc.ReadByte(ioarg.Address); + if (resultUByte.IsSucceed) + ret.Value = resultUByte.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Byte: - ret.Value = (sbyte)plc.ReadByte(ioarg.Address).Value; + var resultByte = plc.ReadByte(ioarg.Address); + if (resultByte.IsSucceed) + ret.Value = (sbyte)resultByte.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint16: - ret.Value =plc.ReadUInt16(ioarg.Address).Value; + var resultUint = plc.ReadUInt16(ioarg.Address); + if (resultUint.IsSucceed) + ret.Value = resultUint.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int16: - ret.Value = plc.ReadInt16(ioarg.Address).Value; + var resultInt = plc.ReadInt16(ioarg.Address); + if (resultInt.IsSucceed) + ret.Value = resultInt.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint32: - ret.Value =plc.ReadUInt32(ioarg.Address).Value; + var resultUint32 = plc.ReadUInt32(ioarg.Address); + if (resultUint32.IsSucceed) + ret.Value = resultUint32.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int32: - ret.Value = plc.ReadInt32(ioarg.Address).Value; + var resultInt32 = plc.ReadInt32(ioarg.Address); + if (resultInt32.IsSucceed) + ret.Value = resultInt32.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Float: - ret.Value = plc.ReadFloat(ioarg.Address).Value; + var resultFloat = plc.ReadFloat(ioarg.Address); + if (resultFloat.IsSucceed) + ret.Value = resultFloat.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Double: - ret.Value = plc.ReadDouble(ioarg.Address).Value; + var resultDouble = plc.ReadDouble(ioarg.Address); + if (resultDouble.IsSucceed) + ret.Value = resultDouble.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint64: - ret.Value = plc.ReadUInt64(ioarg.Address).Value; + var resultUint64 = plc.ReadUInt64(ioarg.Address); + if (resultUint64.IsSucceed) + ret.Value = resultUint64.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int64: - ret.Value = plc.ReadInt64(ioarg.Address).Value; + var resultInt64 = plc.ReadInt64(ioarg.Address); + if (resultInt64.IsSucceed) + ret.Value = resultInt64.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.AsciiString: - ret.Value = plc.ReadString(ioarg.Address); + var resultIntAsciiStr = plc.ReadString(ioarg.Address); + if (resultIntAsciiStr.IsSucceed) + ret.Value = resultIntAsciiStr.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Utf8String: - ret.Value = plc.ReadString(ioarg.Address); + var resultIntUtf8Str = plc.ReadString(ioarg.Address); + if (resultIntUtf8Str.IsSucceed) + ret.Value = resultIntUtf8Str.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; default: break; diff --git a/Plugins/Drivers/OmronFins/OmronFins.cs b/Plugins/Drivers/OmronFins/OmronFins.cs index c887eba..193dae6 100644 --- a/Plugins/Drivers/OmronFins/OmronFins.cs +++ b/Plugins/Drivers/OmronFins/OmronFins.cs @@ -96,46 +96,102 @@ namespace DriverOmronFins switch (ioarg.ValueType) { case PluginInterface.DataTypeEnum.Bit: - ret.Value = plc.ReadBoolean(ioarg.Address).Value == true ? 1 : 0; + var resultBit = plc.ReadBoolean(ioarg.Address); + if (resultBit.IsSucceed) + ret.Value = resultBit.Value == true ? 1 : 0; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Bool: - ret.Value = plc.ReadBoolean(ioarg.Address).Value; + var resultBool = plc.ReadBoolean(ioarg.Address); + if (resultBool.IsSucceed) + ret.Value = resultBool.Value == true ? 1 : 0; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.UByte: - ret.Value = plc.ReadByte(ioarg.Address).Value; + var resultUByte = plc.ReadByte(ioarg.Address); + if (resultUByte.IsSucceed) + ret.Value = resultUByte.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Byte: - ret.Value = (sbyte)plc.ReadByte(ioarg.Address).Value; + var resultByte = plc.ReadByte(ioarg.Address); + if (resultByte.IsSucceed) + ret.Value = (sbyte)resultByte.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint16: - ret.Value =plc.ReadUInt16(ioarg.Address).Value; + var resultUint = plc.ReadUInt16(ioarg.Address); + if (resultUint.IsSucceed) + ret.Value = resultUint.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int16: - ret.Value = plc.ReadInt16(ioarg.Address).Value; + var resultInt = plc.ReadInt16(ioarg.Address); + if (resultInt.IsSucceed) + ret.Value = resultInt.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint32: - ret.Value =plc.ReadUInt32(ioarg.Address).Value; + var resultUint32 = plc.ReadUInt32(ioarg.Address); + if (resultUint32.IsSucceed) + ret.Value = resultUint32.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int32: - ret.Value = plc.ReadInt32(ioarg.Address).Value; + var resultInt32 = plc.ReadInt32(ioarg.Address); + if (resultInt32.IsSucceed) + ret.Value = resultInt32.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Float: - ret.Value = plc.ReadFloat(ioarg.Address).Value; + var resultFloat = plc.ReadFloat(ioarg.Address); + if (resultFloat.IsSucceed) + ret.Value = resultFloat.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Double: - ret.Value = plc.ReadDouble(ioarg.Address).Value; + var resultDouble = plc.ReadDouble(ioarg.Address); + if (resultDouble.IsSucceed) + ret.Value = resultDouble.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Uint64: - ret.Value = plc.ReadUInt64(ioarg.Address).Value; + var resultUint64 = plc.ReadUInt64(ioarg.Address); + if (resultUint64.IsSucceed) + ret.Value = resultUint64.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Int64: - ret.Value = plc.ReadInt64(ioarg.Address).Value; + var resultInt64 = plc.ReadInt64(ioarg.Address); + if (resultInt64.IsSucceed) + ret.Value = resultInt64.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.AsciiString: - ret.Value = plc.ReadString(ioarg.Address); + var resultIntAsciiStr = plc.ReadString(ioarg.Address); + if (resultIntAsciiStr.IsSucceed) + ret.Value = resultIntAsciiStr.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; case PluginInterface.DataTypeEnum.Utf8String: - ret.Value = plc.ReadString(ioarg.Address); + var resultIntUtf8Str = plc.ReadString(ioarg.Address); + if (resultIntUtf8Str.IsSucceed) + ret.Value = resultIntUtf8Str.Value; + else + ret.StatusType = VaribaleStatusTypeEnum.Bad; break; default: break; diff --git a/README.md b/README.md index 0ca02ff..e7b774d 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ * 内置OPCUA服务端,数据实时更新。匿名本地访问:opc.tcp://localhost:62541/Quickstarts/ReferenceServer * 内置Modbus驱动全协议支持 * 内置西门子PLC驱动 +* 内置三菱PLC驱动 +* 内置欧姆龙PLC驱动 +* 内置AB(罗克韦尔)PLC驱动 * 内置OPCUA客户端驱动 * 增加计算表达式 * 支持驱动二次开发(短期内会提供三菱、fanuc通讯) diff --git a/drivers/net5.0/DriverAllenBradley.dll b/drivers/net5.0/DriverAllenBradley.dll index 616a22c..c784521 100644 Binary files a/drivers/net5.0/DriverAllenBradley.dll and b/drivers/net5.0/DriverAllenBradley.dll differ diff --git a/drivers/net5.0/DriverAllenBradley.pdb b/drivers/net5.0/DriverAllenBradley.pdb index e4cc869..3b009e2 100644 Binary files a/drivers/net5.0/DriverAllenBradley.pdb and b/drivers/net5.0/DriverAllenBradley.pdb differ diff --git a/drivers/net5.0/DriverMTConnect.dll b/drivers/net5.0/DriverMTConnect.dll index 501917e..6058726 100644 Binary files a/drivers/net5.0/DriverMTConnect.dll and b/drivers/net5.0/DriverMTConnect.dll differ diff --git a/drivers/net5.0/DriverMTConnect.pdb b/drivers/net5.0/DriverMTConnect.pdb index 2455e6a..240914a 100644 Binary files a/drivers/net5.0/DriverMTConnect.pdb and b/drivers/net5.0/DriverMTConnect.pdb differ diff --git a/drivers/net5.0/DriverMitsubishi.dll b/drivers/net5.0/DriverMitsubishi.dll index cbda5b2..6ad0a68 100644 Binary files a/drivers/net5.0/DriverMitsubishi.dll and b/drivers/net5.0/DriverMitsubishi.dll differ diff --git a/drivers/net5.0/DriverMitsubishi.pdb b/drivers/net5.0/DriverMitsubishi.pdb index d5230cd..71a8a89 100644 Binary files a/drivers/net5.0/DriverMitsubishi.pdb and b/drivers/net5.0/DriverMitsubishi.pdb differ diff --git a/drivers/net5.0/DriverModbusMaster.dll b/drivers/net5.0/DriverModbusMaster.dll index 3ac487f..b545b9c 100644 Binary files a/drivers/net5.0/DriverModbusMaster.dll and b/drivers/net5.0/DriverModbusMaster.dll differ diff --git a/drivers/net5.0/DriverModbusMaster.pdb b/drivers/net5.0/DriverModbusMaster.pdb index 80f58d2..6fbd3fe 100644 Binary files a/drivers/net5.0/DriverModbusMaster.pdb and b/drivers/net5.0/DriverModbusMaster.pdb differ diff --git a/drivers/net5.0/DriverOPCUaClient.dll b/drivers/net5.0/DriverOPCUaClient.dll index 57a622a..385f334 100644 Binary files a/drivers/net5.0/DriverOPCUaClient.dll and b/drivers/net5.0/DriverOPCUaClient.dll differ diff --git a/drivers/net5.0/DriverOPCUaClient.pdb b/drivers/net5.0/DriverOPCUaClient.pdb index b4272f3..70c53f0 100644 Binary files a/drivers/net5.0/DriverOPCUaClient.pdb and b/drivers/net5.0/DriverOPCUaClient.pdb differ diff --git a/drivers/net5.0/DriverOmronFins.dll b/drivers/net5.0/DriverOmronFins.dll index a0996b6..c6fcdf1 100644 Binary files a/drivers/net5.0/DriverOmronFins.dll and b/drivers/net5.0/DriverOmronFins.dll differ diff --git a/drivers/net5.0/DriverOmronFins.pdb b/drivers/net5.0/DriverOmronFins.pdb index 0d49c59..25a9fbf 100644 Binary files a/drivers/net5.0/DriverOmronFins.pdb and b/drivers/net5.0/DriverOmronFins.pdb differ diff --git a/drivers/net5.0/DriverSiemensS7.dll b/drivers/net5.0/DriverSiemensS7.dll index 905a9f1..d834f94 100644 Binary files a/drivers/net5.0/DriverSiemensS7.dll and b/drivers/net5.0/DriverSiemensS7.dll differ diff --git a/drivers/net5.0/DriverSiemensS7.pdb b/drivers/net5.0/DriverSiemensS7.pdb index 24bd948..714eb9c 100644 Binary files a/drivers/net5.0/DriverSiemensS7.pdb and b/drivers/net5.0/DriverSiemensS7.pdb differ diff --git a/drivers/net5.0/PluginInterface.dll b/drivers/net5.0/PluginInterface.dll index 9aff761..9ae9854 100644 Binary files a/drivers/net5.0/PluginInterface.dll and b/drivers/net5.0/PluginInterface.dll differ diff --git a/drivers/net5.0/PluginInterface.pdb b/drivers/net5.0/PluginInterface.pdb index 7ff8553..56e2678 100644 Binary files a/drivers/net5.0/PluginInterface.pdb and b/drivers/net5.0/PluginInterface.pdb differ diff --git a/drivers/net5.0/ref/DriverModbusMaster.dll b/drivers/net5.0/ref/DriverModbusMaster.dll index d22122d..8f70c3c 100644 Binary files a/drivers/net5.0/ref/DriverModbusMaster.dll and b/drivers/net5.0/ref/DriverModbusMaster.dll differ diff --git a/drivers/net5.0/ref/DriverOPCUaClient.dll b/drivers/net5.0/ref/DriverOPCUaClient.dll index fd3c8f3..c5ac7d5 100644 Binary files a/drivers/net5.0/ref/DriverOPCUaClient.dll and b/drivers/net5.0/ref/DriverOPCUaClient.dll differ diff --git a/drivers/net5.0/ref/DriverSiemensS7.dll b/drivers/net5.0/ref/DriverSiemensS7.dll index 195974c..e70d8e5 100644 Binary files a/drivers/net5.0/ref/DriverSiemensS7.dll and b/drivers/net5.0/ref/DriverSiemensS7.dll differ diff --git a/iotgateway.db b/iotgateway.db index 444b00c..119f243 100644 Binary files a/iotgateway.db and b/iotgateway.db differ