Пример #1
0
 /******************************************************************************************************
 * Constructor                                                                                        *
 ******************************************************************************************************/
 public IDTechHandler()
 {
     IDT_Device.startUSBMonitoring();
     IDT_Device.setCallback(MessageCallBack);
     minismartII = false;
     secureMag   = false;
 }
Пример #2
0
 public void SetFormClosing(bool state)
 {
     formClosing = state;
     if (formClosing)
     {
         if (DeviceInformation.emvConfigSupported)
         {
             Debug.WriteLine("DeviceCfg::DISCONNECTING FOR device TYPE={0}", IDT_Device.getDeviceType());
             Device.CloseDevice();
         }
     }
 }
Пример #3
0
 public override void CloseDevice()
 {
     if (Profile.deviceIsInitialized(IDT_DEVICE_Types.IDT_DEVICE_AUGUSTA, DEVICE_INTERFACE_Types.DEVICE_INTERFACE_USB))
     {
         Profile.closeDevice(IDT_DEVICE_Types.IDT_DEVICE_AUGUSTA, DEVICE_INTERFACE_Types.DEVICE_INTERFACE_USB);
     }
     //if (Profile.deviceIsInitialized(IDT_DEVICE_Types.IDT_DEVICE_AUGUSTA_KB, DEVICE_INTERFACE_Types.DEVICE_INTERFACE_USB))
     //{
     //    Profile.closeDevice(IDT_DEVICE_Types.IDT_DEVICE_AUGUSTA_KB, DEVICE_INTERFACE_Types.DEVICE_INTERFACE_USB);
     //}
     IDT_Device.stopUSBMonitoring();
 }
Пример #4
0
        /********************************************************************************************************/
        // DEVICE EVENTS INTERFACE
        /********************************************************************************************************/
        #region -- device event interface ---

        private void DeviceRemovedHandler()
        {
            Debug.WriteLine("\ndevice: removed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");

            connected = false;

            if (attached)
            {
                attached = false;

                // Last device was USDK Type
                if (useUniversalSDK)
                {
                    IDT_Device.stopUSBMonitoring();
                }

                // Unload Device Domain
                NotificationRaise(new DeviceNotificationEventArgs {
                    NotificationType = NOTIFICATION_TYPE.NT_UNLOAD_DEVICE_CONFIGDOMAIN
                });
            }
        }
Пример #5
0
        public void DeviceInit()
        {
            DevicePluginName = "DeviceCfg";

            // Device Discovery
            connected = false;

            // Create Device info object
            DeviceInformation = new DeviceInformation();

            try
            {
                // Initialize Device
                device = HidDevices.Enumerate(Device_IDTech.IDTechVendorID).FirstOrDefault();

                if (device != null)
                {
                    // Get Capabilities
                    Debug.WriteLine("");
                    Debug.WriteLine("device capabilities ----------------------------------------------------------------");
                    Debug.WriteLine("  Usage                          : " + Convert.ToString(device.Capabilities.Usage, 16));
                    Debug.WriteLine("  Usage Page                     : " + Convert.ToString(device.Capabilities.UsagePage, 16));
                    Debug.WriteLine("  Input Report Byte Length       : " + device.Capabilities.InputReportByteLength);
                    Debug.WriteLine("  Output Report Byte Length      : " + device.Capabilities.OutputReportByteLength);
                    Debug.WriteLine("  Feature Report Byte Length     : " + device.Capabilities.FeatureReportByteLength);
                    Debug.WriteLine("  Number of Link Collection Nodes: " + device.Capabilities.NumberLinkCollectionNodes);
                    Debug.WriteLine("  Number of Input Button Caps    : " + device.Capabilities.NumberInputButtonCaps);
                    Debug.WriteLine("  Number of Input Value Caps     : " + device.Capabilities.NumberInputValueCaps);
                    Debug.WriteLine("  Number of Input Data Indices   : " + device.Capabilities.NumberInputDataIndices);
                    Debug.WriteLine("  Number of Output Button Caps   : " + device.Capabilities.NumberOutputButtonCaps);
                    Debug.WriteLine("  Number of Output Value Caps    : " + device.Capabilities.NumberOutputValueCaps);
                    Debug.WriteLine("  Number of Output Data Indices  : " + device.Capabilities.NumberOutputDataIndices);
                    Debug.WriteLine("  Number of Feature Button Caps  : " + device.Capabilities.NumberFeatureButtonCaps);
                    Debug.WriteLine("  Number of Feature Value Caps   : " + device.Capabilities.NumberFeatureValueCaps);
                    Debug.WriteLine("  Number of Feature Data Indices : " + device.Capabilities.NumberFeatureDataIndices);

                    // Using the device notifier to detect device removed event
                    device.Removed        += DeviceRemovedHandler;
                    Device.OnNotification += OnNotification;

                    Device.Init(SerialPortService.GetAvailablePorts(), ref DeviceInformation.deviceMode);

                    // Notify Main Form
                    SetDeviceMode(DeviceInformation.deviceMode);

                    if (DeviceInformation.emvConfigSupported)
                    {
                        // Initialize Universal SDK
                        IDT_Device.setCallback(MessageCallBack);
                        //IDT_Device.setCallbackIP(MessageCallBackIP);
                        IDT_Device.startUSBMonitoring();
                        Debug.WriteLine("DeviceCfg::DeviceInit(): - device TYPE={0}", IDT_Device.getDeviceType());

                        NotificationRaise(new DeviceNotificationEventArgs {
                            NotificationType = NOTIFICATION_TYPE.NT_INITIALIZE_DEVICE, Message = new object[] { "COMPLETED" }
                        });
                    }
                    else
                    {
                        // connect to device
                        Device.Connect();
                    }
                    // Set as Attached
                    attached = true;
                }
                else
                {
                    throw new Exception("NoDevice");
                }
            }
            catch (Exception xcp)
            {
                throw xcp;
            }
        }