17enum class DFURequest : uint8_t
31enum class DFUState : uint8_t
36 DFU_DNLOAD_SYNC = 0x03,
38 DFU_DNLOAD_IDLE = 0x05,
39 DFU_MANIFEST_SYNC = 0x06,
41 DFU_MANIFEST_WAIT_RESET = 0x08,
42 DFU_UPLOAD_IDLE = 0x09,
49enum class DFUStatusCode : uint8_t
56 ERR_CHECK_ERASED = 0x05,
66 ERR_STALLEDPKT = 0x0F,
74 bool can_download =
true;
75 bool can_upload =
true;
76 bool manifestation_tolerant =
true;
77 bool will_detach =
false;
78 uint16_t detach_timeout_ms = 1000u;
79 uint16_t transfer_size = 1024u;
97 const char* interface_string,
const char* webusb_landing_page_url =
nullptr,
98 uint8_t webusb_vendor_code = LibXR::USB::WebUsb::WEBUSB_VENDOR_CODE_DEFAULT)
99 : interface_string_(interface_string),
100 webusb_cap_(webusb_landing_page_url, webusb_vendor_code)
106 return (local_interface_index == 0u) ? interface_string_ :
nullptr;
113 return (index == 0u && webusb_cap_.
Enabled()) ? &webusb_cap_ :
nullptr;
116 uint8_t interface_num_ = 0u;
117 uint8_t current_alt_setting_ = 0u;
118 bool inited_ =
false;
121 const char* interface_string_ =
nullptr;
BOS 能力接口 / BOS capability interface.
USB 设备类接口基类 / USB device class interface base.
DFU 单接口类公共基类 / Common base for single-interface DFU classes.
const char * GetInterfaceString(size_t local_interface_index) const override
返回本类暴露的第 N 个接口字符串 Return the string for the Nth local interface exposed by this class.
size_t GetBosCapabilityCount() override
返回本类提供的 BOS capability 数量 Return the number of BOS capabilities exposed by this class.
BosCapability * GetBosCapability(size_t index) override
返回指定 BOS capability Return the BOS capability at the given index.
WebUSB BOS 能力包装器 / WebUSB BOS capability wrapper.
bool Enabled() const
当前是否启用 WebUSB / Whether WebUSB is currently enabled
@ OK
操作成功 | Operation successful
DFU 功能能力集合 / DFU functional capability set.