> > did you try setting your timeout to a non -1 number? if the problem
> > is with SrmRecieveCheck(), bypassing it with a small timeout value
> > could solve your problems as well.
>
> Yes.  I have tried multiple timeout values.  SrmReceiveCheck() does
> not return until at least 8 bytes are in the buffer.

are you saying it thread blocks, or, doesn't return a value until there
are 8 bytes? to quickly test this, try this small adjustment.

  // Find out if we have bytes in the queue
  serNumBytes = 0;
  error = SrmReceiveCheck(m_serRefNum, &serNumBytes);

  if ((!error) && (serNumBytes))
  {
    char serNumBytesChar = serNumBytes + 0x30;  // convert to ASCII
    FrmCustomAlert(DebugAlert, &serNumBytesChar, NULL, NULL);

    // Clear the buffer
    MemSet(m_serUARTBuffer, SER_BUFF_SIZE, 0);

    // If more bytes are available in UART buffer than we have in the
    // serial message buffer, only get what we have room for.
    if(serNumBytes > 512)
      serNumBytes = 512;

    // Grab bytes from the UART buffer
    serNumBytes = SrmReceive(m_serRefNum, m_serUARTBuffer, serNumBytes, -1,
&error);

  }

that will tell you if it is actually waiting for 8 bytes to come in
specifically on the SrmReceiveCheck before returning, or, if it waits
for 8 bytes before actually telling you there are some bytes available.

as for your 'expert' advice, the one guy i know who could answer your
question specifically (who was introduced to me as "mr. serial manager")
probably doesn't work at palm/palmsource anymore due to recent layoffs :(

i am sure many other people here would love to know their expert
solution to this problem; it seems you were not the only one with
the problem.

[digging up old code]

i found some old code that would grab one byte at a time from the
serial port, but, it made calls specific to XXXReceiveWait and
XXXReceive.

---
        // wait for byte to arrive
        error =
#ifdef USENEWSERMGR
          SrmReceiveWait
#else
          SerReceiveWait
#endif
            ((UInt16)serRef, 1, serInterbyteTimeout);

        // if we had no error, our byte is in the receive queue
        if (!error)
        {
            // receive the byte
            bytesReceived =
#ifdef USENEWSERMGR
              SrmReceive
#else
              SerReceive
#endif
                ((UInt16)serRef, rxByte, 1, serReceiveTimeout, &error);

            // see if we received 1 byte and no errors are present
            if(!error && bytesReceived == 1)
            {
                // set the reception OK flag
                receptionOK = true;
            }
        } // end if(!error)
---

yet another alternative solution to the problem? while this worked
on really old units, i have not needed the code on 5.0 units, but,
this might be another way to tackle the problem?

---
Aaron Ardiri                           [EMAIL PROTECTED]
CEO - CTO                                              +46 70 656 1143
Mobile Wizardry                         http://www.mobilewizardry.com/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to