void QBtLocalDevicePrivate::SetVisible (bool value) { BTUINT16 usMode = BTSDK_CONNECTABLE | BTSDK_PAIRABLE | BTSDK_DISCOVERABLE*((int)value); Btsdk_SetDiscoveryMode(usMode); return; }
void QBtLocalDevicePrivate::SetLimitedDiscoverableStatus(bool isDiscoverabilityLimited) { BTUINT16 usMode = BTSDK_GENERAL_DISCOVERABLE * (!isDiscoverabilityLimited) | BTSDK_LIMITED_DISCOVERABLE * isDiscoverabilityLimited | BTSDK_CONNECTABLE | BTSDK_PAIRABLE; Btsdk_SetDiscoveryMode(usMode); return; }
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Description: This function sets discovery mode of local device Arguments: void Return: void ---------------------------------------------------------------------------*/ void Test_Btsdk_SetDiscoveryMode(void) { BTUINT16 usMode = 1; BTUINT32 ulReturn = 0; printf("Discovery Modes:\n"); printf("1. GENERAL_DISCOVERABLE\n"); printf("2. LIMITED_DISCOVERABLE\n"); printf("4. CONNECTABLE\n"); printf("8. PAIRABLE\n"); printf("The discovery mode can be the binary combination of the upper modes.\n"); printf("For example, Inputting 9 indicates 'GENERAL_DISCOVERABLE|PAIRABLE'.\n"); printf(" Inputting 5 indicates 'GENERAL_DISCOVERABLE|CONNECTABLE', and so on.\n"); printf("Your choice is: "); scanf("%d", &usMode); ulReturn = Btsdk_SetDiscoveryMode(usMode); if (BTSDK_OK == ulReturn) { printf("You have set the discovery mode of this local device successfully.\n"); Btsdk_GetDiscoveryMode(&usMode); printf("The discovery mode after set is:\n"); if (usMode & BTSDK_GENERAL_DISCOVERABLE) { printf("GENERAL_DISCOVERABLE |"); } if (usMode & BTSDK_LIMITED_DISCOVERABLE) { printf(" LIMITED_DISCOVERABLE |"); } if (usMode & BTSDK_CONNECTABLE) { printf(" CONNECTABLE |"); } if (usMode & BTSDK_PAIRABLE) { printf(" PAIRABLE |"); } printf("\n"); } else { PrintErrorMessage(ulReturn, BTSDK_TRUE); } }