Пример #1
0
QT_BEGIN_NAMESPACE

QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType)
    : maxPendingConnections(1), serverType(sType), m_lastError(QBluetoothServer::NoError)
{
#ifndef QT_IOS_BLUETOOTH
    printDummyWarning();
#endif
    if (sType == QBluetoothServiceInfo::RfcommProtocol)
        socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
    else
        socket = new QBluetoothSocket(QBluetoothServiceInfo::L2capProtocol);
}
QBluetoothTransferReply *QBluetoothTransferManager::put(const QBluetoothTransferRequest &request,
                                                        QIODevice *data)
{
#ifdef QT_BLUEZ_BLUETOOTH
    QBluetoothTransferReplyBluez *rep = new QBluetoothTransferReplyBluez(data, request, this);
    connect(rep, SIGNAL(finished(QBluetoothTransferReply*)), this, SIGNAL(finished(QBluetoothTransferReply*)));
    return rep;
#elif QT_OSX_BLUETOOTH
    QBluetoothTransferReply *reply = new QBluetoothTransferReplyOSX(data, request, this);
    connect(reply, SIGNAL(finished(QBluetoothTransferReply*)), this, SIGNAL(finished(QBluetoothTransferReply*)));
    return reply;
#else
    // Android and iOS have no implementation
#if !defined(QT_ANDROID_BLUETOOTH) && !defined(QT_IOS_BLUETOOTH)
    printDummyWarning();
#endif
    Q_UNUSED(request);
    Q_UNUSED(data);
    return 0;
#endif
}