int OpenCommsPort(UInt Speed)
{
Err result;
SerSettingsType SerialSettings;
SysLibFind("Serial Library",&SerialRef); /* Find Communications
Library */
result = SerOpen(SerialRef,0,Speed); /* Open Port 0 */
if (!result)
{
SerialSettings.baudRate = Speed;
SerialSettings.ctsTimeout = serDefaultCTSTimeout;
SerialSettings.flags = serSettingsFlagStopBits1 |
serSettingsFlagBitsPerChar8;
SerSetSettings(SerialRef,&SerialSettings);
return 1;
}
return 0;
}
void CloseCommsPort()
{
if (SerialRef)
SerClose(SerialRef); /* Close COM1
*/
}
static void CommsEnableInfrared()
{
SerControl(SerialRef, serCtlIrDAEnable, 0, 0);
}
static void CommsDisableInfrared()
{
SerControl(SerialRef, serCtlIrDADisable, 0, 0);
}
void InitComms()
{
OpenCommsPort(19200);
CommsEnableInfrared(); // one off operation after opening port
// can now read and write to port
}
Here is a fuller example. If you are getting unexpected chars then either
the port is not set correctly to match what you are talking to OR the
protocol on the other device is not what you believe it is - maybe it uses
the IRDA protocol.
Alan Burgess
Grosvenor Technology Ltd
[EMAIL PROTECTED]
-----Original Message-----
From: Charles Rezsonya [mailto:[EMAIL PROTECTED]]
Sent: 16 October 2000 20:33
To: Palm Developer Forum
Subject: Re: Serial Communication via IR
correct me if i'm wrong , and fill in any gaps i might leave out. i'm
having problems doing this redirect thingy. i open a serial port, set the
settings to 19200 etc (sersettings cmd), then after the serial port is read
as if it were to receive something thru the serial port i do the redirect
thingy. but when i go to do something like sending and receiving data its
all garbaled in strange chars. what might i be forgetting or messing up?
tia
Charles R
-----Original Message-----
From: Alan Burgess <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Date: Friday, October 13, 2000 12:25 PM
Subject: RE: Serial Communication via IR
>Just open the serial port as normal - then redirect as shown below
>
>static void CommsEnableInfrared()
>{
> SerControl(SerialRef, serCtlIrDAEnable, 0, 0);
>}
>
>static void CommsDisableInfrared()
>{
> SerControl(SerialRef, serCtlIrDADisable, 0, 0);
>}
>
>Alan Burgess
>Grosvenor Technology Ltd
>[EMAIL PROTECTED]
>
> -----Original Message-----
>From: James [mailto:[EMAIL PROTECTED]]
>Sent: 10 October 2000 06:43
>To: Palm Developer Forum
>Subject: Serial Communication via IR
>
>Has anyone ever tried this, without going the IrDA route/or using the
>Exchange manager? I'm trying to develop an application and all the
>overhead of the IrDA stack is not really needed. I'm trying to get a
>Palm to communicate to a non-Palm. I will be writing software for the
>other platform(a PC) and will be using some Serial libraries to send and
>receive data from the PC.
>
>I'll just be sending some coordinate information back and forth between
>the Palm and the non-Palm.
>
>What is the best approach for doing this kind of communication between a
>Palm and a non-Palm device...(IrDA, Serial over IR, etc.)?
>
>Thanks in advance.
>
>-James
>
>--
>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/
>
--
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/