private void CommuReceiveThread() { byte[] receivePackage; byte[] framePakcage; while (true) { if (udpCommu.receive(out receivePackage) == false) { continue; } if (pullPackage(receivePackage, out framePakcage) == false) { continue; } if (checkout(framePakcage) == false) { continue; } notifyDone?.Invoke(framePakcage); } }
protected void notifyReceiveDoneEventHandler(byte[] package) { byte rxIndex = getReplyIndex(package); IndexInputType indexType = getIndexInputType(rxIndex); switch (indexType) { case IndexInputType.UnusualMasterSendSlaveReply: case IndexInputType.UsualMasterSendSlaveReply: if (rxIndex == outIndex) { lock (replyCmdList) { replyCmdList.Add(package); } } break; case IndexInputType.UnusualSlaveSendMasterNoReply: case IndexInputType.UsualSlaveSendMasterNoReply: sampleEvent?.Invoke(package); break; } }