Discussion:
simple IR appl
(too old to reply)
Lotfi
2003-06-25 01:02:14 UTC
Permalink
Hi

I would like to programm a very simple IR appl
I need to send 3 * 8 bits chars on the IR (like if it where traditional
serial)
for exemple
ABC characters

I have a device (PC with IRDA capability or another device) that is waiting
for these 3 chars.

Could you provide me an example of sending 3 char on IR with palm (based on
the hello example) ?

thanks in advance.
yours sincerely
Lotfi
Lotfi
2003-07-01 07:37:17 UTC
Permalink
I had an answear :-)
the prog
pbrick-1.0.zip

I am working around it

ciao
Post by Lotfi
Hi
I would like to programm a very simple IR appl
I need to send 3 * 8 bits chars on the IR (like if it where traditional
serial)
for exemple
ABC characters
I have a device (PC with IRDA capability or another device) that is waiting
for these 3 chars.
Could you provide me an example of sending 3 char on IR with palm (based on
the hello example) ?
thanks in advance.
yours sincerely
Lotfi
Lotfi
2003-07-07 14:04:38 UTC
Permalink
Hi again

My RS232 works on the emulator when redirecting the palm serial to PC COM1
port
I open the port using : serPortCradlePort
but I tried serPortIrPort, nothing with the palm and the same with the
Emulator (ie it directs all serials to COM1)
I don't have a serial cable to connect to Palm to see if it work
(any addy for a place which sells m125 universal connectors on Europe/France
?)
but with IR, Isee nothing :-(

Thanks for any info.

here is the code if it interests someone :-)

I open it like this :
-------------------------------
Boolean handled = false;
FormType * frmP;
ControlType * ctlP;
UInt16 paramSize;
UInt32 flags = srmSettingsFlagBitsPerChar8 |
srmSettingsFlagParityOnM | srmSettingsFlagParityEvenM |
srmSettingsFlagStopBits1;
// | srmSettingsFlagRTSAutoM | srmSettingsFlagCTSAutoM;


serPortOpened = false;
err = SrmOpen( serPortCradlePort , 9600, &portId);
// serPortCradlePort ou serPortCradleRS232Port ou serPortIrPort
if (err!=errNone) {
FrmAlert (Err_open_serialAlert);
}
//record our open status in global.
serPortOpened = true;
paramSize = sizeof(flags);
err = SrmControl( portId, srmCtlSetFlags, &flags, &paramSize);
if (err!=errNone) {
FrmAlert (Err_open_serialAlert);
}

MainFormInit(frmP);
FrmDrawForm(frmP);
handled = true;
break;

//and close it like this :
-------------------------
case frmCloseEvent:
if (serPortOpened) {
err = SrmClose ( portId);
if (err!=errNone) {
FrmAlert (Err_close_serialAlert);
}
//record our open status in global.
serPortOpened = false;
}
handled = false;
break;
.............
the remaining is classic


I send the 3 char like this :
--------------------------------
void UpdateAffichage()
{
FormType * frmP;
ControlType * ctlP;
// FieldType *fldP;
UInt32 numSent;
unsigned int vit_bin;
char out[4];
out[3]=0; // fin de la séquence
frmP = FrmGetActiveForm();

if (serPortOpened) {
// I send the 3 char !!!
vit_bin=Vitesse;
out[0]='1';
out[1]=vit_bin & 255;
out[2]=vit_bin /256;
numSent = SrmSend(portId, out, 4, &err);
if (err == serErrTimeOut) {
//cts timeout detected
FrmAlert (Err_send_serialAlert);
}
}
}

Loading...