public void CopyTo(ReceivedDataInfo obj) { obj.CommandType = CommandType; obj.Error = Error; obj.ErrorMessage = ErrorMessage; obj.ReceivedData = ReceivedData; InterfaceInfo.CopyTo(obj.InterfaceInfo); }
public override void ReceivedAllData(string data) { ECString = data; WriteECCommLog("[AMT INTERFACE][RECEIVED], " + data); if (data.Trim() == "") { var sendData = new FAAMTInterfaceServer.FAInterfaceSendCommand(); sendData.Result = FAResult.FAIL; sendData.Msg = "EMPTY DATA"; SendCommand(sendData); return; } if (data.Length < 16) { var sendData = new FAAMTInterfaceServer.FAInterfaceSendCommand(); sendData.Result = FAResult.FAIL; sendData.Msg = "NOT FOUND HEADER. DATA LENGTH IS TOO SHORT.(DATA LENGTH < 16)"; SendCommand(sendData); return; } string[] splitData = new string[2]; splitData[0] = data.Substring(0, 16); splitData[1] = data.Substring(16); //if (splitData.Length < 2) return; string head = splitData[0]; string body = splitData[1]; try { bool result = false; string command = GetCommand(body); string errMessage = string.Empty; if (command == "BUFFER_IN") { result = InterfaceInfo.ReceiveData.Parsing(body, out errMessage); ReceivedCommand = InterfaceInfo.ReceiveData; } ReceiveData.CommandType = command; InterfaceInfo.CopyTo(ReceiveData.InterfaceInfo); ReceiveData.Error = !result; ReceiveData.ErrorMessage = errMessage; ReceiveData.ReceivedData = true; ReceivedDataInfo tempReceiveData = new ReceivedDataInfo(); ReceiveData.CopyTo(tempReceiveData); if (OnReceivedData != null) OnReceivedData(this, new FAGenericEventArgs<ReceivedDataInfo>(tempReceiveData)); var sendData = new FAAMTInterfaceServer.FAInterfaceSendCommand(); if (result) sendData.Result = FAResult.PASS; else { sendData.Result = FAResult.FAIL; sendData.Msg = ""; } SendCommand(sendData); ExistReceivedData = true; } catch { return; } }