コード例 #1
0
QBtDevice::DeviceMajor QBtLocalDevicePrivate::GetDeviceClass()
{
    BTUINT32 devClass;
    BTINT32 result = BTSDK_FALSE;
    result = Btsdk_GetLocalDeviceClass(&devClass);

    if(result != BTSDK_OK)
        return QBtDevice::Uncategorized;

    if(devClass & BTSDK_DEVCLS_COMPUTER)
        return QBtDevice::Computer;
    else if(devClass & BTSDK_DEVCLS_PHONE)
        return QBtDevice::Phone;
    else if(devClass & BTSDK_DEVCLS_LAP)
        return QBtDevice::LANAccess;
    else if(devClass & BTSDK_DEVCLS_AUDIO)
        return QBtDevice::AudioVideo;
    else if(devClass & BTSDK_DEVCLS_PERIPHERAL)
        return QBtDevice::Peripheral;
    else if(devClass & BTSDK_DEVCLS_IMAGE)
        return QBtDevice::Imaging;
    else if(devClass & BTSDK_DEVCLS_IMAGE)
        return QBtDevice::Imaging;
    else if(devClass & BTSDK_DEVCLS_WEARABLE)
        return QBtDevice::Wearable;
    else
        return QBtDevice::Uncategorized;
}
コード例 #2
0
ファイル: loc_dev_tst.c プロジェクト: uri247/lib
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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");	
}
コード例 #3
0
void QBtLocalDevicePrivate::SetDeviceClass(QBtDevice::DeviceMajor classId)
{
    BTUINT32 devClass;
    BTINT32 result = BTSDK_FALSE;
    result = Btsdk_GetLocalDeviceClass(&devClass);

    if(result != BTSDK_OK)
        return;

    QBtDevice::DeviceMajor currentDeviceClass = GetDeviceClass();

    BTUINT32 newDevClass = (devClass ^ (currentDeviceClass * 0x100)) | (classId * 0x100);

    Btsdk_SetLocalDeviceClass(newDevClass);
}
コード例 #4
0
ファイル: loc_dev_tst.c プロジェクト: uri247/lib
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Description:
	This function sets the device class of local device 
Arguments:
	void
Return:
	void 
---------------------------------------------------------------------------*/
void Test_Btsdk_SetLocalDeviceClass(void)
{
	BTUINT32 ulDeviceClass = 0;
	BTUINT32 ulReturn = 0;

	printf("You can input '0X000104' for class of 'Desktop workstation'.\n");
	printf("You can input '0X00010C' for class of 'Laptop computer'.\n");
	printf("You can input '0X240404' for class of 'Headset', possibly used in Handsfree/Headset sample test.\n");
	printf("Please refer to the documents we provide for more information about device's class.\n");
	printf("Device's Class = ");
	scanf("%X", &ulDeviceClass);
	ulReturn = Btsdk_SetLocalDeviceClass(ulDeviceClass);
	if (BTSDK_OK == ulReturn)
	{
		Btsdk_GetLocalDeviceClass(&ulDeviceClass);
		printf("The modified local device's class is 0X%06X.\n", ulDeviceClass);
	}
	else
	{
		PrintErrorMessage(ulReturn, BTSDK_TRUE);
	}	
}