void QuteMessenger::newServiceFound(const QBtDevice& dev, const QBtService& serv) { //since we need only the first available service with the given ClassID //when the first service is reported, the service discovery stops disconnect(serviceDisc, SIGNAL(newServiceFound(const QBtDevice&, const QBtService&)), this, SLOT(newServiceFound(const QBtDevice&, const QBtService&))); qDebug() << "Service to connect: " << serv.getName(); qDebug() << "UUID: " << serv.getClass().get(); qDebug() << "Dev: " << dev.getName(); qDebug() << "Dev Addr: " << dev.getAddress().toString(); if(obexClient) { delete obexClient; obexClient = NULL; } obexClient = new QBtObjectExchangeClient(this); connect(obexClient, SIGNAL(connectedToServer()), this, SLOT(connectedToRemoteOBEXServer())); connect(obexClient, SIGNAL(objectSent()), this, SLOT(fileSent())); connect(obexClient, SIGNAL(error (QBtObjectExchangeClient::ErrorCode)), this, SLOT(reportObexError(QBtObjectExchangeClient::ErrorCode)) ); selectedService = serv; obexClient->connectToServer(deviceQueriedForServices, selectedService); }
/** * 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(); }
bool QBtLocalDevicePrivate::AddNewDevice(const QBtDevice& device) { BTUINT8 devAddr[6] = {0}; BTDEVHDL devHandle = BTSDK_INVALID_HANDLE; QByteArray addrArray = device.getAddress().toReversedByteArray(); memcpy(devAddr, addrArray.constData(), addrArray.size()); devHandle = Btsdk_AddRemoteDevice(devAddr); return (devHandle != BTSDK_INVALID_HANDLE); }
bool QBtLocalDevice::deleteDevice(const QBtDevice& device) { return QBtLocalDevice::deleteDevice(device.getAddress()); }
bool QBtLocalDevice::unpairDevice(const QBtDevice& device) { return QBtLocalDevice::unpairDevice(device.getAddress()); }