Skip to content

Commit cd3cff3

Browse files
committed
Wire up isochronous fns
1 parent b87cffe commit cd3cff3

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/webusb_device.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,12 @@ impl UsbDevice {
500500
}
501501

502502
#[napi(js_name = "nativeIsochronousTransferIn", ts_return_type = "Promise<USBIsochronousInTransferResult>")]
503-
pub async fn isochronousTransferIn(&self, _endpointNumber: u8, _packetLengths: Vec<u32>) -> Result<()> {
503+
pub async fn isochronousTransferIn(&self, _endpointNumber: u8, _packetLengths: Vec<u32>, _timeout: u32) -> Result<()> {
504504
Err(napi::Error::from_reason("isochronousTransferIn error: method not implemented"))
505505
}
506506

507507
#[napi(js_name = "nativeIsochronousTransferOut", ts_return_type = "Promise<USBIsochronousOutTransferResult>")]
508-
pub async fn isochronousTransferOut(&self, _endpointNumber: u8, _data: Uint8Array, _packetLengths: Vec<u32>) -> Result<()> {
508+
pub async fn isochronousTransferOut(&self, _endpointNumber: u8, _data: Uint8Array, _packetLengths: Vec<u32>, _timeout: u32) -> Result<()> {
509509
Err(napi::Error::from_reason("isochronousTransferOut error: method not implemented"))
510510
}
511511

tsc/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ UsbDevice.prototype.transferOut = async function (endpointNumber: number, data:
6868
/**
6969
* Hidden
7070
*/
71-
UsbDevice.prototype.isochronousTransferIn = async function (_endpointNumber: number, _packetLengths: number[]): Promise<USBIsochronousInTransferResult> {
72-
throw new Error('isochronousTransferIn error: method not implemented');
71+
UsbDevice.prototype.isochronousTransferIn = async function (endpointNumber: number, packetLengths: number[], timeout = DEFAULT_TIMEOUT): Promise<USBIsochronousInTransferResult> {
72+
const res = await this.nativeIsochronousTransferIn(endpointNumber, packetLengths, timeout);
73+
return res;
7374
}
7475

7576
/**
7677
* Hidden
7778
*/
78-
UsbDevice.prototype.isochronousTransferOut = async function (_endpointNumber: number, _data: BufferSource, _packetLengths: number[]): Promise<USBIsochronousOutTransferResult> {
79-
throw new Error('isochronousTransferOut error: method not implemented');
79+
UsbDevice.prototype.isochronousTransferOut = async function (endpointNumber: number, data: BufferSource, packetLengths: number[], timeout = DEFAULT_TIMEOUT): Promise<USBIsochronousOutTransferResult> {
80+
const res = await this.nativeIsochronousTransferOut(endpointNumber, toUint8Array(data), packetLengths, timeout);
81+
return res;
8082
}
8183

8284
/**

0 commit comments

Comments
 (0)