Пример #1
0
        private CommunicationResource GetBillValidatorPort(string port)
        {
            CommunicationResource device      = null;
            const int             ATTEMPT_MAX = 3;

            for (int attempt = 0; attempt < ATTEMPT_MAX; attempt++)
            {
                try
                {
                    if (Id003_DetectBillValidatorDevice(port))
                    {
                        device = new CommunicationResource(ResourceType.BILL_VALIDATOR_SERIAL_PORT, DeviceProtocol.PROTOCOL_ID003, port);
                        break;
                    }
                    if (CcTalk_DetectBillValidatorDevice(port))
                    {
                        device = new CommunicationResource(ResourceType.BILL_VALIDATOR_SERIAL_PORT, DeviceProtocol.PROTOCOL_CCTALK, port);
                        break;
                    }
                    if (Ssp_DetectBillValidatorDevice(port))
                    {
                        device = new CommunicationResource(ResourceType.BILL_VALIDATOR_SERIAL_PORT, DeviceProtocol.PROTOCOL_SSP, port);
                        break;
                    }
                }
                catch (Exception e)
                {
                }
                System.Threading.Thread.Sleep(20);
            }

            return(device);
        }
Пример #2
0
        public List <CommunicationResource> GetAllPereferialPorts()
        {
            string[] avalible_serial_ports = CoreGetAvailableResources();

            List <CommunicationResource> portList = new List <CommunicationResource>();

            foreach (string port in avalible_serial_ports)
            {
                try
                {
                    if (DetectCashValidatorDevice(port))
                    {
                        CommunicationResource device = new CommunicationResource(ResourceType.CASH_VALIDATOR_SERIAL_PORT, port);
                        portList.Add(device);
                    }

                    if (DetectIdReaderDevice(port))
                    {
                        CommunicationResource device = new CommunicationResource(ResourceType.ID_CARD_READER_SERIAL_PORT, port);
                        portList.Add(device);
                    }
                }
                catch (Exception e)
                {
                }
            }
            return(portList);
        }
Пример #3
0
        public List <CommunicationResource> GetBillValidatorPort()
        {
            string[] avalible_serial_ports        = CoreGetAvailableResources();
            List <CommunicationResource> portList = new List <CommunicationResource>();

            foreach (string port in avalible_serial_ports)
            {
                try
                {
                    CommunicationResource BillValidator = GetBillValidatorPort(port);
                    if (BillValidator != null)
                    {
                        portList.Add(BillValidator);
                    }
                }
                catch (Exception e)
                {
                }
            }

            return(portList);
        }
Пример #4
0
        public List <CommunicationResource> GetCoinAcceptorPort()
        {
            string[] avalible_serial_ports        = CoreGetAvailableResources();
            List <CommunicationResource> portList = new List <CommunicationResource>();

            foreach (string port in avalible_serial_ports)
            {
                try
                {
                    if (CcTalk_DetectCoinAcceptorDevice(port))
                    {
                        CommunicationResource device = new CommunicationResource(ResourceType.COIN_ACCEPTOR_SERIAL_PORT, DeviceProtocol.PROTOCOL_CCTALK, port);
                        portList.Add(device);
                    }
                }
                catch (Exception e)
                {
                }
            }

            return(portList);
        }
Пример #5
0
        public List <CommunicationResource> GetAllPereferialPorts()
        {
            string[] avalible_serial_ports        = CoreGetAvailableResources();
            List <CommunicationResource> portList = new List <CommunicationResource>();

            foreach (string port in avalible_serial_ports)
            {
                try
                {
                    if (CcTalk_DetectCoinAcceptorDevice(port))
                    {
                        CommunicationResource device = new CommunicationResource(ResourceType.COIN_ACCEPTOR_SERIAL_PORT, DeviceProtocol.PROTOCOL_CCTALK, port);
                        portList.Add(device);
                        continue;
                    }

                    if (DetectIdReaderDevice(port))
                    {
                        CommunicationResource device = new CommunicationResource(ResourceType.ID_CARD_READER_SERIAL_PORT, DeviceProtocol.PROTOCOL_NONE, port);
                        portList.Add(device);
                        continue;
                    }

                    CommunicationResource BillValidator = GetBillValidatorPort(port);
                    if (BillValidator != null)
                    {
                        portList.Add(BillValidator);
                        continue;
                    }
                }
                catch (Exception e)
                {
                }
            }
            return(portList);
        }