Skip to content

取 HID 厂商名

获取设备的 USB HID manufacturer string。

语法

cpp
class Device {
    Status getHIDManufacturerString(
        std::string& manufacturerString
    );
};
class Device {
    Status getHIDManufacturerString(
        std::string& manufacturerString
    );
};
e
类名基类公开备注
RX784设备
方法名返回值类型公开备注
取HID厂商名整数型
参数名类型参考可空数组备注
厂商名文本型
.版本 2 .程序集 RX784设备, , 公开 .子程序 取HID厂商名, 整数型, 公开 .参数 厂商名, 文本型, 参考
py
class Device:
    def get_hid_manufacturer_string(self) -> Tuple[Status, str]: ...
class Device:
    def get_hid_manufacturer_string(self) -> Tuple[Status, str]: ...

返回值

名称英文说明
状态码status成功返回
厂商名manufacturer string用于标识 USB HID 设备的制造商的名称。

示例

cpp
#include <iostream>
#include <string>
#include "rx784.hpp"

int main() {
    RX784::Device device;
    std::string manufacturerString, productString;

    device.open("COM1");

    device.getHIDManufacturerString(manufacturerString);
    device.getHIDProductString(productString);
    std::cout << "厂商名: " << manufacturerString << std::endl
              << "产品名: " << productString      << std::endl;

    device.close();
}
#include <iostream>
#include <string>
#include "rx784.hpp"

int main() {
    RX784::Device device;
    std::string manufacturerString, productString;

    device.open("COM1");

    device.getHIDManufacturerString(manufacturerString);
    device.getHIDProductString(productString);
    std::cout << "厂商名: " << manufacturerString << std::endl
              << "产品名: " << productString      << std::endl;

    device.close();
}
e
方法名返回值类型公开备注
_启动子程序整数型
变量名类型静态数组备注
设备RX784设备
厂商名文本型
产品名文本型
设备.打开 (“COM1”)
设备.取HID厂商名 (厂商名)
设备.取HID产品名 (产品名)
调试输出 (“厂商名”, 厂商名)
调试输出 (“产品名”, 产品名)
设备.关闭 ()
返回 (0)
.版本 2 .子程序 _启动子程序, 整数型 .局部变量 设备, RX784设备 .局部变量 厂商名, 文本型 .局部变量 产品名, 文本型 设备.打开 (“COM1”) 设备.取HID厂商名 (厂商名) 设备.取HID产品名 (产品名) 调试输出 (“厂商名”, 厂商名) 调试输出 (“产品名”, 产品名) 设备.关闭 () 返回 (0)
py
import rx784

device = rx784.Device()
device.open('COM1')

status, manufacturer_string = device.get_hid_manufacturer_string()
status, product_string = device.get_hid_product_string()
print('厂商名:', manufacturer_string)
print('产品名:', product_string)

device.close()
import rx784

device = rx784.Device()
device.open('COM1')

status, manufacturer_string = device.get_hid_manufacturer_string()
status, product_string = device.get_hid_product_string()
print('厂商名:', manufacturer_string)
print('产品名:', product_string)

device.close()