some changes to receiver defs

This commit is contained in:
bergamaschi 2015-08-28 10:56:24 +02:00
parent b27f691d03
commit ed1dc77bb3
3 changed files with 41 additions and 22 deletions

View File

@ -15,6 +15,7 @@
#include "UDPInterface.h" #include "UDPInterface.h"
#include "sls_receiver_defs.h" #include "sls_receiver_defs.h"
#include "genericSocket.h"
class dummyUDPInterface : public UDPInterface { class dummyUDPInterface : public UDPInterface {
@ -58,7 +59,12 @@ class dummyUDPInterface : public UDPInterface {
/** /**
* Destructor * Destructor
*/ */
dummyUDPInterface() : UDPInterface(), dynamicRange(16), scanTag(1000), nFrames(100), fWrite(1), fOverwrite(1), fIndex(0), fCaught(0), totfCaught(0), startAcqIndex(0), startFrameIndex(0), acqIndex(0), dataCompression(false), period(0), type(slsReceiverDefs::GENERIC), framesNeeded(100), udpPort1(1900), udpPort2(1901), shortFrame(0), nFramesToGui(0), e10G(0) {strcpy(detHostname,"none"); strcpy(fName,"run"); strcpy(fPath,"/scratch/"); strcpy(eth,"eth0"); cout << "New dummy UDP Interface" << endl;}; dummyUDPInterface() : UDPInterface(), dynamicRange(16), scanTag(1000), nFrames(100), fWrite(1), fOverwrite(1), fIndex(0), fCaught(0), totfCaught(0), startAcqIndex(0), startFrameIndex(0), acqIndex(0), dataCompression(false), period(0), type(slsReceiverDefs::GENERIC), framesNeeded(100), udpPort1(1900), udpPort2(1901), shortFrame(0), nFramesToGui(0), e10G(0) {strcpy(detHostname,"none"); strcpy(fName,"run"); strcpy(fPath,"/scratch/"); strcpy(eth,"eth0"); cout << "New dummy UDP Interface" << endl;
};
~dummyUDPInterface() {cout << "Destroying dummy UDP Interface" << endl;}; ~dummyUDPInterface() {cout << "Destroying dummy UDP Interface" << endl;};
@ -198,7 +204,18 @@ class dummyUDPInterface : public UDPInterface {
/returns 0 on success or -1 on failure /returns 0 on success or -1 on failure
*/ */
//FIXME: success == 0 or success == 1? //FIXME: success == 0 or success == 1?
virtual int startReceiver(char *message=NULL) {cout << "dummy start receiver" << endl; return 0;}; virtual int startReceiver(char *message=NULL) {cout << "dummy start receiver" << endl;
char buff[8225];
buff[8224]='\0';
int ip=0;
int ib;
genericSocket *udpSocket= new genericSocket(50004,genericSocket::UDP,8224);
while((ib=udpSocket->ReceiveDataOnly(buff,8224))>0) {
cout << "*** "<< ib <<" ************************** " << ip++ << endl;
cout << buff << endl;
cout << "*****************************" << endl << endl<< endl ;
}
return 0;};
/** /**
* Stops Receiver - stops listening for packets * Stops Receiver - stops listening for packets

View File

@ -70,14 +70,14 @@
#define JCTB_FIFO_SIZE 2500 //cannot be less than max jobs per thread = 1000 #define JCTB_FIFO_SIZE 2500 //cannot be less than max jobs per thread = 1000
/*#define MOENCH_ALIGNED_FRAME_SIZE 65536*/ /*#define MOENCH_ALIGNED_FRAME_SIZE 65536*/
#define JCTB_PACKETS_PER_FRAME 50 #define JCTB_PACKETS_PER_FRAME 1
#define JCTB_ONE_PACKET_SIZE 8214 #define JCTB_ONE_PACKET_SIZE 8224
#define JCTB_BUFFER_SIZE (MOENCH_ONE_PACKET_SIZE*MOENCH_PACKETS_PER_FRAME) #define JCTB_BUFFER_SIZE (JCTB_ONE_PACKET_SIZE*40)
#define JCTB_DATA_BYTES (JCTB_BUFFER_PER_FRAME) #define JCTB_DATA_BYTES (8192*JCTB_PACKETS_PER_FRAME)
#define JCTB_FRAME_INDEX_MASK 0xFFFFFF00 #define JCTB_FRAME_INDEX_MASK 0xFFFFFFFF
#define JCTB_FRAME_INDEX_OFFSET 8 #define JCTB_FRAME_INDEX_OFFSET 6+8
#define JCTB_PACKET_INDEX_MASK 0xFF #define JCTB_PACKET_INDEX_MASK 0xFFFFFFFF
#define JCTB_BYTES_PER_ADC (2) #define JCTB_BYTES_PER_ADC (2)
#define JCTB_PIXELS_IN_ONE_ROW 32 #define JCTB_PIXELS_IN_ONE_ROW 32

View File

@ -18,24 +18,26 @@ int main(int argc, char *argv[]) {
bool bottom = false; bool bottom = false;
cout << "CCCCCC" << endl; cout << "CCCCCC" << endl;
dummyUDPInterface *udp=new dummyUDPInterface(); dummyUDPInterface *udp=new dummyUDPInterface();
slsReceiverTCPIPInterface *tcpipInterface = new slsReceiverTCPIPInterface(success, udp, tcpip_port_no, bottom); // slsReceiverTCPIPInterface *tcpipInterface = new slsReceiverTCPIPInterface(success, udp, tcpip_port_no, bottom);
if(tcpipInterface->start() == slsReceiverDefs::OK){ // if(tcpipInterface->start() == slsReceiverDefs::OK){
cout << "DONE!" << endl; // cout << "DONE!" << endl;
string str; // string str;
cin>>str; // cin>>str;
//wait and look for an exit keyword // //wait and look for an exit keyword
while(str.find("exit") == string::npos) // while(str.find("exit") == string::npos)
cin>>str; // cin>>str;
//stop tcp server thread, stop udp socket // //stop tcp server thread, stop udp socket
tcpipInterface->stop(); // tcpipInterface->stop();
} // }
if (tcpipInterface) // if (tcpipInterface)
delete tcpipInterface; // delete tcpipInterface;
udp->startReceiver();
if(udp) if(udp)
delete udp; delete udp;
return 0; return 0;