Share via


Transport Layer Driver References

The following table shows the functions used to write your own transport layer driver on Windows CE.

Function Description
HCI_OpenConnection This function is used to set up, initialize, and establish a connection to the hardware.

It returns TRUE when a connection to the hardware is successfully established.

This is a blocking function.

HCI_ReadHciParameters This function returns the following information about the hardware: version, maximum packet size, and timeout.
HCI_ReadPacket This function allocates an empty buffer (where the size is requested during HCI_ReadHciParameters time) and fills this with an incoming packet, if any.

This function returns with a packet type and error condition.

This is a blocking function. It blocks while doing a read. If an error is returned, the Bluetooth protocol stack will be shut down.

This function must unblock and return an error if HCI_CloseConnection is called.

HCI_WritePacket This function allocates an empty buffer with pre-allocated spaces for packet headers and trailers, which are requested by HCI_ReadHciParameters.

The HCI_WritePacket function blocks while writing the packet. It returns the packet type and buffer. If an error is returned, the stack will be shut down.

This function must unblock and return an error if HCI_CloseConnection is called.

HCI_CloseConnection Calling this function will unblock reads and writes, un-initialize the hardware, and free up any allocated resources including buffers. If a driver is in DLL, it may be unloaded when this function returns.
HCI_SetCallback If hardware removal or insertion is detected, the transport calls the function provided by the upper layer.
HCI_StartHardware This function calls the callback provided by the stack to simulate hardware insertion.
HCI_StopHardware This function calls the callback provided by the stack to simulate hardware removal.

Data Transfers

To avoid data copying, the protocol stack uses two static buffers: one for read and the other for write. These buffers are given to the HCI_ReadPacket and HCI_WritePacket functions, respectively.

The data transfer structure is organized in such a way that headers can be easily pre-allocated on the way down or stripped on the way up.

See Also

Bluetooth HCI Transport Layer

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.