private void HandleFeedback(DirectiveResult recvData, byte[] directiveBytes)
        {
            WaitForFeedBack metadata = null;

            if (!waitForFeedbackDirectives.ContainsKey(recvData.Data.DirectiveId))
            {
                Debug.WriteLine($"waitForFeedbackDirectives not ContainsKey {recvData.Data.DirectiveId}");
                return;
            }

            var feedback = waitForFeedbackDirectives[recvData.Data.DirectiveId];

            //修正同一个指令id,发送和反馈对应的设备不同或者类型不同
            if (feedback?.Directive == null || feedback.Directive.TargetDeviceId != recvData.Data.DeviceId ||
                feedback.Directive.DeviceType != recvData.Data.DeviceType)
            {
                Debug.WriteLine("send and feedback not match");
                return;
            }

            if (waitForFeedbackDirectives.TryRemove(recvData.Data.DirectiveId, out metadata) && null != metadata)
            {
                var args = new SerialPortEventArgs
                {
                    IsSucceed = true,
                    Result    = recvData,
                    Command   = directiveBytes
                };

                OnSerialPortEvent(args);
            }
            else
            {
                Debug.WriteLine($"waitForFeedbackDirectives TryRemove {recvData.Data.DirectiveId} failed");
            }
        }
 public void OnSerialPortEvent(SerialPortEventArgs args)
 {
     SerialPortEvent?.Invoke(args);
 }