Fanuc采集使用Focas库(李兴华)

This commit is contained in:
iioter 2022-06-09 16:11:37 +08:00
parent a8f1d459a7
commit 0985cb5f1d
34 changed files with 13624 additions and 974 deletions

View File

@ -97,9 +97,9 @@ namespace IoTGateway.ViewModel.BasicData.DeviceVariableVMs
var DapThread = deviceService.DeviceThreads.Where(x => x._device.ID == item.DeviceId).FirstOrDefault();
if (DapThread?.DeviceValues != null && DapThread.DeviceValues.ContainsKey(item.ID))
{
item.Value = JsonConvert.SerializeObject(DapThread.DeviceValues[item.ID].Value);
item.CookedValue = JsonConvert.SerializeObject(DapThread.DeviceValues[item.ID].CookedValue);
item.State = DapThread.DeviceValues[item.ID].StatusType.ToString();
item.Value = DapThread?.DeviceValues[item.ID]?.Value?.ToString();
item.CookedValue = DapThread?.DeviceValues[item.ID]?.CookedValue?.ToString();
item.State = DapThread?.DeviceValues[item.ID]?.StatusType.ToString();
}
}

View File

@ -41,88 +41,172 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverSiemensS7", "Plugins\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOmronFins", "Plugins\Drivers\DriverOmronFins\DriverOmronFins.csproj", "{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverFanuc", "Plugins\Drivers\DriverFanuc\DriverFanuc.csproj", "{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverSimTcpClient", "Plugins\Drivers\DriverSimTcpClient\DriverSimTcpClient.csproj", "{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriverSimTcpClient", "Plugins\Drivers\DriverSimTcpClient\DriverSimTcpClient.csproj", "{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverFanucHsl", "Plugins\Drivers\DriverFanucHsl\DriverFanucHsl.csproj", "{10D22B6E-DE30-4F11-A005-8188DF549F72}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverFanuc", "Plugins\Drivers\DriverFanuc\DriverFanuc.csproj", "{41F81606-1728-4A03-AE64-FA2CCF49BE5A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Debug|x86.ActiveCfg = Debug|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Debug|x86.Build.0 = Debug|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Release|Any CPU.Build.0 = Release|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Release|x86.ActiveCfg = Release|Any CPU
{1F9122C1-19DE-4A8B-9A00-D59E592ECC3A}.Release|x86.Build.0 = Release|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Debug|x86.ActiveCfg = Debug|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Debug|x86.Build.0 = Debug|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Release|Any CPU.Build.0 = Release|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Release|x86.ActiveCfg = Release|Any CPU
{44619988-9F09-4714-9532-A44FAF8275FE}.Release|x86.Build.0 = Release|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Debug|x86.ActiveCfg = Debug|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Debug|x86.Build.0 = Debug|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Release|Any CPU.Build.0 = Release|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Release|x86.ActiveCfg = Release|Any CPU
{27FF2D65-0BBA-4C69-9DD7-311A4F21541E}.Release|x86.Build.0 = Release|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Debug|x86.ActiveCfg = Debug|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Debug|x86.Build.0 = Debug|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Release|Any CPU.Build.0 = Release|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Release|x86.ActiveCfg = Release|Any CPU
{E63C22D5-5F9B-4671-B115-40721B27F09F}.Release|x86.Build.0 = Release|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Debug|x86.ActiveCfg = Debug|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Debug|x86.Build.0 = Debug|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Release|Any CPU.Build.0 = Release|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Release|x86.ActiveCfg = Release|Any CPU
{89DE240E-5393-4DD4-87C9-3AD9D44B6E7E}.Release|x86.Build.0 = Release|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Debug|x86.ActiveCfg = Debug|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Debug|x86.Build.0 = Debug|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Release|Any CPU.Build.0 = Release|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Release|x86.ActiveCfg = Release|Any CPU
{96D436B4-4703-4448-A879-B69ACE89CA11}.Release|x86.Build.0 = Release|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Debug|x86.ActiveCfg = Debug|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Debug|x86.Build.0 = Debug|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Release|Any CPU.Build.0 = Release|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Release|x86.ActiveCfg = Release|Any CPU
{816DDA22-F7E8-4FB2-83A4-0954A0EEEBBF}.Release|x86.Build.0 = Release|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Debug|x86.Build.0 = Debug|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Release|Any CPU.Build.0 = Release|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Release|x86.ActiveCfg = Release|Any CPU
{5C12EBFB-B152-48C6-AA52-71128F246594}.Release|x86.Build.0 = Release|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Debug|x86.ActiveCfg = Debug|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Debug|x86.Build.0 = Debug|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Release|Any CPU.Build.0 = Release|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Release|x86.ActiveCfg = Release|Any CPU
{7752AD8C-04BF-4BD2-9272-CDA4F78FA954}.Release|x86.Build.0 = Release|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Debug|x86.ActiveCfg = Debug|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Debug|x86.Build.0 = Debug|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Release|Any CPU.Build.0 = Release|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Release|x86.ActiveCfg = Release|Any CPU
{3106F31C-0502-42D3-A27B-BDD2199D72CC}.Release|x86.Build.0 = Release|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Debug|x86.ActiveCfg = Debug|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Debug|x86.Build.0 = Debug|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Release|Any CPU.Build.0 = Release|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Release|x86.ActiveCfg = Release|Any CPU
{8919CDA5-23A6-4C04-87F9-C83DF4BEF357}.Release|x86.Build.0 = Release|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Debug|x86.ActiveCfg = Debug|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Debug|x86.Build.0 = Debug|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Release|Any CPU.Build.0 = Release|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Release|x86.ActiveCfg = Release|Any CPU
{8E2D91DC-DEE4-4843-8D09-6FC06651527E}.Release|x86.Build.0 = Release|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Debug|x86.ActiveCfg = Debug|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Debug|x86.Build.0 = Debug|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Release|Any CPU.Build.0 = Release|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Release|x86.ActiveCfg = Release|Any CPU
{64D4C755-33DD-4103-908B-82FA63C5BFB2}.Release|x86.Build.0 = Release|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Debug|x86.ActiveCfg = Debug|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Debug|x86.Build.0 = Debug|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Release|Any CPU.Build.0 = Release|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Release|x86.ActiveCfg = Release|Any CPU
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6}.Release|x86.Build.0 = Release|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Debug|x86.ActiveCfg = Debug|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Debug|x86.Build.0 = Debug|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Release|Any CPU.Build.0 = Release|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Release|x86.ActiveCfg = Release|Any CPU
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2}.Release|x86.Build.0 = Release|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Debug|x86.ActiveCfg = Debug|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Debug|x86.Build.0 = Debug|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|Any CPU.Build.0 = Release|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Release|Any CPU.Build.0 = Release|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|x86.ActiveCfg = Release|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|x86.Build.0 = Release|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Debug|x86.ActiveCfg = Debug|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Debug|x86.Build.0 = Debug|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Release|Any CPU.Build.0 = Release|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Release|x86.ActiveCfg = Release|Any CPU
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F}.Release|x86.Build.0 = Release|Any CPU
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Debug|x86.ActiveCfg = Debug|Any CPU
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Debug|x86.Build.0 = Debug|Any CPU
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Release|Any CPU.Build.0 = Release|Any CPU
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Release|x86.ActiveCfg = Release|x86
{10D22B6E-DE30-4F11-A005-8188DF549F72}.Release|x86.Build.0 = Release|x86
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Debug|x86.ActiveCfg = Debug|Any CPU
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Debug|x86.Build.0 = Debug|Any CPU
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Release|Any CPU.Build.0 = Release|Any CPU
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Release|x86.ActiveCfg = Release|Any CPU
{41F81606-1728-4A03-AE64-FA2CCF49BE5A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -141,8 +225,9 @@ Global
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{F8EC5EDE-9A2C-443B-B125-E39C748EBB2F} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{10D22B6E-DE30-4F11-A005-8188DF549F72} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{41F81606-1728-4A03-AE64-FA2CCF49BE5A} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F219808-E6E8-4C1D-B846-41F2F7CF20FA}

BIN
IoTGateway/Dll/Fwlib32.dll Normal file

Binary file not shown.

BIN
IoTGateway/Dll/Fwlib64.dll Normal file

Binary file not shown.

BIN
IoTGateway/Dll/fwlib30i.dll Normal file

Binary file not shown.

Binary file not shown.

BIN
IoTGateway/Dll/fwlibe1.dll Normal file

Binary file not shown.

BIN
IoTGateway/Dll/fwlibe64.dll Normal file

Binary file not shown.

View File

@ -1,41 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<SatelliteResourceLanguages>zh-Hans,en</SatelliteResourceLanguages>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<SatelliteResourceLanguages>zh-Hans,en</SatelliteResourceLanguages>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Remove="ClientApp\**" />
<Content Remove="ClientApp\**" />
<EmbeddedResource Remove="ClientApp\**" />
<None Remove="ClientApp\**" />
</ItemGroup>
<ItemGroup>
<Compile Remove="ClientApp\**" />
<Content Remove="ClientApp\**" />
<EmbeddedResource Remove="ClientApp\**" />
<None Remove="ClientApp\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="MQTTnet" Version="3.1.1" />
<PackageReference Include="MQTTnet.AspNetCore" Version="3.1.1" />
<PackageReference Include="MQTTnet.Extensions.ManagedClient" Version="3.1.1" />
<PackageReference Include="MQTTnet.Extensions.Rpc" Version="3.1.1" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
<PackageReference Include="MQTTnet" Version="3.1.1" />
<PackageReference Include="MQTTnet.AspNetCore" Version="3.1.1" />
<PackageReference Include="MQTTnet.Extensions.ManagedClient" Version="3.1.1" />
<PackageReference Include="MQTTnet.Extensions.Rpc" Version="3.1.1" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IoTGateway.Model\IoTGateway.Model.csproj" />
<ProjectReference Include="..\IoTGateway.DataAccess\IoTGateway.DataAccess.csproj" />
<ProjectReference Include="..\IoTGateway.ViewModel\IoTGateway.ViewModel.csproj" />
<ProjectReference Include="..\WalkingTec.Mvvm\WalkingTec.Mvvm.Mvc\WalkingTec.Mvvm.Mvc.csproj" />
<ProjectReference Include="..\WalkingTec.Mvvm\WalkingTec.Mvvm.TagHelpers.LayUI\WalkingTec.Mvvm.TagHelpers.LayUI.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IoTGateway.Model\IoTGateway.Model.csproj" />
<ProjectReference Include="..\IoTGateway.DataAccess\IoTGateway.DataAccess.csproj" />
<ProjectReference Include="..\IoTGateway.ViewModel\IoTGateway.ViewModel.csproj" />
<ProjectReference Include="..\WalkingTec.Mvvm\WalkingTec.Mvvm.Mvc\WalkingTec.Mvvm.Mvc.csproj" />
<ProjectReference Include="..\WalkingTec.Mvvm\WalkingTec.Mvvm.TagHelpers.LayUI\WalkingTec.Mvvm.TagHelpers.LayUI.csproj" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
<ProjectExtensions>
<VisualStudio>
<UserProperties appsettings_1json__JsonSchema="" />
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>IoTGateway</ActiveDebugProfile>
<NameOfLastUsedPublishProfile>D:\Repos\iotgateway\IoTGateway\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<View_SelectedScaffolderID>RazorViewEmptyScaffolder</View_SelectedScaffolderID>
<View_SelectedScaffolderCategoryPath>root/Common/MVC/View</View_SelectedScaffolderCategoryPath>
</PropertyGroup>

View File

@ -4,17 +4,19 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>True</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<LastUsedPlatform>x86</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net6.0</TargetFramework>
<ProjectGuid>68abbdf2-1485-4756-9a94-6afa874d69a3</ProjectGuid>
<SelfContained>false</SelfContained>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PublishTargetUrl>D:\Repos\iotgateway\IoTGateway\bin\Release\net6.0\publish\</_PublishTargetUrl>
<History>True|2022-01-24T15:31:28.3620602Z;True|2022-01-24T23:30:03.8991942+08:00;True|2022-01-24T23:23:16.4288882+08:00;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;</History>
<_PublishTargetUrl>D:\000000-IIoTGateway\00000-iotgateway\IoTGateway\bin\Release\net6.0\publish\</_PublishTargetUrl>
<History>True|2022-06-09T07:43:47.6180879Z;True|2022-06-09T15:42:06.6021355+08:00;False|2022-06-09T15:41:10.3444145+08:00;False|2022-06-09T15:39:22.0048230+08:00;False|2022-06-09T15:37:35.5049088+08:00;True|2022-06-09T15:34:27.8095097+08:00;True|2022-06-09T15:33:30.9577399+08:00;False|2022-06-09T15:29:58.9432537+08:00;False|2022-06-09T15:29:15.9735490+08:00;True|2022-06-09T15:27:02.3333134+08:00;True|2022-06-09T15:18:02.0623963+08:00;True|2022-01-24T23:31:28.3620602+08:00;True|2022-01-24T23:30:03.8991942+08:00;True|2022-01-24T23:23:16.4288882+08:00;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;</History>
</PropertyGroup>
</Project>

Binary file not shown.

View File

@ -7,7 +7,7 @@ using System.Text;
namespace DriverAllenBradley
{
[DriverSupported("AllenBradley")]
[DriverInfoAttribute("AllenBradley", "V1.0.0", "Copyright WHD-IoTClient© 2022-01-15")]
[DriverInfoAttribute("AllenBradley", "V1.0.0", "Copyright IoTGateway-IoTClient© 2022-01-15")]
public class AllenBradley : IDriver
{
private AllenBradleyClient plc = null;

View File

@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IoTClient" Version="1.0.22" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IoTClient" Version="1.0.22" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
</Project>

View File

@ -5,26 +5,9 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<None Remove="HslCommunication.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="HslCommunication" Version="11.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="HslCommunication">
<HintPath>HslCommunication.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,309 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DriverFaunc
{
public class FanucFocas : Focas1
{
public static ushort h;
//下载程序 5-27
//开始
private static short dwnstart(ushort handle, short type)
{
return FanucFocas.cnc_dwnstart3(handle, type);
}
//结束
private static short dwnend(ushort handle)
{
return FanucFocas.cnc_dwnend3(handle);
}
//下载
private static short dwnload(ushort handle, ref int datalength, string data)
{
//开始下载程序 datalength将会被返回实际的输出的字符数量
return FanucFocas.cnc_download3(handle, ref datalength, data);
}
//获取详细的错误信息
private static short getdtailerr(ushort handle, FanucFocas.ODBERR odberr)
{
return FanucFocas.cnc_getdtailerr(handle, odberr);
}
//下载程序的入口点
/// <summary>
/// 向CNC下载指定类型的程序
/// </summary>
/// <param name="handle">句柄</param>
/// <param name="type">程序类型</param>
/// <param name="data">程序的内容</param>
/// <param name="odberr">保存返回错误信息的详细内容,为null不返回</param>
/// <returns>错误码</returns>
public static short download(ushort handle, short type, string data, FanucFocas.ODBERR odberr)
{
int datalength = data.Length;
short ret = dwnstart(handle, type);
if (ret == 0)
{
int olddata = datalength;
while (true)
{
ret = dwnload(handle, ref datalength, data);
//说明缓存已满或为空,继续尝试
if (ret == (short)FanucFocas.focas_ret.EW_BUFFER)
{
continue;
}
if (ret == FanucFocas.EW_OK)
{
//说明当前下载完成,temp记录剩余下载量
int temp = olddata - datalength;
if (temp <= 0)
{
break;
}
else
{
data = data.Substring(datalength, temp);
datalength = temp; olddata = temp;
}
}
else
{
//下载出现错误,解析出具体的错误信息
if (odberr != null)
{
getdtailerr(handle, odberr);
}
//下载出错
break;
}
}
//判断是哪里出的问题
if (ret == 0)
{
ret = dwnend(handle);
//结束下载出错
return ret;
}
else
{
dwnend(handle);
//下载出错
return ret;
}
}
else
{
dwnend(handle);
//开始下载出错
return ret;
}
}
//下载程序 5-27
//上传程序 5-28
//开始
private static short upstart(ushort handle, short type, int startno, int endno)
{
return cnc_upstart3(handle, type, startno, endno);
}
//上传
private static short uplod(ushort handle, int length, char[] databuf)
{
return cnc_upload3(handle, ref length, databuf);
}
//结束
private static short upend(ushort handle)
{
return cnc_upend3(handle);
}
//上传程序的入口
/// <summary>
/// 根据程序号读取指定程序
/// </summary>
/// <param name="handle">句柄</param>
/// <param name="type">类型</param>
/// <param name="no">程序号</param>
/// <param name="odberr">详细错误内容null不返回</param>
/// <param name="data">返回的程序内容</param>
/// <returns>错误码</returns>
public static short upload(ushort handle, short type, int no, ref string data, FanucFocas.ODBERR odberr)
{
int startno = no; int endno = no;
int length = 256; char[] databuf = new char[256];
short ret = upstart(handle, type, startno, endno);
if (ret == FanucFocas.EW_OK)
{
string temp = "";
while (true)
{
//上传
ret = uplod(handle, length, databuf);
temp = new string(databuf);
int one = temp.Length;
if (ret == (short)FanucFocas.focas_ret.EW_BUFFER)
{
continue;
}
if (ret == FanucFocas.EW_OK)
{
temp = temp.Replace("\0", "");
data += temp;
string lastchar = temp.Substring(temp.Length - 1, 1);
if (lastchar == "%")
{
break;
}
}
else
{
//下载出现错误,解析出具体的错误信息
if (odberr != null)
{
getdtailerr(handle, odberr);
}
//下载出错
break;
}
}
//判断是哪里出的问题
if (ret == 0)
{
ret = upend(handle);
//结束上传出错
return ret;
}
else
{
upend(handle);
//上传出错
return ret;
}
}
else
{
//开始出错
upend(handle);
return ret;
}
}
//上传程序 5-28
//根据alm_grp 编号 返回 提示内容 简
public static string getalmgrp(short no)
{
string ret = "";
switch (no)
{
case 0:
ret = "SW";
break;
case 1:
ret = "PW";
break;
case 2:
ret = "IO";
break;
case 3:
ret = "PS";
break;
case 4:
ret = "OT";
break;
case 5:
ret = "OH";
break;
case 6:
ret = "SV";
break;
case 7:
ret = "SR";
break;
case 8:
ret = "MC";
break;
case 9:
ret = "SP";
break;
case 10:
ret = "DS";
break;
case 11:
ret = "IE";
break;
case 12:
ret = "BG";
break;
case 13:
ret = "SN";
break;
case 14:
ret = "reserved";
break;
case 15:
ret = "EX";
break;
case 19:
ret = "PC";
break;
default:
ret = "Not used";
break;
}
return ret;
}
//根据alm_grp 编号 返回 提示内容 简
//2016-6-2 根据地址码和地址号,返回完整的显示信息
public static string getpmcadd(short a, ushort b)
{
string tempa = "";
switch (a)
{
case 0:
tempa = "G";
break;
case 1:
tempa = "F";
break;
case 2:
tempa = "Y";
break;
case 3:
tempa = "X";
break;
case 4:
tempa = "A";
break;
case 5:
tempa = "R";
break;
case 6:
tempa = "T";
break;
case 7:
tempa = "K";
break;
case 8:
tempa = "C";
break;
case 9:
tempa = "D";
break;
default:
tempa = "n";
break;
}
string tempb = b.ToString().PadLeft(4, '0');
return tempa + tempb;
}
//2016-6-2 根据地址码和地址号,返回完整的显示信息
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HslCommunication" Version="11.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,863 @@

using PluginInterface;
using System;
using System.Text;
using HslCommunication.CNC.Fanuc;
using HslCommunication;
namespace DriverFanucHsl
{
[DriverSupported("Fanuc-0i")]
[DriverInfoAttribute("Fanuc-0i", "V11.0.0", "Copyright HSL ")]
public class FanucHsl : IDriver
{
private FanucSeries0i fanuc;
#region
[ConfigParameter("设备Id")]
public Guid DeviceId { get; set; }
[ConfigParameter("IP地址")]
public string IpAddress { get; set; } = "127.0.0.1";
[ConfigParameter("端口号")]
public int Port { get; set; } = 8193;
[ConfigParameter("超时时间ms")]
public int Timeout { get; set; } = 3000;
[ConfigParameter("最小通讯周期ms")]
public uint MinPeriod { get; set; } = 3000;
#endregion
public FanucHsl(Guid deviceId)
{
// 授权示例 Authorization example
if (!Authorization.SetAuthorizationCode("输入你的授权号"))
{
//return; // 激活失败应该退出系统
}
DeviceId = deviceId;
}
public bool IsConnected
{
get
{
if (fanuc == null)
return false;
else
{
OperateResult<int[]> read = fanuc.ReadProgramList();
if (read.IsSuccess)
{
return true;
}
else
{
return false;
}
}
}
}
public bool Connect()
{
try
{
fanuc?.ConnectClose();
fanuc = new FanucSeries0i(IpAddress, Port);
return fanuc.ConnectServer().IsSuccess;
}
catch (Exception)
{
return false;
}
return IsConnected;
}
public bool Close()
{
try
{
fanuc.ConnectClose();
return !IsConnected;
}
catch (Exception)
{
return false;
}
}
public void Dispose()
{
}
[Method("Fanuc", description: "读系统状态")]
public DriverReturnValueModel ReadSysStatusInfo(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<SysStatusInfo> read = fanuc.ReadSysStatusInfo();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "读报警信息")]
public DriverReturnValueModel ReadSystemAlarm(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<SysAlarm[]> read = fanuc.ReadSystemAlarm();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "坐标数据")]
public DriverReturnValueModel ReadSysAllCoors(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<SysAllCoors> read = fanuc.ReadSysAllCoors();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "程序列表")]
public DriverReturnValueModel ReadProgramList(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int[]> read = fanuc.ReadProgramList();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "当前程序名")]
public DriverReturnValueModel ReadSystemProgramCurrent(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<string, int> read = fanuc.ReadSystemProgramCurrent();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(
new Dictionary<string, object>() { { "ProgramName", read.Content1 }, { "ProgramNo", read.Content2 } }
);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "主轴转进速")]
public DriverReturnValueModel ReadSpindleSpeedAndFeedRate(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<double, double> read = fanuc.ReadSpindleSpeedAndFeedRate();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(
new Dictionary<string, object>() { { "SpindleSpeed", read.Content1 }, { "FeedRate", read.Content2 } }
);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "伺服负载")]
public DriverReturnValueModel ReadFanucAxisLoad(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<double[]> read = fanuc.ReadFanucAxisLoad();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "道具补偿")]
public DriverReturnValueModel ReadCutterInfos(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<CutterInfo[]> read = fanuc.ReadCutterInfos();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "程序路径")]
public DriverReturnValueModel ReadCurrentForegroundDir(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<string> read = fanuc.ReadCurrentForegroundDir();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "工件尺寸")]
public DriverReturnValueModel ReadDeviceWorkPiecesSize(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<double[]> read = fanuc.ReadDeviceWorkPiecesSize();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "报警代号")]
public DriverReturnValueModel ReadAlarmStatus(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadAlarmStatus();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "机床时间")]
public DriverReturnValueModel ReadCurrentDateTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<DateTime> read = fanuc.ReadCurrentDateTime();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "已加工数量")]
public DriverReturnValueModel ReadCurrentProduceCount(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadCurrentProduceCount();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "总加工数量")]
public DriverReturnValueModel ReadExpectProduceCount(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadExpectProduceCount();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "系统语言")]
public DriverReturnValueModel ReadLanguage(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<ushort> read = fanuc.ReadLanguage();
if (read.IsSuccess)
ret.Value = (LanguageType)read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "当前程序")]
public DriverReturnValueModel ReadCurrentProgram(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<string> read = fanuc.ReadCurrentProgram();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "开机时间")]
public DriverReturnValueModel ReadOnLineTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(0);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "运行时间")]
public DriverReturnValueModel ReadRunTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(1);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "切割时间")]
public DriverReturnValueModel ReadCuttingTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(2);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "空闲时间")]
public DriverReturnValueModel ReadIdleTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(3);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "当前道具号")]
public DriverReturnValueModel ReadCutterNumber(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadCutterNumber();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "读宏变量")]
public DriverReturnValueModel ReadSystemMacroValue(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
if (!int.TryParse(Ioarg.Address, out int address))
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"宏变量地址错误";
}
else
{
OperateResult<double> read = fanuc.ReadSystemMacroValue(address);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "读取程序")]
public DriverReturnValueModel ReadProgramAsync(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
if (!int.TryParse(Ioarg.Address, out int address))
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"程序号错误";
}
else
{
OperateResult<string> read = fanuc.ReadProgram(address);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
public async Task<RpcResponse> WriteAsync(string RequestId, string Method, DriverAddressIoArgModel Ioarg)
{
RpcResponse rpcResponse = new() { IsSuccess = false, Description = "设备驱动内未实现写入功能" };
return rpcResponse;
}
public DriverReturnValueModel Read(DriverAddressIoArgModel Ioarg)
{
throw new NotImplementedException();
}
private enum LanguageType
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 6,
= 15,
= 16,
= 17
}
}
}

