using Community;
using HslCommunication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model.HSL
{
///
/// HSL父级
///
public abstract class HslParent : NotificationObject
{
#region 名称
private string nameStr;
///
/// 名称
///
public string NameStr
{
get { return nameStr; }
set
{
nameStr = value;
RaisePropertyChanged("NameStr");
}
}
#endregion
#region IP地址
private string ip;
///
/// IP地址
///
public string IP
{
get { return ip; }
set
{
ip = value;
RaisePropertyChanged("IP");
}
}
#endregion
#region 端口号
private int port;
///
/// 端口号
///
public int Port
{
get { return port; }
set
{
port = value;
RaisePropertyChanged("Port");
}
}
#endregion
#region 品牌
private int brand;
///
/// 品牌 1:三菱 2:松下
///
public int Brand
{
get { return brand; }
set
{
brand = value;
RaisePropertyChanged("Brand");
}
}
#endregion
#region 连接方式
private int connectionType;
///
/// 连接方式 1:TCP/IP 2:串口
///
public int ConnectionType
{
get { return connectionType; }
set
{
connectionType = value;
RaisePropertyChanged("ConnectionType");
}
}
#endregion
#region 串口号
private string portName;
///
/// 串口号
///
public string PortName
{
get { return portName; }
set
{
portName = value;
this.RaisePropertyChanged("PortName");
}
}
#endregion
#region 波特率
private int baudRate;
///
/// 波特率
///
public int BaudRate
{
get { return baudRate; }
set
{
baudRate = value;
this.RaisePropertyChanged("BaudRate");
}
}
#endregion
#region 校验位
private int parityNumber;
///
/// 校验位
///
public int ParityNumber
{
get { return parityNumber; }
set
{
parityNumber = value;
this.RaisePropertyChanged("ParityNumber");
}
}
#endregion
#region 数据位
private int dataBits;
///
/// 数据位
///
public int DataBits
{
get { return dataBits; }
set
{
dataBits = value;
this.RaisePropertyChanged("DataBits");
}
}
#endregion
#region 停止位
private int stopBitsNumber;
///
/// 停止位
///
public int StopBitsNumber
{
get { return stopBitsNumber; }
set
{
stopBitsNumber = value;
this.RaisePropertyChanged("StopBitsNumber");
}
}
#endregion
#region PLC连接状态
private ShowInfo plcStatus;
///
/// PLC连接状态
///
public ShowInfo PlcStatus
{
get { return plcStatus; }
set
{
plcStatus = value;
RaisePropertyChanged("PlcStatus");
}
}
#endregion
#region PLC运行状态
private ShowInfo plcRunStatus;
///
/// PLC运行状态
///
public ShowInfo PlcRunStatus
{
get { return plcRunStatus; }
set
{
plcRunStatus = value;
RaisePropertyChanged("PlcRunStatus");
}
}
#endregion
///
/// 连接PLC
///
///
public abstract bool Conneced();
///
/// 断开连接PLC
///
public abstract void Disconnect();
#region 单数读取
///
/// 读取字符串
///
/// 读取地址
/// 读取字符串长度
///
public abstract string ReadString(string address, ushort Strlength);
///
/// 读取int16
///
///
///
public abstract short ReadShort(string address);
///
/// 读取Int32
///
/// 读取地址
///
public abstract int ReadInt32(string address);
///
/// 读取Long
///
///
///
public abstract long ReadLong(string address);
///
/// 读取Bool
///
/// 读取地址
///
public abstract bool ReadBool(string address);
///
/// 读取flost(单精度浮点数)
///
///
///
public abstract float ReadFloat(string address);
///
/// 读取ushort
///
/// 读取地址
///
public abstract ushort ReadUint16(string address);
///
/// 读取uint
///
/// 读取地址
///
public abstract uint ReadUint(string address);
///
/// 读取Ulong
///
///
public abstract ulong ReadUlong(string address);
///
/// 读取Double
///
///
///
public abstract double ReadDouble(string address);
///
/// 读取字节
///
///
///
///
public abstract byte[] ReadByte(string address, ushort length);
#endregion
#region 批量读取
///
/// 读取int16
///
///
///
///
public abstract short[] ReadShort(string address, ushort length);
///
/// 批量读取Int
///
/// 读取地址
///
///
public abstract int[] ReadInt32(string address, ushort length);
///
/// 读取Long
///
///
///
///
public abstract long[] ReadLong(string address, ushort length);
///
/// 批量读取Bool
///
/// 读取地址
///
///
public abstract bool[] ReadBool(string address, ushort length);
///
/// 批量读取flost(单精度浮点数)
///
///
///
///
public abstract float[] ReadFloat(string address, ushort length);
///
/// 读取uint16
///
/// 读取地址
///
///
public abstract ushort[] ReadUint16(string address, ushort length);
///
/// 批量读取uint
///
/// 读取地址
///
///
public abstract uint[] ReadUint(string address, ushort length);
///
/// 批量读取Ulong
///
///
///
///
public abstract ulong[] ReadUlong(string address, ushort length);
///
/// 批量读取Double
///
///
///
///
public abstract double[] ReadDouble(string address, ushort length);
#endregion
#region 写入ushort
///
/// 写入ushort
///
///
///
///
public abstract bool Write(string address, params ushort[] val);
#endregion
#region 写入short
///
/// 写入short
///
///
///
///
public abstract bool Write(string address, params short[] val);
#endregion
#region 写入 int
///
/// 写入 int
///
///
///
///
public abstract bool Write(string address, params int[] val);
#endregion
#region 写入 long
///
/// 写入 long
///
///
///
///
public abstract bool Write(string address, params long[] val);
#endregion
#region 写入 float
///
/// 写入 float
///
///
///
///
public abstract bool Write(string address, params float[] val);
#endregion
#region 写入 byte
///
/// 写入 byte
///
///
///
///
public abstract bool Write(string address, params byte[] val);
#endregion
#region 写入 double
///
/// 写入 double
///
///
///
///
public abstract bool Write(string address, params double[] val);
#endregion
#region 写入 bool
///
/// 写入 bool
///
///
///
///
public abstract bool Write(string address, bool b);
#endregion
#region 写入字符串
///
/// 写入字符串
///
///
///
///
public abstract bool Write(string address, string val);
#endregion
}
}