Partager via


Accessing an IR Port Through Raw IR

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Raw IR access is only available on devices that expose the IR hardware as a serial port. Using raw IR involves accessing the IR port and handling the connection as a serial port with IR hardware attached. By using this non-IrDA-compliant method, which does not use the Windows Embedded CE-provided IrDA stack, an application has the most control of IR communications. However, the application cannot benefit from the functionality provided by the stack. For example, it is possible for signal collisions to occur between devices during a data exchange. Also, it is possible to lose data when the infrared beam is broken, such as when someone walks between the two devices. The application is responsible for detecting and handling these error conditions.

If a Windows Embedded CE–based device shares serial hardware with the IR port and the serial port, an application must instruct the COM driver to route data through the IR port.

To route data using the IR port

  1. Use the EscapeCommFunction function with the dwFunc parameter set to SETIR.

  2. Use the standard serial communications functions to transmit and receive data. For more information about these functions, see Programming Serial Connections and Serial Communications Functions.

  3. Call the EscapeCommFunction with the dwFunc parameter set to CLRIR to set the port back to normal serial mode.

See Also

Concepts

IrDA Application Development

Other Resources