简体   繁体   中英

Implement multiple hardware interfaces in WPF Desktop App

I want to make a Desktop application with WPF(.net 5). In this application, I want to connect various hardware devices(sometimes simultaneously) via a USB port, Serial ports/Com port (eg RS232), etc.

I want the application to talk both ways. Receiving data from hardware devices with a range of configurations(ie baud rate, frequency, data string), and Sending data to display, modify settings of the device.

I don't have any idea about where to start in WPF | .NET | C#. Are there any inbuilt classes, APIs to achieve this?

There is the Serial port class in.Net, but you might want to read some criticism about the class before using it. There are also libraries available to communicate over USB .

But these are fairly low level protocols that does not know what kind of device is on the other end. So your UI would therefore also need to low level, ie send/receive raw data. And this would mostly be useful for expert users using very specialized devices. While you could probably make the part that sends and receive data share an interface for both USB and Serial, connection and setup would probably need to be handled differently, since these are handled differently for serial and USB.

If you want a easier to use UI you would need to know more about what kind of device it it. There is a number of standardized USB device classes that specify what kind of device it is, and there are often high level APIs to interface with these devices. But that would require coding a module for each individual device class.

So I would recommend to start with figuring out what you really want to do? Connect to a IO board with some general purpose IO pins? Connect to some specialized device like a PanTilt unit? Read data from a webcam? Read some data from some kind of sensor, do some processing and control some kind of output device?

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