How to Capture Log Data by Using the BTLog Tool (Windows CE 5.0)
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.
|
IMG Environment Variables | |
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 | |
3. Use the registry editor to add the following values under the HKEY_CURRENT_USER\Pegasus\Zones key, and set them to zero:
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.
|
Not applicable | |
5. Configure a connection the CEPC, and make the following choices:
|
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:
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:
|
Not applicable | |
9. To reconnect the Bluetooth hardware, at the command prompt, run BTLoader. Type the following command:
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.
|
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:
|
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