bool QBtLocalDevicePrivate::GetLimitedDiscoverableStatus()
{
    BTUINT16 pmode;
    BTINT32 retBool = BTSDK_FALSE;

    retBool = Btsdk_GetDiscoveryMode(&pmode);

    if((pmode & BTSDK_LIMITED_DISCOVERABLE) != 0)
        return true;

    return false;
}
bool QBtLocalDevicePrivate::IsVisible()
{
	BTUINT16 pmode;
	BTINT32 retBool = BTSDK_FALSE;

	retBool = Btsdk_GetDiscoveryMode(&pmode);

	if((pmode & BTSDK_LIMITED_DISCOVERABLE || pmode & BTSDK_DISCOVERABLE) != 0)
		return true;

	return false;
}
Esempio n. 3
0
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Description:
	This function prints information of local device
Arguments:
	void
Return:
	void 
---------------------------------------------------------------------------*/
void Test_Print_Local_Info(void)
{
	int j = 0;
	BTUINT8 szName[BTSDK_DEVNAME_LEN] = {0};
	BTUINT8 szBDAddr[BTSDK_BDADDR_LEN] = {0};
	BTUINT32 ulDevClass = 0;
	BTUINT16 usMode = 0;
	BTUINT16 usLen = BTSDK_DEVNAME_LEN;

	printf("\n");

	/* display the local device name */
	PrintErrorMessage(Btsdk_GetLocalName(szName, &usLen), BTSDK_TRUE);
	printf("Local Name = \"%s\"\n", szName);

	/* display the Bluetooth Address of the local device */
	PrintErrorMessage(Btsdk_GetLocalDeviceAddress(szBDAddr), BTSDK_TRUE);
	printf("BD Addr: ");
	for(j = 5; j > 0; j--)
	{
		printf("%02X:", szBDAddr[j]);
	}
	printf("%02X\n", szBDAddr[0]);

	/* display the device class of the local device */
	PrintErrorMessage(Btsdk_GetLocalDeviceClass(&ulDevClass), BTSDK_TRUE);
	printf("Device Class: %08lX\n", ulDevClass);

	/* display the discovery mode of the local device */
	PrintErrorMessage(Btsdk_GetDiscoveryMode(&usMode), BTSDK_TRUE);
	printf("Discovery Mode: ");
	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\n");
	}
	printf("\n");	
}
Esempio n. 4
0
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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);
	}	
}