How to Read and Write to RFID as Human Interface Device C#

Viewed 247

Am trying to read/write to card using RFID reader, but the RFID reader is appearing under Human Interface Device, so far I have been able to get all Human Interface Devices into a DropDownlist using HidLibrary here is my code:

  HidDevice[] mahdDevices;
    private void Form1_Load(object sender, EventArgs e)
    {
        mahdDevices = HidDevices.Enumerate().ToArray();
        
        for (int i = 0; i < mahdDevices.Length; i++)
        {
            cmbDevices.Items.Add(mahdDevices[i].Description);
        }
    }

But now am not sure of how to send and receive data from the HID selected on the drop downlist, I also checked Hardware IDs of RFID device in properties i Found:

HID\VID_9915&PID_1116&REV_0120, HID\VID_9915&PID_1116, HID\VID_9915&UP:85FF_U:0001, HID_DEVICE_UP:85FF_U0001, HID_DEVICE.

No idea on what to do with the IDs or how to communicate with HID devices, this is how i usually communicate with devices using serial port:

  _port = new SerialPort();
        _port.PortName = comboBox2.Text;
        _port.BaudRate = 9600;
        _port.Parity = Parity.None;
        _port.DataBits = 8;
        _port.StopBits = StopBits.One;

        if (_port.IsOpen)
        {
            textBox1.Clear();
        }
        else
        {
            _port.Close();
        }
        _port.DataReceived += new SerialDataReceivedEventHandler(RFID_DataReceiver);
       

Please I need help communicating with HIDs.

0 Answers
Related