/*!
  Informs that our request has been prosessed and the data is available to be used.
*/
void BluetoothLinkManagerDeviceDiscoverer::RunL()
{
    qDebug() << __PRETTY_FUNCTION__ << iStatus.Int();
    switch (iStatus.Int()) {
    case KErrNone:  // found device
        if (m_pendingCancel && !m_pendingStart) {
            m_pendingCancel = false;
            emit canceled();
        } else {
            m_pendingCancel = false;
            m_pendingStart = false;
            // get next (possible) discovered device
            m_hostResolver.Next(m_entry, iStatus);
            SetActive();
            emit deviceDiscovered(currentDeviceDataToQBluetoothDeviceInfo());
        }
        break;
    case KErrHostResNoMoreResults:  // done with search
        if (m_pendingCancel && !m_pendingStart){  // search was canceled prior to finishing
            m_pendingCancel = false;
            m_pendingStart = false;
            emit canceled();
        }
        else if (m_pendingStart){  // search was restarted just prior to finishing
            m_pendingStart = false;
            m_pendingCancel = false;
            startDiscovery(m_discoveryType);
        } else {  // search completed normally
            m_pendingStart = false;
            m_pendingCancel = false;
            emit deviceDiscoveryComplete();
        }
        break;
    case KErrCancel:  // user canceled search
        if (m_pendingStart){  // user activated search after cancel
            m_pendingStart = false;
            m_pendingCancel = false;
            startDiscovery(m_discoveryType);
        } else {  // standard user cancel case
            m_pendingCancel = false;
            emit canceled();
        }
        break;
    default:
        m_pendingStart = false;
        m_pendingCancel = false;
        setError(iStatus.Int());
    }
}
Beispiel #2
0
void Tennis::mouseMove(int x, int y)
{
    if(isConnected == false){
        // look for clicks in the bt connect icon
        if(x > 440 && x < 540 && y > 200 && y < 300) {
            qDebug() << "Got connect click!";
            if(m_discoveryAgent->isActive()) {
                qDebug() << "stopping!";
                m_discoveryAgent->stop();
                board->animateConnect(false);
            }
            else {
                qDebug() << "starting!";
                startDiscovery();
            }
        }

    }
    y-=12+Board::Paddle/2;
    if(y <= 0)
        y = 0;
    else if(y > Board::Height-Board::Paddle-24)
        y = Board::Height-Board::Paddle-24;

    endPaddlePos = y;
    move(y);
}
Beispiel #3
0
void RemoteSelector::on_refreshPB_clicked() {
    startDiscovery();
    ui->stopButton->setDisabled(false);
}
Beispiel #4
0
void RemoteSelector::startDiscovery() {
    startDiscovery(QBluetoothUuid(QBluetoothUuid::ObexObjectPush));
}
Beispiel #5
0
Controller::Controller() :
    _deviceNeedResolve(0),
    _lastTimeFocused(0),
    _service(&_udpDiscovery, this),
    _udpDiscoveryTimer(this)
{
    _service.moveToThread(&_serviceThread);
    _serviceThread.start();

    _view = new View(&_model);
    _bonjourBrowser = new BonjourServiceBrowser(this);

    connect(&_udpDiscovery, SIGNAL(devicesFound(const QList<Device *> &)), this, SLOT(updateDevices(const QList<Device *> &)));
    connect(&_udpDiscovery, SIGNAL(pongReceived(const QString&)), this, SLOT(onPong(const QString &)));

    connect(_bonjourBrowser, SIGNAL(currentBonjourRecordsChanged(const QList<BonjourRecord> &)),
            this, SLOT(updateRecords(const QList<BonjourRecord> &)));
    connect(_bonjourBrowser, SIGNAL(error(DNSServiceErrorType)),
            this, SLOT(error(DNSServiceErrorType)));

    connect(_view, SIGNAL(sendFile(const QString&, const QList<QUrl>&, DataType)),
            this, SLOT(onSendFile(const QString&, const QList<QUrl>&, DataType)));
    connect(_view, SIGNAL(sendText(const QString&, const QString&, DataType)),
            this, SLOT(onSendText(const QString&, const QString&, DataType)));
    connect(_view, SIGNAL(cancelTransfert(const QString&)),
            this, SLOT(onCancelTransfert(const QString&)));
    connect(_view, SIGNAL(focused()), this, SLOT(onWindowFocused()));
    connect(_view, SIGNAL(forceRefresh()), this, SLOT(onForceRefresh()));

    connect(_view, SIGNAL(registerService()),
            &_service, SLOT(serviceRegister()));
    connect(_view, SIGNAL(unregisterService()),
            &_service, SLOT(serviceUnregister()));
    connect(_view, SIGNAL(deleteFromHistory(int)),
            &_service, SLOT(onDeleteFromHistory(int)));
    connect(_view, SIGNAL(clearHistoryTriggered()),
            &_service, SLOT(onClearHistory()));
    connect(_view, SIGNAL(serviceNameChanged()),
            &_service, SLOT(onTimerOut()));
    connect(_view, SIGNAL(cancelIncomingTransfert()),
            &_service, SLOT(deleteFileReset()));

    connect(&_service, SIGNAL(historyChanged(const QList<HistoryElement>&)),
            _view, SLOT(onHistoryChanged(const QList<HistoryElement>&)));
    connect(&_service, SIGNAL(historyElementProgressUpdated(unsigned)),
            _view, SLOT(historyElementProgressUpdated(unsigned)));

    connect(&_service, SIGNAL(serviceError(ServiceErrorState,bool)),
            _view, SLOT(onServiceError(ServiceErrorState,bool)));
    connect(&_service, SIGNAL(receivingFile(const QString&,int)),
             _view, SLOT(onReceivingFile(const QString&,int)));
    connect(&_service, SIGNAL(receivingFolder(const QString&,int)),
            _view, SLOT(onReceivingFolder(const QString&,int)));
    connect(&_service, SIGNAL(receivingText(const QString&)),
            _view, SLOT(onReceivingText(const QString&)));
    connect(&_service, SIGNAL(receivingUrl(const QString&)),
            _view, SLOT(onReceivingUrl(const QString&)));

    connect(&_model, SIGNAL(newDeviceCreated(Device*)),
            this, SLOT(onNewDeviceCreated(Device*)));
    connect(&_model, SIGNAL(deviceRemoved()),
            _view, SLOT(updateDevices()));

    connect(&_updater, SIGNAL(updateNeeded(const QString&,const QString&)),
            _view, SLOT(onUpdateNeeded(const QString&,const QString&)));

    checkForBonjourState();
    _view->updateDevices();
    _view->onHistoryChanged(_service.getHistory());

    _bonjourBrowser->browseForServiceType(QLatin1String("_fdnd._tcp."));

    connect(&_udpDiscoveryTimer, SIGNAL(timeout()), &_udpDiscovery, SLOT(startDiscovery()));
    _udpDiscoveryTimer.start(UDP_DISCOVERY_INTERVAL);
    _udpDiscovery.startDiscovery();

    createSendTo();
}