Example #1
0
Connector::Connector(QObject *parent)
  : QObject(parent)
{
  conn_server_username="******";
  conn_server_password="";
  conn_server_mountpoint="";
  conn_content_type="";
  conn_audio_channels=2;
  conn_audio_samplerate=44100;
  conn_audio_bitrates.push_back(128);
  conn_stream_name="no name";
  conn_stream_description="unknown";
  conn_stream_url="";
  conn_stream_irc="";
  conn_stream_icq="";
  conn_stream_aim="";
  conn_stream_genre="unknown";
  conn_stream_public=true;
  conn_stream_timestamp_offset=0;
  conn_host_hostname="";
  conn_host_port=0;
  conn_connected=false;
  conn_watchdog_active=false;
  conn_script_up_process=NULL;
  conn_script_down_process=NULL;
  conn_is_stopping=false;

  conn_data_timer=new QTimer(this);
  connect(conn_data_timer,SIGNAL(timeout()),this,SLOT(dataTimeoutData()));
  conn_data_timer->start(RINGBUFFER_SERVICE_INTERVAL);

  conn_watchdog_timer=new QTimer(this);
  conn_watchdog_timer->setSingleShot(true);
  connect(conn_watchdog_timer,SIGNAL(timeout()),
	  this,SLOT(watchdogTimeoutData()));

  conn_stop_timer=new QTimer(this);
  conn_stop_timer->setSingleShot(true);
  connect(conn_stop_timer,SIGNAL(timeout()),this,SLOT(stopTimeoutData()));

  conn_script_down_garbage_timer=new QTimer(this);
  conn_script_down_garbage_timer->setSingleShot(true);
  connect(conn_script_down_garbage_timer,SIGNAL(timeout()),
	  this,SLOT(scriptDownCollectGarbageData()));

  conn_script_up_garbage_timer=new QTimer(this);
  conn_script_up_garbage_timer->setSingleShot(true);
  connect(conn_script_up_garbage_timer,SIGNAL(timeout()),
	  this,SLOT(scriptUpCollectGarbageData()));
}
Example #2
0
Harlond::Harlond(RDMatrix *matrix,QObject *parent)
  : Switcher(matrix,parent)
{
  bt_recv_buffer="";

  //
  // Get Matrix Parameters
  //
  bt_ip_address=matrix->ipAddress(RDMatrix::Primary);
  bt_tcp_port=matrix->ipPort(RDMatrix::Primary);
  bt_password=matrix->password(RDMatrix::Primary);
  bt_matrix=matrix->matrix();
  bt_inputs=matrix->inputs();
  bt_outputs=matrix->outputs();
  bt_start_cart=matrix->startCart(RDMatrix::Primary);
  bt_stop_cart=matrix->stopCart(RDMatrix::Primary);

  //
  // Reset Timers
  //
  bt_reset_mapper=new QSignalMapper(this);
  connect(bt_reset_mapper,SIGNAL(mapped(int)),this,SLOT(resetTimeoutData(int)));
  for(int i=0;i<bt_inputs;i++) {
    bt_reset_states.push_back(false);
    bt_reset_timers.push_back(new QTimer(this));
    bt_reset_mapper->setMapping(bt_reset_timers.back(),i);
    connect(bt_reset_timers.back(),SIGNAL(timeout()),
	    bt_reset_mapper,SLOT(map()));
  }

  //
  // Initialize TCP/IP Connection
  //
  bt_socket=new QSocket(this);
  connect(bt_socket,SIGNAL(connected()),this,SLOT(socketConnectedData()));
  connect(bt_socket,SIGNAL(disconnected()),this,SLOT(socketDisconnectedData()));
  connect(bt_socket,SIGNAL(readyRead()),this,SLOT(socketReadyReadData()));
  connect(bt_socket,SIGNAL(error(QAbstractSocket::SocketError)),
	  this,SLOT(socketErrorData(QAbstractSocket::SocketError)));
  bt_watchdog_timer=new QTimer(this);
  connect(bt_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogTimeoutData()));
  bt_watchdog_timer->start(5000,true);
}