The SrmSetWakeupHandler (note it is an interrupt task so needs be
small) is the way of doing this kind of thing.
However, if he just needs to do data gathering without handshaking, he
can simply allocate just under 64k to the serial buffer and only wake
up when it is likely to be just about full.
Even the older serial API allowed you to set the input buffer, and
thus the size. So just allocate a huge buffer, and check it
periodically. I've done this in similar situations where latency
wasn't a problem. I'd even check how many characters arrived and not
bother until it was over 1/2 full since the loop that processed things
would be more efficient (though if you don't process events, and it
takes time, the UI will feel sticky).
On Thu, Dec 07, 2000 at 11:44:21AM -0500, Gregory S Hayes (LMC) wrote:
> Haven't tried this but...
>
> Have you looked at using SrmSetWakeupHandler?
>
> You could register a function to:
> Read the serial buffer and copy data to a safe place,
> Send a user message/event to your main loop,
> Re-register and quit
> (Remember this acts like an ISR, and should be as short as possible)
>
> Your main loop can pick up the message and handle the new data, or if you
> don't want to have to wait for messages, can poll (eugh) a buffer index
> waiting for changes.
>
> Hope this helps,
>
> Greg.
>
> > -----Original Message-----
> > From: Steve Stover [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, December 07, 2000 1:27 PM
> > To: Palm Developer Forum
> > Subject: RE: [W] Multiple Threads under Codewarrior
> >
> > Can't do the getevent timeout - I have asynch data coming in an RS-232
> > port.
> >
> > Looks like this will be a "quick and dirty"...
>
> >
> > Ah, the joys of "real time" code :)
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]] On Behalf Of Richard
> > Anderson
> > Sent: Thursday, December 07, 2000 8:05 AM
> > To: Palm Developer Forum
> > Subject: RE: [W] Multiple Threads under Codewarrior
> >
> > If you setup you main event loop to send nil events at least every second
> > (timeout in get event) you can check the time then every five seconds call
> > your routine or post yourself an event. Theres lots of stuff about timing
> > in
> > the archives, but not much in the manuals.
> >
> > Rik
> >
> > > -----Original Message-----
> > > From: Steve Stover [SMTP:[EMAIL PROTECTED]]
> > > Sent: 07 December 2000 17:46
> > > To: Palm Developer Forum
> > > Subject: RE: [W] Multiple Threads under Codewarrior
> > >
> > > Cool, but...
> > >
> > > I have a data collection routine that operates at (relatively) long
> > > intervals. It would be nice if I could say
> > > Get Data;
> > > Sleep(5sec)
> > > Repeat
> > > And keep it separate from the other code.
> > >
> > > If I understand your event queue correctly, I still need the main loop
> > to
> > > calculate timing somehow, and a running (or idling) event loop to handle
> > > the
> > > special event. Or is there some way to call a specific event handler
> > when
> > > needed? But that wouldn't buy me anything I don't already have. It's
> > the
> > > timing calculation that would be simplified in a separate thread, to run
> > > different parts of the code at different rates...
> > >
> > > Am I missing the point?
> > <snip>
> >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> > please see http://www.palmos.com/dev/tech/support/forums/
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palmos.com/dev/tech/support/forums/
--
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/