2917-02-28 Update 1 Add Name Mode。
This commit is contained in:
@@ -18,7 +18,12 @@ namespace Modbus.Net
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通讯标识
|
/// 通讯标识
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CommunicationTag
|
CommunicationTag,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
Name
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -34,7 +39,12 @@ namespace Modbus.Net
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通讯标识
|
/// 通讯标识
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CommunicationTag
|
CommunicationTag,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
Name
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class BaseMachine : IMachineProperty
|
public abstract class BaseMachine : IMachineProperty
|
||||||
@@ -233,6 +243,11 @@ namespace Modbus.Net
|
|||||||
key = AddressFormater.FormatAddress(address.Area, address.Address, address.SubAddress);
|
key = AddressFormater.FormatAddress(address.Area, address.Address, address.SubAddress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MachineGetDataType.Name:
|
||||||
|
{
|
||||||
|
key = address.Name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
key = address.CommunicationTag;
|
key = address.CommunicationTag;
|
||||||
@@ -340,6 +355,11 @@ namespace Modbus.Net
|
|||||||
GetAddresses.SingleOrDefault(p => p.CommunicationTag == value.Key);
|
GetAddresses.SingleOrDefault(p => p.CommunicationTag == value.Key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MachineSetDataType.Name:
|
||||||
|
{
|
||||||
|
address = GetAddresses.SingleOrDefault(p => p.Name == value.Key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//地址为空报错
|
//地址为空报错
|
||||||
if (address == null)
|
if (address == null)
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace Modbus.Net
|
|||||||
public enum MachineDataType
|
public enum MachineDataType
|
||||||
{
|
{
|
||||||
Address,
|
Address,
|
||||||
CommunicationTag
|
CommunicationTag,
|
||||||
|
Name
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -348,6 +349,12 @@ namespace Modbus.Net
|
|||||||
SetDataType = MachineSetDataType.CommunicationTag;
|
SetDataType = MachineSetDataType.CommunicationTag;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MachineDataType.Name:
|
||||||
|
{
|
||||||
|
GetDataType = MachineGetDataType.Name;
|
||||||
|
SetDataType = MachineSetDataType.Name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user