Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reading from an interrupt Endpoint with USB fxs



Here is the code (without declarations or error printouts)
that I am using to read from the interrupt driven USB input.

I have been reading apple's info on runloops, and I
recognize the steps, create a source, add the source to the
Runloop, Request a block of data asynchronously, and start
the runloop.

I did not find information on the callback function. As far
as I can tell, it runs only once (I only get one printout),
for some reason, argo has the number of buffer points read,
and then CFRunloopStop stops the runloop and I can access my
data in gbuffer.

the last argument of readpipeasync is passed to the callback
fx, I assume it is the callbackfunction argument arg0?

My main question is, right now I am acquiring data for 5mn,
I should be able to plot the data as it is acquired. Where
do I put the plotting code? How do I make sure accessing
the data to plot it does not disturb the buffer just when
data is being added to it? How do I know how much data has
been acquired at any one point.

If this is basic, can you tell me what words I should use to
search apple's documents.

thank you for your help

anne

void MyCallBackFunction(void *dummy, IOReturn result, void
*arg0)
{
printf("MyCallbackfunction: %d, %d, %d\n", (int)dummy, (int)result, (int)arg0);
CFRunLoopStop(CFRunLoopGetCurrent());
}


void transferData(IOUSBInterfaceInterface **intf, UInt8
inPipeRef)
{
numBytesRead = sizeof(gBuffer);
err = (*intf)->CreateInterfaceAsyncEventSource(intf, &cfSource);
CFRunLoopAddSource(CFRunLoopGetCurrent(), cfSource,
kCFRunLoopDefaultMode);
err = (*intf)->ReadPipeAsync(intf, inPipeRef, gBuffer,
numBytesRead, (IOAsyncCallback1)MyCallBackFunction,
(void*)(UInt32)inPipeRef);
CFRunLoopRun();
...
// at this point gbuffer has all the data requested.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden

References: 
 >Re: reading from an interrupt Endpoint with USB fxs (From: David Ferguson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.