Freigeben über


How to Capture Log Data by Using the BTLog Tool (Windows CE 5.0)

Send Feedback

BTLog is a command line tool that logs communication between the Bluetooth stack and the hardware. While CeLog captures data in binary format, BTLog translates the binary log data into a readable HTML format.

For example, by enabling BTLog, each Bluetooth transport function call is logged as:

HCI_OpenConnection: Logging is started
HCI_CloseConnection: Logging is stopped
HCI_ReadPacket: Inbound packet is logged
HCI_WritePacket: Outbound packet is logged

These instructions show you how to capture activity on the target device using the BTLog tool, and then flush the log data to the development system for viewing.

Hardware and Software Assumptions

  • Your Bluetooth device is connected to your target device.

  • Your OS design is based on a design template that includes support for Bluetooth and supports the Command Prompt. For example, you could use Mobile Handheld design template and then add the Command Processor and Console Window to your OS design from the Catalog. For more information about this design template, see Mobile Phone Design Template.

  • You have the appropriate device driver Catalog item included in your OS design. For example, if your Bluetooth hardware uses USB, ensure that SYSGEN_USB is set to 1.

  • You have registered sdpuser.dll so that you can parse Service Discovery Protocol (SDP) commands by using BTLog.

    To register sdpuser.dll type the following command.

    Regsvr32 <%_WINCEROOT%>\public\common\oak\bin\i386\sdpuser.dll
    

To track your progress in the following table, select the check box next to each step.

  Step Topic
1. In your development workstation, use the set command to verify that the following variables are set. If not, then set these variables.
  • IMGAUTOFLUSH. This variable enables CeLog to write to a .clg file in your release directory instead of using the Kernel Tracker.
  • IMGCELOGENABLE. This variable adds the CeLog.dll to the configuration and starts CeLog automatically on boot.
  • WINCEREL. This variable releases the built components into the %_FLATRELEASEDIR% directory and into the Public directory.
IMG Environment Variables

Setting or Clearing an Environment Variable

2. Set the SYSGEN_BTH_UTILS variable to 1. This variable adds the BtLoader.exe in the release directory on your development workstation.

- or -

Build the executable from the %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\BLUETOOTH\SAMPLE\BTLOADER directory.

Setting or Clearing an Environment Variable

Building a Project

3. Use the registry editor to add the following values under the HKEY_CURRENT_USER\Pegasus\Zones key, and set them to zero:
  • CeLogZoneUser : REG_DWORD
  • CeLogZoneCE : REG_DWORD
  • CeLogZoneProcess : REG_DWORD

This configures the defined zones registry settings that enables CeLog to ignore activities not related to Bluetooth.

Not applicable
4. Build the OS design into a run-time image.
  • From the Build OS menu, ensure that the following are selected:
    • Clean Before Building
    • Copy Files to Release Directory after Build
    • Make Run-Time Image After Build
  • From the Build OS menu, choose Build and Sysgen.
Not applicable
5. Configure a connection the CEPC, and make the following choices:
  1. Add your device and give it a name. In this example, type BluetoothLog, and choose Add.
  2. From the Download list, choose Ethernet and then choose Settings.
  3. From the Device Boot Name list, choose the CEPC.
  4. From the Transport list, choose Ethernet.
Configuring a Connection for Downloading and Debugging
6. From the Target menu, choose Attach Device.

When successfully attached, the target device displays the shell user interface.

 
7. On the target device, open a command prompt and then run the BtLoader tool to disconnect the Bluetooth hardware. Type the following command:

btloader stop card

If the hardware is successfully disconnected, Result = 1 is displayed. Otherwise, Result = 0 is displayed on the command prompt.

Device Driver Management Sample
8. To enable CeLog in the target device, at the command prompt type the following command:
btloader celog on
Not applicable
9. To reconnect the Bluetooth hardware, at the command prompt, run BTLoader. Type the following command:

btloader start card

If the hardware is successfully connected, Result = 1 is displayed. Otherwise, Result = 0 is displayed on the command prompt.

Not applicable
10. Perform the operation you want to log.

For example, from the Control Panel, open Bluetooth Device Properties, and then choose Scan Device.

Note   Log data is automatically saved in the file, Celog.clg, in the release directory on your target device. If the log data is not flushed to your development workstation, manually flush the Celog.clg file by typing the following command at the command prompt of your target device:
celogflush
CeLogFlush.exe
11. Convert binary data in the .clg file to a readable HTML format. To do this, on your development workstation navigate to your release directory, and then type the following command:
btlog celog.clg <output filename>.htm -output all
Not applicable
12. To see the log data, open the <output filename>.htm file in the release directory on your development workstation. Not applicable

Note   For more information about other options available with BTLog type , at a command prompt, type the following command:

btlog -help

See Also

Bluetooth Application Development | Bluetooth

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.