电表模拟器
97协议测试
07协议测试
private void btnSend_Click(object sender, EventArgs e) { string addr = txtAddr.Text.Trim(); string data = txtDataFlg.Text.Trim(); byte control = 0x01; switch (cmbControl.SelectedIndex) { case 0: control = (byte)0x01; break;// 97协议 case 1: control = (byte)0x11; break;// 07协议 } if (string.IsNullOrEmpty(addr)) { AddMessage("电表地址不允许为空"); return; } if (string.IsNullOrEmpty(data)) { AddMessage("数据标识不允许为空"); return; } MeterEntity entity = dlt.Read(addr, control, data); AddMessage("SEND " + entity.Send); if (!string.IsNullOrEmpty(entity.OutMsg)) { AddMessage("执行出错,errmsg=" + entity.OutMsg); } else { AddMessage("RECV " + entity.Recv); AddMessage("analysis,Addr=" + entity.Addr + ",Control=" + entity.Control + ",Flg=" + entity.DataFlg + ",Data=" + entity.Data); } }