修改监控部分功能
This commit is contained in:
@@ -18,9 +18,9 @@ namespace SamplePre.Communication
|
||||
/// <param name="connectionParams">连接参数</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotSupportedException"></exception>
|
||||
public static ICommunication CreateCommunication(CommProtocolType protocolType, string connectionParams)
|
||||
public static CommunicationBase CreateCommunication(CommProtocolType protocolType, string connectionParams)
|
||||
{
|
||||
ICommunication comm = null;
|
||||
CommunicationBase comm = null;
|
||||
|
||||
switch (protocolType)
|
||||
{
|
||||
@@ -41,21 +41,21 @@ namespace SamplePre.Communication
|
||||
}
|
||||
|
||||
|
||||
public static ICommunication CreateS7(string connectionParams)
|
||||
public static CommunicationBase CreateS7(string connectionParams)
|
||||
{
|
||||
string[] params1 = connectionParams.Split(':');
|
||||
if(params1 == null || params1.Length < 3) return null;
|
||||
//ICommunication comm = new S7PlcCommunicator(CpuType.S71500, "192.168.10.2", 0, 1);
|
||||
ICommunication comm = new S7PlcCommunicator(CpuType.S71500, params1[0], int.Parse( params1[1]), int.Parse( params1[2]));
|
||||
CommunicationBase comm = new S7PlcCommunicator(CpuType.S71500, params1[0], int.Parse( params1[1]), int.Parse( params1[2]));
|
||||
|
||||
return comm;
|
||||
}
|
||||
|
||||
public static ICommunication CreateModbusTcp(string connectionParams)
|
||||
public static CommunicationBase CreateModbusTcp(string connectionParams)
|
||||
{
|
||||
string[] params1 = connectionParams.Split(':');
|
||||
if (params1 == null || params1.Length < 2) return null;
|
||||
ICommunication comm = new ModbusTcpCommunicator(params1[0], int.Parse(params1[1]));
|
||||
CommunicationBase comm = new ModbusTcpCommunicator(params1[0], int.Parse(params1[1]));
|
||||
|
||||
return comm;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user