/*!
\fn Win_QextSerialPort& Win_QextSerialPort::operator=(const Win_QextSerialPort& s)
overrides the = operator
*/
Win_QextSerialPort& Win_QextSerialPort::operator=(const Win_QextSerialPort& s)
{
    setOpenMode(s.openMode());
    lastErr=s.lastErr;
    port = s.port;
    Settings.FlowControl=s.Settings.FlowControl;
    Settings.Parity=s.Settings.Parity;
    Settings.DataBits=s.Settings.DataBits;
    Settings.StopBits=s.Settings.StopBits;
    Settings.BaudRate=s.Settings.BaudRate;
    Win_Handle=s.Win_Handle;
    memcpy(&Win_CommTimeouts, &s.Win_CommTimeouts, sizeof(COMMTIMEOUTS));
    return *this;
}
void Q3SocketDevice::close()
{
    if ( fd == -1 || !isOpen() )		// already closed
	return;
    resetStatus();
    setOpenMode(NotOpen);
    ::close( fd );
#if defined(QSOCKETDEVICE_DEBUG)
    qDebug( "Q3SocketDevice::close: Closed socket %x", fd );
#endif
    fd = -1;
    fetchConnectionParameters();
    QIODevice::close();
}
bool ByteArrayModelIoDevice::open( OpenMode openMode )
{
    QIODevice::open( openMode );

    openMode ^= WriteOnly | Append;
    setOpenMode( openMode );

    if( ! isReadable() )
        return false;

    seek( 0 );

    return true;
}
CustomDeviceReply::CustomDeviceReply(QByteArray &fileData)
    : data(fileData), origLen(fileData.length())
{
    qDebug() << "CustomDeviceReply::CustomDeviceReply() ";
    setOpenMode(QIODevice::ReadOnly | QIODevice::Unbuffered);
    //setOpenMode(QIODevice::Text);

    //data = QString::fromStdString("div,html{background-color:red;}").toUtf8();

    //emit readyRead();

    QTimer::singleShot(0, this, &QIODevice::readyRead);
    QTimer::singleShot(0, this, &QIODevice::readChannelFinished);
}
Beispiel #5
0
HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
        const QByteArray &fileData, const QString& mimeType)
    : data(fileData), origLen(fileData.length())
{
    TRACE_OBJ
    setRequest(request);
    setUrl(request.url());
    setOpenMode(QIODevice::ReadOnly);

    setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
    setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
    QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
    QTimer::singleShot(0, this, SIGNAL(readyRead()));
    QTimer::singleShot(0, this, SIGNAL(finished()));
}
/*!
\fn Win_QextSerialPort::Win_QextSerialPort(const Win_QextSerialPort&)
Copy constructor.
*/
Win_QextSerialPort::Win_QextSerialPort(const Win_QextSerialPort& s):
	QextSerialBase(s.port)
{
    Win_Handle=INVALID_HANDLE_VALUE;
    setOpenMode(s.openMode());
    lastErr=s.lastErr;
    port = s.port;
    Settings.FlowControl=s.Settings.FlowControl;
    Settings.Parity=s.Settings.Parity;
    Settings.DataBits=s.Settings.DataBits;
    Settings.StopBits=s.Settings.StopBits;
    Settings.BaudRate=s.Settings.BaudRate;
    Win_Handle=s.Win_Handle;
    memcpy(&Win_CommTimeouts, &s.Win_CommTimeouts, sizeof(COMMTIMEOUTS));
}
void CryptFileDevice::close()
{
    if (!isOpen())
        return;

    if ((openMode() & WriteOnly) || (openMode() & Append))
        flush();

    seek(0);
    m_device->close();
    setOpenMode(NotOpen);

    if (m_encrypted)
        m_encrypted = false;
}
KCHMNetworkReply::KCHMNetworkReply( const QNetworkRequest &request, const QUrl &url )
{
	setRequest( request );
	setOpenMode( QIODevice::ReadOnly );

	m_data = loadResource( url );
	m_length = m_data.length();

	setHeader( QNetworkRequest::ContentLengthHeader, QByteArray::number(m_data.length()) );
	QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);

	if ( m_length )
		QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection);

	QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
}
void QBluetoothSocket::abort()
{
    if (state() == UnconnectedState)
        return;

    Q_D(QBluetoothSocket);
    setOpenMode(QIODevice::NotOpen);
    setSocketState(ClosingState);
    d->abort();

#ifndef QT_ANDROID_BLUETOOTH
    //Android closes when the Java event loop comes around
    setSocketState(QBluetoothSocket::UnconnectedState);
    emit disconnected();
#endif
}
Beispiel #10
0
/*!
   \reimp

    Creates a unique file name for the temporary file, and opens it.  You can
    get the unique name later by calling fileName(). The file is guaranteed to
    have been created by this function (i.e., it has never existed before).
*/
bool QTemporaryFile::open(OpenMode flags)
{
    Q_D(QTemporaryFile);
    if (!d->fileName.isEmpty()) {
        if (static_cast<QTemporaryFileEngine*>(d->engine())->isReallyOpen()) {
            setOpenMode(flags);
            return true;
        }
    }

    if (QFile::open(flags)) {
        d->fileName = d->fileEngine->fileName(QAbstractFileEngine::DefaultName);
        return true;
    }
    return false;
}
/*!
\fn bool Posix_QextSerialPort::open(OpenMode mode)
Opens the serial port associated to this class.
This function has no effect if the port associated with the class is already open.
The port is also configured to the current settings, as stored in the Settings structure.
*/
bool Posix_QextSerialPort::open(OpenMode mode)
{
    LOCK_MUTEX();
    if (mode == QIODevice::NotOpen)
        return isOpen();
    if (!isOpen()) {
        /*open the port*/
        qDebug("trying to open file");
        //note: linux 2.6.21 seems to ignore O_NDELAY flag
        if ((fd = ::open(port.toAscii() ,O_RDWR | O_NOCTTY | O_NDELAY)) != -1) {
            qDebug("file opened succesfully");

            setOpenMode(mode);			// Flag the port as opened
            tcgetattr(fd, &old_termios);	// Save the old termios
            Posix_CommConfig = old_termios;	// Make a working copy
            cfmakeraw(&Posix_CommConfig);	// Enable raw access

            /*set up other port settings*/
            Posix_CommConfig.c_cflag|=CREAD|CLOCAL;
            Posix_CommConfig.c_lflag&=(~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG));
            Posix_CommConfig.c_iflag&=(~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY));
            Posix_CommConfig.c_oflag&=(~OPOST);
            Posix_CommConfig.c_cc[VMIN]= 0;
#ifdef _POSIX_VDISABLE	// Is a disable character available on this system?
            // Some systems allow for per-device disable-characters, so get the
            //  proper value for the configured device
            const long vdisable = fpathconf(fd, _PC_VDISABLE);
            Posix_CommConfig.c_cc[VINTR] = vdisable;
            Posix_CommConfig.c_cc[VQUIT] = vdisable;
            Posix_CommConfig.c_cc[VSTART] = vdisable;
            Posix_CommConfig.c_cc[VSTOP] = vdisable;
            Posix_CommConfig.c_cc[VSUSP] = vdisable;
#endif //_POSIX_VDISABLE
            setBaudRate(Settings.BaudRate);
            setDataBits(Settings.DataBits);
            setParity(Settings.Parity);
            setStopBits(Settings.StopBits);
            setFlowControl(Settings.FlowControl);
            setTimeout(Settings.Timeout_Millisec);
            tcsetattr(fd, TCSAFLUSH, &Posix_CommConfig);
        } else {
            qDebug("could not open file: %s", strerror(errno));
        }
    }
    UNLOCK_MUTEX();
    return isOpen();
}
Beispiel #12
0
Nuria::ReferenceDevice::ReferenceDevice (QIODevice *referencedDevice, QObject *parent)
	: QIODevice (parent), d_ptr (new ReferenceDevicePrivate)
{
	
	this->d_ptr->device = referencedDevice;
	setOpenMode (referencedDevice->openMode ());
	
	if (this->d_ptr->device->isSequential ()) {
		nWarn() << "Device" << referencedDevice << "is not random-access!";
	}
	
	// Signal connections
	connect (referencedDevice, &QIODevice::aboutToClose, this, &ReferenceDevice::close);
	connect (referencedDevice, &QIODevice::readyRead, this, &ReferenceDevice::autoExtendRange);
	connect (referencedDevice, &QObject::destroyed, this, &ReferenceDevice::referencedDeviceDestroyed);
	
}
bool KoLimitedIODevice::open( QIODevice::OpenMode m )
{
    //kDebug(7005) << "m=" << m;
    if ( m & QIODevice::ReadOnly ) {
        /*bool ok = false;
          if ( m_dev->isOpen() )
          ok = ( m_dev->mode() == QIODevice::ReadOnly );
          else
          ok = m_dev->open( m );
          if ( ok )*/
        m_dev->seek( m_start ); // No concurrent access !
    }
    else
        kWarning(7005) << "KoLimitedIODevice::open only supports QIODevice::ReadOnly!";
    setOpenMode( QIODevice::ReadOnly );
    return true;
}
/*!
\fn Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s)
Override the = operator.
*/
Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s)
{
   	setOpenMode(s.openMode());
    port = s.port;
    Settings.BaudRate=s.Settings.BaudRate;
    Settings.DataBits=s.Settings.DataBits;
    Settings.Parity=s.Settings.Parity;
    Settings.StopBits=s.Settings.StopBits;
    Settings.FlowControl=s.Settings.FlowControl;
    lastErr=s.lastErr;

    Posix_File=s.Posix_File;
    memcpy(&Posix_Timeout, &(s.Posix_Timeout), sizeof(struct timeval));
    memcpy(&Posix_Copy_Timeout, &(s.Posix_Copy_Timeout), sizeof(struct timeval));
    memcpy(&Posix_CommConfig, &(s.Posix_CommConfig), sizeof(struct termios));
    return *this;
}
Beispiel #15
0
void SocksClient::grantUDPAssociate(const QString &relayHost, int relayPort)
{
    if(d->step != StepRequest || !d->waiting)
        return;

    // response
    d->waiting = false;
    writeData(sp_set_request(relayHost, relayPort, RET_SUCCESS));
    d->udp = true;
    setOpenMode(QIODevice::ReadWrite);
#ifdef PROX_DEBUG
    fprintf(stderr, "SocksClient: server << Success >>\n");
#endif

    if(!d->recvBuf.isEmpty())
        d->recvBuf.resize(0);
}
/*!
\fn Posix_QextSerialPort::Posix_QextSerialPort(const Posix_QextSerialPort&)
Copy constructor.
*/
Posix_QextSerialPort::Posix_QextSerialPort(const Posix_QextSerialPort& s)
    : QextSerialBase(s.port)
{
    setOpenMode(s.openMode());
    port = s.port;
    Settings.BaudRate=s.Settings.BaudRate;
    Settings.DataBits=s.Settings.DataBits;
    Settings.Parity=s.Settings.Parity;
    Settings.StopBits=s.Settings.StopBits;
    Settings.FlowControl=s.Settings.FlowControl;
    lastErr=s.lastErr;

    fd = s.fd;
    memcpy(&Posix_Timeout, &s.Posix_Timeout, sizeof(struct timeval));
    memcpy(&Posix_Copy_Timeout, &s.Posix_Copy_Timeout, sizeof(struct timeval));
    memcpy(&Posix_CommConfig, &s.Posix_CommConfig, sizeof(struct termios));
}
Beispiel #17
0
/*!
Opens the serial port associated to this class.
This function has no effect if the port associated with the class is already open.
The port is also configured to the current settings, as stored in the Settings structure.
*/
bool QextSerialPort::open(OpenMode mode)
{
    QMutexLocker lock(mutex);
    if (mode == QIODevice::NotOpen)
        return isOpen();
    if (!isOpen()) {
       // qDebug() << "trying to open file" << port.toAscii();
        //note: linux 2.6.21 seems to ignore O_NDELAY flag
        if ((fd = ::open(port.toAscii() ,O_RDWR | O_NOCTTY | O_NDELAY)) != -1) {
            //qDebug("file opened succesfully");

            setOpenMode(mode);              // Flag the port as opened
            tcgetattr(fd, &old_termios);    // Save the old termios
            Posix_CommConfig = old_termios; // Make a working copy
            cfmakeraw(&Posix_CommConfig);   // Enable raw access

            /*set up other port settings*/
            Posix_CommConfig.c_cflag|=CREAD|CLOCAL;
            Posix_CommConfig.c_lflag&=(~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG));
            Posix_CommConfig.c_iflag&=(~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY));
            Posix_CommConfig.c_oflag&=(~OPOST);
            Posix_CommConfig.c_cc[VMIN]= 0;
#ifdef _POSIX_VDISABLE  // Is a disable character available on this system?
            // Some systems allow for per-device disable-characters, so get the
            //  proper value for the configured device
            const long vdisable = fpathconf(fd, _PC_VDISABLE);
            Posix_CommConfig.c_cc[VINTR] = vdisable;
            Posix_CommConfig.c_cc[VQUIT] = vdisable;
            Posix_CommConfig.c_cc[VSTART] = vdisable;
            Posix_CommConfig.c_cc[VSTOP] = vdisable;
            Posix_CommConfig.c_cc[VSUSP] = vdisable;
#endif //_POSIX_VDISABLE
            setBaudRate(Settings.BaudRate);
            setDataBits(Settings.DataBits);
            setParity(Settings.Parity);
            setStopBits(Settings.StopBits);
            setFlowControl(Settings.FlowControl);
            setTimeout(Settings.Timeout_Millisec);
            tcsetattr(fd, TCSAFLUSH, &Posix_CommConfig);

            if (queryMode() == QextSerialPort::EventDriven) {
                readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
                connect(readNotifier, SIGNAL(activated(int)), this, SIGNAL(readyRead()));
            }
        } else {
/*!
    \reimp

    Closes the socket and sets the socket identifier to -1 (invalid).

    (This function ignores errors; if there are any then a file
    descriptor leakage might result. As far as we know, the only error
    that can arise is EBADF, and that would of course not cause
    leakage. There may be OS-specific errors that we haven't come
    across, however.)

    \sa open()
*/
void MSocketDevice::close()
{
    if (fd == -1 || !isOpen())                  // already closed
        return;

    setOpenMode(NotOpen);

    ::close(fd);

    LOG(VB_SOCKET, LOG_DEBUG,
        QString("MSocketDevice::close: Closed socket %1").arg(fd));

    fd = -1;

    fetchConnectionParameters();

    QIODevice::close();
}
Beispiel #19
0
/*!
    Closes the serial device.
*/
void QSerialPort::close()
{
    if ( d->notifier ) {
        d->notifier->deleteLater();
        d->notifier = 0;
    }
    if ( d->timer ) {
        delete d->timer;
        d->timer = 0;
    }
#ifdef USE_POSIX_SYSCALLS
    if ( d->fd != -1 ) {
        ::close( d->fd );
        d->fd = -1;
    }
#endif
    setOpenMode( NotOpen );
}
void CryptFileDevice::close()
{
    if (!isOpen())
        return;

    if ((openMode() & WriteOnly) || (openMode() & Append))
        flush();

    seek(0);
    m_device->close();
    setOpenMode(NotOpen);

    if (m_encrypted)
    {
        EVP_CIPHER_CTX_cleanup(&m_encCtx);
        EVP_CIPHER_CTX_cleanup(&m_decCtx);
        m_encrypted = false;
    }
}
Beispiel #21
0
ShoutCastIODevice::ShoutCastIODevice(void)
    :  m_redirects (0), 
       m_scratchpad_pos (0),
       m_state (NOT_CONNECTED)
{
    m_socket = new QTcpSocket;
    m_response = new ShoutCastResponse;

    connect(m_socket, SIGNAL(hostFound()), SLOT(socketHostFound()));
    connect(m_socket, SIGNAL(connected()), SLOT(socketConnected()));
    connect(m_socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed()));
    connect(m_socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
    connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), 
            SLOT(socketError(QAbstractSocket::SocketError)));

    switchToState(NOT_CONNECTED);

    setOpenMode(ReadWrite);
}
/*!
\fn void QextSerialBase::construct()
Common constructor function for setting up default port settings.
(115200 Baud, 8N1, Hardware flow control where supported, otherwise no flow control, and 500 ms timeout).
*/
void QextSerialBase::construct()
{
    Settings.BaudRate=BAUD115200;
    Settings.DataBits=DATA_8;
    Settings.Parity=PAR_NONE;
    Settings.StopBits=STOP_1;
    Settings.FlowControl=FLOW_HARDWARE;
    Settings.Timeout_Sec=0;
    Settings.Timeout_Millisec=500;

#ifdef QT_THREAD_SUPPORT
    if (!mutex) {
        mutex=new QMutex( QMutex::Recursive );
    }
    refCount++;
#endif

	setOpenMode(QIODevice::NotOpen);
}
Beispiel #23
0
void SocksClient::grantConnect()
{
    if(d->step != StepRequest || !d->waiting)
        return;

    // response
    d->waiting = false;
    writeData(sp_set_request(d->rhost, d->rport, RET_SUCCESS));
    setOpenMode(QIODevice::ReadWrite);
#ifdef PROX_DEBUG
    fprintf(stderr, "SocksClient: server << Success >>\n");
#endif

    if(!d->recvBuf.isEmpty()) {
        appendRead(d->recvBuf);
        d->recvBuf.resize(0);
        readyRead();
    }
}
Beispiel #24
0
/*!
    Constructs a new QxtStdio with \a parent.
 */
