Bluetooth Stack Status (Windows CE 5.0)
During boot time, the Bluetooth Protocol Stack takes time to fully load and initialize. 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 OpenEvent function. and is used to open a named event.
The following example code how to open the named event, BTH_NAMEDEVENT_STACK_INITED, to check the status of the Bluetooth stack.
// 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
Bluetooth Application Development
Send Feedback on this topic to the authors