Device Driver Management Sample (Windows Embedded CE 6.0)

1/6/2010

This sample utility application enables users to manage Bluetooth device drivers for PCMCIA/CF cards.

The compiled sample generates a Btloader.exe application.

Note

If the stack is built with a Winsock interface, it loads when the system boots and cannot be unloaded.

To view supported command line options use BTLOADER /?.

Usage

btloader {    install                      |
              uninstall                    |
              load                         |
              unload                       |
              start card                   |
              stop card                    |
              celog {on | off}             |
              console {on | off}           |
              debugout {console | serial}  |
              debug <hex mask>
              } <module_name>

Install/Uninstall

Uninstall will remove the following registry key and all subkeys from the registry.

[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth]

Load / Unload

These operations are used to load and unload the Bluetooth stack. If the load is successful, the handle to the stack is stored in the registry key. If the unload is successful, this registry key is removed from the registry.

[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\hci\handle]

Celog

This option enables CeLog in your target device. Use this option to capture log data related to Bluetooth activities. You can use the BTLog tool to convert binary log data, captured by CeLog, into a readable HTML format. **.

Card / Console / Debug

These operations are initiated after a stream is opened to communicate with the stack. The following example code performs the function of opening a stream.

HANDLE hDev = CreateFile (
                   L"BTD0:",
                   GENERIC_READ | GENERIC_WRITE,
                   FILE_SHARE_READ | FILE_SHARE_WRITE,
                   NULL, OPEN_EXISTING, 0, NULL
                  );

Remarks

If the stream opens successfully, applications can manage the stack's characteristics through the DeviceIoControl call. In this example, the following services are demonstrated.

IOCTL function Service

IOCTL_SERVICE_START

Card start.

IOCTL_SERVICE_STOP

Card stop.

IOCTL_SERVICE_CONSOLE

Console on or off.

IOCTL_SERVICE_DEBUG

DebugOut console/serial, debug <mask>.

Sample Location

%_WINCEROOT%\Public\Common\Oak\Drivers\Bluetooth\Sample\Btloader

Note

This sample application has not been thoroughly tested and is not intended for production use.

See Also

Concepts

Bluetooth OS Design Development Samples
Bluetooth Samples

Other Resources

Bluetooth Application Development