1# IUsbPortInterface 2 3 4## 概述 5 6**相关模块:**[HdiUsb](_hdi_usb_v2_0.md) 7 8 9## 汇总 10 11 12### Public 成员函数 13 14| 名称 | 描述 | 15| -------- | -------- | 16| [SetPortRole](#setportrole)([in] int portId, [in] int powerRole, [in] int dataRole) | 设置USB设备端口的角色。 | 17| [QueryPort](#queryport)([out] int portId, [out] int powerRole, [out] int dataRole, [out] int mode) | 查询USB设备端口的当前设置信息。 | 18| [QueryPorts](#queryports)([out] struct [UsbPort](_usb_port.md)[] portList) | 查询USB设备所有端口的当前设置信息。 | 19| [BindUsbdPortSubscriber](#bindusbdportsubscriber)([in] [IUsbdSubscriber](interface_i_usbd_subscriber.md) subscriber) | 绑定订阅者。 | 20| [UnbindUsbdPortSubscriber](#unbindusbdportsubscriber)([in] [IUsbdSubscriber](interface_i_usbd_subscriber.md) subscriber) | 解绑订阅者。 | 21 22 23## 成员函数说明 24 25 26### SetPortRole() 27 28``` 29IUsbPortInterface::SetPortRole([in] int portId, [in] int powerRole, [in] int dataRole) 30``` 31 32**描述** 33 34设置USB设备端口的角色。 35 36**起始版本:** 5.1 37 38**参数:** 39 40| 名称 | 描述 | 41| -------- | -------- | 42| portId | USB设备端口ID。 | 43| powerRole | 电源角色的值。 | 44| dataRole | 数据角色的值。 | 45 46**返回:** 47 480 表示操作成功。 49 50非零值 表示操作失败。 51 52 53### QueryPort() 54 55``` 56IUsbPortInterface::QueryPort([out] int portId, [out] int powerRole, [out] int dataRole, [out] int mode) 57``` 58 59**描述** 60 61查询USB设备端口的当前设置信息。 62 63**起始版本:** 5.1 64 65**参数:** 66 67| 名称 | 描述 | 68| -------- | -------- | 69| portId | USB设备端口ID。 | 70| powerRole | USB设备电源角色。 | 71| dataRole | USB设备数据角色。 | 72| mode | USB设备模式。 | 73 74**返回:** 75 760 表示操作成功。 77 78非零值 表示操作失败。 79 80 81### QueryPorts() 82 83``` 84IUsbPortInterface::QueryPorts([out] struct UsbPort[] portList); 85``` 86 87**描述** 88 89查询USB设备所有端口的当前设置信息。 90 91**起始版本:** 5.1 92 93**参数:** 94 95| 名称 | 描述 | 96| -------- | -------- | 97| portList | USB设备端口ID集合。 | 98 99**返回:** 100 1010 表示操作成功。 102 103非零值 表示操作失败。 104 105 106### BindUsbdPortSubscriber() 107 108``` 109IUsbPortInterface::BindUsbdPortSubscriber([in] IUsbdSubscriber subscriber) 110``` 111 112**描述** 113 114绑定订阅者。 115 116**起始版本:** 5.1 117 118**参数:** 119 120| 名称 | 描述 | 121| -------- | -------- | 122| subscriber | 订阅者信息,详见[IUsbdSubscriber](interface_i_usbd_subscriber.md)。 | 123 124**返回:** 125 1260 表示操作成功。 127 128非零值 表示操作失败。 129 130 131### UnbindUsbdPortSubscriber() 132 133``` 134IUsbPortInterface::UnbindUsbdPortSubscriber([in] IUsbdSubscriber subscriber); 135``` 136 137**描述** 138 139解绑订阅者。 140 141**起始版本:** 5.1 142 143**参数:** 144 145| 名称 | 描述 | 146| -------- | -------- | 147| subscriber | 订阅者信息,详见[IUsbdSubscriber](interface_i_usbd_subscriber.md)。 | 148 149**返回:** 150 1510 表示操作成功。 152 153非零值 表示操作失败。 154