public SendRecive() { myHeader = null; myReport = null; myCEMI = null; myNPDU = null; }
/// <summary> /// 读对象值信息 /// </summary> /// <param name="desAddress"></param> /// <returns></returns> public string SendReadValue(int desAddress) { myNPDU = new NPDU(1, 0, 0, ""); myCEMI = new CEMI(0x11, 0xbc, 0xe0, 0, desAddress); myReport = new ReportHeader(10 + myNPDU.Length); myHeader = new Header(0x13, myReport.HeadLength + myReport.BodyLength); return(myHeader.SetHeader() + myReport.SetReportHeader() + myCEMI.SetCEMI() + myNPDU.SetNPDU()); }
/// <summary> /// 写内存信息 /// </summary> /// <param name="desAddress"></param> /// <param name="sendTime"></param> /// <param name="readAddress"></param> /// <param name="readLength"></param> /// <param name="writeData"></param> /// <returns></returns> public string SendWriteMemory(int desAddress, int sendTime, int readAddress, int readLength, string writeData) { myNPDU = new NPDU((writeData.Length / 2) + 3, 10, readLength, GlobalClass.AddLeftZero(readAddress.ToString("X"), 4) + writeData, true, sendTime); myCEMI = new CEMI(0x11, 0xbc, 0x60, 0, desAddress); myReport = new ReportHeader(10 + myNPDU.Length); myHeader = new Header(0x13, myReport.HeadLength + myReport.BodyLength); return(myHeader.SetHeader() + myReport.SetReportHeader() + myCEMI.SetCEMI() + myNPDU.SetNPDU()); }