Example #1
0
---------------------------------------*/ int setbcorbit(int tag)  {
int rc;
char buffer[50];
printf("setting ttcmi clock:%d\n", tag);
if(micratepresent()==0) {
#define MAXdbhns 40
  char dbhns[MAXdbhns]; int ldbhns;
  ldbhns= readclockshift(dbhns, MAXdbhns);
  printf("mi crate not present. readclockshift:%d:%s:\n", ldbhns,dbhns);
  if(tag==1) {bcmvme=3; omvme=0; 
  } else if(tag==2) {bcmvme=2; omvme=1; 
  } else if(tag==3) {bcmvme=1; omvme=2; 
  } else if(tag==4) {bcmvme=0; omvme=2; 
  } else {
    printf("novme setbcorbit: bad tag:%d bcmvme:%x omvme:%x\n", tag, bcmvme, omvme);
  return(0);
  };
} else {
 setbcorbitMain(tag);
};
rc= dis_update_service(SHIFTid);
printf("TTCMI/SHIFT updated for %d clients\n", rc);  
sprintf(buffer, "mon ds005 N:%d", tag); 
rc= udpsend(udpsock, (unsigned char *)buffer, strlen(buffer)+1);
getclocknow();
return(tag);
}
Example #2
0
/*----------------------------------------------------------- MICLOCKcaba
*/
void MICLOCKcaba(void *tag, void **msgpv, int *size, int *blabla) {
char **msgp= (char **)msgpv; int rc;
char msg[100], clientid[100];
// readVME:
getclocknow();
rc= getclientid(clientid);
*msgp= clocknow;
*size= strlen(clocknow)+1;
sprintf(msg, "MICLOCKcaba clocknow:%s size:%d clientid:%s rc:%d",
  clocknow, *size, clientid, rc); prtLog(msg); 
}
Example #3
0
/*-----------------*/ void MICLOCK_SETcmd(void *tag, void *msgv, int *size)  {
char errmsg[200];
char msg[80]; int rc,rc2=0; int nwclocktag, msglen;
sprintf(errmsg, "MICLOCK_SETcmd: tag:%d size:%d msg:%5.5s", 
  *(int *)tag, *size, (char *)msgv); prtLog(errmsg); 
/* pydim client: msg not finished by 0x0 ! -that's why strncmp() used below...

if(*size >=2) {
msg[*size]='\0';   // with python client ok
//if(msg[*size-2]=='\n') { msg[*size-2]='\0'; } else { msg[*size-1]='\0'; };
};
*/
msglen= *size;
strncpy(msg, (char *)msgv, msglen); msg[msglen]='\0';
rc= authenticate(""); rc2=1; //rc2= authenticate("oerjan/");
//rc=0;
if((rc!=0) and (rc2!=0) ) {
  //sprintf(errmsg, "Only trigger/oerjan user can change the clock"); prtLog(errmsg); 
  sprintf(errmsg, "Only alidcscom779 can request the change of the clock"); prtLog(errmsg); 
  return;  
};
if(strncmp(msg,"qq", 2)==0) ds_stop();
if(strncmp(msg,"BEAM1", 5)==0) { nwclocktag=1;
} else if(strncmp(msg,"BEAM2", 5)==0) { nwclocktag=2;
} else if(strncmp(msg,"REF", 3)==0) { nwclocktag=3;
} else if(strncmp(msg,"LOCAL", 5)==0) { nwclocktag=4;
} else { 
  sprintf(errmsg, "bad clock request:%s ignored.\n", msg); infolog_trgboth(LOG_ERROR, errmsg); 
  return; 
};
strcpy(lastmsg,msg);
getclocknow();
if(clocktag==nwclocktag) {
  sprintf(errmsg, "clock request:%s ignored (already set).\n", msg); infolog_trgboth(LOG_ERROR, errmsg); 
  return; 
};
sprintf(errmsg, "ALICE clock change to %s starting...\n", msg); infolog_trgboth(LOG_WARNING, errmsg); 
checkstartthread(nwclocktag);
}