reformat project architecture for more extends
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Web.Http;
|
|||||||
using System.Web.Http.Routing;
|
using System.Web.Http.Routing;
|
||||||
using CrossLampControl.WebApi.Models;
|
using CrossLampControl.WebApi.Models;
|
||||||
using ModBus.Net;
|
using ModBus.Net;
|
||||||
|
using ModBus.Net.Simense;
|
||||||
|
|
||||||
namespace CrossLampControl.WebApi.Controllers
|
namespace CrossLampControl.WebApi.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,74 +17,6 @@ namespace ModBus.Net
|
|||||||
public abstract KeyValuePair<int,int> AddressTranslate(string address, bool isRead);
|
public abstract KeyValuePair<int,int> AddressTranslate(string address, bool isRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// NA200H数据单元翻译器
|
|
||||||
/// </summary>
|
|
||||||
public class AddressTranslatorNA200H : AddressTranslator
|
|
||||||
{
|
|
||||||
protected Dictionary<string, int> TransDictionary;
|
|
||||||
protected Dictionary<string, int> ReadFunctionCodeDictionary;
|
|
||||||
protected Dictionary<string, int> WriteFunctionCodeDictionary;
|
|
||||||
|
|
||||||
public AddressTranslatorNA200H()
|
|
||||||
{
|
|
||||||
TransDictionary = new Dictionary<string, int>
|
|
||||||
{
|
|
||||||
{"Q", 0},
|
|
||||||
{"M", 10000},
|
|
||||||
{"N", 20000},
|
|
||||||
{"I", 0},
|
|
||||||
{"S", 10000},
|
|
||||||
{"IW", 0},
|
|
||||||
{"SW", 5000},
|
|
||||||
{"MW", 0},
|
|
||||||
{"NW", 10000},
|
|
||||||
{"QW", 20000},
|
|
||||||
};
|
|
||||||
ReadFunctionCodeDictionary = new Dictionary<string, int>
|
|
||||||
{
|
|
||||||
{"Q", (int)ModbusProtocalReadDataFunctionCode.ReadCoilStatus},
|
|
||||||
{"M", (int)ModbusProtocalReadDataFunctionCode.ReadCoilStatus},
|
|
||||||
{"N", (int)ModbusProtocalReadDataFunctionCode.ReadCoilStatus},
|
|
||||||
{"I", (int)ModbusProtocalReadDataFunctionCode.ReadInputStatus},
|
|
||||||
{"S", (int)ModbusProtocalReadDataFunctionCode.ReadInputStatus},
|
|
||||||
{"IW", (int)ModbusProtocalReadDataFunctionCode.ReadInputRegister},
|
|
||||||
{"SW", (int)ModbusProtocalReadDataFunctionCode.ReadInputRegister},
|
|
||||||
{"MW", (int)ModbusProtocalReadDataFunctionCode.ReadHoldRegister},
|
|
||||||
{"NW", (int)ModbusProtocalReadDataFunctionCode.ReadHoldRegister},
|
|
||||||
{"QW", (int)ModbusProtocalReadDataFunctionCode.ReadHoldRegister},
|
|
||||||
};
|
|
||||||
WriteFunctionCodeDictionary = new Dictionary<string, int>
|
|
||||||
{
|
|
||||||
{"Q", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiCoil},
|
|
||||||
{"M", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiCoil},
|
|
||||||
{"N", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiCoil},
|
|
||||||
{"MW", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiRegister},
|
|
||||||
{"NW", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiRegister},
|
|
||||||
{"QW", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiRegister},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public override KeyValuePair<int, int> AddressTranslate(string address, bool isRead)
|
|
||||||
{
|
|
||||||
address = address.ToUpper();
|
|
||||||
int i = 0;
|
|
||||||
int t;
|
|
||||||
while (!int.TryParse(address[i].ToString(), out t) && i < address.Length)
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (i == 0 || i >= address.Length) throw new FormatException();
|
|
||||||
string head = address.Substring(0, i);
|
|
||||||
string tail = address.Substring(i);
|
|
||||||
return isRead
|
|
||||||
? new KeyValuePair<int, int>(TransDictionary[head] + int.Parse(tail) - 1,
|
|
||||||
ReadFunctionCodeDictionary[head])
|
|
||||||
: new KeyValuePair<int, int>(TransDictionary[head] + int.Parse(tail) - 1,
|
|
||||||
WriteFunctionCodeDictionary[head]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 基本的单元转换器
|
/// 基本的单元转换器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -102,54 +34,4 @@ namespace ModBus.Net
|
|||||||
throw new FormatException();
|
throw new FormatException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AddressTranslatorSimense : AddressTranslator
|
|
||||||
{
|
|
||||||
protected Dictionary<string, int> AreaCodeDictionary;
|
|
||||||
|
|
||||||
public AddressTranslatorSimense()
|
|
||||||
{
|
|
||||||
AreaCodeDictionary = new Dictionary<string, int>
|
|
||||||
{
|
|
||||||
{"S", 0x04},
|
|
||||||
{"SM", 0x05},
|
|
||||||
{"AI", 0x06},
|
|
||||||
{"AQ", 0x07},
|
|
||||||
{"C", 0x1E},
|
|
||||||
{"T", 0x1F},
|
|
||||||
{"HC", 0x20},
|
|
||||||
{"I", 0x81},
|
|
||||||
{"Q", 0x82},
|
|
||||||
{"M", 0x83},
|
|
||||||
{"DB", 0x84},
|
|
||||||
{"V", 0x184},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public override KeyValuePair<int, int> AddressTranslate(string address, bool isRead)
|
|
||||||
{
|
|
||||||
address = address.ToUpper();
|
|
||||||
if (address.Substring(0,2) == "DB")
|
|
||||||
{
|
|
||||||
var addressSplit = address.Split('.');
|
|
||||||
if (addressSplit.Length != 2) throw new FormatException();
|
|
||||||
addressSplit[0] = addressSplit[0].Substring(2);
|
|
||||||
if (addressSplit[1].Substring(0, 2) == "DB")
|
|
||||||
addressSplit[1] = addressSplit[1].Substring(2);
|
|
||||||
return new KeyValuePair<int, int>(int.Parse(addressSplit[1]), int.Parse(addressSplit[0]) * 256 + AreaCodeDictionary["DB"]);
|
|
||||||
}
|
|
||||||
int i = 0;
|
|
||||||
int t;
|
|
||||||
while (!int.TryParse(address[i].ToString(), out t) && i < address.Length)
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (i == 0 || i >= address.Length) throw new FormatException();
|
|
||||||
string head = address.Substring(0, i);
|
|
||||||
string tail = address.Substring(i);
|
|
||||||
return
|
|
||||||
new KeyValuePair<int, int>(int.Parse(tail),
|
|
||||||
AreaCodeDictionary[head]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -44,24 +44,9 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="CRC16.cs" />
|
<Compile Include="CRC16.cs" />
|
||||||
<Compile Include="IProtocalFormatting.cs" />
|
<Compile Include="IProtocalFormatting.cs" />
|
||||||
<Compile Include="ModbusMachine.cs" />
|
|
||||||
<Compile Include="ModbusProtocal.cs" />
|
|
||||||
<Compile Include="ModbusProtocalLinkerBytesExtend.cs" />
|
|
||||||
<Compile Include="ModbusRtuProtocal.cs" />
|
|
||||||
<Compile Include="ModbusRtuProtocalLinker.cs" />
|
|
||||||
<Compile Include="ModbusTcpProtocal.cs" />
|
|
||||||
<Compile Include="ModbusTcpProtocalLinker.cs" />
|
|
||||||
<Compile Include="ModbusUtility.cs" />
|
|
||||||
<Compile Include="ProtocalLinker.cs" />
|
<Compile Include="ProtocalLinker.cs" />
|
||||||
<Compile Include="ProtocalLinkerBytesExtend.cs" />
|
<Compile Include="ProtocalLinkerBytesExtend.cs" />
|
||||||
<Compile Include="ProtocalUnit.cs" />
|
<Compile Include="ProtocalUnit.cs" />
|
||||||
<Compile Include="SimenseMachine.cs" />
|
|
||||||
<Compile Include="SimenseProtocal.cs" />
|
|
||||||
<Compile Include="SimenseProtocalLinkerBytesExtend.cs" />
|
|
||||||
<Compile Include="SimenseStructDefinition.cs" />
|
|
||||||
<Compile Include="SimenseTcpProtocal.cs" />
|
|
||||||
<Compile Include="SimenseTcpProtocalLinker.cs" />
|
|
||||||
<Compile Include="SimenseUtility.cs" />
|
|
||||||
<Compile Include="TaskManager.cs" />
|
<Compile Include="TaskManager.cs" />
|
||||||
<Compile Include="TcpConnector.cs" />
|
<Compile Include="TcpConnector.cs" />
|
||||||
<Compile Include="TcpProtocalLinker.cs" />
|
<Compile Include="TcpProtocalLinker.cs" />
|
||||||
@@ -71,9 +56,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="ConfigurationManager.resx" />
|
<None Include="ConfigurationManager.resx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup />
|
||||||
<Folder Include="c:\Users\luosheng\Documents\Projects\Modbus.Net-xamarin\ModBus.Net\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -56,9 +56,10 @@
|
|||||||
<Compile Include="BaseUtility.cs" />
|
<Compile Include="BaseUtility.cs" />
|
||||||
<Compile Include="BaseMachine.cs" />
|
<Compile Include="BaseMachine.cs" />
|
||||||
<Compile Include="ComConnector.cs" />
|
<Compile Include="ComConnector.cs" />
|
||||||
<Compile Include="ModbusMachine.cs" />
|
<Compile Include="Modbus\AddressTranslatorModbus.cs" />
|
||||||
<Compile Include="ModbusProtocalLinkerBytesExtend.cs" />
|
<Compile Include="Modbus\ModbusMachine.cs" />
|
||||||
<Compile Include="ModbusUtility.cs" />
|
<Compile Include="Modbus\ModbusProtocalLinkerBytesExtend.cs" />
|
||||||
|
<Compile Include="Modbus\ModbusUtility.cs" />
|
||||||
<Compile Include="ComProtocalLinker.cs" />
|
<Compile Include="ComProtocalLinker.cs" />
|
||||||
<Compile Include="ConfigurationManager.Designer.cs">
|
<Compile Include="ConfigurationManager.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
@@ -68,22 +69,23 @@
|
|||||||
<Compile Include="BaseConnector.cs" />
|
<Compile Include="BaseConnector.cs" />
|
||||||
<Compile Include="CRC16.cs" />
|
<Compile Include="CRC16.cs" />
|
||||||
<Compile Include="IProtocalFormatting.cs" />
|
<Compile Include="IProtocalFormatting.cs" />
|
||||||
<Compile Include="ModbusRtuProtocal.cs" />
|
<Compile Include="Modbus\ModbusRtuProtocal.cs" />
|
||||||
<Compile Include="ModbusRtuProtocalLinker.cs" />
|
<Compile Include="Modbus\ModbusRtuProtocalLinker.cs" />
|
||||||
<Compile Include="ModbusTcpProtocalLinker.cs" />
|
<Compile Include="Modbus\ModbusTcpProtocalLinker.cs" />
|
||||||
<Compile Include="ProtocalLinker.cs" />
|
<Compile Include="ProtocalLinker.cs" />
|
||||||
<Compile Include="ProtocalLinkerBytesExtend.cs" />
|
<Compile Include="ProtocalLinkerBytesExtend.cs" />
|
||||||
<Compile Include="ProtocalUnit.cs" />
|
<Compile Include="ProtocalUnit.cs" />
|
||||||
<Compile Include="ModbusProtocal.cs" />
|
<Compile Include="Modbus\ModbusProtocal.cs" />
|
||||||
<Compile Include="ModbusTcpProtocal.cs" />
|
<Compile Include="Modbus\ModbusTcpProtocal.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SimenseMachine.cs" />
|
<Compile Include="Simense\AddressTranslatorSimense.cs" />
|
||||||
<Compile Include="SimenseProtocal.cs" />
|
<Compile Include="Simense\SimenseMachine.cs" />
|
||||||
<Compile Include="SimenseStructDefinition.cs" />
|
<Compile Include="Simense\SimenseProtocal.cs" />
|
||||||
<Compile Include="SimenseTcpProtocal.cs" />
|
<Compile Include="Simense\SimenseStructDefinition.cs" />
|
||||||
<Compile Include="SimenseProtocalLinkerBytesExtend.cs" />
|
<Compile Include="Simense\SimenseTcpProtocal.cs" />
|
||||||
<Compile Include="SimenseTcpProtocalLinker.cs" />
|
<Compile Include="Simense\SimenseProtocalLinkerBytesExtend.cs" />
|
||||||
<Compile Include="SimenseUtility.cs" />
|
<Compile Include="Simense\SimenseTcpProtocalLinker.cs" />
|
||||||
|
<Compile Include="Simense\SimenseUtility.cs" />
|
||||||
<Compile Include="TaskManager.cs" />
|
<Compile Include="TaskManager.cs" />
|
||||||
<Compile Include="TcpConnector.cs">
|
<Compile Include="TcpConnector.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
@@ -97,6 +99,7 @@
|
|||||||
<LastGenOutput>ConfigurationManager.Designer.cs</LastGenOutput>
|
<LastGenOutput>ConfigurationManager.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
76
Modbus.Net/ModBus.Net/Modbus/AddressTranslatorModbus.cs
Normal file
76
Modbus.Net/ModBus.Net/Modbus/AddressTranslatorModbus.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ModBus.Net.Modbus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NA200H数据单元翻译器
|
||||||
|
/// </summary>
|
||||||
|
public class AddressTranslatorNA200H : AddressTranslator
|
||||||
|
{
|
||||||
|
protected Dictionary<string, int> TransDictionary;
|
||||||
|
protected Dictionary<string, int> ReadFunctionCodeDictionary;
|
||||||
|
protected Dictionary<string, int> WriteFunctionCodeDictionary;
|
||||||
|
|
||||||
|
public AddressTranslatorNA200H()
|
||||||
|
{
|
||||||
|
TransDictionary = new Dictionary<string, int>
|
||||||
|
{
|
||||||
|
{"Q", 0},
|
||||||
|
{"M", 10000},
|
||||||
|
{"N", 20000},
|
||||||
|
{"I", 0},
|
||||||
|
{"S", 10000},
|
||||||
|
{"IW", 0},
|
||||||
|
{"SW", 5000},
|
||||||
|
{"MW", 0},
|
||||||
|
{"NW", 10000},
|
||||||
|
{"QW", 20000},
|
||||||
|
};
|
||||||
|
ReadFunctionCodeDictionary = new Dictionary<string, int>
|
||||||
|
{
|
||||||
|
{"Q", (int)ModbusProtocalReadDataFunctionCode.ReadCoilStatus},
|
||||||
|
{"M", (int)ModbusProtocalReadDataFunctionCode.ReadCoilStatus},
|
||||||
|
{"N", (int)ModbusProtocalReadDataFunctionCode.ReadCoilStatus},
|
||||||
|
{"I", (int)ModbusProtocalReadDataFunctionCode.ReadInputStatus},
|
||||||
|
{"S", (int)ModbusProtocalReadDataFunctionCode.ReadInputStatus},
|
||||||
|
{"IW", (int)ModbusProtocalReadDataFunctionCode.ReadInputRegister},
|
||||||
|
{"SW", (int)ModbusProtocalReadDataFunctionCode.ReadInputRegister},
|
||||||
|
{"MW", (int)ModbusProtocalReadDataFunctionCode.ReadHoldRegister},
|
||||||
|
{"NW", (int)ModbusProtocalReadDataFunctionCode.ReadHoldRegister},
|
||||||
|
{"QW", (int)ModbusProtocalReadDataFunctionCode.ReadHoldRegister},
|
||||||
|
};
|
||||||
|
WriteFunctionCodeDictionary = new Dictionary<string, int>
|
||||||
|
{
|
||||||
|
{"Q", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiCoil},
|
||||||
|
{"M", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiCoil},
|
||||||
|
{"N", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiCoil},
|
||||||
|
{"MW", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiRegister},
|
||||||
|
{"NW", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiRegister},
|
||||||
|
{"QW", (int)ModbusProtocalWriteDataFunctionCode.WriteMultiRegister},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override KeyValuePair<int, int> AddressTranslate(string address, bool isRead)
|
||||||
|
{
|
||||||
|
address = address.ToUpper();
|
||||||
|
int i = 0;
|
||||||
|
int t;
|
||||||
|
while (!int.TryParse(address[i].ToString(), out t) && i < address.Length)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (i == 0 || i >= address.Length) throw new FormatException();
|
||||||
|
string head = address.Substring(0, i);
|
||||||
|
string tail = address.Substring(i);
|
||||||
|
return isRead
|
||||||
|
? new KeyValuePair<int, int>(TransDictionary[head] + int.Parse(tail) - 1,
|
||||||
|
ReadFunctionCodeDictionary[head])
|
||||||
|
: new KeyValuePair<int, int>(TransDictionary[head] + int.Parse(tail) - 1,
|
||||||
|
WriteFunctionCodeDictionary[head]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace ModBus.Net
|
namespace ModBus.Net.Modbus
|
||||||
{
|
{
|
||||||
public class ModbusMachine : BaseMachine
|
public class ModbusMachine : BaseMachine
|
||||||
{
|
{
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ModBus.Net.Modbus
|
||||||
|
{
|
||||||
internal enum ModbusProtocalVariableFunctionCode : byte
|
internal enum ModbusProtocalVariableFunctionCode : byte
|
||||||
{
|
{
|
||||||
ReadVariable = 20,
|
ReadVariable = 20,
|
||||||
@@ -37,8 +39,6 @@ internal enum ModbusProtocalWriteDataFunctionCode : byte
|
|||||||
WriteMultiRegister = 16,
|
WriteMultiRegister = 16,
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
|
||||||
public abstract class ModbusProtocal : BaseProtocal
|
public abstract class ModbusProtocal : BaseProtocal
|
||||||
{
|
{
|
||||||
public override bool Connect()
|
public override bool Connect()
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ModBus.Net
|
namespace ModBus.Net.Modbus
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tcp协议字节伸缩
|
/// Tcp协议字节伸缩
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace ModBus.Net.Modbus
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modbus/Rtu协议
|
/// Modbus/Rtu协议
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
namespace ModBus.Net.Modbus
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
{
|
||||||
class ModbusRtuProtocalLinker : ComProtocalLinker
|
class ModbusRtuProtocalLinker : ComProtocalLinker
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace ModBus.Net.Modbus
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modbus/Tcp协议
|
/// Modbus/Tcp协议
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace ModBus.Net.Modbus
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
{
|
||||||
public class ModbusTcpProtocalLinker : TcpProtocalLinker
|
public class ModbusTcpProtocalLinker : TcpProtocalLinker
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System.Threading.Tasks;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
|
namespace ModBus.Net.Modbus
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Modbus连接类型
|
/// Modbus连接类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -16,8 +17,6 @@ public enum ModbusType
|
|||||||
Tcp = 1,
|
Tcp = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
|
||||||
public class ModbusUtility : BaseUtility
|
public class ModbusUtility : BaseUtility
|
||||||
{
|
{
|
||||||
private ModbusType _modbusType;
|
private ModbusType _modbusType;
|
||||||
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
|
|||||||
// 方法是按如下所示使用“*”:
|
// 方法是按如下所示使用“*”:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.2.5.0716")]
|
[assembly: AssemblyVersion("0.2.9.0923")]
|
||||||
[assembly: AssemblyFileVersion("0.2.5.0716")]
|
[assembly: AssemblyFileVersion("0.2.9.0923")]
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace ModBus.Net
|
namespace ModBus.Net.Simense
|
||||||
{
|
{
|
||||||
public class SimenseMachine : BaseMachine
|
public class SimenseMachine : BaseMachine
|
||||||
{
|
{
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace ModBus.Net.Simense
|
||||||
|
{
|
||||||
public enum SimenseTypeCode : byte
|
public enum SimenseTypeCode : byte
|
||||||
{
|
{
|
||||||
Bool = 0x01,
|
Bool = 0x01,
|
||||||
@@ -30,8 +32,6 @@ public enum SimenseDataType : byte
|
|||||||
OtherAccess = 0x04
|
OtherAccess = 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
|
||||||
public abstract class SimenseProtocal : BaseProtocal
|
public abstract class SimenseProtocal : BaseProtocal
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ModBus.Net
|
namespace ModBus.Net.Simense
|
||||||
{
|
{
|
||||||
public class SimenseTcpProtocalLinkerBytesExtend : ProtocalLinkerBytesExtend
|
public class SimenseTcpProtocalLinkerBytesExtend : ProtocalLinkerBytesExtend
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace ModBus.Net.Simense
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
{
|
||||||
public struct TodClockStatus
|
public struct TodClockStatus
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System.Threading.Tasks;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ModBus.Net
|
namespace ModBus.Net.Simense
|
||||||
{
|
{
|
||||||
public class SimenseTcpProtocal : SimenseProtocal
|
public class SimenseTcpProtocal : SimenseProtocal
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ModBus.Net
|
namespace ModBus.Net.Simense
|
||||||
{
|
{
|
||||||
public class SimenseTcpProtocalLinker : TcpProtocalLinker
|
public class SimenseTcpProtocalLinker : TcpProtocalLinker
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ModBus.Net.Simense
|
||||||
|
{
|
||||||
public enum SimenseType
|
public enum SimenseType
|
||||||
{
|
{
|
||||||
Ppi = 0,
|
Ppi = 0,
|
||||||
@@ -18,8 +20,7 @@ public enum SimenseMachineModel
|
|||||||
S7_1500 = 5
|
S7_1500 = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace ModBus.Net
|
|
||||||
{
|
|
||||||
public class SimenseUtility : BaseUtility
|
public class SimenseUtility : BaseUtility
|
||||||
{
|
{
|
||||||
private byte _tdpuSize;
|
private byte _tdpuSize;
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 2012
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModBus.Net-xamarin", "ModBus.Net\ModBus.Net-xamarin.csproj", "{E97FCE46-855D-498B-8E58-00AFF3A1E760}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{E97FCE46-855D-498B-8E58-00AFF3A1E760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{E97FCE46-855D-498B-8E58-00AFF3A1E760}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{E97FCE46-855D-498B-8E58-00AFF3A1E760}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{E97FCE46-855D-498B-8E58-00AFF3A1E760}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<Properties StartupItem="ModBus.Net\ModBus.Net-xamarin.csproj">
|
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="ModBus.Net\ConfigurationManager.Designer.cs">
|
|
||||||
<Files>
|
|
||||||
<File FileName="ModBus.Net\ValueHelper.cs" Line="1" Column="1" />
|
|
||||||
<File FileName="ModBus.Net\TcpProtocalLinker.cs" Line="1" Column="1" />
|
|
||||||
<File FileName="ModBus.Net\ModbusTcpProtocal.cs" Line="1" Column="1" />
|
|
||||||
<File FileName="ModBus.Net\ConfigurationManager.Designer.cs" Line="1" Column="1" />
|
|
||||||
</Files>
|
|
||||||
</MonoDevelop.Ide.Workbench>
|
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
|
||||||
<BreakpointStore />
|
|
||||||
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
|
||||||
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
|
|
||||||
<DisabledProjects>
|
|
||||||
<String>Modbus.Net-xamarin\Modbus.Net.csproj</String>
|
|
||||||
<String>ModBus.Net\ModBus.Net.csproj</String>
|
|
||||||
</DisabledProjects>
|
|
||||||
</Properties>
|
|
||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using ModBus.Net;
|
using ModBus.Net;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using ModBus.Net.Simense;
|
||||||
|
|
||||||
|
|
||||||
namespace NA200H.UI.WPF
|
namespace NA200H.UI.WPF
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using ModBus.Net;
|
using ModBus.Net;
|
||||||
|
using ModBus.Net.Simense;
|
||||||
|
|
||||||
namespace Simense_S7_200.UI.WPF.TaskTest
|
namespace Simense_S7_200.UI.WPF.TaskTest
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user