View File

@ -8,7 +8,7 @@ namespace DriverMitsubishi
{
[DriverSupported("A_1E")]
[DriverSupported("Qna_3E")]
[DriverInfoAttribute("Mitsubishi", "V1.0.0", "Copyright WHD-IoTClient© 2022-01-15")]
[DriverInfoAttribute("Mitsubishi", "V1.0.0", "Copyright IoTGateway-IoTClient© 2022-01-15")]
public class Mitsubishi : IDriver
{
private MitsubishiClient plc = null;

View File

@ -13,7 +13,7 @@ namespace DriverModbusMaster
[DriverSupported("ModbusUDP")]
[DriverSupported("ModbusRtu")]
[DriverSupported("ModbusAscii")]
[DriverInfoAttribute("ModbusMaster", "V1.0.0", "Copyright WHD© 2021-12-19")]
[DriverInfoAttribute("ModbusMaster", "V1.0.0", "Copyright IoTGateway© 2021-12-19")]
public class ModbusMaster : IDriver
{
private TcpClient clientTcp = null;

View File

@ -12,7 +12,7 @@ using OpcUaHelper;
namespace DriverOPCUaClient
{
[DriverSupported("OPC UA")]
[DriverInfoAttribute("OPCUaClient", "V1.0.0", "Copyright WHD© 2021-12-19")]
[DriverInfoAttribute("OPCUaClient", "V1.0.0", "Copyright IoTGateway© 2021-12-19")]
public class OPCUaClient : IDriver
{
OpcUaClientHelper opcUaClient = null;

View File

@ -7,7 +7,7 @@ using System.Text;
namespace DriverOmronFins
{
[DriverSupported("OmronFins")]
[DriverInfoAttribute("OmronFins", "V1.0.0", "Copyright WHD-IoTClient© 2022-01-15")]
[DriverInfoAttribute("OmronFins", "V1.0.0", "Copyright IoTGateway-IoTClient© 2022-01-15")]
public class OmronFins : IDriver
{
private OmronFinsClient plc = null;

View File

@ -11,7 +11,7 @@ namespace DriverSiemensS7
[DriverSupported("300")]
[DriverSupported("200")]
[DriverSupported("200Smart")]
[DriverInfoAttribute("SiemensS7", "V1.0.0", "Copyright WHD© 2021-12-19")]
[DriverInfoAttribute("SiemensS7", "V1.0.0", "Copyright IoTGateway© 2021-12-19")]
public class SiemensS7 : IDriver
{
private Plc plc = null;

View File

@ -6,7 +6,7 @@ using System.Text;
namespace DriverSimTcpClient
{
[DriverSupported("SimTcpServerDevice")]
[DriverInfoAttribute("SimTcpClient", "V1.0.0", "Copyright iotgateway© 2022-06-04")]
[DriverInfoAttribute("SimTcpClient", "V1.0.0", "Copyright IoTGateway© 2022-06-04")]
public class SimTcpClient : IDriver
{
/// <summary>

View File

@ -1,16 +1,8 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using PluginInterface;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using IoTGateway.DataAccess;
using IoTGateway.Model;
@ -87,62 +79,68 @@ namespace Plugin
{
var systemManage = DC.Set<SystemConfig>().FirstOrDefault();
var driver = _DrvierManager.DriverInfos.Where(x => x.Type.FullName == Device.Driver.AssembleName).SingleOrDefault();
var settings = DC.Set<DeviceConfig>().Where(x => x.DeviceId == Device.ID).AsNoTracking().ToList();
Type[] types = new Type[1] { typeof(Guid) };
object[] param = new object[1] { Device.ID };
ConstructorInfo constructor = driver.Type.GetConstructor(types);
var DeviceObj = constructor.Invoke(param) as IDriver;
foreach (var p in driver.Type.GetProperties())
if (driver == null)
_logger.LogError($"找不到设备:[{Device.DeviceName}]的驱动:[{Device.Driver.AssembleName}]");
else
{
var config = p.GetCustomAttribute(typeof(ConfigParameterAttribute));
var setting = settings.Where(x => x.DeviceConfigName == p.Name).FirstOrDefault();
if (config == null || setting == null)
continue;
var settings = DC.Set<DeviceConfig>().Where(x => x.DeviceId == Device.ID).AsNoTracking().ToList();
Type[] types = new Type[1] { typeof(Guid) };
object[] param = new object[1] { Device.ID };
object value = setting.Value;
ConstructorInfo constructor = driver.Type.GetConstructor(types);
var DeviceObj = constructor.Invoke(param) as IDriver;
if (p.PropertyType == typeof(bool))
value = setting.Value == "0" ? false : true;
else if (p.PropertyType == typeof(byte))
value = byte.Parse(setting.Value);
else if (p.PropertyType == typeof(sbyte))
value = sbyte.Parse(setting.Value);
else if (p.PropertyType == typeof(short))
value = short.Parse(setting.Value);
else if (p.PropertyType == typeof(ushort))
value = ushort.Parse(setting.Value);
else if (p.PropertyType == typeof(int))
value = int.Parse(setting.Value);
else if (p.PropertyType == typeof(uint))
value = uint.Parse(setting.Value);
else if (p.PropertyType == typeof(long))
value = long.Parse(setting.Value);
else if (p.PropertyType == typeof(ulong))
value = ulong.Parse(setting.Value);
else if (p.PropertyType == typeof(float))
value = float.Parse(setting.Value);
else if (p.PropertyType == typeof(double))
value = double.Parse(setting.Value);
else if (p.PropertyType == typeof(decimal))
value = decimal.Parse(setting.Value);
else if (p.PropertyType == typeof(Guid))
value = Guid.Parse(setting.Value);
else if (p.PropertyType == typeof(DateTime))
value = DateTime.Parse(setting.Value);
else if (p.PropertyType == typeof(string))
value = setting.Value;
else if (p.PropertyType == typeof(IPAddress))
value = IPAddress.Parse(setting.Value);
else if (p.PropertyType.BaseType == typeof(Enum))
value = Enum.Parse(p.PropertyType, setting.Value);
foreach (var p in driver.Type.GetProperties())
{
var config = p.GetCustomAttribute(typeof(ConfigParameterAttribute));
var setting = settings.Where(x => x.DeviceConfigName == p.Name).FirstOrDefault();
if (config == null || setting == null)
continue;
p.SetValue(DeviceObj, value);
object value = setting.Value;
if (p.PropertyType == typeof(bool))
value = setting.Value != "0";
else if (p.PropertyType == typeof(byte))
value = byte.Parse(setting.Value);
else if (p.PropertyType == typeof(sbyte))
value = sbyte.Parse(setting.Value);
else if (p.PropertyType == typeof(short))
value = short.Parse(setting.Value);
else if (p.PropertyType == typeof(ushort))
value = ushort.Parse(setting.Value);
else if (p.PropertyType == typeof(int))
value = int.Parse(setting.Value);
else if (p.PropertyType == typeof(uint))
value = uint.Parse(setting.Value);
else if (p.PropertyType == typeof(long))
value = long.Parse(setting.Value);
else if (p.PropertyType == typeof(ulong))
value = ulong.Parse(setting.Value);
else if (p.PropertyType == typeof(float))
value = float.Parse(setting.Value);
else if (p.PropertyType == typeof(double))
value = double.Parse(setting.Value);
else if (p.PropertyType == typeof(decimal))
value = decimal.Parse(setting.Value);
else if (p.PropertyType == typeof(Guid))
value = Guid.Parse(setting.Value);
else if (p.PropertyType == typeof(DateTime))
value = DateTime.Parse(setting.Value);
else if (p.PropertyType == typeof(string))
value = setting.Value;
else if (p.PropertyType == typeof(IPAddress))
value = IPAddress.Parse(setting.Value);
else if (p.PropertyType.BaseType == typeof(Enum))
value = Enum.Parse(p.PropertyType, setting.Value);
p.SetValue(DeviceObj, value);
}
var deviceThread = new DeviceThread(Device, DeviceObj, systemManage.GatewayName, _MyMqttClient, interpreter, _MqttServer, _logger);
DeviceThreads.Add(deviceThread);
}
var deviceThread = new DeviceThread(Device, DeviceObj, systemManage.GatewayName, _MyMqttClient, interpreter, _MqttServer, _logger);
DeviceThreads.Add(deviceThread);
}
@ -156,17 +154,17 @@ namespace Plugin
}
public void CreateDeviceThreads(List<Device> Devices)
public void CreateDeviceThreads(List<Device> devices)
{
foreach (Device device in Devices)
foreach (Device device in devices)
CreateDeviceThread(device);
}
public void RemoveDeviceThread(Device Device)
public void RemoveDeviceThread(Device devices)
{
if (Device != null)
if (devices != null)
{
var DeviceThread = DeviceThreads.Where(x => x._device.ID == Device.ID).FirstOrDefault();
var DeviceThread = DeviceThreads.Where(x => x._device.ID == devices.ID).FirstOrDefault();
if (DeviceThread != null)
{
DeviceThread.StopThread();
@ -176,19 +174,19 @@ namespace Plugin
}
}
public void RemoveDeviceThreads(List<Device> Devices)
public void RemoveDeviceThreads(List<Device> devices)
{
foreach (var device in Devices)
foreach (var device in devices)
RemoveDeviceThread(device);
}
public List<ComboSelectListItem> GetDriverMethods(Guid? DeviceId)
public List<ComboSelectListItem> GetDriverMethods(Guid? deviceId)
{
List<ComboSelectListItem> driverFilesComboSelect = new List<ComboSelectListItem>();
try
{
_logger.LogInformation($"GetDriverMethods Start:{DeviceId}");
foreach (var method in DeviceThreads.Where(x => x._device.ID == DeviceId).FirstOrDefault()?.Methods)
_logger.LogInformation($"GetDriverMethods Start:{deviceId}");
foreach (var method in DeviceThreads.Where(x => x._device.ID == deviceId).FirstOrDefault()?.Methods)
{
var Attribute = method.CustomAttributes.ToList().FirstOrDefault().ConstructorArguments;
var item = new ComboSelectListItem
@ -198,12 +196,12 @@ namespace Plugin
};
driverFilesComboSelect.Add(item);
}
_logger.LogInformation($"GetDriverMethods End:{DeviceId}");
_logger.LogInformation($"GetDriverMethods End:{deviceId}");
}
catch (Exception ex)
{
_logger.LogInformation($"GetDriverMethods Error:{DeviceId}");
_logger.LogInformation($"GetDriverMethods Error:{deviceId}");
}
return driverFilesComboSelect;

View File

@ -47,6 +47,8 @@ namespace PluginInterface
TimeStampMs,
[Display(Name = "timestamp(s)")]
TimeStampS,
[Display(Name = "任意类型")]
Any,
[Display(Name = "自定义1")]
Custome1,
[Display(Name = "自定义2")]

Binary file not shown.