IR Serial COM Port Programming and EscapeCommFunction 
Author Message
 IR Serial COM Port Programming and EscapeCommFunction

I am attempting to connect to an IRDA device (not a Windows device
though) and I need to gain access to it from the PocketPC IR port.  I
have a Jornada 548 that I can connect to this same device (via a
standard RS232 bypassing the IRDA on both sides) through COM1 and
everything works fine. I then attempted to connect to the same device
through the IR Serial connection using COM3 on the Jornada and I can
send data fine from the Jornada to the device, but nothing is returned.
The only event that I ever see is the CD_Changed event.  No Receive
events.  I know that there is a shared COM port on the Jornada and you
cannot use them simultaneously. Ok, I only need IR.  How do I get
receive
events from the IR Port (like I get during the RS232 connection)?

The only hint I have in this area is that I will probably need to issue
a
EscapeCommFunction(hPort, SETIR)          'SETIR = 10 -decimal- from
winbase.h
This is suppose to set the port into IR mode.  I can only get the hPort
value via the comSerial.CommID property from the CECOMM object after
comSerial.Open.  When I call the EscapeCommFunction with a valid hPort
after opening the port, EscapeCommFunction fails(=0). When I do a
GetLastError, it returns an 87 (parameter is incorrect - according to
the API reference/Error Values).
 So, is SETIR really a decimal 10?  If not, what is it?

All I want to do is to set IR mode and use VB COMM properties and events
-

HOW?  I am currently on day 3 of searching the Web, newsgroups and other
deadends.

Has anyone solved this?  I sure need some expert advice.

Thanks,

 rick



Tue, 16 Sep 2003 01:10:27 GMT  
 IR Serial COM Port Programming and EscapeCommFunction
I forgot to mention that I am using an ACTiSYS IRDA tranceiver.  Thus I
have access
to the data from the device to the Jornada.  The data flows from the
device to
the ACTiSys IRDA heading back to the Jornada.  The data is being sent,
and the Jornada is not holding back on the data, for if it did, I would
see RTS/CTS dropping eventually to stop the flow.  The Jornada is taking
it, just not delivering it to the application.

All this has been tested with a Laptop IR connection using VB6 and it
works fine.

Quote:

> Thanks,

>  rick



Tue, 16 Sep 2003 01:24:29 GMT  
 IR Serial COM Port Programming and EscapeCommFunction
I have had the same problem with a Cassiopeia and a Nokia phone.

The unique solution I have found for this problem is using the ReadFile
function from the CE API.

I put a timer and every 10 ms I see if there is something in the input
buffer. The Comm port is defined as
cominputmodebinary.

The fact is that I cannot receive an event when something comes to my port,
so I have to go to poll it. I can
use the comm1.output instruction but I cannot use the comm1.input.

Declare Function ReadFileL Lib "Coredll" Alias "ReadFile" _
(ByVal hFile As Long, lpBuffer As Byte, ByVal nNumberOfBytesToRead As Long,
_
lpNumberOfBytesRead As Long, lpOverlapped As Long) As Long

Private Sub Timer1_Timer()
  Dim i, nret
  Dim Arr As Byte
  If Comm1.PortOpen = True Then
    nret = ReadFileL(Comm1.CommID, Arr, 1, i, 0)
    If i > 0 Then
         sBuffTemp = sBuffTemp & Chr(Arr)
  End If
End Sub

Hope this will help you. If you need more help, please let me know.

Ander Gorostiza



Quote:
> I forgot to mention that I am using an ACTiSYS IRDA tranceiver.  Thus I
> have access
> to the data from the device to the Jornada.  The data flows from the
> device to
> the ACTiSys IRDA heading back to the Jornada.  The data is being sent,
> and the Jornada is not holding back on the data, for if it did, I would
> see RTS/CTS dropping eventually to stop the flow.  The Jornada is taking
> it, just not delivering it to the application.

> All this has been tested with a Laptop IR connection using VB6 and it
> works fine.


> > Thanks,

> >  rick



Tue, 16 Sep 2003 20:59:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Read IR Remote from Serial Port

2. Printing text through the serial/IR port

3. IR Device on COM Port

4. COM PORT / IR REMOTE CONTROL

5. Question: VB Libraries IR Com Port control?

6. IR Port Programming

7. Audio Programming and Serial Port programming advice needed.

8. Read COM (serial) port using CreateFile?

9. Problem with Serial Port COM (RS232)

10. How to access the serial com port

11. using the serial port (COM) in a VB Script

12. com and serial port control

 

 
Powered by phpBB® Forum Software