📄 btd.cxx
字号:
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadClassOfDevice_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_WriteAuthenticationEnable_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteAuthenticationEnable_Out: status %d\n", status));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteAuthenticationEnable_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteAuthenticationEnable_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteAuthenticationEnable_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_WRITE_AUTHN_ENABLE);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteAuthenticationEnable_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadAuthenticationEnable_Out (void *pCallContext, unsigned char status, unsigned char authnetication_enable) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadAuthenticationEnable_Out: status %d, authnetication_enable 0x%02x\n", status, authnetication_enable));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadAuthenticationEnable_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadAuthenticationEnable_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadAuthenticationEnable_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_READ_AUTHN_ENABLE);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0)
pCall->ucResult = authnetication_enable;
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadAuthenticationEnable_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_WriteLinkPolicySettings_Out (void *pCallContext, unsigned char status, unsigned short connection_handle) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteLinkPolicySettings_Out: status %d connection_handle 0x%04x\n", status, connection_handle));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteLinkPolicySettings_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteLinkPolicySettings_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteLinkPolicySettings_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_WRITE_LINK_POLICY);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteLinkPolicySettings_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadLinkPolicySettings_Out (void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned short link_policy_settings) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadLinkPolicySettings_Out: status %d, connection_handle 0x%04x link_policy_settings 0x%04x\n", status, connection_handle, link_policy_settings));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadLinkPolicySettings_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadLinkPolicySettings_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadLinkPolicySettings_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_READ_LINK_POLICY);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0)
pCall->usResult = link_policy_settings;
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadLinkPolicySettings_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_InquiryCancel_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_InquiryCancel_Out: status %d\n", status));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_InquiryCancel_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_InquiryCancel_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_InquiryCancel_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_CANCEL_INQUIRY);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_InquiryCancel_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_Disconnect_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_Disconnect_Out: status 0x%02x\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_CreateConnection_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_CreateConnection_Out: status 0x%02x\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_SetEventFilter_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_SetEventFilter_Out: status 0x%02x\n", status));
if (! gpState)
return ERROR_SERVICE_NOT_ACTIVE;
gpState->Lock ();
if (! gpState->fIsRunning) {
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_AddSCOConnection_Out(void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_AddSCOConnection_Out: status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_AcceptConnectionRequest_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_AcceptConnectionRequest_Out: status %d\n", status));
if (status != 0) {
if (! gpState)
return ERROR_SERVICE_NOT_ACTIVE;
gpState->Lock ();
if (! gpState->fIsRunning) {
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
DeleteCall(pCall);
gpState->Unlock ();
}
return ERROR_SUCCESS;
}
static int btshell_InquiryComplete (void *pUserContext, void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"Shell: Inquiry complete status %d\n", status));
if (! gpState)
return ERROR_SERVICE_NOT_ACTIVE;
gpState->Lock ();
if (! gpState->fIsRunning) {
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_InquiryResult (void *pUserContext, void *pCallContext, BD_ADDR *pba, unsigned char page_scan_repetition_mode, unsigned char page_scan_period_mode, unsigned char page_scan_mode, unsigned int class_of_device, unsigned short clock_offset) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"Shell: Inquiry result %04x%08x rep %d period %d mode %d cod 0x%06x offset 0x%04x\n", pba->NAP, pba->SAP, page_scan_repetition_mode, page_scan_period_mode, page_scan_mode, class_of_device, clock_offset));
if (! gpState)
return ERROR_SERVICE_NOT_ACTIVE;
gpState->Lock ();
if (! gpState->fIsRunning) {
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
InquiryBuffer *pBuff = (InquiryBuffer *)pCall->ptrResult.pBuffer;
if (pBuff->cb < SVSUTIL_ARRLEN(pBuff->ba)) {
pBuff->cod[pBuff->cb] = class_of_device;
pBuff->ba[pBuff->cb] = SET_NAP_SAP(pba->NAP, pba->SAP);;
pBuff->psm[pBuff->cb] = page_scan_mode;
pBuff->pspm[pBuff->cb] = page_scan_period_mode;
pBuff->psrm[pBuff->cb] = page_scan_repetition_mode;
pBuff->co[pBuff->cb] = clock_offset;
pBuff->cb++;
}
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_RemoteNameDone (void *pUserContext, void *pCallContext, unsigned char status, BD_ADDR *pba, unsigned char utf_name[248]) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"Shell: RemoteNameDone status %d addr %04x%08x\n", status, pba->NAP, pba->SAP));
if (! gpState)
return ERROR_SERVICE_NOT_ACTIVE;
gpState->Lock ();
if (! gpState->fIsRunning) {
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0) {
DWORD dwCurrentPerms = pCall->ptrResult.dwPerms ? SetProcPermissions (pCall->ptrResult.dwPerms) : 0;
BOOL bKMode = FALSE;
if (pCall->ptrResult.bKMode)
bKMode = SetKMode (TRUE);
strcpy ((char *)pCall->ptrResult.pBuffer, (char *)utf_name);
if (pCall->ptrResult.bKMode)
SetKMode (bKMode);
if (dwCurrentPerms)
SetProcPermissions (dwCurrentPerms);
}
SetEvent (pCall->hEvent);
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadRemoteSupportedFeaturesCompleteEvent (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char lmp_features[8]) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadRemoteSupportedFeaturesCompleteEvent status %d connection 0x%04x\n", status, connection_handle));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadRemoteSupportedFeaturesCompleteEvent ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadRemoteSupportedFeaturesCompleteEvent ERROR_SERVICE_NOT_ACTIVE\n"));
gpState->Unlock ();
return ERROR_SERVICE_NOT_ACTIVE;
}
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadRemoteSupportedFeaturesCompleteEvent ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0)
memcpy (pCall->ftmResult, lmp_features, 8);
SetEvent (pCall->hEvent);
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadRemoteVersionInformationCompleteEvent (void *pUserContext, void *pCallContext, unsigned char status, unsigned short connection_handle, unsigned char lmp_version, unsigned short manufacturers_name, unsigned short lmp_subversion) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadRemoteVersionInformationCompleteEvent status %d connection 0x%04x\n", status, connection_handle));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadRemoteVersionInformationCompleteEvent ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -