1 Star 0 Fork 4K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.usb.d.ts 29.04 KB
一键复制 编辑 原始数据 按行查看 历史
秦际红 提交于 2024-07-05 14:06 +08:00 . add @type 
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit BasicServicesKit
*/
/**
* @namespace usb
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
* @useinstead ohos.usbManager
*/
declare namespace usb {
/**
* Obtains the USB device list.
*
* @returns { Array<Readonly<USBDevice>> } USB device list.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function getDevices(): Array<Readonly<USBDevice>>;
/**
* Connects to the USB device based on the device information returned by getDevices().
*
* @param { USBDevice } device - USB device on the device list returned by getDevices().
* @returns { Readonly<USBDevicePipe> } object for data transfer.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function connectDevice(device: USBDevice): Readonly<USBDevicePipe>;
/**
* Checks whether the application has the permission to access the device.
*
* @param { string } deviceName - device name defined by USBDevice.name.
* @returns { boolean } indicates if the user has the permission to access the device.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function hasRight(deviceName: string): boolean;
/**
* Requests the temporary permission for a given application to access the USB device.
*
* @param { string } deviceName - device name defined by USBDevice.name.
* @returns { Promise<boolean> } indicates if the device access permissions are granted.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function requestRight(deviceName: string): Promise<boolean>;
/**
* Converts the string descriptor of a given USB function list to a numeric mask combination.
*
* @param { string } funcs - descriptor of the supported function list.
* @returns { number } the numeric mask combination of the function list.
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
function usbFunctionsFromString(funcs: string): number;
/**
* Converts the numeric mask combination of a given USB function list to a string descriptor.
*
* @param { FunctionType } funcs - numeric mask combination of the function list.
* @returns { string } - descriptor of the supported function list.
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
function usbFunctionsToString(funcs: FunctionType): string;
/**
* Sets the current USB function list in Device mode.
*
* @param { FunctionType } funcs - numeric mask combination of the supported function list.
* @returns { Promise<boolean> } returns **true** if the setting is successful; returns **false** otherwise.
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
function setCurrentFunctions(funcs: FunctionType): Promise<boolean>;
/**
* Obtains the numeric mask combination for the current USB function list in Device mode.
*
* @returns { FunctionType } the numeric mask combination for the current USB function list in FunctionType.
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
function getCurrentFunctions(): FunctionType;
/**
* Obtains the USBPort list.
*
* @returns { Array<USBPort> } the USBPort list.
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
function getPorts(): Array<USBPort>;
/**
* Gets the mask combination for the supported mode list of the specified USBPort.
*
* @param { number } portId
* @returns { PortModeType } the mask combination for the supported mode list in PortModeType.
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
function getSupportedModes(portId: number): PortModeType;
/**
* Sets the role types supported by the specified USBPort, which can be powerRole (for charging) and dataRole (for data transfer).
*
* @param { number } portId - unique ID of the port.
* @param { PowerRoleType } powerRole - charging role.
* @param { DataRoleType } dataRole - data role.
* @returns { Promise<boolean> } returns **true** if the setting is successful; returns **false** otherwise.
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<boolean>;
/* usb pipe functions begin */
/**
* Claims a USB interface.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the bus number and device address.
* @param { USBInterface } iface - USB interface , which is used to determine the interface to claim.
* @param { boolean } [force] - optional parameter that determines whether to forcibly claim the USB interface.
* @returns { number } returns **0** if the USB interface is successfully claimed; returns an error code otherwise.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number;
/**
* Releases a USB interface.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the bus number and device address.
* @param { USBInterface } iface - USB interface , which is used to determine the interface to release.
* @returns { number } returns **0** if the USB interface is successfully released; returns an error code otherwise.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number;
/**
* Sets the device configuration.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the bus number and device address.
* @param { USBConfig } config - device configuration.
* @returns { number } returns **0** if the device configuration is successfully set; returns an error code otherwise.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number;
/**
* Sets a USB interface.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the bus number and device address.
* @param { USBInterface } iface - USB interface , which is used to determine the interface to set.
* @returns { number } returns **0** if the USB interface is successfully set; return an error code otherwise.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function setInterface(pipe: USBDevicePipe, iface: USBInterface): number;
/**
* Obtains the raw USB descriptor.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the bus number and device address.
* @returns { Uint8Array } returns the raw descriptor data.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function getRawDescriptor(pipe: USBDevicePipe): Uint8Array;
/**
* Obtains the file descriptor.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the USB device.
* @returns { number } returns the file descriptor of the USB device.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function getFileDescriptor(pipe: USBDevicePipe): number;
/**
* Performs control transfer.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the USB device.
* @param { USBControlParams } controlparam - control transfer parameters.
* @param { number } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout.
* @returns { Promise<number> } returns the size of the transmitted or received data block if the control transfer is successful;
* return -1 if an exception occurs.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise<number>;
/**
* Performs bulk transfer.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the USB device.
* @param { USBEndpoint } endpoint - USB endpoint, which is used to determine the USB port for data transfer.
* @param { Uint8Array } buffer - buffer for writing or reading data.
* @param { number } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout.
* @returns { Promise<number> } the size of the transmitted or received data block if the control transfer is successful;
* return -1 if an exception occurs.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function bulkTransfer(
pipe: USBDevicePipe,
endpoint: USBEndpoint,
buffer: Uint8Array,
timeout?: number
): Promise<number>;
/**
* Closes a USB device pipe.
*
* @param { USBDevicePipe } pipe - device pipe , which is used to determine the USB device.
* @returns { number } returns **0** if the USB device pipe is closed successfully; return an error code otherwise.
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
function closePipe(pipe: USBDevicePipe): number;
/**
* Represents the USB endpoint from which data is sent or received. You can obtain the USB endpoint through USBInterface.
*
* @typedef USBEndpoint
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interface USBEndpoint {
/**
* Endpoint address
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
address: number;
/**
* Endpoint attributes
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
attributes: number;
/**
* Endpoint interval
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interval: number;
/**
* Maximum size of data packets on the endpoint
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
maxPacketSize: number;
/**
* Endpoint direction
*
* @type { USBRequestDirection }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
direction: USBRequestDirection;
/**
* Endpoint number
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
number: number;
/**
* Endpoint type
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
type: number;
/**
* Unique ID defined by {@link USBInterface.id}, which indicates the interface to which the endpoint belongs
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interfaceId: number;
}
/**
* Represents a USB interface. One config can contain multiple **USBInterface** instances, each providing a specific function.
*
* @typedef USBInterface
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interface USBInterface {
/**
* Unique ID of the USB interface
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
id: number;
/**
* Interface protocol
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
protocol: number;
/**
* Device type
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
clazz: number;
/**
* Device subclass
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
subClass: number;
/**
* Alternation between descriptors of the same USB interface
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
alternateSetting: number;
/**
* Interface name
*
* @type { string }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
name: string;
/**
* USBEndpoint that belongs to the USB interface
*
* @type { Array<USBEndpoint> }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
endpoints: Array<USBEndpoint>;
}
/**
* USB configuration. One USBDevice can contain multiple USBConfig instances.
*
* @typedef USBConfig
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interface USBConfig {
/**
* Unique ID of the USB configuration
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
id: number;
/**
* Configuration attributes
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
attributes: number;
/**
* Maximum power consumption, in mA
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
maxPower: number;
/**
* Configuration name, which can be left empty
*
* @type { string }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
name: string;
/**
* Support for remote wakeup
*
* @type { boolean }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
isRemoteWakeup: boolean;
/**
* Support for independent power supplies
*
* @type { boolean }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
isSelfPowered: boolean;
/**
* Supported interface
*
* @type { Array<USBInterface> }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interfaces: Array<USBInterface>;
}
/**
* Represents a USB device.
*
* @typedef USBDevice
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interface USBDevice {
/**
* Bus address
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
busNum: number;
/**
* Device address
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
devAddress: number;
/**
* Device SN
*
* @type { string }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
serial: string;
/**
* Device name
*
* @type { string }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
name: string;
/**
* Device manufacturer
*
* @type { string }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
manufacturerName: string;
/**
* Product information
*
* @type { string }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
productName: string;
/**
* Product version
*
* @type { string }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
version: string;
/**
* Vendor ID
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
vendorId: number;
/**
* Product ID
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
productId: number;
/**
* Device class
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
clazz: number;
/**
* Device subclass
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
subClass: number;
/**
* Device protocol code
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
protocol: number;
/**
* Device configuration descriptor information
*
* @type { Array<USBConfig> }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
configs: Array<USBConfig>;
}
/**
* Represents a USB device pipe, which is used to determine the USB device.
*
* @typedef USBDevicePipe
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interface USBDevicePipe {
/**
* Bus address.
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
busNum: number;
/**
* Device address
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
devAddress: number;
}
/**
* Enumerates power role types.
*
* @enum { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
export enum PowerRoleType {
/**
* None
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
NONE = 0,
/**
* External power supply
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
SOURCE = 1,
/**
* Internal power supply
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
SINK = 2
}
/**
* Enumerates data role types.
*
* @enum { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
export enum DataRoleType {
/**
* None
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
NONE = 0,
/**
* Host mode
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
HOST = 1,
/**
* Device mode
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
DEVICE = 2
}
/**
* Enumerates port mode types
*
* @enum { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
export enum PortModeType {
/**
* None
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
NONE = 0,
/**
* Upstream facing port, which functions as the sink of power supply
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
UFP = 1,
/**
* Downstream facing port, which functions as the source of power supply
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
DFP = 2,
/**
* Dynamic reconfiguration port (DRP), which can function as the DFP (host) or UFP (device). It is not supported currently.
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
DRP = 3,
/**
* Not supported currently
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
NUM_MODES = 4
}
/**
* Enumerates USB device port roles.
*
* @typedef USBPortStatus
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
interface USBPortStatus {
/**
* USB mode
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
currentMode: number;
/**
* Power role
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
currentPowerRole: number;
/**
* Data role
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
currentDataRole: number;
}
/**
* Represents a USB device port.
*
* @typedef USBPort
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
interface USBPort {
/**
* Unique ID of the USB port
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
id: number;
/**
* Mask combination for the supported mode list of the USB port
*
* @type { PortModeType }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
supportedModes: PortModeType;
/**
* USB port role
*
* @type { USBPortStatus }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
status: USBPortStatus;
}
/**
* Represents control transfer parameters.
*
* @typedef USBControlParams
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
interface USBControlParams {
/**
* Request type
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
request: number;
/**
* Request target type
*
* @type { USBRequestTargetType }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
target: USBRequestTargetType;
/**
* Control request type
*
* @type { USBControlRequestType }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
reqType: USBControlRequestType;
/**
* Request parameter value
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
value: number;
/**
* Index of the parameter value
*
* @type { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
index: number;
/**
* Data written to or read from the buffer
*
* @type { Uint8Array }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
data: Uint8Array;
}
/**
* Enumerates USB request target types.
*
* @enum { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
export enum USBRequestTargetType {
/**
* USB device
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_TARGET_DEVICE = 0,
/**
* USB interface
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_TARGET_INTERFACE = 1,
/**
* Endpoint
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_TARGET_ENDPOINT = 2,
/**
* Others
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_TARGET_OTHER = 3
}
/**
* Enumerates control request types.
*
* @enum { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
export enum USBControlRequestType {
/**
* Standard
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_TYPE_STANDARD = 0,
/**
* Class
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_TYPE_CLASS = 1,
/**
* Vendor
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_TYPE_VENDOR = 2
}
/**
* Enumerates request directions.
*
* @enum { number }
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
export enum USBRequestDirection {
/**
* Request for writing data from the host to the device
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_DIR_TO_DEVICE = 0,
/**
* Request for reading data from the device to the host
*
* @syscap SystemCapability.USB.USBManager
* @since 8
* @deprecated since 9
*/
USB_REQUEST_DIR_FROM_DEVICE = 0x80
}
/**
* Enumerates function modes.
*
* @enum { number }
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
export enum FunctionType {
/**
* None
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
NONE = 0,
/**
* Serial port device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
ACM = 1,
/**
* Ethernet port device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
ECM = 2,
/**
* HDC device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
HDC = 4,
/**
* MTP device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
MTP = 8,
/**
* PTP device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
PTP = 16,
/**
* RNDIS device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
RNDIS = 32,
/**
* MIDI device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
MIDI = 64,
/**
* Audio source device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
AUDIO_SOURCE = 128,
/**
* NCM device
*
* @syscap SystemCapability.USB.USBManager
* @systemapi
* @since 9
* @deprecated since 9
*/
NCM = 256
}
}
export default usb;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助