Example #1
0
/*!
    Constructs a new serial port object with the given \a parent
    to represent the serial port with the specified \a name.

    The name should have a specific format; see the setPort() method.
*/
QSerialPort::QSerialPort(const QString &name, QObject *parent)
    : QIODevice(*new QSerialPortPrivate, parent)
    , d_dummy(0)
{
    setPortName(name);
}
Example #2
0
BDSensitive::BDSensitive(const char *portName, const char* edgeType) {
	initMembers();

	setPortName(portName);
	setSenseType(edgeType);
}
Example #3
0
/*!
\fn QextSerialBase::QextSerialBase(const QString & name)
Construct a port and assign it to the device specified by the name parameter.
*/
QextSerialBase::QextSerialBase(const QString & name)
 : QIODevice()
{
    setPortName(name);
    construct();
}
Example #4
0
/*!
    Constructs a serial port attached to the port specified by name.
    \a name is the name of the device, which is windowsystem-specific,
    e.g."COM1" or "/dev/ttyS0". \a mode
*/
QextSerialPort::QextSerialPort(const QString &name, QextSerialPort::QueryMode mode, QObject *parent)
    : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this))
{
    setQueryMode(mode);
    setPortName(name);
}
Example #5
0
/*!
    Constructs a new serial port object with the given \a parent
    to represent the serial port with the specified \a name.

    The name should have a specific format; see the setPort() method.
*/
QSerialPort::QSerialPort(const QString &name, QObject *parent)
    : QIODevice(parent)
    , d_ptr(new QSerialPortPrivate(this))
{
    setPortName(name);
}
Example #6
0
Xnor::Xnor( QGraphicsItem *parent ) : GraphicElement( 2, 8, 1, 1, parent ) {
  setOutputsOnTop( true );
  setPixmap( QPixmap( ":/basic/xnor.png" ) );
  updatePorts( );
  setPortName( "XNOR" );
}
Example #7
0
bool MidiInterface::open(const QString& portName)
{
    if(_rtMidiIn)
    {
        QStringList ports;
        // Check available ports.
        unsigned int nPorts = _rtMidiIn->getPortCount();
        for (unsigned int i=0;i<nPorts;i++)
        {
            const QString inputName = QString(_rtMidiIn->getPortName(i).c_str());
            ports.append(inputName);
//          qDebug() << "In port: " << inputName << i;
        }
        int portIndex = ports.indexOf(portName);
        if(portIndex<0)
            return false;
        else
        {
            setPortName(portName);
            if (!openIn(portIndex)) { return false; }
        }
        if(_rtMidiOut)
        {
            // We will try to find an output port corresponding to the current input
            // If found, this output will be used as feedback (ie. LED driving)
            QStringList ports = Midi::getPorts(_rtMidiOut);

            // Depending on OS, we have different correspondings
            // Linux : "nanoKONTROL2 28:0" (in) -> "nanoKONTROL2:0" (out)
            // Windows : "nanoKONTROL2" (in) -> "nanoKONTROL2" (out)
            int portIndex = ports.indexOf(portName);
            if(portIndex<0)
            {
                QRegExp rx("(\\w+) (.+):(\\d+)");
                if(rx.indexIn(portName) == -1)
                {
                    qDebug() << Q_FUNC_INFO
                             << "no match for:" << portName;
                }
                else
                {
                    QStringList sl = rx.capturedTexts();
                    qDebug() << Q_FUNC_INFO
                             <<   sl;
                    Q_ASSERT(sl.count()==4);
                    const QString outputName = sl.at(1) + QString(":") + sl.at(3);
                    portIndex = ports.indexOf(outputName);

                }
            }
            if(portIndex>=0)
            {
                openOut(portIndex);
            }
        }
        // Auto load mapping
        loadMapping();
        return true;
    }
    return false;
}
XbeeConfigurationWindow::XbeeConfigurationWindow(LinkInterface* link, QWidget *parent, Qt::WindowFlags flags): QWidget(parent, flags), 
	userConfigured(false)
{
	XbeeLinkInterface *xbeeLink = dynamic_cast<XbeeLinkInterface*>(link);

	if(xbeeLink != 0)
	{
		this->link = xbeeLink;

		action = new QAction(QIcon(":/files/images/devices/network-wireless.svg"), "", link);

		baudLabel = new QLabel;
		baudLabel->setText(tr("Baut Rate"));
		baudBox = new QComboBox;
		baudLabel->setBuddy(baudBox);
		portLabel = new QLabel;
		portLabel->setText(tr("SerialPort"));
		portBox = new QComboBox;
		portBox->setEditable(true);
		portLabel->setBuddy(portBox);
		highAddrLabel = new QLabel;
		highAddrLabel->setText(tr("Remote hex Address &High"));
		highAddr = new HexSpinBox(this);
		highAddrLabel->setBuddy(highAddr);
		lowAddrLabel = new QLabel;
		lowAddrLabel->setText(tr("Remote hex Address &Low"));
		lowAddr = new HexSpinBox(this);
		lowAddrLabel->setBuddy(lowAddr);
		actionLayout = new QGridLayout;
		actionLayout->addWidget(baudLabel,1,1);
		actionLayout->addWidget(baudBox,1,2);
		actionLayout->addWidget(portLabel,2,1);
		actionLayout->addWidget(portBox,2,2);
		actionLayout->addWidget(highAddrLabel,3,1);
		actionLayout->addWidget(highAddr,3,2);
		actionLayout->addWidget(lowAddrLabel,4,1);
		actionLayout->addWidget(lowAddr,4,2);
		tmpLayout = new QVBoxLayout;
		tmpLayout->addStretch();
		tmpLayout->addLayout(actionLayout);
		xbeeLayout = new QHBoxLayout;
		xbeeLayout->addStretch();
		xbeeLayout->addLayout(tmpLayout);
		this->setLayout(xbeeLayout);

		//connect(portBox,SIGNAL(activated(QString)),this,SLOT(setPortName(QString)));
		//connect(baudBox,SIGNAL(activated(QString)),this,SLOT(setBaudRateString(QString)));
		connect(portBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(setPortName(QString)));
		connect(portBox,SIGNAL(editTextChanged(QString)),this,SLOT(setPortName(QString)));
		connect(baudBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(setBaudRateString(QString)));
		connect(highAddr,SIGNAL(valueChanged(int)),this,SLOT(addrChangedHigh(int)));
		connect(lowAddr,SIGNAL(valueChanged(int)),this,SLOT(addrChangedLow(int)));
		connect(this,SIGNAL(addrHighChanged(quint32)),xbeeLink,SLOT(setRemoteAddressHigh(quint32)));
		connect(this,SIGNAL(addrLowChanged(quint32)),xbeeLink,SLOT(setRemoteAddressLow(quint32)));

		baudBox->addItem("1200",1200);
		baudBox->addItem("2400",2400);
		baudBox->addItem("4800",4800);
		baudBox->addItem("9600",9600);
		baudBox->addItem("19200",19200);
		baudBox->addItem("38400",38400);
		baudBox->addItem("57600",57600);
		baudBox->setCurrentIndex(6);

		// try to open xbeeConf file for last remote address
		QFile in("Xbeeconf.txt");
		if(in.open(QIODevice::ReadOnly))
		{
			QDataStream inStr(&in);
			int tmpaddrHigh;
			int tmpaddrLow;
			inStr >> tmpaddrHigh;
			inStr >> tmpaddrLow;
			highAddr->setValue(tmpaddrHigh);
			lowAddr->setValue(tmpaddrLow);
		}
Example #9
0
/*!
\fn QextSerialBase::QextSerialBase(const QString & name)
Construct a port and assign it to the device specified by the name parameter.
*/
QextSerialBase::QextSerialBase(const QString & name, QObject* parent)
    : QIODevice(parent)
{
    setPortName(name);
    construct();
}