/**
* ConnectToServer
* Connect to the server
* @param remoteDevice the remote server to connect to
* @param remoteServive the remote service of the server
*/
void QBtObjectExchangeClientPrivate::ConnectToServer(const QBtDevice& remoteDevice, const QBtService& remoteService)
{
	//check
	if( !remoteDevice.getAddress().isValid())
	{
		emit p_ptr->error(QBtObjectExchangeClient::OBEXClientNoSelectedDevice);
		return;
	}
	if( remoteService.getClass()  == QBtConstants::UndefinedClass &&
		remoteService.getHandle() == 0)
	{
		emit p_ptr->error(QBtObjectExchangeClient::OBEXClientNoSelectedService);
		return;
	}
	
	server = new QBtDevice(remoteDevice);
	connectingService = new QBtService(remoteService);
	
	BTDEVHDL devHandle = GetDeviceHandle(server->getAddress());

	BTINT32 result = BTSDK_FALSE;

	if(connectionHandle != BTSDK_INVALID_HANDLE)
		result = Btsdk_Connect(connectingService->getHandle(), 0, &connectionHandle);
	else
		result = Btsdk_ConnectEx(devHandle, connectingService->getClass(), 0, &connectionHandle);

	if(result != BTSDK_OK)
		emit p_ptr->error(QBtObjectExchangeClient::OBEXClientConnectionError);
	else
		emit p_ptr->connectedToServer();
}
Beispiel #2
0
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Description:
	This function is to connect HF service by its service handle.
Arguments:
Return:
	void 
---------------------------------------------------------------------------*/
void TestConnectHFSvc()
{
	BTINT32 ulRet = BTSDK_FALSE;
	
	ulRet = Btsdk_Connect(s_currHFSvcHdl, 0, &s_currHFConnHdl);
	if (BTSDK_OK != ulRet)
	{
		printf("Please make sure that the expected device is powered on and connectable.\n");
	}
	else
	{
		printf("Connect to Audio GateWay successfully.\n");
	}
}
Beispiel #3
0
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Description:
	This function is to connect HF service by its service handle.
Arguments:
Return:
	void 
---------------------------------------------------------------------------*/
void TestConnectAGSvc()
{
	BTINT32 ulRet = BTSDK_FALSE;
	
	ulRet = Btsdk_Connect(s_currHFSvcHdl, 0, &s_currAGConnHdl);
	if (BTSDK_OK != ulRet)
	{
		printf("Please make sure that the expected device is powered on and connectable.\n");
	}
	else
	{
		printf("Please switch your audio card to Bluetooth SCO card, then you can hear music with the headset device.\n");
	}
}