The serial port on Pose has worked for several revisions...
1) make sure hotsync is not running or the com port you've selected on Pose
is different (and no other apps are using it)
2) you switch-case is in the wrong place, you've placed it in the
'successful' branch when testing 'err'
3) bad port is referring to using a bad PortID
4) Don't close the port if you didn't successfully open it
5) Make sure there are no keyboard drivers active on the device
6) Make sure you're not using a hack or speed up app that isn't compatible
with the serial port

Try using someone else's serial app to make sure you have Pose setup
correctly.  Read over the serial example included in the SDK, read over the
serial examples available in the KnowledgeBase.

  Baud = 9600;
  error = SerOpen(SerLibRef,0,Baud);
  if(error == serErrAlreadyOpen)
   {
   ErrDisplay("Serial port is already open");
   PortOpen = true;
   return 1;
   }
  else if(error == serErrBadParam)
   {
   ErrDisplay("Unable to open serial port");
   PortOpen = false;
   return 0;
   }
  else if(error == memErrNotEnoughSpace)
   {
   ErrDisplay("Not enough memory to open serial port");
   PortOpen = false;
   return 0;
   }

 PortOpen = true;
 SerReceiveFlush(SerLibRef,40);
return 1;

----- Original Message -----
From: "Ken Green" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, August 27, 2001 8:45 AM
Subject: Serial Ports, POSE, whats up?


>
> Hello all
>
> I'd ;ike anyone/everyone input on the palm serial managment. I've
> writen an applaction thats supposed to use the palms serial port to talk
> to another device(not a pc). I think i've writen the code correctly, but
> when I load it into pose to test it First when I try to open the port I
> get the port allready open error Ok fine I tried to recive data, because
> if the ports open I should be able to recive data, I get the BadPort
> error. POSE is set to COM2 on the computer the other device is pluged in
> and on, Al devices are set to the correct baud rate but nothing seems to
> want to talk :(. In the PalmOS Doc's it talks about the code being outside
> the event loop, I think mine is because I only need to qurrey the port
> when a button is pushed so I have my button handler with when the button
> is pressed jumps into another function that's supposed to open the port,
> recive data, and close the port all in one. I don't think thats the
> problem but..... Below is the code I'm using to do this Please any help
> would be appricated.
>
> if (!serPortOpen)
> {
> //err = SerOpen(refNum,0,9600);
> err = SrmOpen(serPortCradlePort, 9600, &portID);
>
> if (err) {
> if (err == serErrAlreadyOpen) {
> FrmCustomAlert(TestAlert,"", "Port Already
> Open","");
> }else{
> FrmCustomAlert(TestAlert,"Port not
> Availble", "Failed to Open","");}
> }else{
> FrmCustomAlert(TestAlert,"Port Open", "","");
> serPortOpen = true;
> SrmReceive(portID, &buf, 10, 100, &err);
> switch (err){
> case serErrBadPort:
> FrmCustomAlert(TestAlert,"Bad
> Port", "","");
> break;
> case serErrNotOpen:
> FrmCustomAlert(TestAlert,"Not
> Open", "","");
> break;
> case serErrConfigurationFailed:
>
> FrmCustomAlert(TestAlert,"Configuration Failed", "","");
> break;
> case serErrNotSupported:
> FrmCustomAlert(TestAlert,"Not
> Supported", "","");
> break;
> default:
> FrmCustomAlert(TestAlert, "Other
> Error", "","");
> break;
> }
> FrmCustomAlert(TestAlert, &buf, "","");
> err = SrmClose(portID);
>
>
> --
> 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/

Reply via email to