Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@
<PackageReference Include="BootstrapBlazor.VideoPlayer" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.7" />
<PackageReference Include="Longbow.Logging" Version="9.0.1" />
<PackageReference Include="Longbow.Modbus" Version="9.0.6" />
<PackageReference Include="Longbow.Sockets" Version="9.0.3" />
<PackageReference Include="Longbow.Modbus" Version="9.0.9" />
<PackageReference Include="Longbow.Sockets" Version="9.0.4" />
<PackageReference Include="Longbow.Tasks" Version="9.0.2" />
<PackageReference Include="Longbow.TcpSocket" Version="9.0.10" />
<PackageReference Include="Longbow.TcpSocket" Version="9.0.11" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ private IModbusFactory? ModbusFactory { get; set; }</Pre>
<li>保持寄存器 (Holding Registers) 最大读取数量: <code>125</code>, 最大写入数量: <code>123</code></li>
</ul>

<p><code>IModbusClient</code> 所有读取返回值均为 <code>IModbusResponse</code> 实例</p> 其定义如下:

<Pre>public interface IModbusResponse
{
// 获得 原始数据
ReadOnlyMemory&lt;byte&gt; RawData { get; }

// 获得 Longbow.Modbus.IModbusMessageBuilder 实例
IModbusMessageBuilder Builder { get; }
}</Pre>

<p>通过调用其扩展方法或者 <code>Builder</code> 属性 <code>IModbusMessageBuilder</code> 实例方法</p>

<ul class="ul-demo">
<li><code>ReadBoolValues</code> 将 <code>IModbusResponse</code> 实例中 <code>RawData</code> 转换成布尔数组</li>
<li><code>ReadUShortValues</code> 将 <code>IModbusResponse</code> 实例中 <code>RawData</code> 转换成无符号短整型数组</li>
</ul>

<p>通过接口 <code>IModbusResponse</code> 获得到其原始数据 <code>RawData</code> 可以通过自定义扩展非常方便的扩展出符合自己业务的数据类型。如通过连续 2 个寄存器存储的数据,得到遵循 IEEE 754 标准的 32 位 <b>浮点数</b></p>

<p><b>注意:</b>在将 <code>RawData</code> 转换为自定义类型(如 32 位浮点数)时,需要注意字节序(Endianness)。字节序会影响数据的解释方式,错误的字节序可能导致解析结果不正确。请根据实际设备或协议规范选择合适的字节序进行转换。</p>

<p>项目包含 Benchmark 基准测试工程</p>

<Pre>private const int NumberOfTask = 10;
Expand Down
Loading