Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

You can check the initialization status of the Bluetooth stack by using the symbolic define BTH_NAMEDEVENT_STACK_INITED, defined in %_WINCEROOT%\Public\Common\Sdk\Inc\Bt_api.h. To open this named event, use the OpenEventfunction.

During boot time, the Bluetooth Protocol Stacktakes time to fully load and initialize.

The following example code how to open the named event, BTH_NAMEDEVENT_STACK_INITED, to check the status of the Bluetooth stack.

Copy Code
// Make sure BT stack is up
BOOL fStackUp = FALSE;
for (int i = 0 ; i < 100 ; ++i) 
{
  HANDLE hBthStackInited = OpenEvent (EVENT_ALL_ACCESS, FALSE,
BTH_NAMEDEVENT_STACK_INITED);
  if (hBthStackInited) 
  {
	DWORD dwRes = WaitForSingleObject (hBthStackInited, INFINITE);
	CloseHandle (hBthStackInited);
	if (WAIT_OBJECT_0 == dwRes) 
	{
	fStackUp = TRUE;
	break;
}
  }
  Sleep (1000);
}
if (! fStackUp) 
{
  // Perform error handling.
}

See Also