You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.Core.PlcServer
{
public interface IPlc
{
/// <summary>
/// 是否连接
/// </summary>
bool IsConnected { get; set; }
/// <summary>
/// 建立连接
/// </summary>
/// <param name="IP"></param>
/// <param name="port"></param>
/// <returns></returns>
bool Connect(string IP, int port);
/// <summary>
/// 断开连接
/// </summary>
/// <returns></returns>
bool DisConnect();
/// <summary>
/// 读取byte数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
byte[] ReadBytes(string address);
/// <summary>
/// 读取bool
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
bool ReadBool(string address);
Task<bool> ReadBoolAsync(string address);
/// <summary>
/// 读取int16
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
int ReadInt16(string address);
/// <summary>
/// 读取int32
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
int ReadInt32(string address);
/// <summary>
/// 读取string
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
string ReadString(string address);
/// <summary>
/// 读取Float
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
float ReadFloat(string address);
/// <summary>
/// 写入int16
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
bool WriteInt16(string address, string value);
/// <summary>
/// 写入int32
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
bool WriteInt32(string address, int value);
/// <summary>
/// 写入string
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
bool WriteString(string address, string value);
/// <summary>
/// 写入byte
/// </summary>
/// <param name="address"></param>
/// <param name="bytes"></param>
/// <returns></returns>
bool WriteByte(string address, byte[] bytes);
/// <summary>
/// 写入byte
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
bool WriteFloat(string address, float value);
/// <summary>
/// 写入double
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
bool Writedouble(string address, double value);
/// <summary>
/// 心跳使用——喂狗
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
Task<bool> Read(string address);
}
}