/// <summary> /// MelsecNet Driver Bit Read Method /// </summary> /// <param name="ownerId"></param> /// <param name="name"></param> /// <param name="address"></param> /// <param name="deviceType"></param> /// <param name="length"></param> /// <returns></returns> public bool MelsecNetBitRead(string ownerId, string name, string address, enumDeviceType deviceType, int length) { string resultData = ""; if (_melsecConnect == enumMelsecConnect.CONNECT) { object value = ReadValiable(address); resultData = value.ToString(); CLogManager.Instance.Log(new CMelsecLogFormat(Catagory.Info, true, ownerId, name, portID.ToString(), deviceType.ToString(), address, 1, resultData, 0, true)); return(resultData == "true"); } return(false); }
/// <summary> /// MelsecNet Driver Word Read Method /// </summary> /// <param name="ownerId"></param> /// <param name="name"></param> /// <param name="address"></param> /// <param name="deviceType"></param> /// <returns></returns> public string MelsecNetWordRead(string ownerId, string name, string address, enumDeviceType deviceType) { string resultData = string.Empty; if (_melsecConnect == enumMelsecConnect.CONNECT) { object value = ReadValiable(address); resultData = value.ToString(); CLogManager.Instance.Log(new CMelsecLogFormat(Catagory.Info, true, ownerId, name, portID.ToString(), deviceType.ToString(), address, 1, resultData, 0, true)); } return(resultData); }
/// <summary> /// MelsecNet Driver Multi Word Read Method /// </summary> /// <param name="ownerId"></param> /// <param name="name"></param> /// <param name="address"></param> /// <param name="deviceType"></param> /// <param name="length"></param> /// <returns></returns> public ushort[] MelsecNetMultiWordRead(string ownerId, string name, string address, enumDeviceType deviceType, int length) { ushort[] resultData = new ushort[length]; if (_melsecConnect == enumMelsecConnect.CONNECT) { object value = ReadValiable(address); resultData = null; StringBuilder sb = new StringBuilder(); foreach (ushort item in resultData) { if (sb.ToString() != "") { sb.Append(","); } sb.Append(item.ToString()); } CLogManager.Instance.Log(new CMelsecLogFormat(Catagory.Info, true, ownerId, name, portID.ToString(), deviceType.ToString(), address, length, sb.ToString(), 0, true)); } return(resultData); }
/// <summary> /// MelsecNet Driver Multi Word Write List<ushort>Method /// </summary> /// <param name="ownerId"></param> /// <param name="name"></param> /// <param name="address"></param> /// <param name="deviceType"></param> /// <param name="data"></param> public void MelsecNetMultiWordWrite(string ownerId, string name, string address, enumDeviceType deviceType, List <ushort> data) { int iRet = 0; if (_melsecConnect == enumMelsecConnect.CONNECT) { iRet = WriteValiable(address, data.ToArray()); StringBuilder sb = new StringBuilder(); foreach (ushort item in data) { if (sb.ToString() != "") { sb.Append(","); } sb.Append(item.ToString()); } CLogManager.Instance.Log(new CMelsecLogFormat(Catagory.Info, false, ownerId, name, portID.ToString(), deviceType.ToString(), address, data.Count, sb.ToString(), iRet, true)); } }
/// <summary> /// MelsectNet Driver Word Write (ushort) Method /// </summary> /// <param name="ownerId"></param> /// <param name="name"></param> /// <param name="address"></param> /// <param name="deviceType"></param> /// <param name="data"></param> public void MelsecNetWordWrite(string ownerId, string name, string address, enumDeviceType deviceType, ushort data) { int iRet = 0; if (_melsecConnect == enumMelsecConnect.CONNECT) { iRet = WriteValiable(address, data); CLogManager.Instance.Log(new CMelsecLogFormat(Catagory.Info, false, ownerId, name, portID.ToString(), deviceType.ToString(), address, 1, data.ToString(), iRet, true)); } }
public int MelsecNetBitOnOff(string ownerId, string name, string address, enumDeviceType deviceType, bool value, bool display) { int iRet = -99; if (_melsecConnect == enumMelsecConnect.CONNECT) { iRet = WriteValiable(address, value); CLogManager.Instance.Log(new CMelsecLogFormat(Catagory.Info, false, ownerId, name, portID.ToString(), deviceType.ToString(), address, 1, value, iRet, display)); return(iRet); } return(iRet); }