Ejemplo n.º 1
0
void
LV2Module::activatePorts()
{
   jassert (instance != nullptr);
   for (int32 p = 0; p < numPorts; ++p)
   {
       //const bool isInput  = isPortInput (p);
       const PortType type = getPortType (p);
       
       if (type == PortType::Atom)
       {
           
       }
       else if (type == PortType::Audio)
       {
           
       }
       else if (type == PortType::Control)
       {
           // normally this would ONLY be done during 'run'. However,
           // control ports are only connected once, here, during activation
           connectPort (p, priv->values.getData() + p);
       }
       else if (type == PortType::CV)
       {
           
       }
   }
}
Ejemplo n.º 2
0
bool clsYarp::initPortSend(char* portSend,char *portRcv, char* protocol)
{
	if(!initPort(portSend))
	{
		return false;
	}
	
	return connectPort(portSend,portRcv,protocol);
}
Ejemplo n.º 3
0
bool clsYarp::initPortRcv(char* portRcv,char *portSend, char* protocol)
{
	if(!initPort(portRcv))
	{
	        WARNMSG(("Failed to initPort %s",portRcv));
		return false;
	}
	
	return connectPort(portSend,portRcv,protocol);
}
Ejemplo n.º 4
0
void eaps8000UsbUICharWindow::connectivityButtonPressed()
{
    if( _ui->btn_connect->text() == CONNECT_PORT )
    {
        connectPort();
    }
    else if( _ui->btn_connect->text() == DISCONNECT_PORT )
    {
        disconnectPort();
    }
}
Ejemplo n.º 5
0
QT_USE_NAMESPACE

