All,
I have a simple question (I think).
I have my palm m515 connect to my computers serial port. I have written a
simple windows app to send data to the palm via the serial port.
In my palm code I setup my serial port to call a WakeupHandler whenever it
receives 50 bytes on the serial port. It is calling my handler every time I
send data from my PC.
However, I can only send data 10 times and then my palm crashes.
I have the serial port opened with the default buffer of 512 bytes. I am
sending 50 bytes of data each time, so on the 11th send, the palm crashes.
Obviously, the buffer is filling up. I don't understand why. Here is my
code in the event handler.
void SerialDataEventHandler( UInt32 portID )
{
// We know that we have atleast 50 bytes of data available, so lets
// get it directly out of the UART receive buffer.
unsigned char *buffer = NULL;
UInt32 bytesAvailable = 0;
Err error = SrmReceiveWindowOpen( portID, &buffer, &bytesAvailable );
if ( error == errNone )
{
// Close the UART buffer and tell it how much data we read.
error = SrmReceiveWindowClose( portID, 50 );
if ( error != errNone )
{
ErrDisplay( "Failed to close window" );
}
}
else
{
ErrDisplay( "Cannot read serial port" );
}
// We always need to prime the port so that it can call
// our function.
error = SrmPrimeWakeupHandler( portID, 50 );
if ( error != errNone )
ErrDisplay( "Failed to prime wakeup handler" );
}
I am not doing anything but reading in 50 bytes, closing the window and
re-priming the event handler. Am I missing something totally obvious?
Thanks,
Brad
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/