/// <summary>
        /// 監視モード時の応答割り振り
        /// </summary>
        /// <param name="order">OrderCardMachineClass</param>
        /// <param name="ret">CardMachineErrorClass</param>
        private void MonitoringEventReturn(OrderCardMachineClass order, CardMachineErrorClass ret)
        {
            try
            {
                RmGetStatusParamClass Data = (RmGetStatusParamClass)order.Param;

                // 監視している場合は特殊応答
                if (OldRWStatus == 0 && Data.rwsStatus == 1)
                {
                    // 未挿入から処理中
                    NotInserted_To_Processing?.Invoke(Data);
                }
                else if (OldRWStatus == 1 && Data.rwsStatus == 2)
                {
                    // 処理中から抜き取り待ち
                    Processing_To_PullWait?.Invoke(Data);
                }
                else if (OldRWStatus == 2 && Data.rwsStatus == 0)
                {
                    // 抜取り待ちから未挿入
                    PullWait_To_NotInserted?.Invoke(Data);
                }
                else if (OldRWStatus == 1 && Data.rwsStatus == 0)
                {
                    // 処理中から未挿入
                    Processing_To_NotInserted?.Invoke(Data);
                }
                else if (OldRWStatus == 0 && Data.rwsStatus == 2)
                {
                    // 未挿入から抜き取り待ち
                    NotInserted_To_PullWait?.Invoke(Data);
                }

                // 最新ステータスを保持
                OldRWStatus = Data.rwsStatus;
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// 受け取った命令を実行する
        /// </summary>
        /// <param name="OrderName"></param>
        /// <param name="Param"></param>
        private void ExecutionCardMachine()
        {
            try
            {
                // 戻り値格納用
                CardMachineErrorClass ret = null;

                // 命令格納用
                OrderCardMachineClass Order = null;

                // 監視命令のステータスかどうか
                bool MonitoringFlag = false;

                // 命令が無ければ監視モード
                if (OrderQue.Count != 0)
                {
                    // 命令取得
                    Order = OrderQue.Dequeue();

                    // 監視命令OFF
                    MonitoringFlag = false;
                }
                else
                {
                    // 監視モードじゃなければ終了
                    if (!MonitoringMode)
                    {
                        return;
                    }

                    // ステータス監視
                    Order = new OrderCardMachineClass
                    {
                        OrderName = OrderCardMachineState.RmGetStatus,
                        Param     = new RmGetStatusParamClass()
                    };

                    // 監視命令ON
                    MonitoringFlag = true;
                }


                // 各種処理分岐
                switch (Order.OrderName)
                {
                case OrderCardMachineState.None:
                    break;

                case OrderCardMachineState.OpenPort:
                    ret = CardMachineCom.OpenPort((OpenPortParamClass)Order.Param);
                    break;

                case OrderCardMachineState.ClosePort:
                    ret = CardMachineCom.ClosePort();
                    break;

                case OrderCardMachineState.RmGetStatus:
                    ret = CardMachineCom.RmGetStatus((RmGetStatusParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmGetVersion:
                    ret = CardMachineCom.RmGetVersion((RmGetVersionParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmSendClock:
                    ret = CardMachineCom.RmSendClock((RmSendClockParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmSendRecCard:
                    ret = CardMachineCom.RmSendRecCard((RmSendRecCardParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmGetCardDataA:
                    ret = CardMachineCom.RmGetCardDataA((RmGetCardDataAParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmSendExchnge:
                    ret = CardMachineCom.RmSendExchnge((RmSendExchngeParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmSendSellA:
                    ret = CardMachineCom.RmSendSellA((RmSendSellAParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmGetCalcA:
                    ret = CardMachineCom.RmGetCalcA((RmGetCalcAParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmSendMessageData:
                    ret = CardMachineCom.RmSendMessageData((RmSendMessageDataParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmSendName:
                    ret = CardMachineCom.RmSendName((RmSendNameParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmGetICM:
                    ret = CardMachineCom.RmGetICM((RmGetICMParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmGetMode:
                    ret = CardMachineCom.RmGetMode((RmGetModeParamClass)Order.Param);
                    break;

                case OrderCardMachineState.RmSendProcRun:
                    ret = CardMachineCom.RmSendProcRun();
                    break;

                case OrderCardMachineState.RmSendCancel:
                    ret = CardMachineCom.RmSendCancel();
                    break;

                case OrderCardMachineState.RmSendCleaning:
                    ret = CardMachineCom.RmSendCleaning();
                    break;

                case OrderCardMachineState.RmSendTestMode:
                    ret = CardMachineCom.RmSendTestMode();
                    break;

                case OrderCardMachineState.RmSendICMClear:
                    ret = CardMachineCom.RmSendICMClear();
                    break;

                case OrderCardMachineState.RmSendModem:
                    ret = CardMachineCom.RmSendModem();
                    break;

                default:
                    break;
                }

                // 命令完了処理
                if (ret != null)
                {
                    // 応答処理
                    if (ret.ErrorCode == 0)
                    {
                        if (!MonitoringFlag)
                        {
                            ReturnData?.Invoke(Order.OrderName, Order.Param);
                        }
                        else
                        {
                            // 監視モード時の特殊応答
                            MonitoringEventReturn(Order, ret);
                        }
                    }
                    else
                    {
                        Error = ret;
                        ErrorEvent?.Invoke(Error);
                    }
                }
            }
            catch
            {
                throw;
            }
        }