diff --git a/slsReceiverSoftware/include/ZmqSocket.h b/slsReceiverSoftware/include/ZmqSocket.h index df8a2b12f..d64837dc3 100644 --- a/slsReceiverSoftware/include/ZmqSocket.h +++ b/slsReceiverSoftware/include/ZmqSocket.h @@ -58,7 +58,7 @@ public: // construct address sprintf (serverAddress, "tcp://%s:%d", ip, portno); #ifdef VERBOSE - cprintf(BLUE,"addres:%s\n",serverAddress); + cprintf(BLUE,"address:%s\n",serverAddress); #endif // create context @@ -101,10 +101,9 @@ public: * Creates socket, context and connects to server * @param hostname hostname or ip of server * @param portnumber port number - * @param ethip is the ip of the ethernet interface to stream zmq from. - * If blank, it will get ip from "hostname -i", else stream to all interfaces + * @param ethip is the ip of the ethernet interface to stream zmq from */ - ZmqSocket (const uint32_t portnumber, const char *ethip=NULL): + ZmqSocket (const uint32_t portnumber, const char *ethip): portno (portnumber), server (true), contextDescriptor (NULL), @@ -124,35 +123,11 @@ public: //Socket Options provided above - - // construct ip to stream from - char ip[MAX_STR_LENGTH]; - memset(ip, 0, MAX_STR_LENGTH); - - // if ethip pre-defined - if (ethip != NULL) - strcpy(ip,ethip); - else { - bool valid = false; - FILE *sysFile = popen("hostname -i", "r"); - if (sysFile != NULL) { - if (fgets(ip, MAX_STR_LENGTH, sysFile) != NULL) { - sscanf(ip,"%s\n",ip); -#ifdef VERBOSE - cprintf(BLUE, "read ip:%s.\n",ip); -#endif - valid = true; - pclose(sysFile); - } - } - if(!valid) - strcpy(ip,"*"); - - } - - // construct addresss - sprintf (serverAddress,"tcp://%s:%d", ip, portno); + sprintf (serverAddress,"tcp://%s:%d", ethip, portno); +#ifdef VERBOSE + cprintf(BLUE,"address:%s\n",serverAddress); +#endif // bind address if (zmq_bind (socketDescriptor, serverAddress) < 0) { PrintError (); @@ -282,7 +257,7 @@ public: * @returns 0 if error, else 1 */ int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0, - uint32_t npixelsx = 0, uint32_t npixelsy = 0, + uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0, uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL, uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0, uint64_t bunchId = 0, uint64_t timestamp = 0, @@ -299,6 +274,7 @@ public: "\"bitmode\":%u, " "\"fileIndex\":%llu, " "\"shape\":[%u, %u], " + "\"size\":%u, " "\"acqIndex\":%llu, " "\"fIndex\":%llu, " "\"fname\":\"%s\", " @@ -319,7 +295,7 @@ public: "\"version\":%u" "}\n\0"; int length = sprintf(buf, jsonHeaderFormat, - jsonversion, dynamicrange, fileIndex, npixelsx, npixelsy, + jsonversion, dynamicrange, fileIndex, npixelsx, npixelsy, imageSize, acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1, frameNumber, expLength, packetNumber, bunchId, timestamp, modId, xCoord, yCoord, zCoord, debug, roundRNumber, diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index bbfd48e85..f925cabba 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -489,7 +489,7 @@ void DataProcessor::InsertGapPixels(char* buf, uint32_t dr) { // copying line by line srcptr = buf; dstptr = tempBuffer + b1line + b1pxofst; // left fpga (index 0) has no extra 1px offset, but right fpga has - for (int i = 0; i < (ny-1); ++i) { + for (uint32_t i = 0; i < (ny-1); ++i) { memcpy(dstptr, srcptr, b1chip); srcptr += b1chip; dstptr += (b1chip + b2px); @@ -507,7 +507,7 @@ void DataProcessor::InsertGapPixels(char* buf, uint32_t dr) { srcptr = tempBuffer + b1line; dstptr = tempBuffer + b1line; - for (int i = 0; i < (ny-1); ++i) { + for (uint32_t i = 0; i < (ny-1); ++i) { srcgp1 = srcptr + b1pxofst + b1chip - b1px; dstgp1 = srcgp1 + b1px; srcgp2 = srcgp1 + b3px; @@ -545,7 +545,7 @@ void DataProcessor::InsertGapPixels(char* buf, uint32_t dr) { // horizontal filling of values srcptr = tempBuffer + b1line; dstptr = tempBuffer; - for (int i = 0; i < nx; ++i) { + for (uint32_t i = 0; i < nx; ++i) { switch (dr) { case 8: (*((uint8_t*)srcptr)) = (*((uint8_t*)srcptr))/2; (*((uint8_t*)dstptr)) = (*((uint8_t*)srcptr)); break; case 16:(*((uint16_t*)srcptr)) = (*((uint16_t*)srcptr))/2; (*((uint16_t*)dstptr)) = (*((uint16_t*)srcptr)); break; diff --git a/slsReceiverSoftware/src/DataStreamer.cpp b/slsReceiverSoftware/src/DataStreamer.cpp index 9b28625a2..a4905ebef 100644 --- a/slsReceiverSoftware/src/DataStreamer.cpp +++ b/slsReceiverSoftware/src/DataStreamer.cpp @@ -280,7 +280,7 @@ int DataStreamer::SendHeader(sls_detector_header* header, uint32_t nx, uint32_t uint64_t acquisitionIndex = header->frameNumber - firstAcquisitionIndex; return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex, - nx, ny, + nx, ny,generalData->imageSize, acquisitionIndex, frameIndex, fileNametoStream, header->frameNumber, header->expLength, header->packetNumber, header->bunchId, header->timestamp, header->modId, header->xCoord, header->yCoord, header->zCoord, diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 3652b9aa5..a4ecf694e 100644 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -2355,7 +2355,7 @@ int slsReceiverTCPIPInterface::set_streaming_source_ip() { else if (receiverBase->getStatus() != IDLE) receiverNotIdle(); else { - receiverBase->setStreamingSourceIP(arg); + receiverBase->setStreamingSourceIP(arg); } //get