// ---------------------------------------------------------
// QBtDeviceDiscovererPrivate::~QBtDeviceDiscovererPrivate()
// Destructor
// ---------------------------------------------------------
//
QBtDeviceDiscovererPrivate::~QBtDeviceDiscovererPrivate()
{
	StopDiscovery();

	BtSdkCallbackStru cb;
	cb.type = BTSDK_INQUIRY_COMPLETE_IND;
	cb.func = NULL;	
	Btsdk_RegisterCallback4ThirdParty(&cb);

	cb.type = BTSDK_INQUIRY_RESULT_IND;
	cb.func = NULL;
	Btsdk_RegisterCallback4ThirdParty(&cb);

	Btsdk_RegisterGetStatusInfoCB4ThirdParty(NULL);

	QBtAuxFunctions::DeinitBthSdk();
}
Пример #2
0
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Description:
	This function is the main function
Arguments:
	void
Return:
	always return 0
---------------------------------------------------------------------------*/
int main(void)
{
    BTUINT8 chInputCmd = 0;
    BTUINT8 chEnterChoice = 0;

    printf("IVT BlueSoleil SDK is being Initialized....\n");
    if (FALSE == InitBlueSoleilForSample())
    {
        printf("Fail to initialize BlueSoleil, assure BlueSoleil is installed!\n");
        printf("Press any key to exit this application please.\n");
        scanf(" %c", &chEnterChoice);
        getchar();
        return 1;
    }
    else
    {
        RegAppIndCallback();
        Test_RegisterGetStatusCBK();

        if (BTSDK_TRUE != Btsdk_IsBluetoothHardwareExisted())
        {
            printf("There isn't any Bluetooth hardware detected.\n");
            printf("1. Enter 'N' to exit this application.\n");
            printf("2. Plug a Bluetooth hardware and enter 'Y' to continue.\n");

            while (TRUE)
            {
                scanf(" %c",&chEnterChoice);
                getchar();

                if (('y'==chEnterChoice)||('Y'==chEnterChoice))
                {
                    if (BTSDK_TRUE == Btsdk_IsBluetoothHardwareExisted())
                    {
                        printf("Bluetooth hardware is detected.\n");
                        break;
                    }
                    else
                    {
                        printf("Bluetooth hardware isn't detected and plug it again please.\n");
                        printf("Enter 'Y' to try again, Enter 'N' to exit this application.\n");
                        printf(">");
                    }
                }
                else if(('n'==chEnterChoice)||('N'== chEnterChoice))
                {
                    return 1;
                }
                else
                {
                    printf("You have entered into an invalid character.\n");
                }
            }
        }

        if (BTSDK_FALSE == Btsdk_IsBluetoothReady())
        {
            Btsdk_StartBluetooth();
        }

        if (BTSDK_TRUE == Btsdk_IsBluetoothReady())
        {
            /*we default expect this application runs on desktop platform.
            	of course, you can set another device class according to your need. */
            Btsdk_SetLocalDeviceClass(BTSDK_COMPCLS_DESKTOP);

            SdkTestShowMenu();
            while (chInputCmd != 'q')
            {
                scanf(" %c", &chInputCmd);
                getchar();
                if ('\n' == chInputCmd)
                {
                    printf(">>");
                }
                else
                {
                    ExecInputCmd(chInputCmd);
                    printf("\n");
                    if (chInputCmd != 'q')
                    {
                        SdkTestShowMenu();
                    }
                }
            }

        }
        else
        {
            printf("BlueSoleil fail to reset hardware...\n");
        }

        printf("IVT BlueSoleil SDK is being quitted....\n");
        Btsdk_RegisterGetStatusInfoCB4ThirdParty(NULL);
        UnRegAppIndCallback();
        Btsdk_Done();
        return 0;

    }
}
Пример #3
0
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Description:
	This function registers callback function to get status change of BlueSoleil.
Arguments:
	void
Return:
	void
---------------------------------------------------------------------------*/
void Test_RegisterGetStatusCBK(void)
{
    /* register callback function to get the status change of BlueSoleil. */
    Btsdk_RegisterGetStatusInfoCB4ThirdParty(BsStatusCBKFuc);
    Btsdk_SetStatusInfoFlag(BTSDK_BLUETOOTH_STATUS_FLAG);
}