On Wed, Feb 4, 2009 at 3:07 PM, Yukang Guo <[email protected]> wrote:
> Hi Everyone,
>
> I have two questions,
>
> 1) Compared to synchorous UsbPipe submission using byte[], is multiple
> buffers submission of UsbIrp interface really more suitable for sending
> large amount of data  in high speed?

Absolutely - you have to use multiple simultaneous async submissions
to get high throughput.

>
> 2) If the answer to Q1 is yes, is there any example for multiple buffers
> submission for UsbIrp interface available, which I could follow?

In simple psuedocode,

pipe.addUsbPipeListener(myUsbIrpListener);
while (bytesLeftToSend > 0)
  pipe.asyncSubmit(createNewUsbIrpWithNextDataSection());


asyncSubmit should not throw an Exception under normal circumstances,
but it's possible so you should add a handler.
All the results of the submissions will come back to your listener in
an ordered manner.

If you want to send data continuously and not just a single buffer
occasionally, you can send N UsbIrps (pick any number that is good for
you) and use the listener callback to resubmit more data.  So in the
completeion handler of the listener, do something like

handleResultsOfCompletedUsbIrpIfYouNeedTo();
pipe.asyncSubmit(createNewUsbIrpWithNextDataSection());

and of course add an exception handler.  You should also handle failed
transfers in the listener, although in my experience transfer failures
typically mean either you sent the wrong data, or some low level
problem happened that you really can't recover from without
re-initializing the device or interface.


>
> 3) Does multiple buffers submission of UsbIrp mean  submit  multiple buffers
> once per submission for one UsbIrp or submit single buffer once per
> submission for several UsbIrp under one UsbPipe?

Not sure if I understand what you are asking, but if you mean multiple
buffers per UsbIrp, that isn't possible, so no.  You submit one buffer
per UsbIrp.  You create multple UsbIrps, set the data on them, and
submit all of them to UsbIrp.  You can use a single large buffer if
you want across multiple UsbIrps, by using the offset and length
parameters.

>
> Since I am newbie in Java programming for USB device, so the questions above
> might be not very professional. Any advice is highly appreciated! Thanks in
> advance!
>
> Yukang
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> javax-usb-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/javax-usb-devel
>
>

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
javax-usb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/javax-usb-devel

Reply via email to