frame index now is set via the multi and sls and sent to receiver when frames/cycles is set, resetframescaught doesnt decide if frames needed, possible problem in acquire scans,gets #frames/cycles from detector,but needed

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@451 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-02-05 11:23:46 +00:00
parent ed4aaa83ce
commit 7a55ed9a74
14 changed files with 196 additions and 57 deletions

View File

@ -120,6 +120,7 @@ int slsReceiverFuncs::function_table(){
flist[F_SET_FILE_NAME] = &slsReceiverFuncs::set_file_name;
flist[F_SET_FILE_PATH] = &slsReceiverFuncs::set_file_dir;
flist[F_SET_FILE_INDEX] = &slsReceiverFuncs::set_file_index;
flist[F_SET_FRAME_INDEX] = &slsReceiverFuncs::set_frame_index;
flist[F_SETUP_UDP] = &slsReceiverFuncs::setup_udp;
flist[F_START_RECEIVER] = &slsReceiverFuncs::start_receiver;
flist[F_STOP_RECEIVER] = &slsReceiverFuncs::stop_receiver;
@ -387,6 +388,60 @@ int slsReceiverFuncs::set_file_index() {
int slsReceiverFuncs::set_frame_index() {
ret=OK;
int retval=-1;
int index;
strcpy(mess,"Could not set frame index\n");
// receive arguments
if(socket->ReceiveDataOnly(&index,sizeof(index)) < 0 ){
strcpy(mess,"Error reading from socket\n");
ret = FAIL;
}
// execute action if the arguments correctly arrived
#ifdef SLS_RECEIVER_FUNCTION_LIST
if (ret==OK) {
if (lockStatus==1 && socket->differentClients==1){//necessary???
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
ret=FAIL;
}
else
retval=slsReceiverList->setFrameIndexNeeded(index);
}
#ifdef VERBOSE
if(ret!=FAIL)
cout << "frame index:" << retval << endl;
else
cout << mess << endl;
#endif
#endif
if(ret==OK && socket->differentClients){
cout << "Force update" << endl;
ret=FORCE_UPDATE;
}
// send answer
socket->SendDataOnly(&ret,sizeof(ret));
if(ret==FAIL)
socket->SendDataOnly(mess,sizeof(mess));
socket->SendDataOnly(&retval,sizeof(retval));
//return ok/fail
return ret;
}
int slsReceiverFuncs::setup_udp(){
ret=OK;
strcpy(mess,"could not set up udp connection");
@ -606,18 +661,11 @@ int slsReceiverFuncs::get_frame_index(){
int slsReceiverFuncs::reset_frames_caught(){
ret=OK;
int retval=-1;
int index=-1;
strcpy(mess,"Could not reset frames caught\n");
// receive arguments
if(socket->ReceiveDataOnly(&index,sizeof(index)) < 0) {;
sprintf(mess,"Error reading from socket\n");
ret=FAIL;
}
// execute action if the arguments correctly arrived
#ifdef SLS_RECEIVER_FUNCTION_LIST
if (ret==OK) {
@ -626,7 +674,7 @@ int slsReceiverFuncs::reset_frames_caught(){
ret=FAIL;
}
else
retval=slsReceiverList->resetTotalFramesCaught(index);
slsReceiverList->resetTotalFramesCaught();
}
#endif
@ -639,7 +687,7 @@ int slsReceiverFuncs::reset_frames_caught(){
socket->SendDataOnly(&ret,sizeof(ret));
if(ret==FAIL)
socket->SendDataOnly(mess,sizeof(mess));
socket->SendDataOnly(&retval,sizeof(retval));
//return ok/fail
return ret;