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.

97 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AUCMA.STORE.DeviceAdapter
{
public enum CommType
{
RJ45 = 1, //网口
RS232 = 2, //com口
RS485 = 3, //485接口
};
public enum DeviceType
{
/// <summary>
/// 1200系列
/// </summary>
S1200 = 1,
/// <summary>
/// 300系列
/// </summary>
S300 = 2,
/// <summary>
/// 400系列
/// </summary>
S400 = 3,
/// <summary>
/// 1500系列PLC
/// </summary>
S1500 = 4,
/// <summary>
/// 200的smart系列
/// </summary>
S200Smart = 5,
/// <summary>
/// 200系统需要额外配置以太网模块
/// </summary>
S200 = 6
};
/// <summary>
/// 设备层接口
/// </summary>
public interface IDeviceAdapter
{
/// <summary>
/// 设备初始化
/// </summary>
/// <returns>true成功false失败</returns>
/// <param name="iCommType">通讯类型 1RJ45 2串口。</param>
/// <param name="pUrl">连接字符串 当iCommType为1时pUrl格式“192.168.1.100:23”为2时pUrl格式为“Com1:9600“</param>
/// <param name="iDeviceType">详见DeviceType</param>
bool Device_Init(CommType iCommType, string pUrl, UInt16 iDeviceId, string deviceType);
/// <summary>
/// 连接设备
/// </summary>
/// <returns>true成功false失败</returns>
bool Device_Connect();
/// <summary>
/// 重新连接设备
/// </summary>
/// <returns>true成功false失败</returns>
bool Device_ReConnect();
/// <summary>
/// 设备销毁
/// </summary>
void Device_Destroy();
/// <summary>
/// 设备状态
/// </summary>
/// <returns>true正常false异常</returns>
bool Device_GetState();
bool ReadBoolByAddress(string address);
string ReadStringByAddress(string address);
int ReadInt16ByAddress(string address);
int ReadInt32ByAddress(string address);
bool WriteInt16ByAddress(string address, string value);
bool WriteInt32ByAddress(string address, int value);
bool WriteStringByAddress(string address, string value);
bool WriteByteByAddress(string address, byte[] bytes);
}
}