设备基础命令
This commit is contained in:
22
DeviceCommand/Base/IS7Device.cs
Normal file
22
DeviceCommand/Base/IS7Device.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using S7.Net;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DeviceCommand.Base
|
||||
{
|
||||
public interface IS7Device : IBaseInterface, IDisposable
|
||||
{
|
||||
// 暴露出 S7.Net 原生的 Plc 对象,方便外部进行复杂扩展
|
||||
Plc PlcContext { get; }
|
||||
|
||||
// 核心读写接口(支持直接传物理地址,如 "DB1.DBD0" 或 "M0.0")
|
||||
Task WriteAsync(string address, object value, CancellationToken ct = default);
|
||||
Task<object> ReadAsync(string address, CancellationToken ct = default);
|
||||
Task<T> ReadAsync<T>(string address, CancellationToken ct = default);
|
||||
|
||||
// 批量读取/写入原始字节(常用于大块数据交互)
|
||||
Task<byte[]> ReadBytesAsync(DataType dataType, int db, int startByteAdr, int count, CancellationToken ct = default);
|
||||
Task WriteBytesAsync(DataType dataType, int db, int startByteAdr, byte[] value, CancellationToken ct = default);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user