Howdy all,
        I have been working to try to access the Ir port as a standard
serial device.  I need to do unidirectional communication and therefore
can't use IrDA's Comm package as all IrDA is bidirectional.  It looks like
I am stuck using the old serial manager, as I can't get ahold of an SDK
which has the appropriate includes and libraries for the new serial
manager (which would solve my problem).
        I have tried specifying the port in serOpen as 1, and as 0x8001,
neither gives me an error.  I am using a Palm III upgraded to PalmOS 3.3.
Any ideas what might be happening if I'm not getting any errors?   (I do
get port already opened sometimes, and the time out error on the IrReceive
function but I think those are non-critical).  The critical parts of my
code are included below,

        Any and all help is greatly appreciated,



        Noah Ternullo
============================================================================
#include <SerialMgr.h>
...
// function prototypes
Err IrSerialOpen(ULong baudrate );
Err IrSerialClose();
Err IrSendData(char Sendme);
Err IrReceiveData(char* ReceiveBuf, ULong size);
...
#define IRPORT          1 // I have also tried 0x8001


//Critical calls of the appropriate functions...
//
========================================================================
static  Err IrSerialOpen(ULong baudrate )
{
//baud rate is typically 9600
//SerRefNum is a global variable
...
        retval = SysLibFind ("Serial Library", &SerRefNum);
        ... //errorchecking here        
        retval = SerOpen (SerRefNum, IRPORT, baudrate);
        ... //errorchecking here
        return retval;
        
}

=====================================================================
static  Err IrSerialClose()
{
...     
        retval = SerClose (SerRefNum);
        ... //errorcheck here   
        return retval;
}

=====================================================================

static  Err IrSendData(char Sendme)
{
...

        count = SerSend (SerRefNum, &Sendme, (long) 1, &retval);
        ... //errorcheck here           
        return retval;  
}

=====================================================================

static  Err IrReceiveData(char* ReceiveBuf, ULong size)
{
...     
        Long timeout=5 //wait around 5 ticks (1 second?)

        numbytesreceived =  SerReceive (SerRefNum, ReceiveBuf, size, 
                                                     timeout, &retval);
        ... //errorchecking here        
        
        return retval;
        
}


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to