private void button3_Click(object sender, EventArgs e) { if (cmbTranserFunction.SelectedIndex < 0) { MessageBox.Show("没有指定输出函数"); return; } bool ret = false; TransferFunctionCode tc = (TransferFunctionCode)cmbTranserFunction.SelectedIndex; ret = HartDevice.WriteTransferFunction(tc); MessageBox.Show(ret ? "设置成功" : HartDevice.GetLastError(), "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// 设置主变量DA输出转换函数 /// </summary> public bool WriteTransferFunction(long longAddress, TransferFunctionCode code) { RequestPacket request = new RequestPacket() { LongOrShort = 1, Address = longAddress, Command = 47, DataContent = new byte[] { (byte)code }, }; ResponsePacket response = Request(request); return(response != null); }
/// <summary> /// 设置主变量DA输出转换函数 /// </summary> public bool WriteTransferFunction(TransferFunctionCode code) { if (_ID == null) { return(false); } bool ret = _HartComport.WriteTransferFunction(_ID.LongAddress, code); if (ret) { _PVOutput = null; } return(ret); }