public void RadioPos()
 {
     buf = new byte[6];
     res = ScannerDLL.goRadioPos(0, buf);
     if (res == 0)
     {
         Utility.WriteLog("ID scanner condition : move to the RF card holding success", "step-action");
     }
     else
     {
         Utility.WriteLog("ID scanner condition : move to the RF card holding failed", "step-action");
     }
 }
        public async Task FrontSwallow()
        {
            buf          = new byte[6];
            isTimeOut    = false;
            isManualStop = false;
            mIsRunning   = false;
            bool result = false;

            deviceNum = 0;
            res       = -1;
            overTime  = 300000;

            IDCardInfo idcardinfo = null;
            DateTime   startTime  = DateTime.Now;

            status = new byte[2];
            res    = ScannerDLL.openDeviceList(ref deviceNum);
            if (res == 0)
            {
                Utility.WriteLog("ID scanner condition : open device list success", "step-action");
            }
            else
            {
                Utility.WriteLog("ID scanner condition : open device list failed", "step-action");
            }
            res = ScannerDLL.openDevice(0);
            if (res == 0)
            {
                Utility.WriteLog("ID scanner condition : open device success", "step-action");
            }
            else
            {
                Utility.WriteLog("ID scanner condition : open device failed", "step-action");
            }
            res = ScannerDLL.getDeviceStatus(0);
            if (res == 1)
            {
                Utility.WriteLog("ID scanner condition : get status success", "step-action");
            }
            else
            {
                Utility.WriteLog("ID scanner condition : get status failed", "step-action");
            }
            res = ScannerDLL.backSwallow(0, 0, buf);
            if (res == 0)
            {
                Utility.WriteLog("ID scanner condition : set back entry success", "step-action");
            }
            else
            {
                Utility.WriteLog("ID scanner condition : set back entry failed", "step-action");
            }
            res = ScannerDLL.frontSwallow(0, 1, buf);
            if (res == 0)
            {
                Utility.WriteLog("ID scanner condition : set front entry success", "step-action");
            }
            else
            {
                Utility.WriteLog("ID scanner condition : set front entry failed", "step-action");
            }

            while (!isManualStop)
            {
                try
                {
                    await Task.Delay(100);

                    span = DateTime.Now - startTime;
                    if (overTime > 0 && span.TotalMilliseconds > overTime)
                    {
                        res       = -132;
                        isTimeOut = true;
                        Utility.WriteLog("ID scanner condition : device timeout", "step-action");
                        navman.NavigateTo("/");
                        break;
                    }
                    int iRet = ScannerDLL.getDeviceStatus(0);
                    if (iRet != 1)
                    {
                        Utility.WriteLog("ID scanner condition : get status failed", "step-action");
                        continue;
                    }
                    //Utility.WriteLog("ID scanner condition : get status success", "step-action");
                    iRet = ScannerDLL.cisQuery(0, status);
                    if (iRet == 0)
                    {
                        //Utility.WriteLog("ID scanner condition : ics checking success", "step-action");
                        switch (status[0])
                        {
                        case 50:
                        {
                            Utility.WriteLog("ID scanner condition : the card is at the front card holding", "step-action");
                            iRet = ScannerDLL.goRadioPos(0, status);
                            if (iRet != 0)
                            {
                                Utility.WriteLog("ID scanner condition : move to the RF card holding failed", "step-action");
                                break;
                            }
                            Thread.Sleep(500);
                            iRet = ScannerDLL.cisQuery(0, status);
                            Thread.Sleep(200);
                            if (status[0] == 51)
                            {
                                Utility.WriteLog("ID scanner condition : the card is at RF card reading", "step-action");
                                res          = 0;
                                isManualStop = true;
                                test         = true;
                                result       = isManualStop;
                                break;
                            }
                            break;
                        }

                        case 51:
                        {
                            Utility.WriteLog("ID scanner condition : the card is at RF card reading", "step-action");
                            res          = 0;
                            isManualStop = true;
                            test         = true;
                            result       = isManualStop;
                            break;
                        }

                        //case 48:
                        //    {
                        //        Utility.WriteLog("ID scanner condition : no card and no card inserted", "step-action");
                        //        break;
                        //    }
                        case 49:
                        {
                            Utility.WriteLog("ID scanner condition : the card movement needs to be detected according to the state of optical sensor", "step-action");
                            break;
                        }

                        case 52:
                        {
                            Utility.WriteLog("ID scanner condition : the card is at the rear card holding", "step-action");
                            break;
                        }

                        case 53:
                        {
                            Utility.WriteLog("ID scanner condition : the card is illegally positioned", "step-action");
                            break;
                        }
                        }
                    }
                    else
                    {
                        Utility.WriteLog("ID scanner condition : ics checking failed", "step-action");
                    }
                }
                catch
                {
                    idcardinfo = null;
                    Utility.WriteLog("ID scanner condition : read card id information error", "step-action");
                }
            }
            mIsRunning = false;
            res        = ScannerDLL.frontSwallow(0, 0, buf);
            if (res == 0)
            {
                Utility.WriteLog("ID scanner condition : set front entry success", "step-action");
            }
            else
            {
                Utility.WriteLog("ID scanner condition : set front entry failed", "step-action");
            }
            //return result;
        }