COM Port Emulation Facility

The COM Port emulator lives at the top of the stack and provides access based on a virtual COM port to RFCOMM. It does not expose stack interfaces at the top, no other stack layer can rest on top of it; it is an API layer.

When this layer is present in the Bluetooth stack, a virtual server or client COM port can be created to accept incoming or create outgoing RFCOMM connections.

To create a virtual COM port, call the RegisterDevice function, as illustrated below.

RegisterDevice (L"COM", index, L"btd.dll", (DWORD)&pp);

Where pp is of type PORTEMUPortParams.

To remove the virtual COM port, call the DeregisterDevice function.

Once created, the COM port is a functional equivalent of a serial port. The same APIs can be used to access it.

For client ports, the physical connection is created only when the device is open with read or write access using the CreateFile API. The physical connection is terminated for both server and client ports when the first handle with read or write access closes.

Up to four open handles can be outstanding for each virtual port created. Every handle maintains its own set of communication event masks. If a file is open with a 0 access mask, it can only be used for WaitCommEvent, but not with ReadFile and WriteFile APIs.

The following functions are supported:

See Also

Bluetooth

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.