Class DeviceFormatters.ScaledInt16

Namespace
ProtoTest.Devices
Assembly
ProtoTest.Devices.dll

A decimal stored as a signed 16-bit register scaled by 10^decimals, as many Modbus devices do.

public abstract class DeviceFormatters.ScaledInt16 : IDeviceBinaryFieldFormatter<decimal>
Inheritance
DeviceFormatters.ScaledInt16
Implements
Inherited Members
Extension Methods

Constructors

ScaledInt16(int)

A decimal stored as a signed 16-bit register scaled by 10^decimals, as many Modbus devices do.

protected ScaledInt16(int decimals)

Parameters

decimals int

Properties

Size

Gets how many bytes the field takes.

public int Size { get; }

Property Value

int

Methods

Read(ReadOnlySpan<byte>, bool)

Reads the value from exactly Size bytes.

public decimal Read(ReadOnlySpan<byte> source, bool bigEndian)

Parameters

source ReadOnlySpan<byte>
bigEndian bool

Returns

decimal

Write(decimal, Span<byte>, bool)

Writes the value into exactly Size bytes.

public void Write(decimal value, Span<byte> destination, bool bigEndian)

Parameters

value decimal
destination Span<byte>
bigEndian bool