Share via


Debug/Auxiliary

The Bluetooth stack layer has unified console/debug output stubs used throughout the stack. Console is a thread that only runs in the debug version of the stack. It provides a command-line monitor to access stack information. The format of a command is as follows.

<layer name> <layer-specific commands>

The thread extracts the layer name then dispatches the rest of the command to the appropriate layer. Each layer exports one function that parses the rest of the command and responds appropriately. The following function is exported by every layer.

int layer_ProcessConsoleCommand (WCHAR *pString);

Each layer must understand command help and print out a list of available commands.

void DumpBuff (unsigned int cMask, unsigned char *lpBuffer, unsigned int cBuffer);
void DebugOut (unsigned int cMask, WCHAR *lpszFormat, ...);
void DebugInitialize (void);

Debugger facilities center around a debug mask that is initialized in the following manner.

[Software\Microsoft\Bluetooth\Debug]
    "mask" = DWORD:0
    "console"=DWORD:0

The following table shows the available debug layers. The mask registry value is a union of these.

Element Hex code
DEBUG_ERROR 0x00000001
DEBUG_WARN 0x00000002
DEBUG_OUTPUT 0x00000004
DEBUG_SHELL_ALL 0x00000030
DEBUG_SHELL_INIT 0x00000010
DEBUG_SHELL_TRACE 0x00000020
DEBUG_HCI_ALL 0x00003f00
DEBUG_HCI_INIT 0x00000100
DEBUG_HCI_TRACE 0x00000200
DEBUG_HCI_DUMP 0x00000400
DEBUG_HCI_PACKETS 0x00000800
DEBUG_HCI_CALLBACK 0x00001000
DEBUG_HCI_TRANSPORT 0x00002000
DEBUG_L2CAP_ALL 0x000f0000
DEBUG_L2CAP_INIT 0x00010000
DEBUG_L2CAP_TRACE 0x00020000
DEBUG_L2CAP_PACKETS 0x00040000
DEBUG_L2CAP_CALLBACK 0x00080000
DEBUG_RFCOMM_ALL 0x00f00000
DEBUG_RFCOMM_INIT 0x00100000
DEBUG_RFCOMM_TRACE 0x00200000
DEBUG_RFCOMM_PACKETS 0x00400000
DEBUG_RFCOMM_CALLBACK 0x00800000
DEBUG_SDP_ALL 0x0f000000
DEBUG_SDP_INIT 0x01000000
DEBUG_SDP_TRACE 0x02000000
DEBUG_SDP_PACKETS 0x04000000
DEBUG_SDP_CALLBACK 0x08000000
DEBUG_TDI_ALL 0xf0000000
DEBUG_TDI_INIT 0x10000000
DEBUG_TDI_TRACE 0x20000000
DEBUG_TDI_PACKETS 0x40000000
DEBUG_TDI_CALLBACK 0x80000000

The message is printed if cMask, provided in DebugOut or DebugDump, intersects with the mask in the registry key.

The following table shows the available output modes. The console registry value is a union of these.

Element Hex code
OUTPUT_MODE_DEBUG 0
OUTPUT_MODE_CONSOLE 1
OUTPUT_MODE_FILE 2

See Also

Common Layer Characteristics | Bluetooth Protocol Stack

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.