ZephyrXtreme::ZephyrXtreme(int id,QObject *parent)
  : LPSwitcher(id,LPSwitcher::TypeZephyrXtreme,parent)
{
  zep_locked=false;
  zep_xmt_algo=LPSwitcher::XmtAlgoLast;
  zep_rcv_algo=LPSwitcher::RcvAlgoLast;
  zep_channel_rate=LPSwitcher::ChannelRateLast;
  zep_pending_channel_rate=LPSwitcher::ChannelRateLast;
  zep_sample_rate=0;
  zep_pending_sample_rate=0;
  for(int i=0;i<2;i++) {
    zep_line_state[i]=LPSwitcher::StateOffline;
    zep_dialed_string[i]="";
    zep_pending_string[i]="";
  }

  zep_device=new LPTTYDevice(this);
  zep_device->setSpeed(ZEPHYRXTREME_SPEED);
  zep_device->setWordLength(ZEPHYRXTREME_WORD_LENGTH);
  zep_device->setParity(ZEPHYRXTREME_PARITY);
  zep_device->setFlowControl(ZEPHYRXTREME_FLOW_CONTROL);
  connect(zep_device,SIGNAL(readyRead()),this,SLOT(readyReadData()));

  zep_socket=new QTcpSocket(this);
  connect(zep_socket,SIGNAL(connected()),this,SLOT(connectedData()));
  connect(zep_socket,SIGNAL(disconnected()),this,SLOT(disconnectedData()));
  connect(zep_socket,SIGNAL(readyRead()),this,SLOT(socketReadyRead()));

  zep_poll_timer=new QTimer(this);
  connect(zep_poll_timer,SIGNAL(timeout()),this,SLOT(pollData()));
}
Example #2
0
RDSocket::RDSocket(int id,QObject *parent)
  : Q3Socket(parent)
{
  id_num=id;
  connect(this,SIGNAL(hostFound()),this,SLOT(hostFoundData()));
  connect(this,SIGNAL(connected()),this,SLOT(connectedData()));
  connect(this,SIGNAL(connectionClosed()),this,SLOT(connectionClosedData()));
  connect(this,SIGNAL(delayedCloseFinished()),
	  this,SLOT(delayedCloseFinishedData()));
  connect(this,SIGNAL(readyRead()),this,SLOT(readyReadData()));
  connect(this,SIGNAL(bytesWritten(int)),this,SLOT(bytesWrittenData(int)));
  connect(this,SIGNAL(error(int)),this,SLOT(errorData(int)));
}
Example #3
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    this->setWindowIcon(QIcon(":res/123.png"));
    mdi = new QMdiArea(this);
    this->setCentralWidget(mdi);
    QDockWidget* dock = new QDockWidget(tr("Script log"),this);
    dock->setObjectName(tr("ScriptLogDock"));
    logText = new QTextEdit(dock);
    logText->setReadOnly(true);
    logText->setLineWrapMode(QTextEdit::NoWrap);
    dock->setWidget(logText);
    this->addDockWidget(Qt::BottomDockWidgetArea, dock);
    if(hidenum == 0){
        hidenum = new QUsbHidEnumerator(this);
    }
    if(hid == 0){
        hid = new QUsbHid(this);
    }
    connect(hidenum, SIGNAL(deviceDiscovered(QUsbHidInfo)), this, SLOT(devconnect(QUsbHidInfo)));
    connect(hidenum, SIGNAL(deviceRemoved(QUsbHidInfo)), this, SLOT(devdisconnect(QUsbHidInfo)));
    connect(hid, SIGNAL(readyRead()), this, SLOT(readyReadData()));
    hidenum->setUpNotifications(0x250,0x250);

    QList<QUsbHidInfo> devs = QUsbHid::enumDevices(0x250,0x250);
    if(devs.size()){
        hidpath = devs.at(0).path;
    }
    QMenu* menu = 0;
    QList<QAction*> list = menuBar()->actions();
    foreach(QAction* act, list){
        if( act->text().contains(tr("help"),Qt::CaseInsensitive) ){
            menu = act->menu();
        }
    }

    if(menu == 0){
        menu = menuBar()->addMenu(tr("&Help"));
    }
    menu->addAction(dock->toggleViewAction());
    menu->addSeparator();
    QAction* act = menu->addAction(tr("&About..."));
    connect(act,SIGNAL(triggered()),this,SLOT(my_about()));
    act = menu->addAction(tr("Send"));
    connect(act,SIGNAL(triggered()),this,SLOT(my_send()));
    this->setWindowTitle(QString::fromLocal8Bit("Tool Box"));

    //test_hid_devices(this);
}
Sas16000::Sas16000(int id,QObject *parent)
  : LPSwitcher(id,LPSwitcher::TypeSas16000,parent)
{
  bt_xmap=false;
  for(unsigned i=0;i<SAS16000_OUTPUTS;i++) {
    bt_crosspoints[i]=0;
  }

  bt_device=new LPTTYDevice(this);
  bt_device->setSpeed(SAS16000_SPEED);
  bt_device->setWordLength(SAS16000_WORD_LENGTH);
  bt_device->setParity(SAS16000_PARITY);
  bt_device->setFlowControl(SAS16000_FLOW_CONTROL);
  connect(bt_device,SIGNAL(readyRead()),this,SLOT(readyReadData()));
}
Example #5
0
void BoxitSocket::readyReadData() {
    QDataStream in(this);
    in.setVersion(QDataStream::Qt_4_6);


    if (readBlockSize == 0) {
        if (bytesAvailable() < (int)sizeof(quint16))
            return;

        in >> readBlockSize;
    }


    if (readMSGID == 0) {
        if (bytesAvailable() < (int)sizeof(quint16))
            return;

        in >> readMSGID;
    }


    if (bytesAvailable() < readBlockSize)
        return;


    QByteArray subData;
    in >> subData;
    data.append(subData);

    // Restart our timeout
    timeoutCount = 0;

    // Emit signal
    if (readMSGID != MSG_RESET_TIMEOUT
            && readMSGID != MSG_DATA_PACKAGE_MULTIPLE)
        emit readData(readMSGID, data);

    // Clear data if this isn't a multiple package
    if (readMSGID != MSG_DATA_PACKAGE_MULTIPLE)
        data.clear();

    readBlockSize = 0;
    readMSGID = 0;

    if (bytesAvailable() != 0)
        readyReadData();
}
Example #6
0
Connection::Connection(int id,QTcpSocket *sock,QObject *parent)
  : QObject(parent)
{
  conn_parser=new LPParser(this);
  connect(conn_parser,SIGNAL(messageReceived(const LPMessage &)),
	  this,SLOT(messageReceivedData(const LPMessage &)));
  connect(conn_parser,SIGNAL(metadataReceived(const QByteArray &)),
	  this,SLOT(metadataReceivedData(const QByteArray &)));

  conn_authenticated=false;
  conn_is_isolated=true;
  conn_ptr=0;
  conn_istate=0;
  conn_body_count=0;
  conn_id=id;
  conn_socket=sock;
  connect(conn_socket,SIGNAL(readyRead()),this,SLOT(readyReadData()));
}
Example #7
0
SoftwareAuthority::SoftwareAuthority(RDMatrix *matrix,QObject *parent)
  : Switcher(matrix,parent)
{
  swa_matrix=matrix->matrix();
  swa_ptr=0;
  swa_istate=0;

  //
  // Get Matrix Parameters
  //
  swa_username=matrix->username(RDMatrix::Primary);
  swa_password=matrix->password(RDMatrix::Primary);
  swa_porttype=matrix->portType(RDMatrix::Primary);
  swa_ipaddress=matrix->ipAddress(RDMatrix::Primary);
  swa_ipport=matrix->ipPort(RDMatrix::Primary);
  swa_card=matrix->card();
  swa_inputs=0;
  swa_outputs=0;
  swa_gpis=0;
  swa_gpos=0;
  swa_start_cart=matrix->startCart(RDMatrix::Primary);
  swa_stop_cart=matrix->stopCart(RDMatrix::Primary);

  //
  // Reconnection Timer
  //
  swa_reconnect_timer=new QTimer(this);
  connect(swa_reconnect_timer,SIGNAL(timeout()),this,SLOT(ipConnect()));

  //
  // Initialize the connection
  //
  swa_socket=new Q3Socket(this);
  connect(swa_socket,SIGNAL(connected()),this,SLOT(connectedData()));
  connect(swa_socket,SIGNAL(connectionClosed()),
	  this,SLOT(connectionClosedData()));
  connect(swa_socket,SIGNAL(readyRead()),
	  this,SLOT(readyReadData()));
  connect(swa_socket,SIGNAL(error(int)),this,SLOT(errorData(int)));
  ipConnect();
}
Example #8
0
BoxitSocket::BoxitSocket(int sessionID, QObject *parent) :
    QSslSocket(parent),
    sessionID(sessionID)
{
    setReadBufferSize(0);
    setPeerVerifyMode(QSslSocket::VerifyNone);

    readBlockSize = 0;
    readMSGID = 0;
    timeoutCount = 0;
    timeOutTimer.setInterval(5000);

    // Connect signals and slots
    connect(this, SIGNAL(readyRead())   ,   this, SLOT(readyReadData()));
    connect(this, SIGNAL(sslErrors(QList<QSslError>))   ,   this, SLOT(sslErrors(QList<QSslError>)));
    connect(this, SIGNAL(error(QAbstractSocket::SocketError))   ,   this, SLOT(socketError()));
    connect(&timeOutTimer, SIGNAL(timeout())    ,   this, SLOT(timeOutDestroy()));

    // Start timeout timer
    timeOutTimer.start();
}
RDCddbLookup::RDCddbLookup(FILE *profile_msgs,QObject *parent)
  : QObject(parent)
{
  lookup_state=0;
  lookup_profile_msgs=profile_msgs;

  //
  // Get the Hostname
  //
  if(getenv("HOSTNAME")==NULL) {
    lookup_hostname=RDCDDBLOOKUP_DEFAULT_HOSTNAME;
  }
  else {
    lookup_hostname=getenv("HOSTNAME");
  }

  //
  // Socket
  //
  lookup_socket=new QSocket(this,"lookup_socket");
  connect(lookup_socket,SIGNAL(readyRead()),this,SLOT(readyReadData()));
  connect(lookup_socket,SIGNAL(error(int)),this,SLOT(errorData(int)));
}
Example #10
0
BtSs82::BtSs82(int id,QObject *parent)
  : LPSwitcher(id,LPSwitcher::TypeBtSs82,parent)
{
  for(unsigned i=0;i<BTSS82_OUTPUTS;i++) {
    bt_crosspoints[i]=0;
  }
  for(unsigned i=0;i<BTSS82_GPIS;i++) {
    bt_gpi_states[i]=false;
  }
  bt_silence_sense_states[0]=false;
  bt_silence_sense_states[1]=false;

  bt_device=new LPTTYDevice(this);
  bt_device->setSpeed(BTSS82_SPEED);
  bt_device->setWordLength(BTSS82_WORD_LENGTH);
  bt_device->setParity(BTSS82_PARITY);
  bt_device->setFlowControl(BTSS82_FLOW_CONTROL);
  connect(bt_device,SIGNAL(readyRead()),this,SLOT(readyReadData()));

  bt_poll_counter=0;
  bt_poll_timer=new QTimer(this);
  connect(bt_poll_timer,SIGNAL(timeout()),this,SLOT(pollData()));
}