mirror of
https://github.com/RRQM/TouchSocket.git
synced 2025-12-18 09:26:42 +08:00
修改modbus 主站名称
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||
<SignAssembly>True</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>$(MSBuildProjectName).snk</AssemblyOriginatorKeyFile>
|
||||
<Version>2.0.0-beta.246</Version>
|
||||
<Version>2.0.0-beta.249</Version>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Company>若汝棋茗</Company>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
////------------------------------------------------------------------------------
|
||||
//// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
//// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
//// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
//// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
//// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
//// Github源代码仓库:https://github.com/RRQM
|
||||
//// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
//// 交流QQ群:234762506
|
||||
//// 感谢您的下载和使用
|
||||
////------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//using System;
|
||||
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -1566,6 +1566,84 @@ namespace TouchSocket.Core
|
||||
}
|
||||
#endregion UInt64
|
||||
|
||||
#region Decimal
|
||||
|
||||
/// <summary>
|
||||
/// 从当前流位置读取一个默认端序的<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
public decimal ReadDecimal()
|
||||
{
|
||||
var value = TouchSocketBitConverter.Default.ToDecimal(this.Buffer, this.Pos);
|
||||
this.m_position += 16;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从当前流位置读取一个<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
/// <param name="endianType">指定端序</param>
|
||||
public decimal ReadDecimal(EndianType endianType)
|
||||
{
|
||||
var value = TouchSocketBitConverter.GetBitConverter(endianType).ToDecimal(this.Buffer, this.Pos);
|
||||
this.m_position += 16;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入默认端序的<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void Write(decimal value)
|
||||
{
|
||||
this.Write(TouchSocketBitConverter.Default.GetBytes(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="endianType">指定端序</param>
|
||||
public void Write(decimal value, EndianType endianType)
|
||||
{
|
||||
this.Write(TouchSocketBitConverter.GetBitConverter(endianType).GetBytes(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将当前有效内存转为默认端序的<see cref="decimal"/>集合。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<decimal> ToDecimals()
|
||||
{
|
||||
this.m_position = 0;
|
||||
while (true)
|
||||
{
|
||||
if (this.m_position + 16 > this.m_length)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return this.ReadDecimal();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将当前有效内存转为指定端序的<see cref="decimal"/>集合。
|
||||
/// </summary>
|
||||
/// <param name="endianType"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<decimal> ToDecimals(EndianType endianType)
|
||||
{
|
||||
this.m_position = 0;
|
||||
while (true)
|
||||
{
|
||||
if (this.m_position + 16 > this.m_length)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return this.ReadDecimal(endianType);
|
||||
}
|
||||
}
|
||||
#endregion Decimal
|
||||
|
||||
#region Null
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1514,6 +1514,84 @@ namespace TouchSocket.Core
|
||||
}
|
||||
#endregion UInt64
|
||||
|
||||
#region Decimal
|
||||
|
||||
/// <summary>
|
||||
/// 从当前流位置读取一个默认端序的<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
public decimal ReadDecimal()
|
||||
{
|
||||
var value = TouchSocketBitConverter.Default.ToDecimal(this.Buffer, this.Pos);
|
||||
this.m_position += 16;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从当前流位置读取一个<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
/// <param name="endianType">指定端序</param>
|
||||
public decimal ReadDecimal(EndianType endianType)
|
||||
{
|
||||
var value = TouchSocketBitConverter.GetBitConverter(endianType).ToDecimal(this.Buffer, this.Pos);
|
||||
this.m_position += 16;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入默认端序的<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void Write(decimal value)
|
||||
{
|
||||
this.Write(TouchSocketBitConverter.Default.GetBytes(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入<see cref="decimal"/>值
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="endianType">指定端序</param>
|
||||
public void Write(decimal value, EndianType endianType)
|
||||
{
|
||||
this.Write(TouchSocketBitConverter.GetBitConverter(endianType).GetBytes(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将当前有效内存转为默认端序的<see cref="decimal"/>集合。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<decimal> ToDecimals()
|
||||
{
|
||||
this.m_position = 0;
|
||||
while (true)
|
||||
{
|
||||
if (this.m_position + 16 > this.m_length)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return this.ReadDecimal();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将当前有效内存转为指定端序的<see cref="decimal"/>集合。
|
||||
/// </summary>
|
||||
/// <param name="endianType"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<decimal> ToDecimals(EndianType endianType)
|
||||
{
|
||||
this.m_position = 0;
|
||||
while (true)
|
||||
{
|
||||
if (this.m_position + 16 > this.m_length)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return this.ReadDecimal(endianType);
|
||||
}
|
||||
}
|
||||
#endregion Decimal
|
||||
|
||||
#region Null
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using TouchSocket.Core;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TouchSocket.Core;
|
||||
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using TouchSocket.Core;
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System.Linq;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Linq;
|
||||
using TouchSocket.Core;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using TouchSocket.Core;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using TouchSocket.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System.Net;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Net;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System.Linq;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
internal class ModbusDataLocater
|
||||
{
|
||||
private bool[] m_coils;
|
||||
private bool[] m_discreteInputs;
|
||||
private byte[] m_holdingRegisters;
|
||||
private byte[] m_inputRegisters;
|
||||
public ModbusDataLocater(int coilsQuantity, int discreteInputsQuantity, int holdingRegistersQuantity, int inputRegistersQuantity)
|
||||
{
|
||||
this.m_coils = new bool[coilsQuantity];
|
||||
this.m_discreteInputs = new bool[discreteInputsQuantity];
|
||||
this.m_holdingRegisters = new byte[holdingRegistersQuantity*2];
|
||||
this.m_inputRegisters=new byte[inputRegistersQuantity*2];
|
||||
}
|
||||
|
||||
public IModbusResponse Execute(ModbusRequest modbusRequest)
|
||||
{
|
||||
return new InternalModbusResponse(default, FunctionCode.ReadCoils, ModbusErrorCode.Success);
|
||||
}
|
||||
|
||||
class InternalModbusResponse : IModbusResponse
|
||||
{
|
||||
public InternalModbusResponse(byte[] data, FunctionCode functionCode, ModbusErrorCode errorCode)
|
||||
{
|
||||
this.Data = data;
|
||||
this.FunctionCode = functionCode;
|
||||
this.ErrorCode = errorCode;
|
||||
}
|
||||
|
||||
public byte[] Data { get; }
|
||||
|
||||
public FunctionCode FunctionCode { get; }
|
||||
|
||||
public ModbusErrorCode ErrorCode { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using TouchSocket.Core;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System.Threading;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.SerialPorts;
|
||||
@@ -9,7 +21,7 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// 基于串口的Modbus主站接口
|
||||
/// </summary>
|
||||
public class ModbusRtuClient : SerialPortClientBase, IModbusRtuClient
|
||||
public class ModbusRtuMaster : SerialPortClientBase, IModbusRtuMaster
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override bool CanSetDataHandlingAdapter => false;
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -12,7 +24,7 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// 基于Tcp协议,且使用Rtu数据格式的Modbus主站接口
|
||||
/// </summary>
|
||||
public class ModbusRtuOverTcpClient : TcpClientBase, IModbusRtuOverTcpClient
|
||||
public class ModbusRtuOverTcpMaster : TcpClientBase, IModbusRtuOverTcpMaster
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override bool CanSetDataHandlingAdapter => false;
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -12,7 +24,7 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// 基于Udp协议,且使用Rtu格式的Modbus主站
|
||||
/// </summary>
|
||||
public class ModbusRtuOverUdpClient : UdpSessionBase, IModbusRtuOverUdpClient
|
||||
public class ModbusRtuOverUdpMaster : UdpSessionBase, IModbusRtuOverUdpMaster
|
||||
{
|
||||
#region 字段
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using TouchSocket.Core;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using TouchSocket.Core;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -10,14 +22,14 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// 基于Tcp协议的Modbus客户端
|
||||
/// </summary>
|
||||
public class ModbusTcpClient : TcpClientBase,IModbusTcpClient
|
||||
public class ModbusTcpMaster : TcpClientBase,IModbusTcpMaster
|
||||
{
|
||||
private readonly WaitHandlePool<ModbusTcpResponse> m_waitHandlePool;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化一个基于Tcp协议的Modbus客户端
|
||||
/// </summary>
|
||||
public ModbusTcpClient()
|
||||
public ModbusTcpMaster()
|
||||
{
|
||||
this.m_waitHandlePool = new WaitHandlePool<ModbusTcpResponse>()
|
||||
{
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -12,14 +24,14 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// 基于Udp协议的Modbus
|
||||
/// </summary>
|
||||
public class ModbusUdpClient : UdpSessionBase, IModbusUdpClient
|
||||
public class ModbusUdpMaster : UdpSessionBase, IModbusUdpMaster
|
||||
{
|
||||
private readonly WaitHandlePool<ModbusTcpResponse> m_waitHandlePool;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化一个基于Udp协议的Modbus
|
||||
/// </summary>
|
||||
public ModbusUdpClient()
|
||||
public ModbusUdpMaster()
|
||||
{
|
||||
this.m_waitHandlePool = new WaitHandlePool<ModbusTcpResponse>()
|
||||
{
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using TouchSocket.Core;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using TouchSocket.Core;
|
||||
using System;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -8,7 +20,7 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// ModbusClientExtension
|
||||
/// </summary>
|
||||
public static class ModbusClientExtension
|
||||
public static class ModbusMasterExtension
|
||||
{
|
||||
#region ReadWrite 默认超时
|
||||
|
||||
@@ -22,7 +34,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">写入位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入数据</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadWriteMultipleRegisters(this IModbusClient client, byte slaveId, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
public static IModbusResponse ReadWriteMultipleRegisters(this IModbusMaster client, byte slaveId, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
return client.ReadWriteMultipleRegisters(slaveId,startingAddressForRead,quantityForRead,startingAddress,bytes,1000,CancellationToken.None);
|
||||
}
|
||||
@@ -37,7 +49,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">写入位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入数据</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static Task<IModbusResponse> ReadWriteMultipleRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
public static Task<IModbusResponse> ReadWriteMultipleRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
return client.ReadWriteMultipleRegistersAsync(slaveId, startingAddressForRead, quantityForRead, startingAddress, bytes, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -53,7 +65,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static bool[] ReadCoils(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static bool[] ReadCoils(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadCoils(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -66,7 +78,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static bool[] ReadDiscreteInputs(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static bool[] ReadDiscreteInputs(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadDiscreteInputs(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -79,7 +91,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadHoldingRegisters(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static IModbusResponse ReadHoldingRegisters(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadHoldingRegisters(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -93,7 +105,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadInputRegisters(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static IModbusResponse ReadInputRegisters(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadInputRegisters(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -110,7 +122,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static Task<bool[]> ReadCoilsAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static Task<bool[]> ReadCoilsAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadCoilsAsync(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -123,7 +135,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static Task<bool[]> ReadDiscreteInputsAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static Task<bool[]> ReadDiscreteInputsAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadDiscreteInputsAsync(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -136,7 +148,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static Task<IModbusResponse> ReadHoldingRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static Task<IModbusResponse> ReadHoldingRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadHoldingRegistersAsync(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -149,7 +161,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static Task<IModbusResponse> ReadInputRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
public static Task<IModbusResponse> ReadInputRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadInputRegistersAsync(slaveId, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -165,7 +177,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="values">待写入集合</param>
|
||||
public static void WriteMultipleCoils(this IModbusClient client, byte slaveId, ushort startingAddress, bool[] values)
|
||||
public static void WriteMultipleCoils(this IModbusMaster client, byte slaveId, ushort startingAddress, bool[] values)
|
||||
{
|
||||
client.WriteMultipleCoils(slaveId, startingAddress, values, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -177,7 +189,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入集合</param>
|
||||
public static void WriteMultipleRegisters(this IModbusClient client, byte slaveId, ushort startingAddress, byte[] bytes)
|
||||
public static void WriteMultipleRegisters(this IModbusMaster client, byte slaveId, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
client.WriteMultipleRegisters(slaveId, startingAddress, bytes, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -189,7 +201,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static void WriteSingleCoil(this IModbusClient client, byte slaveId, ushort startingAddress, bool value)
|
||||
public static void WriteSingleCoil(this IModbusMaster client, byte slaveId, ushort startingAddress, bool value)
|
||||
{
|
||||
client.WriteSingleCoil(slaveId, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -201,7 +213,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static void WriteSingleRegister(this IModbusClient client, byte slaveId, ushort startingAddress, short value)
|
||||
public static void WriteSingleRegister(this IModbusMaster client, byte slaveId, ushort startingAddress, short value)
|
||||
{
|
||||
client.WriteSingleRegister(slaveId, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -217,7 +229,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="values">待写入集合</param>
|
||||
public static Task WriteMultipleCoilsAsync(this IModbusClient client, byte slaveId, ushort startingAddress, bool[] values)
|
||||
public static Task WriteMultipleCoilsAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, bool[] values)
|
||||
{
|
||||
return client.WriteMultipleCoilsAsync(slaveId, startingAddress, values, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -229,7 +241,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入集合</param>
|
||||
public static Task WriteMultipleRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddress, byte[] bytes)
|
||||
public static Task WriteMultipleRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
return client.WriteMultipleRegistersAsync(slaveId, startingAddress, bytes, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -241,7 +253,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static Task WriteSingleCoilAsync(this IModbusClient client, byte slaveId, ushort startingAddress, bool value)
|
||||
public static Task WriteSingleCoilAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, bool value)
|
||||
{
|
||||
return client.WriteSingleCoilAsync(slaveId, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -253,7 +265,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="slaveId">站点号</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static Task WriteSingleRegisterAsync(this IModbusClient client, byte slaveId, ushort startingAddress, short value)
|
||||
public static Task WriteSingleRegisterAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, short value)
|
||||
{
|
||||
return client.WriteSingleRegisterAsync(slaveId, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -271,7 +283,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static bool[] ReadCoils(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static bool[] ReadCoils(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadCoils, startingAddress, quantity);
|
||||
|
||||
@@ -289,7 +301,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static bool[] ReadDiscreteInputs(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static bool[] ReadDiscreteInputs(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadDiscreteInputs, startingAddress, quantity);
|
||||
|
||||
@@ -307,7 +319,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadHoldingRegisters(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static IModbusResponse ReadHoldingRegisters(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadHoldingRegisters, startingAddress, quantity);
|
||||
|
||||
@@ -325,7 +337,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadInputRegisters(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static IModbusResponse ReadInputRegisters(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadInputRegisters, startingAddress, quantity);
|
||||
|
||||
@@ -347,7 +359,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static async Task<bool[]> ReadCoilsAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static async Task<bool[]> ReadCoilsAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadCoils, startingAddress, quantity);
|
||||
|
||||
@@ -365,7 +377,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static async Task<bool[]> ReadDiscreteInputsAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static async Task<bool[]> ReadDiscreteInputsAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadDiscreteInputs, startingAddress, quantity);
|
||||
|
||||
@@ -383,7 +395,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static async Task<IModbusResponse> ReadHoldingRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static async Task<IModbusResponse> ReadHoldingRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadHoldingRegisters, startingAddress, quantity);
|
||||
|
||||
@@ -401,7 +413,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static async Task<IModbusResponse> ReadInputRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
public static async Task<IModbusResponse> ReadInputRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort quantity, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadInputRegisters, startingAddress, quantity);
|
||||
|
||||
@@ -421,7 +433,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="values">待写入集合</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static void WriteMultipleCoils(this IModbusClient client, byte slaveId, ushort startingAddress, bool[] values, int timeout, CancellationToken token)
|
||||
public static void WriteMultipleCoils(this IModbusMaster client, byte slaveId, ushort startingAddress, bool[] values, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteMultipleCoils);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -439,7 +451,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="bytes">待写入集合</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static void WriteMultipleRegisters(this IModbusClient client, byte slaveId, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
public static void WriteMultipleRegisters(this IModbusMaster client, byte slaveId, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteMultipleRegisters);
|
||||
request.StartingAddress=startingAddress;
|
||||
@@ -457,7 +469,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="value">待写入数值</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static void WriteSingleCoil(this IModbusClient client, byte slaveId, ushort startingAddress, bool value, int timeout, CancellationToken token)
|
||||
public static void WriteSingleCoil(this IModbusMaster client, byte slaveId, ushort startingAddress, bool value, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteSingleCoil);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -475,7 +487,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="value">待写入数值</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static void WriteSingleRegister(this IModbusClient client, byte slaveId, ushort startingAddress, short value, int timeout, CancellationToken token)
|
||||
public static void WriteSingleRegister(this IModbusMaster client, byte slaveId, ushort startingAddress, short value, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteSingleRegister);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -493,7 +505,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="value">待写入数值</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static void WriteSingleRegister(this IModbusClient client, byte slaveId, ushort startingAddress, ushort value, int timeout, CancellationToken token)
|
||||
public static void WriteSingleRegister(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort value, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteSingleRegister);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -515,7 +527,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="values">待写入集合</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static async Task WriteMultipleCoilsAsync(this IModbusClient client, byte slaveId, ushort startingAddress, bool[] values, int timeout, CancellationToken token)
|
||||
public static async Task WriteMultipleCoilsAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, bool[] values, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteMultipleCoils);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -533,7 +545,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="bytes">待写入集合</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static async Task WriteMultipleRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
public static async Task WriteMultipleRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteMultipleRegisters);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -551,7 +563,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="value">待写入数值</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static async Task WriteSingleCoilAsync(this IModbusClient client, byte slaveId, ushort startingAddress, bool value, int timeout, CancellationToken token)
|
||||
public static async Task WriteSingleCoilAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, bool value, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteSingleCoil);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -569,7 +581,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="value">待写入数值</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static async Task WriteSingleRegisterAsync(this IModbusClient client, byte slaveId, ushort startingAddress, short value, int timeout, CancellationToken token)
|
||||
public static async Task WriteSingleRegisterAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, short value, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteSingleRegister);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -587,7 +599,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="value">待写入数值</param>
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
public static async Task WriteSingleRegisterAsync(this IModbusClient client, byte slaveId, ushort startingAddress, ushort value, int timeout, CancellationToken token)
|
||||
public static async Task WriteSingleRegisterAsync(this IModbusMaster client, byte slaveId, ushort startingAddress, ushort value, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.WriteSingleRegister);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -612,7 +624,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadWriteMultipleRegisters(this IModbusClient client, byte slaveId, ushort startingAddressForRead,ushort quantityForRead, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
public static IModbusResponse ReadWriteMultipleRegisters(this IModbusMaster client, byte slaveId, ushort startingAddressForRead,ushort quantityForRead, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadWriteMultipleRegisters);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -634,7 +646,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="timeout">超时时间,单位(ms)</param>
|
||||
/// <param name="token">可取消令箭</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static async Task<IModbusResponse> ReadWriteMultipleRegistersAsync(this IModbusClient client, byte slaveId, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
public static async Task<IModbusResponse> ReadWriteMultipleRegistersAsync(this IModbusMaster client, byte slaveId, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes, int timeout, CancellationToken token)
|
||||
{
|
||||
var request = new ModbusRequest(slaveId, FunctionCode.ReadWriteMultipleRegisters);
|
||||
request.StartingAddress = startingAddress;
|
||||
@@ -1,4 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using TouchSocket.Core;
|
||||
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -8,7 +20,7 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// ModbusTcpClientExtension
|
||||
/// </summary>
|
||||
public static class ModbusTcpClientExtension
|
||||
public static class ModbusTcpMasterExtension
|
||||
{
|
||||
#region ReadWrite 默认超时
|
||||
|
||||
@@ -21,7 +33,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">写入位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入数据</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadWriteMultipleRegisters(this IModbusTcpClient client,ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
public static IModbusResponse ReadWriteMultipleRegisters(this IModbusTcpMaster client,ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
return client.ReadWriteMultipleRegisters(1, startingAddressForRead, quantityForRead, startingAddress, bytes, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -35,7 +47,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">写入位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入数据</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static Task<IModbusResponse> ReadWriteMultipleRegistersAsync(this IModbusTcpClient client, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
public static Task<IModbusResponse> ReadWriteMultipleRegistersAsync(this IModbusTcpMaster client, ushort startingAddressForRead, ushort quantityForRead, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
return client.ReadWriteMultipleRegistersAsync(1, startingAddressForRead, quantityForRead, startingAddress, bytes, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -49,7 +61,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static bool[] ReadCoils(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static bool[] ReadCoils(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadCoils(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -61,7 +73,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static bool[] ReadDiscreteInputs(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static bool[] ReadDiscreteInputs(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadDiscreteInputs(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -73,7 +85,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadHoldingRegisters(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static IModbusResponse ReadHoldingRegisters(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadHoldingRegisters(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -85,7 +97,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static IModbusResponse ReadInputRegisters(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static IModbusResponse ReadInputRegisters(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadInputRegisters(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -101,7 +113,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static Task<bool[]> ReadCoilsAsync(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static Task<bool[]> ReadCoilsAsync(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadCoilsAsync(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -113,7 +125,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>读取到的值集合</returns>
|
||||
public static Task<bool[]> ReadDiscreteInputsAsync(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static Task<bool[]> ReadDiscreteInputsAsync(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadDiscreteInputsAsync(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -125,7 +137,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static Task<IModbusResponse> ReadHoldingRegistersAsync(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static Task<IModbusResponse> ReadHoldingRegistersAsync(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadHoldingRegistersAsync(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -137,7 +149,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="quantity">读取数量</param>
|
||||
/// <returns>响应值</returns>
|
||||
public static Task<IModbusResponse> ReadInputRegistersAsync(this IModbusTcpClient client, ushort startingAddress, ushort quantity)
|
||||
public static Task<IModbusResponse> ReadInputRegistersAsync(this IModbusTcpMaster client, ushort startingAddress, ushort quantity)
|
||||
{
|
||||
return client.ReadInputRegistersAsync(1, startingAddress, quantity, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -152,7 +164,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="values">待写入集合</param>
|
||||
public static void WriteMultipleCoils(this IModbusTcpClient client, ushort startingAddress, bool[] values)
|
||||
public static void WriteMultipleCoils(this IModbusTcpMaster client, ushort startingAddress, bool[] values)
|
||||
{
|
||||
client.WriteMultipleCoils(1, startingAddress, values, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -163,7 +175,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入集合</param>
|
||||
public static void WriteMultipleRegisters(this IModbusTcpClient client, ushort startingAddress, byte[] bytes)
|
||||
public static void WriteMultipleRegisters(this IModbusTcpMaster client, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
client.WriteMultipleRegisters(1, startingAddress, bytes, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -174,7 +186,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static void WriteSingleCoil(this IModbusTcpClient client, ushort startingAddress, bool value)
|
||||
public static void WriteSingleCoil(this IModbusTcpMaster client, ushort startingAddress, bool value)
|
||||
{
|
||||
client.WriteSingleCoil(1, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -185,7 +197,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static void WriteSingleRegister(this IModbusTcpClient client, ushort startingAddress, short value)
|
||||
public static void WriteSingleRegister(this IModbusTcpMaster client, ushort startingAddress, short value)
|
||||
{
|
||||
client.WriteSingleRegister(1, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -200,7 +212,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="values">待写入集合</param>
|
||||
public static Task WriteMultipleCoilsAsync(this IModbusTcpClient client, ushort startingAddress, bool[] values)
|
||||
public static Task WriteMultipleCoilsAsync(this IModbusTcpMaster client, ushort startingAddress, bool[] values)
|
||||
{
|
||||
return client.WriteMultipleCoilsAsync(1, startingAddress, values, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -211,7 +223,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="bytes">待写入集合</param>
|
||||
public static Task WriteMultipleRegistersAsync(this IModbusTcpClient client, ushort startingAddress, byte[] bytes)
|
||||
public static Task WriteMultipleRegistersAsync(this IModbusTcpMaster client, ushort startingAddress, byte[] bytes)
|
||||
{
|
||||
return client.WriteMultipleRegistersAsync(1, startingAddress, bytes, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -222,7 +234,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static Task WriteSingleCoilAsync(this IModbusTcpClient client, ushort startingAddress, bool value)
|
||||
public static Task WriteSingleCoilAsync(this IModbusTcpMaster client, ushort startingAddress, bool value)
|
||||
{
|
||||
return client.WriteSingleCoilAsync(1, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -233,7 +245,7 @@ namespace TouchSocket.Modbus
|
||||
/// <param name="client">通讯客户端</param>
|
||||
/// <param name="startingAddress">起始位置(从0开始)</param>
|
||||
/// <param name="value">待写入数值</param>
|
||||
public static Task WriteSingleRegisterAsync(this IModbusTcpClient client, ushort startingAddress, short value)
|
||||
public static Task WriteSingleRegisterAsync(this IModbusTcpMaster client, ushort startingAddress, short value)
|
||||
{
|
||||
return client.WriteSingleRegisterAsync(1, startingAddress, value, 1000, CancellationToken.None);
|
||||
}
|
||||
@@ -1,4 +1,16 @@
|
||||
using System.Threading;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
@@ -6,7 +18,7 @@ namespace TouchSocket.Modbus
|
||||
/// <summary>
|
||||
/// 提供Modbus的操作接口
|
||||
/// </summary>
|
||||
public interface IModbusClient
|
||||
public interface IModbusMaster
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送Modbus请求
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.SerialPorts;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于串口的Modbus主站接口
|
||||
/// </summary>
|
||||
public interface IModbusRtuClient:ISerialPortClient,IModbusClient
|
||||
{
|
||||
}
|
||||
}
|
||||
28
src/TouchSocket.Modbus/Interfaces/IModbusRtuMaster.cs
Normal file
28
src/TouchSocket.Modbus/Interfaces/IModbusRtuMaster.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.SerialPorts;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于串口的Modbus主站接口
|
||||
/// </summary>
|
||||
public interface IModbusRtuMaster:ISerialPortClient,IModbusMaster
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Tcp协议,且使用Rtu数据格式的Modbus主站接口
|
||||
/// </summary>
|
||||
public interface IModbusRtuOverTcpClient: IModbusTcpClient
|
||||
{
|
||||
}
|
||||
}
|
||||
27
src/TouchSocket.Modbus/Interfaces/IModbusRtuOverTcpMaster.cs
Normal file
27
src/TouchSocket.Modbus/Interfaces/IModbusRtuOverTcpMaster.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Tcp协议,且使用Rtu数据格式的Modbus主站接口
|
||||
/// </summary>
|
||||
public interface IModbusRtuOverTcpMaster: IModbusTcpMaster
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Udp协议,且使用Rtu格式的Modbus主站接口
|
||||
/// </summary>
|
||||
public interface IModbusRtuOverUdpClient:IModbusUdpClient
|
||||
{
|
||||
}
|
||||
}
|
||||
28
src/TouchSocket.Modbus/Interfaces/IModbusRtuOverUdpMaster.cs
Normal file
28
src/TouchSocket.Modbus/Interfaces/IModbusRtuOverUdpMaster.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Udp协议,且使用Rtu格式的Modbus主站接口
|
||||
/// </summary>
|
||||
public interface IModbusRtuOverUdpMaster:IModbusUdpMaster
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Tcp协议的Modbus主站接口。
|
||||
/// </summary>
|
||||
public interface IModbusTcpClient: ITcpClient,IModbusClient
|
||||
{
|
||||
}
|
||||
}
|
||||
29
src/TouchSocket.Modbus/Interfaces/IModbusTcpMaster.cs
Normal file
29
src/TouchSocket.Modbus/Interfaces/IModbusTcpMaster.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Tcp协议的Modbus主站接口。
|
||||
/// </summary>
|
||||
public interface IModbusTcpMaster: ITcpClient,IModbusMaster
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Udp协议的Modbus主站接口。
|
||||
/// </summary>
|
||||
public interface IModbusUdpClient:IUdpSession,IModbusClient
|
||||
{
|
||||
}
|
||||
}
|
||||
28
src/TouchSocket.Modbus/Interfaces/IModbusUdpMaster.cs
Normal file
28
src/TouchSocket.Modbus/Interfaces/IModbusUdpMaster.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace TouchSocket.Modbus
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于Udp协议的Modbus主站接口。
|
||||
/// </summary>
|
||||
public interface IModbusUdpMaster:IUdpSession,IModbusMaster
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TouchSocket.Sockets
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
using System;
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
|
||||
// CSDN博客:https://blog.csdn.net/qq_40374647
|
||||
// 哔哩哔哩视频:https://space.bilibili.com/94253567
|
||||
// Gitee源代码仓库:https://gitee.com/RRQM_Home
|
||||
// Github源代码仓库:https://github.com/RRQM
|
||||
// API首页:http://rrqm_home.gitee.io/touchsocket/
|
||||
// 交流QQ群:234762506
|
||||
// 感谢您的下载和使用
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
Reference in New Issue
Block a user