📄 btd.cxx
字号:
SCall *pCall = VerifyCall ((SCall *)pCallContext);
if (! pCall) {
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
memcpy (&pCall->baResult, pba, sizeof(pCall->baResult));
SetEvent (pCall->hEvent);
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_RemoteName_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"Shell: remote name out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_ReadRemoteVersionInformation_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadRemoteVersionInformation_Out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_ReadRemoteSupportedFeatures_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadRemoteSupportedFeatures_Out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_HoldMode_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_HoldMode_Out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_SniffMode_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_SniffMode_Out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_ParkMode_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ParkMode_Out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_ExitSniffMode_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_SniffMode_Out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_ExitParkMode_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ParkMode_Out status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_security_command_out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"Shell: encryption/authentication status %d\n", status));
if (status != 0)
return btshell_CallAborted (pCallContext, StatusToError (status, ERROR_INTERNAL_ERROR));
return ERROR_SUCCESS;
}
static int btshell_AuthenticationRequested_out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"Shell: encryption/authentication status %d\n", status));
if (status != 0) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"Shell: Auth request not accepted for call 0x%08x status %d\n", pCallContext, 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);
if ((status == 0x0c) || (status == 0x22) || (status == 0x23))
pCall->fRetry = TRUE;
SetEvent (pCall->hEvent);
gpState->Unlock ();
}
return ERROR_SUCCESS;
}
static int btshell_ReadLocalVersionInformation_Out (void *pCallContext, unsigned char status, unsigned char hci_version,
unsigned short hci_revision, unsigned char lmp_version, unsigned short manufacturer_name,
unsigned short lmp_subversion) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadLocalVersionInformation_Out: status %d\n", status));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadLocalVersionInformation_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadLocalVersionInformation_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_ReadLocalVersionInformation_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_READ_LOCAL_VERSION);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0) {
VersionInformation *pvi = &pCall->viResult;
pvi->hci_revision = hci_revision;
pvi->hci_version = hci_version;
pvi->lmp_subversion = lmp_subversion;
pvi->lmp_version = lmp_version;
pvi->manufacturer_name = manufacturer_name;
}
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadLocalVersionInformation_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadLocalSupportedFeatures_Out (void *pCallContext, unsigned char status, unsigned char features_mask[8]) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadLocalSupportedFeatures_Out: status %d\n", status));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadLocalSupportedFeatures_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadLocalSupportedFeatures_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_ReadLocalSupportedFeatures_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_READ_LOCAL_LMP);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0)
memcpy (pCall->ftmResult, features_mask, 8);
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadLocalSupportedFeatures_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_WriteScan_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteScan_Out: status %d\n", status));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteScan_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteScan_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_WriteScan_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_WRITE_SCAN_ENABLE);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteScan_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadScan_Out (void *pCallContext, unsigned char status, unsigned char mask) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadScan_Out: status %d, mask 0x%02x\n", status, mask));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadScan_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadScan_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_ReadScan_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_READ_SCAN_ENABLE);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0)
pCall->ucResult = mask;
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadScan_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_WritePageTimeout_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WritePageTimeout_Out: status %d\n", status));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WritePageTimeout_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WritePageTimeout_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_WritePageTimeout_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_WRITE_PAGE_TIMEOUT);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WritePageTimeout_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadPageTimeout_Out (void *pCallContext, unsigned char status, unsigned short page) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadPageTimeout_Out: status %d, page %d\n", status, page));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadPageTimeout_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadPageTimeout_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_ReadPageTimeout_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_READ_PAGE_TIMEOUT);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0)
pCall->usResult = page;
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadPageTimeout_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_WriteClassOfDevice_Out (void *pCallContext, unsigned char status) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteClassOfDevice_Out: status %d\n", status));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteClassOfDevice_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_WriteClassOfDevice_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_WriteClassOfDevice_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_WRITE_CLASS_OF_DEVICE);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
SetEvent (pCall->hEvent);
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_WriteClassOfDevice_Out: ERROR_SUCCESS\n"));
gpState->Unlock ();
return ERROR_SUCCESS;
}
static int btshell_ReadClassOfDevice_Out (void *pCallContext, unsigned char status, unsigned int cod) {
IFDBG(DebugOut (DEBUG_SHELL_TRACE, L"btshell_ReadClassOfDevice_Out: status %d, cod 0x%06x\n", status, cod));
if (! gpState) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadClassOfDevice_Out: ERROR_SERVICE_NOT_ACTIVE\n"));
return ERROR_SERVICE_NOT_ACTIVE;
}
gpState->Lock ();
if (! gpState->fIsRunning) {
IFDBG(DebugOut (DEBUG_WARN, L"btshell_ReadClassOfDevice_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_ReadClassOfDevice_Out: ERROR_NOT_FOUND\n"));
gpState->Unlock ();
return ERROR_NOT_FOUND;
}
SVSUTIL_ASSERT (pCall->fWhat == CALL_HCI_READ_CLASS_OF_DEVICE);
pCall->fComplete = TRUE;
pCall->iResult = StatusToError (status, ERROR_INTERNAL_ERROR);
if (status == 0)
pCall->dwResult = cod;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -