123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using HandyControl.Controls;
- using HslCommunication;
- using HslCommunication.Profinet.Inovance;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LogoForceTestApp.Modules.MainModule
- {
- public class InovanceTcp//汇川H5U
- {
- public InovanceTcpNet tcpNet;
-
- public bool Connection(string ip, int port)
- {
- tcpNet = new InovanceTcpNet(ip, port, 1);//ip,端口,站号
- OperateResult connect = tcpNet.ConnectServer();
- if (connect.IsSuccess)
- {
- //连接成功
- return true;
- }
- else
- {
- return false;
- }
- }
- public void ConnectionClose()
- {
- tcpNet.ConnectClose();
- }
- public void WriteDate<T>(string address, T t)
- {
- dynamic temp = t;
- OperateResult result = tcpNet.Write(address, temp);//WriteDate("D200",10);WriteDate("W5.0",true);
- }
- public bool[] Read(string add,ushort lenght=1)
- {
- bool[] obj = tcpNet.ReadBool(add, lenght).Content;
- return obj;
- }
- public int ReadInteger(string add)
- {
- var obj = tcpNet.ReadInt32(add).Content;
- return obj;
- }
- }
- }
|