当前位置: 首页>>代码示例>>C++>>正文


C++ QBluetoothAddress函数代码示例

本文整理汇总了C++中QBluetoothAddress函数的典型用法代码示例。如果您正苦于以下问题:C++ QBluetoothAddress函数的具体用法?C++ QBluetoothAddress怎么用?C++ QBluetoothAddress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了QBluetoothAddress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QBluetoothAddress

QBluetoothAddress HciManager::addressForConnectionHandle(quint16 handle) const
{
    if (!isValid())
        return QBluetoothAddress();

    hci_conn_info *info;
    hci_conn_list_req *infoList;

    const int maxNoOfConnections = 20;
    infoList = (hci_conn_list_req *)
            malloc(sizeof(hci_conn_list_req) + maxNoOfConnections * sizeof(hci_conn_info));

    if (!infoList)
        return QBluetoothAddress();

    QScopedPointer<hci_conn_list_req, QScopedPointerPodDeleter> p(infoList);
    p->conn_num = maxNoOfConnections;
    p->dev_id = hciDev;
    info = p->conn_info;

    if (ioctl(hciSocket, HCIGETCONNLIST, (void *) infoList) < 0) {
        qCWarning(QT_BT_BLUEZ) << "Cannot retrieve connection list";
        return QBluetoothAddress();
    }

    for (int i = 0; i < infoList->conn_num; i++) {
        if (info[i].handle == handle)
            return QBluetoothAddress(convertAddress(info[i].bdaddr.b));
    }

    return QBluetoothAddress();
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:32,代码来源:hcimanager.cpp

示例2: QL2capServer

int QDeclarativeBluetoothServicePrivate::listen() {

    if (m_protocol == "l2cap") {
        QL2capServer *server = new QL2capServer();

        server->setMaxPendingConnections(1);
        server->listen(QBluetoothAddress(), m_port);
        m_port = server->serverPort();
        m_listen = server;
    }
    else if (m_protocol == "rfcomm") {
        QRfcommServer *server = new QRfcommServer();

        server->setMaxPendingConnections(1);
        server->listen(QBluetoothAddress(), m_port);
        m_port = server->serverPort();
        m_listen = server;
    }
    else {
        qDebug() << "Unknown protocol, can't make service" << m_protocol;
    }

    return m_port;

}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:25,代码来源:qdeclarativebluetoothservice.cpp

示例3: QBluetoothAddress

void tst_QBluetoothAddress::tst_comparison_data()
{
    QTest::addColumn<QBluetoothAddress>("address1");
    QTest::addColumn<QBluetoothAddress>("address2");
    QTest::addColumn<bool>("result");

    QTest::newRow("invalid == invalid") << QBluetoothAddress() << QBluetoothAddress() << true;
    QTest::newRow("valid != invalid") << QBluetoothAddress(Q_UINT64_C(0x112233445566)) << QBluetoothAddress() << false;
    QTest::newRow("valid == valid") << QBluetoothAddress(Q_UINT64_C(0x112233445566)) << QBluetoothAddress(Q_UINT64_C(0x112233445566)) << true;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:10,代码来源:tst_qbluetoothaddress.cpp

示例4: QBluetoothAddress

void tst_QL2capServer::tst_listen_data()
{
    QTest::addColumn<QBluetoothAddress>("address");
    QTest::addColumn<quint16>("port");

    QTest::newRow("default") << QBluetoothAddress() << quint16(0);
    QTest::newRow("specified address") << QBluetoothAddress("00:11:B1:08:AD:B8") << quint16(0);
    QTest::newRow("specified port") << QBluetoothAddress() << quint16(24160);
    QTest::newRow("specified address/port") << QBluetoothAddress("00:11:B1:08:AD:B8") << quint16(10);
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:10,代码来源:tst_ql2capserver.cpp

示例5: QBluetoothAddress

QBluetoothAddress QBluetoothSocketPrivate::peerAddress() const
{
    if (!remoteDevice.isValid())
        return QBluetoothAddress();

    const QString address = remoteDevice.callObjectMethod("getAddress",
                                                          "()Ljava/lang/String;").toString();

    return QBluetoothAddress(address);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:10,代码来源:qbluetoothsocket_android.cpp

示例6: QBluetoothAddress

void tst_QBluetoothLocalDevice::tst_pairingStatus_data()
{
    QTest::addColumn<QBluetoothAddress>("deviceAddress");
    QTest::addColumn<QBluetoothLocalDevice::Pairing>("pairingExpected");

    QTest::newRow("UnPaired Device: DUMMY") << QBluetoothAddress("11:00:00:00:00:00") << QBluetoothLocalDevice::Unpaired;
#ifdef Q_OS_SYMBIAN
    QTest::newRow("UNPAIR Device: BH-604") << QBluetoothAddress("00:0d:3c:b0:77:1c") << QBluetoothLocalDevice::Unpaired;
    QTest::newRow("Paired Device: TESTMACHINE") << QBluetoothAddress("00:09:DD:50:93:DD") << QBluetoothLocalDevice::Paired;
#endif // Q_OS_SYMBIAN
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:11,代码来源:tst_qbluetoothlocaldevice.cpp

示例7: QBluetoothAddress

static PyObject *meth_QBluetoothServiceInfo_registerService(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = NULL;

    {
        const QBluetoothAddress& a0def = QBluetoothAddress();
        const QBluetoothAddress* a0 = &a0def;
        QBluetoothServiceInfo *sipCpp;

        static const char *sipKwdList[] = {
            sipName_localAdapter,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, NULL, "B|J9", &sipSelf, sipType_QBluetoothServiceInfo, &sipCpp, sipType_QBluetoothAddress, &a0))
        {
            bool sipRes;

            sipRes = sipCpp->registerService(*a0);

            return PyBool_FromLong(sipRes);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QBluetoothServiceInfo, sipName_registerService, doc_QBluetoothServiceInfo_registerService);

    return NULL;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:28,代码来源:sipQtBluetoothQBluetoothServiceInfo.cpp

示例8: Q_Q

void QBluetoothServerPrivate::controlReply(ppsResult result)
{
    Q_Q(QBluetoothServer);

    if (result.msg == QStringLiteral("register_server")) {
        qCDebug(QT_BT_QNX) << "SPP: Server registration succesfull";

    } else if (result.msg == QStringLiteral("get_mount_point_path")) {
        qCDebug(QT_BT_QNX) << "SPP: Mount point for server" << result.dat.first();

        int socketFD = ::open(result.dat.first().toStdString().c_str(), O_RDWR | O_NONBLOCK);
        if (socketFD == -1) {
            m_lastError = QBluetoothServer::InputOutputError;
            emit q->error(m_lastError);
            qCWarning(QT_BT_QNX) << Q_FUNC_INFO << "RFCOMM Server: Could not open socket FD" << errno;
        } else {
            if (!socket) { // Should never happen
                qCWarning(QT_BT_QNX) << "Socket not valid";
                m_lastError = QBluetoothServer::UnknownError;
                emit q->error(m_lastError);
                return;
            }

            socket->setSocketDescriptor(socketFD, QBluetoothServiceInfo::RfcommProtocol,
                                           QBluetoothSocket::ConnectedState);
            socket->connectToService(QBluetoothAddress(nextClientAddress), m_uuid);
            activeSockets.append(socket);
            socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol, this);
            socket->setSocketState(QBluetoothSocket::ListeningState);
            emit q->newConnection();
        }
    }
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:33,代码来源:qbluetoothserver_qnx.cpp

示例9: Q_Q

void QBluetoothServerPrivate::setBtCallbackParameters(int receivedSocket)
{
    Q_Q(QBluetoothServer);
    if (receivedSocket == -1) {
        qCDebug(QT_BT_QNX) << "Socket error: " << qt_error_string(errno);
        m_lastError = QBluetoothServer::InputOutputError;
        emit q->error(m_lastError);
        return;
    }
    socket->setSocketDescriptor(receivedSocket, QBluetoothServiceInfo::RfcommProtocol,
                                QBluetoothSocket::ConnectedState,
                                QBluetoothSocket::ReadWrite);
    char addr[18];
    if (bt_spp_get_address(receivedSocket, addr) == -1) {
        qCDebug(QT_BT_QNX) << "Could not obtain the remote address. "
                           << qt_error_string(errno);
        m_lastError = QBluetoothServer::InputOutputError;
        emit q->error(m_lastError);
        return;
    }
    socket->d_ptr->m_peerAddress = QBluetoothAddress(addr);
    activeSockets.append(socket);
    socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol, this);
    socket->setSocketState(QBluetoothSocket::ListeningState);
    emit q->newConnection();
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:26,代码来源:qbluetoothserver_qnx.cpp

示例10: QObject

BluetoothMultiplexer::BluetoothMultiplexer(const QString &address, const QString &service_uuid, QObject *parent)
    : QObject(parent)
    , m_socket(NULL)
    , m_connections()
    , m_connections_nextid(1)
    , m_buffer_in_required(0)
    , m_buffer_in_data()
    , m_buffer_in_version(0)
    , m_buffer_in_type(0)
    , m_buffer_out_data()
{
    qDebug() << this << "Creating";

    m_buffer_out_data.clear();

    m_socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol, this);

    connect(m_socket, &QBluetoothSocket::connected, this, &BluetoothMultiplexer::_connected);
    connect(m_socket, &QBluetoothSocket::disconnected, this, &BluetoothMultiplexer::_disconnected);
    connect(m_socket, &QBluetoothSocket::readyRead, this, &BluetoothMultiplexer::_read);
    connect(m_socket, &QBluetoothSocket::stateChanged, this, &BluetoothMultiplexer::_stateChanged);
    connect(m_socket, static_cast<void(QBluetoothSocket::*)(QBluetoothSocket::SocketError)>(&QBluetoothSocket::error),
            this, &BluetoothMultiplexer::_error);

    processNext(2, &BluetoothMultiplexer::_processInHeader);

    m_socket->connectToService(QBluetoothAddress(address), QBluetoothUuid(service_uuid));
}
开发者ID:rabits,项目名称:onecontrol,代码行数:28,代码来源:bluetoothmultiplexer.cpp

示例11: QBluetoothAddress

/*!
    Returns the remote device address. If setRemoteAddress is not called, the function
    will return default QBluetoothAddress.

*/
QBluetoothAddress QBluetoothServiceDiscoveryAgent::remoteAddress() const
{
    if (d_ptr->singleDevice == true)
        return d_ptr->deviceAddress;
    else
        return QBluetoothAddress();
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:12,代码来源:qbluetoothservicediscoveryagent.cpp

示例12: ppsReadRemoteDevice

bool ppsReadRemoteDevice(int fd, pps_decoder_t *decoder, QBluetoothAddress *btAddr, QString *deviceName)
{
    char buf[ppsBufferSize * 2];
    char addr_buf[18];

    addr_buf[17] = '\0';

    if (qt_safe_read(fd, &buf, sizeof(buf)) == -1) {
        qCWarning(QT_BT_QNX) << Q_FUNC_INFO << "Could not qt_safe_read from pps remote device file";
        return false;
    }

    qCDebug(QT_BT_QNX) << "Remote device" << buf;

    //the address of the BT device is stored at the beginning of the qt_safe_read
    if (buf[0] != '-') {
        memcpy(&addr_buf, &buf[1], 17);
    } else { //The device was removed
        memcpy(&addr_buf, &buf[2], 17);
        return false;
    }

    *btAddr = QBluetoothAddress(QString::fromUtf8(addr_buf));

    if (pps_decoder_parse_pps_str(decoder, buf) == PPS_DECODER_OK) {
        const char* name;
        pps_decoder_push(decoder, 0);

        if (pps_decoder_get_string(decoder, "name", &name) == PPS_DECODER_OK)
            (*deviceName) = QString::fromUtf8(name);

        return true;
    }
    return false;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:35,代码来源:ppshelpers.cpp

示例13: QBluetoothAddress

//! [Connect to remote service]
void Chat::connectClicked()
{
    ui->connectButton->setEnabled(false);

    // scan for services
    const QBluetoothAddress adapter = localAdapters.isEmpty() ?
                                           QBluetoothAddress() :
                                           localAdapters.at(currentAdapterIndex).address();

    RemoteSelector remoteSelector(adapter);
    remoteSelector.startDiscovery(QBluetoothUuid(serviceUuid));
    if (remoteSelector.exec() == QDialog::Accepted) {
        QBluetoothServiceInfo service = remoteSelector.service();

        qDebug() << "Connecting to service 2" << service.serviceName()
                 << "on" << service.device().name();

        // Create client
        qDebug() << "Going to create client";
        ChatClient *client = new ChatClient(this);
qDebug() << "Connecting...";

        connect(client, SIGNAL(messageReceived(QString,QString)),
                this, SLOT(showMessage(QString,QString)));
        connect(client, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
        connect(client, SIGNAL(connected(QString)), this, SLOT(connected(QString)));
        connect(this, SIGNAL(sendMessage(QString)), client, SLOT(sendMessage(QString)));
qDebug() << "Start client";
        client->startClient(service);

        clients.append(client);
    }

    ui->connectButton->setEnabled(true);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:36,代码来源:chat.cpp

示例14: QVariant

void tst_QBluetoothTransferRequest::tst_construction_data()
{
    QTest::addColumn<QBluetoothAddress>("address");
    QTest::addColumn<QMap<int, QVariant> >("parameters");

    QMap<int, QVariant> inparameters;
    inparameters.insert((int)QBluetoothTransferRequest::DescriptionAttribute, "Desciption");
    inparameters.insert((int)QBluetoothTransferRequest::LengthAttribute, QVariant(1024));
    inparameters.insert((int)QBluetoothTransferRequest::TypeAttribute, "OPP");

    QTest::newRow("0x000000 COD") << QBluetoothAddress("000000000000") << inparameters;
    QTest::newRow("0x000100 COD") << QBluetoothAddress("000000000000") << inparameters;
    QTest::newRow("0x000104 COD") << QBluetoothAddress("000000000000") << inparameters;
    QTest::newRow("0x000118 COD") << QBluetoothAddress("000000000000") << inparameters;
    QTest::newRow("0x000200 COD") << QBluetoothAddress("000000000000") << inparameters;
}
开发者ID:mer-packages,项目名称:qtconnectivity,代码行数:16,代码来源:tst_qbluetoothtransferrequest.cpp

示例15: QBluetoothAddress

void tst_QBluetoothLocalDevice::tst_pairingStatus_data()
{
    QTest::addColumn<QBluetoothAddress>("deviceAddress");
    QTest::addColumn<QBluetoothLocalDevice::Pairing>("pairingExpected");

    QTest::newRow("UnPaired Device: DUMMY") << QBluetoothAddress("11:00:00:00:00:00")
            << QBluetoothLocalDevice::Unpaired;
}
开发者ID:lainwir3d,项目名称:qtconnectivity,代码行数:8,代码来源:tst_qbluetoothlocaldevice.cpp


注:本文中的QBluetoothAddress函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。