Beispiel #1
0
 public Device_Augusta(IDTECH_DEVICE_PID mode) : base(mode)
 {
     deviceType = IDT_DEVICE_Types.IDT_DEVICE_AUGUSTA;
     deviceMode = mode;
     Debug.WriteLine("device: Augusta instantiated with PID={0}", deviceMode);
     Logger.debug("device: August instantiated with PID={0}", deviceMode);
 }
Beispiel #2
0
 public Unknown_Device(IDTECH_DEVICE_PID mode)
 {
     Console.WriteLine($"Unknown Unsupported Device {mode}");
     NotificationRaise(new NotificationEventArgs {
         NotificationType = NotificationType.DeviceEvent, DeviceEvent = DeviceEvent.DeviceError
     });
 }
Beispiel #3
0
        private void SetDeviceMode(IDTECH_DEVICE_PID mode)
        {
            object [] message = { "" };

            switch (mode)
            {
            case IDTECH_DEVICE_PID.AUGUSTA_KYB:
            {
                useUniversalSDK = true;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.AUGUSTA_KYB;
                DeviceInformation.emvConfigSupported = false;
                message[0] = USK_DEVICE_MODE.USB_HID;
                break;
            }

            case IDTECH_DEVICE_PID.AUGUSTA_HID:
            {
                useUniversalSDK = true;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.AUGUSTA_HID;
                DeviceInformation.emvConfigSupported = true;
                message[0] = USK_DEVICE_MODE.USB_KYB;
                break;
            }

            case IDTECH_DEVICE_PID.AUGUSTAS_KYB:
            {
                useUniversalSDK = true;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.AUGUSTAS_KYB;
                DeviceInformation.emvConfigSupported = false;
                message[0] = USK_DEVICE_MODE.USB_HID;
                break;
            }

            case IDTECH_DEVICE_PID.AUGUSTAS_HID:
            {
                useUniversalSDK = true;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.AUGUSTAS_HID;
                DeviceInformation.emvConfigSupported = true;
                message[0] = USK_DEVICE_MODE.USB_KYB;
                break;
            }

            case IDTECH_DEVICE_PID.VP3000_HID:
            {
                useUniversalSDK = true;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.VP3000_HID;
                DeviceInformation.emvConfigSupported = true;
                message[0] = USK_DEVICE_MODE.USB_KYB;
                break;
            }

            case IDTECH_DEVICE_PID.VP3000_KYB:
            {
                useUniversalSDK = false;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.VP3000_KYB;
                DeviceInformation.emvConfigSupported = false;
                message[0] = USK_DEVICE_MODE.USB_HID;
                break;
            }

            case IDTECH_DEVICE_PID.VP5300_HID:
            {
                useUniversalSDK = true;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.VP5300_HID;
                DeviceInformation.emvConfigSupported = true;
                message[0] = USK_DEVICE_MODE.USB_KYB;
                break;
            }

            case IDTECH_DEVICE_PID.VP5300_KYB:
            {
                useUniversalSDK = false;
                DeviceInformation.deviceMode         = IDTECH_DEVICE_PID.VP5300_KYB;
                DeviceInformation.emvConfigSupported = false;
                message[0] = USK_DEVICE_MODE.USB_HID;
                break;
            }

            default:
            {
                message[0] = USK_DEVICE_MODE.UNKNOWN;
                break;
            }
            }

            // Notify Main Form
            NotificationRaise(new DeviceNotificationEventArgs {
                NotificationType = NOTIFICATION_TYPE.NT_SET_DEVICE_MODE, Message = message
            });
        }
        public void Init(string[] available, ref IDTECH_DEVICE_PID mode)
        {
            BaudRate      = int.Parse(ConfigurationManager.AppSettings["IPA.DAL.Device.COMBaudRate"]);
            DataBits      = int.Parse(ConfigurationManager.AppSettings["IPA.DAL.Device.COMDataBits"]);
            AcceptedPorts = ConfigurationManager.AppSettings["IPA.DAL.Device.AcceptedComPorts"].Split(',');

            DeviceFolder = ConfigurationManager.AppSettings["IPA.DAL.Application.Folders.Devices"];
            LoggingLevel = ConfigurationManager.AppSettings["IPA.DAL.Device.LoggingLevel"];

            deviceStatus = DeviceStatus.NoDevice;
            var devices = GetUSBDevices();

            if (devices.Count == 1)
            {
                var vendor = devices[0].Vendor;
                Device.Manufacturer = devices[0].Vendor;

                switch (devices[0].Vendor)
                {
                case DeviceManufacturer.IDTech:
                {
                    var       deviceID = devices[0].DeviceID;
                    string [] worker   = deviceID.Split('&');

                    int pidId = 0;
                    // should contain PID_XXXX...
                    if (System.Text.RegularExpressions.Regex.IsMatch(worker[1], "PID_"))
                    {
                        string [] worker2 = System.Text.RegularExpressions.Regex.Split(worker[1], @"PID_");
                        string    pid     = worker2[1].Substring(0, 4);

                        // See if device matches
                        pidId = Int32.Parse(pid);

                        switch (pidId)
                        {
                        case (int)IDTECH_DEVICE_PID.VP3000_HID:
                        case (int)IDTECH_DEVICE_PID.VP3000_KYB:
                        case (int)IDTECH_DEVICE_PID.SECUREKEY_HID:
                        case (int)IDTECH_DEVICE_PID.AUGUSTA_KYB:
                        case (int)IDTECH_DEVICE_PID.AUGUSTAS_KYB:
                        case (int)IDTECH_DEVICE_PID.AUGUSTA_HID:
                        case (int)IDTECH_DEVICE_PID.AUGUSTAS_HID:
                        case (int)IDTECH_DEVICE_PID.VP5300_HID:
                        {
                            mode = (IDTECH_DEVICE_PID)pidId;
                            break;
                        }

                        default:
                        {
                            mode = IDTECH_DEVICE_PID.UNKNOWN;
                            break;
                        }
                        }
                    }

                    deviceMode = mode;
                    if (mode == IDTECH_DEVICE_PID.AUGUSTA_HID || mode == IDTECH_DEVICE_PID.AUGUSTA_KYB ||
                        mode == IDTECH_DEVICE_PID.AUGUSTAS_HID || mode == IDTECH_DEVICE_PID.AUGUSTAS_KYB)
                    {
                        deviceInterface = new Device_Augusta(deviceMode);
                    }
                    else if (mode == IDTECH_DEVICE_PID.VP5300_HID)
                    {
                        deviceInterface = new Device_VP5300(deviceMode);
                    }

                    /*else if (mode == IDTECH_DEVICE_PID.VP3000_HID || mode == IDTECH_DEVICE_PID.VP3000_KYB)
                     * {
                     *  deviceInterface = new Device_VP3000(deviceMode);
                     * }
                     * else if (mode == IDTECH_DEVICE_PID.SECUREKEY_HID)
                     * {
                     *  deviceInterface = new Device_IDTech(deviceMode);
                     * }
                     * else
                     * {
                     *  Unknown_Device ukd = new Unknown_Device(mode);
                     *  ukd.SetConfig("PID", pidId.ToString());
                     *  deviceInterface = ukd;
                     * }*/
                    deviceInterface.OnNotification += DeviceOnNotification;
                    break;
                }

                case DeviceManufacturer.Ingenico:
                {
///                        deviceInterface = new Device_Ingenico();
///                        deviceInterface.OnNotification += DeviceOnNotification;
                    break;
                }

                default:
                {
                    throw new ArgumentOutOfRangeException(nameof(vendor), vendor, null);
                }
                }
            }
            else if (devices.Count > 1)
            {
                throw new Exception(DeviceStatus.MultipleDevice.ToString());
            }
            else
            {
                throw new Exception(DeviceStatus.NoDevice.ToString());
            }
            deviceInterface?.Init(Device.AcceptedPorts, available, Device.BaudRate, Device.DataBits);
        }
 public Device_VP3000(IDTECH_DEVICE_PID mode) : base(mode)
 {
     deviceType = IDT_DEVICE_Types.IDT_DEVICE_NONE;
     deviceMode = mode;
     Debug.WriteLine("device: VP3300 instantiated with PID={0}", deviceMode);
 }