mirror of https://github.com/rusefi/usb4java.git
Implemented pipe events.
This commit is contained in:
parent
33a215b319
commit
ea6b8cc5b4
|
@ -181,6 +181,7 @@ final class PipeQueueProcessor extends Thread
|
||||||
irp.setUsbException(e);
|
irp.setUsbException(e);
|
||||||
}
|
}
|
||||||
irp.complete();
|
irp.complete();
|
||||||
|
this.pipe.sendEvent(irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ import javax.usb.UsbNotActiveException;
|
||||||
import javax.usb.UsbNotClaimedException;
|
import javax.usb.UsbNotClaimedException;
|
||||||
import javax.usb.UsbNotOpenException;
|
import javax.usb.UsbNotOpenException;
|
||||||
import javax.usb.UsbPipe;
|
import javax.usb.UsbPipe;
|
||||||
|
import javax.usb.event.UsbPipeDataEvent;
|
||||||
|
import javax.usb.event.UsbPipeErrorEvent;
|
||||||
import javax.usb.event.UsbPipeListener;
|
import javax.usb.event.UsbPipeListener;
|
||||||
import javax.usb.util.DefaultUsbControlIrp;
|
import javax.usb.util.DefaultUsbControlIrp;
|
||||||
import javax.usb.util.DefaultUsbIrp;
|
import javax.usb.util.DefaultUsbIrp;
|
||||||
|
@ -384,6 +386,26 @@ final class UsbPipeImpl implements UsbPipe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends event to all event listeners.
|
||||||
|
*
|
||||||
|
* @param irp
|
||||||
|
* Then request package
|
||||||
|
*/
|
||||||
|
|
||||||
|
void sendEvent(final UsbIrp irp)
|
||||||
|
{
|
||||||
|
if (irp.isUsbException())
|
||||||
|
{
|
||||||
|
this.listeners.errorEventOccurred(new UsbPipeErrorEvent(this, irp));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.listeners.dataEventOccurred(new UsbPipeDataEvent(this, irp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the request packet queue.
|
* Returns the request packet queue.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue