made updatereceiver to actually update client in parameters that it can

This commit is contained in:
Dhanya Maliakal
2017-07-03 17:37:31 +02:00
parent 26f9b1ccbd
commit 460a44a9b1
9 changed files with 42 additions and 34 deletions

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsReceiverSoftware Path: slsDetectorsPackage/slsReceiverSoftware
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
Repsitory UUID: 55bce97b990e627682fc8dc7b38ed883fe155fde Repsitory UUID: 93d7b6862d591a0615e8f6f710aca7c69040dd97
Revision: 599 Revision: 601
Branch: developer Branch: updaterec
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 604 Last Changed Rev: 606
Last Changed Date: 2017-06-30 18:17:33 +0200 Last Changed Date: 2017-07-03 13:45:45 +0200

View File

@ -166,7 +166,7 @@ class BinaryFileStatic {
(long long int)acquisitionPeriod, (long long int)acquisitionPeriod,
ctime(&t)); ctime(&t));
if (strlen(message) > MAX_STR_LENGTH) { if (strlen(message) > MAX_STR_LENGTH) {
bprintf(BG_RED,"Master File Size %d is greater than max str size %d\n", bprintf(RED,"Master File Size %d is greater than max str size %d\n",
(int)strlen(message), MAX_STR_LENGTH); (int)strlen(message), MAX_STR_LENGTH);
return 1; return 1;
} }

View File

@ -18,7 +18,8 @@
#define BOLD "\x1b[1m" #define BOLD "\x1b[1m"
//on background black //on background black
#define bprintf(code, format, ...) printf(code BG_BLACK format RESET, ##__VA_ARGS__) #define bprintf(code, format, ...) printf(code BG_BLACK format RESET, ##__VA_ARGS__)
//normal printout //normal printout
#define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__) #define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__)
/* /*

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "55bce97b990e627682fc8dc7b38ed883fe155fde" #define SVNREPUUID "93d7b6862d591a0615e8f6f710aca7c69040dd97"
//#define SVNREV 0x604 //#define SVNREV 0x606
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Dhanya_Maliakal" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x604 #define SVNREV 0x606
#define SVNDATE 0x20170630 #define SVNDATE 0x20170703
// //

View File

@ -297,7 +297,6 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
/** port number */ /** port number */
int portNumber; int portNumber;
//***callback parameters*** //***callback parameters***
/** /**
* Call back for start acquisition * Call back for start acquisition

View File

@ -59,7 +59,7 @@ void HDF5File::PrintMembers() {
} else if (datatype == PredType::STD_U32LE) { } else if (datatype == PredType::STD_U32LE) {
FILE_LOG(logINFO) << "Data Type: 32"; FILE_LOG(logINFO) << "Data Type: 32";
} else { } else {
FILE_LOG(logERROR) << BG_RED,"unknown data type"; FILE_LOG(logERROR) << "unknown data type";
} }
} }

View File

@ -275,7 +275,7 @@ void Listener::ThreadExecution() {
//error check, (should not be here) if not transmitting yet (previous if) rc should be > 0 //error check, (should not be here) if not transmitting yet (previous if) rc should be > 0
if (rc <= 0) { if (rc <= 0) {
//bprintf(BG_RED,"Error:(Weird Early self shut down), UDP Sockets not shut down, but received nothing\n"); //cprintf(RED,"Error:(Weird Early self shut down), UDP Sockets not shut down, but received nothing\n");
StopListening(buffer); StopListening(buffer);
return; return;
} }
@ -343,7 +343,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
//------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------
if (fnum != currentFrameIndex) { if (fnum != currentFrameIndex) {
if (fnum < currentFrameIndex) { if (fnum < currentFrameIndex) {
bprintf(BG_RED,"Error:(Weird), With carry flag: Frame number %lu less than current frame number %lu\n", fnum, currentFrameIndex); bprintf(RED,"Error:(Weird), With carry flag: Frame number %lu less than current frame number %lu\n", fnum, currentFrameIndex);
return 0; return 0;
} }
new_header->packetNumber = numpackets; new_header->packetNumber = numpackets;

View File

@ -203,9 +203,9 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
} }
if (DataStreamer::GetErrorMask() || error) { if (DataStreamer::GetErrorMask() || error) {
if (DataStreamer::GetErrorMask()) if (DataStreamer::GetErrorMask())
bprintf(BG_RED,"Error: Could not create data callback threads\n"); bprintf(RED,"Error: Could not create data callback threads\n");
else else
bprintf(BG_RED,"Error: Could not create zmq sockets\n"); bprintf(RED,"Error: Could not create zmq sockets\n");
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
delete(*it); delete(*it);
dataStreamer.clear(); dataStreamer.clear();
@ -731,7 +731,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
(generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize), (generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize),
fifoDepth, success)); fifoDepth, success));
if (!success) { if (!success) {
bprintf(BG_RED,"Error: Could not allocate memory for fifo structure of index %d\n", i); bprintf(RED,"Error: Could not allocate memory for fifo structure of index %d\n", i);
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it) for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
delete(*it); delete(*it);
fifo.clear(); fifo.clear();

View File

@ -510,6 +510,7 @@ int slsReceiverTCPIPInterface::lock_receiver() {
int slsReceiverTCPIPInterface::get_last_client_ip() { int slsReceiverTCPIPInterface::get_last_client_ip() {
ret = OK; ret = OK;
if (mySock->differentClients) if (mySock->differentClients)
ret = FORCE_UPDATE; ret = FORCE_UPDATE;
@ -602,7 +603,8 @@ int slsReceiverTCPIPInterface::update_client() {
// send answer // send answer
mySock->SendDataOnly(&ret,sizeof(ret)); mySock->SendDataOnly(&ret,sizeof(ret));
if (ret == FAIL){ //fail and force_update
if (ret != OK){
mySock->SendDataOnly(mess,sizeof(mess)); mySock->SendDataOnly(mess,sizeof(mess));
// return ok/fail // return ok/fail
return ret; return ret;
@ -622,7 +624,7 @@ int slsReceiverTCPIPInterface::send_update() {
mySock->SendDataOnly(mySock->lastClientIP,sizeof(mySock->lastClientIP)); mySock->SendDataOnly(mySock->lastClientIP,sizeof(mySock->lastClientIP));
//filepath // filepath
#ifdef SLS_RECEIVER_UDP_FUNCTIONS #ifdef SLS_RECEIVER_UDP_FUNCTIONS
path = receiverBase->getFilePath(); path = receiverBase->getFilePath();
#endif #endif
@ -633,7 +635,7 @@ int slsReceiverTCPIPInterface::send_update() {
delete[] path; delete[] path;
} }
//filename // filename
#ifdef SLS_RECEIVER_UDP_FUNCTIONS #ifdef SLS_RECEIVER_UDP_FUNCTIONS
path = receiverBase->getFileName(); path = receiverBase->getFileName();
#endif #endif
@ -644,27 +646,29 @@ int slsReceiverTCPIPInterface::send_update() {
delete[] path; delete[] path;
} }
//index // index
#ifdef SLS_RECEIVER_UDP_FUNCTIONS #ifdef SLS_RECEIVER_UDP_FUNCTIONS
ind=receiverBase->getFileIndex(); ind=receiverBase->getFileIndex();
#endif #endif
mySock->SendDataOnly(&ind,sizeof(ind)); mySock->SendDataOnly(&ind,sizeof(ind));
//file format
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
ind=(int)receiverBase->getFileFormat();
#endif
mySock->SendDataOnly(&ind,sizeof(ind));
// file path
// file name
// file index
// file format
// file write enable // file write enable
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
ind=(int)receiverBase->getFileWriteEnable();
#endif
mySock->SendDataOnly(&ind,sizeof(ind));
// file overwrite enable // file overwrite enable
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
// activate ind=(int)receiverBase->getOverwriteEnable();
// fifo depth #endif
mySock->SendDataOnly(&ind,sizeof(ind));
// data stream enable
// receiver read frequency
// receiver read timer
if (!lockStatus) if (!lockStatus)
strcpy(mySock->lastClientIP,mySock->thisClientIP); strcpy(mySock->lastClientIP,mySock->thisClientIP);
@ -747,6 +751,10 @@ int slsReceiverTCPIPInterface::set_detector_type(){
} }
} }
#endif #endif
// client has started updating receiver, update ip
if (!lockStatus)
strcpy(mySock->lastClientIP,mySock->thisClientIP);
if (ret == OK && mySock->differentClients) if (ret == OK && mySock->differentClients)
ret = FORCE_UPDATE; ret = FORCE_UPDATE;