Creating an Installable Stream Driver for the Bluetooth Extension Layer (Windows CE 5.0)
The Bluetooth stack implementation in Windows CE allows extension layers to be installed on top of the HCI layer. An extension layer must be written as an installable stream device driver. Stream device drivers make use of common APIs to manage a device.
To create an installable stream driver for the Bluetooth extension layer, implement the following common functions (where XXX is the name of the driver).
- XXX_Init (Device Manager)
- XXX_Deinit (Device Manager)
- XXX_Read (Device Manager)
- XXX_Write (Device Manager)
- XXX_Open (Device Manager)
- XXX_Close (Device Manager)
- XXX_IOControl (Device Manager)
- XXX_Seek (Device Manager)
- XXX_PowerUp (Device Manager)
- XXX_PowerDown (Device Manager)
For a detailed discussion about stream interface drivers, see Stream Interface Drivers and Stream Interface Driver Implementation.
Initializing the Driver
To initialize the driver, implement the XXX_Init function. The initialization routine must include a call to the **ExtensionLayer_CreateDriverInstance to instantiate the Bluetooth extension layer.
The following code example is an excerpt from the BthLink sample that creates an instance of the extension layer class.
extern "C" DWORD BTL_Init (DWORD Index)
{
return (DWORD)(bthlink_CreateDriverInstance () == ERROR_SUCCESS);
}
Deinitializing the Driver
To deinitialize the driver, implement the XXX_Deinit function. The deinitialization routine must include a call to the **ExtensionLayer_CloseDriverInstance to delete the existing instance of the Bluetooth extension layer.
The following code example is an excerpt from the BthLink sample that deletes an instance of the extension layer class.
extern "C" BOOL BTL_Deinit(DWORD dwData)
{
bthlink_CloseDriverInstance ();
return TRUE;
}
See Also
Creating a Bluetooth Stack Extension Layer | Bluetooth OS Design Development | Host Controller Interface | How to Develop and Load a Bluetooth HCI Stack Extension Layer
Send Feedback on this topic to the authors