oops, I left a line of code out in the code listing below.
Use this one instead.
Thanks,
Brad
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 )
{
unsigned char testBuffer[ 50 ];
MemMove( testBuffer, buffer, 50 );
// 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" );
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/