2using System.Collections.Generic;
3using System.Threading.Tasks;
24 this.Multiplier = 1.0;
31 [Page(4,
"Modbus", 100)]
32 [Header(13,
"Register Number:")]
33 [ToolTip(14,
"Register number on the Modbus unit.")]
41 [Page(4,
"Modbus", 100)]
42 [Header(25,
"Raw Name:")]
43 [ToolTip(26,
"Custom field name for raw value.")]
44 [DefaultValueStringEmpty]
50 [Page(4,
"Modbus", 100)]
51 [Header(11,
"Field Name:")]
52 [ToolTip(12,
"Custom field name for value.")]
53 [DefaultValueStringEmpty]
59 [Page(4,
"Modbus", 100)]
60 [Header(18,
"Multiplier:")]
61 [ToolTip(19,
"Multiplier will be multiplied to the register before reporting value.")]
63 [Text(
TextPosition.BeforeField, 24,
"Raw value will be transformed as follows: Value = ((Raw * Multiplier) / Divisor) + Offset. To this transformed value, the unit will be added.")]
69 [Page(4,
"Modbus", 100)]
70 [Header(20,
"Divisor:")]
71 [ToolTip(21,
"Divisor will be divided from the register (after multiplication) before reporting value.")]
78 [Page(4,
"Modbus", 100)]
79 [Header(22,
"Offset:")]
80 [ToolTip(23,
"Offset will be addded to the register (after division) before reporting value.")]
87 [Page(4,
"Modbus", 100)]
89 [ToolTip(17,
"Unit of register value (after scaling and offset).")]
90 [DefaultValueStringEmpty]
91 public string Unit {
get;
set; }
96 [Page(4,
"Modbus", 100)]
97 [Header(46,
"Switch byte order.")]
98 [ToolTip(47,
"If checked, byte order in registers will be reversed.")]
120 LinkedList<Parameter> Result = await base.GetDisplayableParametersAsync(
Language, Caller) as LinkedList<Parameter>;
134 await Client.
Enter();
140 int NrDec = Math.Min(255, Math.Max(0, (
int)Math.Ceiling(-Math.Log10(
this.Multiplier /
this.Divisor))));
141 DateTime TP = DateTime.UtcNow;
143 List<Field> Fields =
new List<Field>
148 if (!
string.IsNullOrEmpty(this.
RawName))
159 await Client.
Leave();
169 if (
string.IsNullOrEmpty(this.
FieldName))
Task Leave()
Leaves unique access to the TCP client. Must be called exactly one for each call to Enter.
async Task< ushort[]> ReadInputRegisters(byte UnitAddress, ushort ReferenceNumber, ushort NrWords)
Reads input registers from a Modbus unit.
Task Enter()
Enters unique access to the TCP client. Must be followed by exactly one Leave call.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Node representing a TCP/IP connection to a Modbus Gateway
Abstract base class for child nodes to Mobus Unit nodes.
async Task< ModbusGatewayNode > GetGateway()
Modbus Gateway node.
async Task< ModbusUnitNode > GetUnitNode()
Modbus Unit node.
async Task< ThingReference > GetReportAs()
Under what node fields are to be reported.
Represents a holding register on a Modbus unit node.
Tokens available in request.
Represents a 32-bit integer value.
Represents a physical quantity value.
Contains information about an error on a thing
Contains a reference to a thing
Interface for sensor nodes.
Interface for classes managing sensor data readouts.
Task ReportErrors(bool Done, params ThingError[] Errors)
Report error states to the client.
Task ReportFields(bool Done, params Field[] Fields)
Report read fields to the client.
TextPosition
Where the instructions are to be place.
FieldQoS
Field Quality of Service flags
FieldType
Field Type flags