目前我正在为大学做一个项目,我必须创建一个程序来控制玻璃容器中的湿度。为此,我有一个湿度计。
首先,程序必须从湿度计导入原始数据,但我不知道它是如何工作的。文档说它有一个 USB 接口,但我只能找到如何解析原始数据的方法。我还给销售这种湿度计的公司写了一封电子邮件。他们说有一个外部软件可以导入和处理这些数据。但是我不允许使用外部软件。因此我被迫直接从 USB 端口读取原始数据。我尝试使用 usb4java,但我只能找到所有连接的 USB 设备。我不知道如何继续。请帮我 文档 文档
下面的代码
public class DumpDevices
{
/**
* Dumps the specified USB device to stdout.
*
* @param device
* The USB device to dump.
*/
private static void dumpDevice(final UsbDevice device)
{
// Dump information about the device itself
System.out.println(device);
final UsbPort port = device.getParentUsbPort();
if (port != null)
{
System.out.println("Connected to port: " + port.getPortNumber());
System.out.println("Parent: " + port.getUsbHub());
}
// Dump device descriptor
System.out.println(device.getUsbDeviceDescriptor());
// Process all …Run Code Online (Sandbox Code Playgroud)