I'm using a 3Com Palm IIIx OS version 3.1.

I have an Ericsson GSM phone connected to the Palm's serial
port through an "Option International Snap-On GSM adapter for
Plam Pilot", this is a piece of hardware that connects the
serial port of the GSM phone to the serial port of the Palm.

The data I'm passing are just commando's to let the GSM phone
send SMS messages and commando's to read the SMS messages
stored in the phone (the one's it received).

I'm using baudrate 9600, 8 bits, 1 stop bit, no parity,
Xon Xoff. Before I send the data out I call SerReceiveFlush,
then I send the data and wait for the phone's response. I'm
using the standard buffer (I'm not assingning my own buffer).

Following is some code:

// Open
error = SysLibFind("Serial Library",&m_uiRefno);
if (error == 0) {
        error = SerOpen(m_uiRefno,0,9600L);
        if (error == 0) {
                SerGetSettings(m_uiRefno, &settings);
                settings.flags = serSettingsFlagBitsPerChar8 |
                                     serSettingsFlagStopBits1 |
                                     serSettingsFlagXonXoffM;
                SerSetSettings(m_uiRefno, &settings);
        }
}

// Send
char pData[500];
ULong DataSize, dwWritten; // %lu
SerReceiveFlush( m_uiRefno, 0 );
Err error;
ULong size = SerSend(m_uiRefno, pData, DataSize, &error);
if (error != 0) {
        String ErrorStr;
        ErrorStr.Printf("Cannot write error %d in SerSend",error);
        MessageBox(NULL,ErrorStr.ptr(), "Mobile", MB_OK|MB_ICONERROR);

        return FALSE;
}
error = SerSendWait(m_uiRefno, (TimeOut*SysTicksPerSecond())/1000);
if (error != 0) {
        String ErrorStr;
        ErrorStr.Printf("Cannot write error %d in SerSendWait",error);
        MessageBox(NULL,ErrorStr.ptr(), "Mobile", MB_OK|MB_ICONERROR);

        return FALSE;
}

// Receive
ULong dwRead;
char pData[500];
String Data  = "";

Err error;
dwRead = SerReceive(m_uiRefno, pData, Len,
(TimeOut*SysTicksPerSecond())/1000, &error);
if (error != 0) {
        if (error != serErrTimeOut) {
                char buffer[256];
                if (error == serErrLineErr) {
                        Boolean ctsOn, dsrOn;
                        Word status = SerGetStatus(m_uiRefno, &ctsOn,
&dsrOn);
                        sprintf(buffer, "error = %x, status = %x", error,
status);
                } else {
                        sprintf(buffer, "error = %x", error);
                }
                MessageBox(NULL,buffer, "SerReceive", MB_OK|MB_ICONERROR);
        }
        return "";
}

pData[dwRead] = 0;
if( dwRead ) {
        char ts[500];
        sprintf(ts, "%s", pData);
        Data = ts;
}

return Data;
//--------------------

Especialy the receive part seems a bit odd maybe but
this is used only for reading one character at a time.
There is a loop that calls this code until it recocnize
a pattern. This code is not written by myself but works
fine under Windows NT and Windows CE so it should also
work under Palm OS when the IO functions whould be called
as they should. The MessageBox call in the code is just a
template that calls an Alert.

Thanx for your help,

Sander Kloos

> -----Original Message-----
> From: Dave Lippincott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 14, 1999 17:02
> To: [EMAIL PROTECTED]
> Subject: Re: Communication problems (again)
> 
> 
> Which Palm model are you using? Do you have any code 
> examples?  What kind of
> data are you passing?  Which Baud rate?  Serial or IR?  Is 
> GSM direct to the
> phone or via a module? Any additional information will help.
> 
> -----Original Message-----
> From: Sander Kloos <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Thursday, October 14, 1999 9:58 AM
> Subject: Communication problems (again)
> 
> 
> >Hi all,
> >
> >I seem to have communication problems again:
> >
> >Most of the time communicating goes well only sometimes I get
> >timeouts on the receiving end... I got no errors as far as
> >I can see (I catch all error conditions) it just seems that
> >the GSM I'm talking to doesn't get the messages I send
> >sometimes... so I tried longer timeouts aswell as resending
> >the messages... the same demo /w the same phone work fine on
> >WinCE...
> >
> >Any suggestions please?
> >
> >Sander
> >
> >
> 
> 
> 

Reply via email to