QxtStdio::QxtStdio(QObject * parent): QxtPipe(parent)
{
    QXT_INIT_PRIVATE(QxtStdio);

    setvbuf(stdin , NULL , _IONBF , 0);
    setvbuf(stdout , NULL , _IONBF , 0);

    setOpenMode(QIODevice::ReadWrite);
    qxt_d().notify = new QSocketNotifier(

#ifdef Q_CC_MSVC
        _fileno(stdin)
#else
        fileno(stdin)
#endif

        , QSocketNotifier::Read, this);
    QObject::connect(qxt_d().notify, SIGNAL(activated(int)), &qxt_d(), SLOT(activated(int)));
}
Beispiel #25
0
void CNetworkConnection::initializeSocket()
{
	m_pSocket->moveToThread(thread());
    m_pSocket->setReadBufferSize(m_nInputSize);
    connect(m_pSocket, SIGNAL(connected()),
            this, SIGNAL(connected()));
	connect(m_pSocket, SIGNAL(readyRead()),
			this, SIGNAL(readyRead()));
    connect(m_pSocket, SIGNAL(disconnected()),
            this, SIGNAL(disconnected()));
    connect(m_pSocket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SIGNAL(error(QAbstractSocket::SocketError)));
    connect(m_pSocket, SIGNAL(bytesWritten(qint64)),
            this, SIGNAL(bytesWritten(qint64)));
    connect(m_pSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
            this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
	connect(m_pSocket, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose()));
    setOpenMode(m_pSocket->openMode());
    setSocketState(m_pSocket->state());
}
QGreenphoneWakeupSerialIODevice::QGreenphoneWakeupSerialIODevice
        ( QSerialIODevice *device, QObject *parent )
    : QSerialIODevice( parent ), wakeupFd(-1)
{
    this->device = device;
    this->mux = 0;

    // Pass through signals from the underlying device.
    connect( device, SIGNAL(readyRead()), this, SLOT(haveReady()) );
    connect( device, SIGNAL(dsrChanged(bool)), this, SIGNAL(dsrChanged(bool)) );
    connect( device, SIGNAL(ctsChanged(bool)), this, SIGNAL(ctsChanged(bool)) );
    connect( device, SIGNAL(carrierChanged(bool)),
             this, SIGNAL(carrierChanged(bool)) );

    // If the device is open, then we need to be as well.
    if ( device->isOpen() )
    {
        wakeupFd = ::open("/dev/omega_bcm2121", O_RDWR);
        if ( wakeupFd < 0 ) {
            ::perror( "open /dev/omega_bcm2121" );
        } else { 
            // Power on modem then immediately sleep. The modem needs
            // a positive edge on the control line to trigger a wakeup.
            // The first write will generate the positive edge.
            ::ioctl(wakeupFd, 0x5404, 0); // power on modem, only if it is off
            sleep();
        }

        setOpenMode( ReadWrite | Unbuffered );
    }

    // Create a timer that will put the modem to sleep if we don't
    // read or write any data.
    sleepTimer = new QTimer( this );
    sleepTimer->setSingleShot( true );
    connect( sleepTimer, SIGNAL(timeout()), this, SLOT(sleep()) );

    connect( new QtopiaChannel( "QPE/GreenphoneModem", this ),
             SIGNAL(received(QString,QByteArray)),
             this, SLOT(received(QString,QByteArray)) );
}
Beispiel #27
0
/*!
   \reimp
*/
bool QBuffer::open(OpenMode flags)
{
    Q_D(QBuffer);

    if ((flags & Append) == Append)
        flags |= WriteOnly;
    setOpenMode(flags);
    if (!(isReadable() || isWritable())) {
        qWarning("QFile::open: File access not specified");
        return false;
    }

    if ((flags & QIODevice::Truncate) == QIODevice::Truncate)
        d->buf->resize(0);
    if ((flags & QIODevice::Append) == QIODevice::Append) // append to end of buffer
        d->ioIndex = qint64(d->buf->size());
    else
        d->ioIndex = 0;

    return true;
}
Beispiel #28
0
bool QFrankDatenstromfilter::open(OpenMode strommodus)
{
	/*
		Der Quelldatenstrom muss im selben Modus geöffnet sei wie das Filter.
		Wenn er nicht geöffnet ist, wird versucht ihn in dem selben Modus zu öffnen wie das Filter
	*/
#ifndef QT_NO_DEBUG
	qDebug(qPrintable(trUtf8("QFrankDatenstromfilter öffnen: Modus 0x%1","debug").arg(strommodus,0,16)));
#endif
	bool QuelldatenstromBereit;
	if(K_Quelldatenstrom->isOpen())
	{
		QuelldatenstromBereit=K_Quelldatenstrom->openMode()!=strommodus? false:true;
		if(!QuelldatenstromBereit)
		{
			setErrorString(trUtf8("Der Quelldatenstrom muss im selben Modus geöffnet sein."));
#ifndef QT_NO_DEBUG
			qWarning(qPrintable(trUtf8("QFrankDatenstromfilter öffnen: Quelldatenstrom ist anders geöffnet Modus: 0x%1","debug")
										.arg(K_Quelldatenstrom->openMode(),0,16)));
#endif
		}
	}
	else
	{
		QuelldatenstromBereit=K_Quelldatenstrom->open(strommodus);
		if(!QuelldatenstromBereit)
		{
			setErrorString(trUtf8("Der Quelldatenstrom konnte nicht geöffnet werden."));
#ifndef QT_NO_DEBUG
			qWarning(qPrintable(trUtf8("QFrankDatenstromfilter öffnen: Quelldatenstrom konnte nicht geöffnet werden","debug")));
#endif
		}
	}
	if(QuelldatenstromBereit)
	{
		setOpenMode(strommodus);
		return true;
	}
	return false;
}
/*!
    Attempts to make a connection with \a address on the given \a port.

    The socket is opened in the given \a openMode.

    The socket first enters ConnectingState, and attempts to connect to \a address. If a
    connection is established, QBluetoothSocket enters ConnectedState and emits connected().

    At any point, the socket can emit error() to signal that an error occurred.

    On BlackBerry and Android, a connection to a service can not be established using a port. Calling this function
    will emit a \l {QBluetoothSocket::ServiceNotFoundError}{ServiceNotFoundError}

    Note that most platforms require a pairing prior to connecting to the remote device. Otherwise
    the connection process may fail.

    \sa state(), disconnectFromService()
*/
void QBluetoothSocket::connectToService(const QBluetoothAddress &address, quint16 port, OpenMode openMode)
{
    Q_D(QBluetoothSocket);
#if defined(QT_QNX_BLUETOOTH) || defined(QT_ANDROID_BLUETOOTH)
    Q_UNUSED(port);
    Q_UNUSED(openMode);
    Q_UNUSED(address);
    d->errorString = tr("Connecting to port is not supported");
    setSocketError(QBluetoothSocket::ServiceNotFoundError);
    qCWarning(QT_BT) << "Connecting to port is not supported";
#else
    if (state() != QBluetoothSocket::UnconnectedState) {
        qCWarning(QT_BT)  << "QBluetoothSocket::connectToService called on busy socket";
        d->errorString = QBluetoothSocket::tr("Trying to connect while connection is in progress");
        setSocketError(QBluetoothSocket::OperationError);
        return;
    }

    setOpenMode(openMode);
    d->connectToService(address, port, openMode);
#endif
}
/*!
\fn Win_QextSerialPort& Win_QextSerialPort::operator=(const Win_QextSerialPort& s)
overrides the = operator
*/
Win_QextSerialPort& Win_QextSerialPort::operator=(const Win_QextSerialPort& s) {
    setOpenMode(s.openMode());
    _queryMode = s._queryMode;
    _bytesToWrite = s._bytesToWrite;
    bytesToWriteLock = new QReadWriteLock;
    overlapThread = new Win_QextSerialThread(this);
    memcpy(& overlap, & s.overlap, sizeof(OVERLAPPED));
    memcpy(& overlapWrite, & s.overlapWrite, sizeof(OVERLAPPED));
    lastErr=s.lastErr;
    port = s.port;
    Settings.FlowControl=s.Settings.FlowControl;
    Settings.Parity=s.Settings.Parity;
    Settings.DataBits=s.Settings.DataBits;
    Settings.StopBits=s.Settings.StopBits;
    Settings.BaudRate=s.Settings.BaudRate;
    Win_Handle=s.Win_Handle;
    memcpy(&Win_CommConfig, &s.Win_CommConfig, sizeof(COMMCONFIG));
    memcpy(&Win_CommTimeouts, &s.Win_CommTimeouts, sizeof(COMMTIMEOUTS));
    if (s.overlapThread->isRunning())
    	overlapThread->start();
    return *this;
}