CREAD_SERIAL_PORT::CREAD_SERIAL_PORT(const QString &port, const QString &baud, const QString &data, const QString &parity, const QString &stop, const QString &flow,  QObject *parent)
    : QObject(parent)
{
    serial = new QSerialPort();

    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(handleTimeout()));
    m_timer.start(5000);

    currentSettings.name = port;
    currentSettings.baudRate = static_cast<QSerialPort::BaudRate>(baud.toInt());
    currentSettings.dataBits = static_cast<QSerialPort::DataBits>(data.toInt());
    currentSettings.parity = static_cast<QSerialPort::Parity>(parity.toInt());
    currentSettings.stopBits = static_cast<QSerialPort::StopBits>(stop.toInt());
    currentSettings.flowControl = static_cast<QSerialPort::FlowControl>(flow.toInt());

    connectPort();
}
Ejemplo n.º 6
0
std::string RhrController::getConfigString() const {

    std::stringstream config;
    if (connectionMethod() == RhrController::Connect) {
        auto host = listenHost();
        unsigned short port = listenPort();
        config << "connect " << host << " " << port;
    } else if (connectionMethod() == RhrController::Listen) {
        auto host = connectHost();
        unsigned short port = connectPort();
        if (port > 0) {
            config << "listen " << host << " " << port;
        } else {
            int id = m_module->id();
            config << "listen " << "_" << " " << ":" << id;
        }
    }

    return config.str();
}
Ejemplo n.º 7
0
KeytrackSerial::KeytrackSerial(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::KeytrackSerial)
{
    ui->setupUi(this);
    _serial_port = new QSerialPort(this);

    refreshPortList();

    //Populate baudRate combo box with baud rate options
    ui->baudRate->addItem(QString::number(QSerialPort::Baud1200));
    ui->baudRate->addItem(QString::number(QSerialPort::Baud2400));
    ui->baudRate->addItem(QString::number(QSerialPort::Baud4800));
    ui->baudRate->addItem(QString::number(QSerialPort::Baud9600));
    ui->baudRate->addItem(QString::number(QSerialPort::Baud19200));
    ui->baudRate->addItem(QString::number(QSerialPort::Baud38400));
    ui->baudRate->addItem(QString::number(QSerialPort::Baud57600));
    ui->baudRate->addItem(QString::number(QSerialPort::Baud115200));
    //Preset baud rate selection to 9600
    ui->baudRate->setCurrentText(QString::number(QSerialPort::Baud9600));

    //Populate parity combo box with parity options
    ui->parity->addItem("No Parity");
    ui->parity->addItem("Even Parity");
    ui->parity->addItem("Odd Parity");
    ui->parity->addItem("Space Parity");
    ui->parity->addItem("Mark Parity");

    updatePortSettings();

    connect(ui->connectButton,SIGNAL(clicked()),SLOT(connectPort()));
    connect(ui->disconnectButton, SIGNAL(clicked()),SLOT(disconnectPort()));
    connect(ui->baudRate,SIGNAL(currentTextChanged(QString)),SLOT(updatePortSettings()));
    connect(ui->parity,SIGNAL(currentTextChanged(QString)), SLOT(updatePortSettings()));
    connect(ui->dataBits,SIGNAL(currentTextChanged(QString)),SLOT(updatePortSettings()));
    connect(ui->stopBits,SIGNAL(currentTextChanged(QString)),SLOT(updatePortSettings()));
    connect(_serial_port, SIGNAL(readyRead()),SLOT(handleReadyRead()));
    connect(ui->sendButton,SIGNAL(clicked()),SLOT(sendTextFromBox()));
    connect(ui->sendBox,SIGNAL(returnPressed()),SLOT(sendTextFromBox()));
    connect(this,SIGNAL(destroyed()),SLOT(disconnectPort()));
}
Ejemplo n.º 8
0
void eaps8000UsbUICharWindow::mLabSignal( char signal, const QString& cmd )
{
    if( signal == SIGNAL_SHUTDOWN )
    {
        emergencyStop();
    }
    else if( signal == SIGNAL_STOP )
    {
        if( _ui->chb_setZeroAtStopSignal->isChecked() )
        {
            uiCharFinished();

            _ui->lbl_info->setText( STOP_RECEIVED );
            _ui->lbl_info->setStyleSheet( STYLE_ERROR );
        }
    }
    else if( signal == 10 )
    {
        if( _ui->btn_startStop->text() == STOP )
        {
            startStop();
        }
    }
    else if( signal == 11 )
    {
        if( _ui->btn_startStop->text() == START )
        {
            startStop();
        }
    }
    else if( signal == 12 )
    {
        if( _ui->btn_connect->text() == CONNECT_PORT )
        {
            connectPort();
        }
    }
    else if( signal == 13 )
    {
        if( _ui->btn_connect->text() == DISCONNECT_PORT )
        {
            disconnectPort();
        }
    }
    else if( signal == 14 )
    {
        if( cmd == "true" )
        {
            _ui->chb_setZeroAtStopSignal->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_setZeroAtStopSignal->setChecked( false );
        }
    }
    else if( signal == 15 )
    {
        if( cmd == "true" )
        {
            _ui->chb_setZeroWhenFinished->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_setZeroWhenFinished->setChecked( false );
        }
    }
    else if( signal == 16 )
    {
        if( cmd == "true" )
        {
            _ui->chb_emitStopSignal->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_emitStopSignal->setChecked( false );
        }
    }
    else if( signal == 18
             || signal == 19 )
    {
        resetInfo();
    }
    else if( signal == 41 )
    {
        int indexType = _ui->cob_setValue->findText( cmd );
        if( indexType == -1 )
        {
            return;
        }
        _ui->cob_setValue->setCurrentIndex( indexType );
    }
    else if( signal == 42 )
    {
        bool conversionSuccessful = false;
        double stepSize = cmd.toDouble( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->dsb_stepSize->setValue( stepSize );
        }
    }
    else if( signal == 43 )
    {
        if( cmd == "true" )
        {
            _ui->chb_calcValues->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_calcValues->setChecked( false );
        }
    }
    else if( signal == 45 )
    {
        bool conversionSuccessful = false;
        double fromValue = cmd.toDouble( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->dsb_fromValue->setValue( fromValue );
        }
    }
    else if( signal == 46 )
    {
        bool conversionSuccessful = false;
        double toValue = cmd.toDouble( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->dsb_toValue->setValue( toValue );
        }
    }
    else if( signal == 47 )
    {
        int unitType = _ui->cob_unit->findText( cmd );
        if( unitType == -1 )
        {
            return;
        }
        _ui->cob_unit->setCurrentIndex( unitType );
    }
    else if( signal == 51 )
    {
        bool conversionSuccessful = false;
        int repeat = cmd.toInt( &conversionSuccessful );
        if( conversionSuccessful )
        {
            _ui->spb_repeat->setValue( repeat );
        }
    }
    else if( signal == 52 )
    {
        if( cmd == "true" )
        {
            _ui->chb_loop->setChecked( true );
        }
        else if( cmd == "false" )
        {
            _ui->chb_loop->setChecked( false );
        }
    }
}
Ejemplo n.º 9
0
void eaps8000UsbWindow::mLabSignal( char signal, const QString& cmd )
{
    if( signal == SIGNAL_SHUTDOWN )
    {
        emergencyStop();
    }
    else if( signal == SIGNAL_STOP )
    {
        if( _ui->chb_setZeroAtStopSignal->isChecked()
                && _port.isOpen() )
        {
            _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage, 0.0,
                            false );
            _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent, 0.0,
                            false );

            _ui->lbl_info->setText( STOP_RECEIVED );
            _ui->lbl_info->setStyleSheet( STYLE_ERROR );
            emit changeWindowState( this->windowTitle(), false );
        }
    }
    else if( signal == 12 )
    {
        if( _ui->btn_connect->text() == CONNECT_PORT )
        {
            connectPort();
        }
    }
    else if( signal == 13 )
    {
        if( _ui->btn_connect->text() == DISCONNECT_PORT )
        {
            disconnectPort();
        }
    }
    else if( signal == 18
             || signal == 19 )
    {
        resetInfo();
    }
    else if( signal == 30 )
    {
        if( _port.isRunning() )
        {
            _ui->dsp_setValue->setValue( 0.0 );
            _ui->chb_adjustSetValue->setChecked( false );
            _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage,
                            0.0, false );
            _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent,
                            0.0, false );
        }
    }
    else if( signal >= 31
             && signal <= 39 )
    {
        if( !_port.isRunning() )
        {
            return;
        }
        if( cmd.at( 0 ) != 'a'
                && cmd.at( 0 ) != 'n' )
        {
            return;
        }
        bool adjustValue = false;
        if( cmd.at( 0 ) == 'a' )
        {
            adjustValue = true;
        }
        bool convOk = false;
        double value = cmd.mid( 1 ).toDouble( &convOk );
        if( !convOk )
        {
            return;
        }

        QString type;
        QString unit;
        if( signal == 31 )
        {
            type = VOLTAGE;
            unit = UNIT_VOLT;
        }
        else if( signal == 32 )
        {
            type = CURRENT;
            unit = UNIT_AMPERE;
        }
        else if( signal == 33 )
        {
            type = POWER;
            unit = UNIT_WATT;
        }
        else if( signal == 34 )
        {
            type = POWER_BY_VOLTAGE;
            unit = UNIT_WATT;
        }
        else if( signal == 35 )
        {
            type == POWER_BY_CURRENT;
            unit = UNIT_WATT;
        }
        else if( signal == 36 )
        {
            type == RESISTANCE_BY_VOLTAGE;
            unit = UNIT_OHM;
        }
        else if( signal == 37 )
        {
            type == RESISTANCE_BY_CURRENT;
            unit = UNIT_OHM;
        }
        else if( signal == 38 )
        {
            type = _ui->cob_setValue->currentText();
            unit = _ui->cob_setValueUnit->currentText();
            value += _ui->dsp_setValue->value();
        }
        else if( signal == 39 )
        {
            type = _ui->cob_setValue->currentText();
            unit = _ui->cob_setValueUnit->currentText();
            value *= _ui->dsp_setValue->value();
        }

        int indexType = _ui->cob_setValue->findText( type );
        int indexUnit = _ui->cob_setValue->findText( unit );
        if( indexType == -1
                || indexUnit == -1 )
        {
            return;
        }
        _ui->dsp_setValue->setValue( value );
        _ui->cob_setValue->setCurrentIndex( indexType );
        _ui->cob_setValueUnit->setCurrentIndex( indexUnit );
        _ui->chb_adjustSetValue->setChecked( adjustValue );
        setValue();
    }
}
Ejemplo n.º 10
0
void
LV2Module::connectChannel (const PortType type, const int32 channel, void* data, const bool isInput)
{
    connectPort (priv->channels.getPort (type, channel, isInput), data);
}