Exemplo n.º 1
0
bool RDCae::loadPlay(int card,QString name,int *stream,int *handle)
{
  int count=0;

  SendCommand(QString().sprintf("LP %d %s!",
				card,(const char *)name));

  //
  // This is really warty, but needed to make the method 'synchronous'
  // with respect to CAE.
  //
  *stream=-2;
  *handle=-1;
  while(*stream==-2) {
    readyData(stream,handle,name);
    usleep(1000);
    count++;
  }
  if(count>1000) {
    syslog(LOG_ERR,"*** LoadPlay: CAE took %d mS to return stream for %s ***",
	   count,(const char *)name);
  }
  cae_handle[card][*stream]=*handle;
  cae_pos[card][*stream]=0xFFFFFFFF;

  // CAE Daemon sends back a stream of -1 if there is an issue with allocating it
  // such as file missing, etc.
  if(*stream < 0) {
      return false;
  }

  return true;
}
Exemplo n.º 2
0
void RDCae::connectHost()
{
  int count=10;
  //  QHostAddress addr;
  QTimer *timer=new QTimer(this,"read_timer");

  connect(timer,SIGNAL(timeout()),this,SLOT(readyData()));
  timer->start(CAE_POLL_INTERVAL);
  while((!cae_socket->connect(cae_station->caeAddress(cae_config),
			      CAED_TCP_PORT))&&(--count>0)) {
    usleep(100000);
  } 
  usleep(100000);
  if(count>0) {
    SendCommand(QString().sprintf("PW %s!",
				  (const char *)cae_config->password()));
    for(int i=0;i<RD_MAX_CARDS;i++) {
      SendCommand(QString().sprintf("TS %d!",i));
      for(int j=0;j<RD_MAX_PORTS;j++) {
	SendCommand(QString().sprintf("IS %d %d!",i,j));
      }
    }
    SendCommand(QString().sprintf("ME %u!",cae_meter_socket->port()));
  }
}
Exemplo n.º 3
0
void RDCae::readyData()
{
  readyData(0,0,"");
}