简体   繁体   中英

c# Detect incoming data from usb port

Hi I'm working on a project using a fingerprint reader. I would like to know if there is any way to detect incoming data from that device, what I want to do is: When data detected from the fingerprint reader show a form(the form show data from the user detected), but I been searching for methods, and all of them use libraries, if there any way to solve it, without libraries? Thanks.

The reader is a U.are.U. 4500, in using their SDK, but there is any method that check is the fingerprint reader is sending data.

I download LibUSB.net, I would to know if I can solve this problem using this librarie.

It sounds like you need something like this:

// event handler
protected void ScanDetected(sender object, args e)
{
    Fingerprint fp = //data received
    RespondToScan(fp);
}

internal void RespondToScan(Fingerprint _fp)
{
   Person who = GetPersonWithFingerprint(_fp);
   PersonForm pf = new PersonForm(who);
   pf.ShowDialog();
}

internal Person GetPersonWithFingerprint(Fingerprint _fp)
{
    Person person = null;
    if (lotsOfSquigglyLinesAndSuch)
    {
       person = new Person();
       person.FirstName = "John";
       person.LastName = "Dillinger";
       . . .
    }
    else if (someOtherCharacteristic)
    {
       . . .
    }
    return person;
}

// Form that will be invoked and display user's data:
class PersonForm: Form
. . .
string _firstname;
string _lastname;
public PersonForm(Person person)
{
    _firstname = person.FirstName;
    . . .             
}

private void FormShow(sender object, eventargs e)
{
    textboxFirstName.Text = _firstName;
    . . .  
}

// class to hold data
public class Person
{
    string FirstName { get; set; }
    string LastName { get; set; }
    Picture Mugshot { get; set; }
    . . .
}

This, of course, is just pseudocode to give you a general idea of how to proceed - provided I understand your situation correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM