mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
Merge branch 'master' of gitorious.psi.ch:sls_det_software/sls_receiver_software
This commit is contained in:
@ -269,6 +269,12 @@ int UDPStandardImplementation::setDetectorType(detectorType det){ FILE_LOG(logD
|
||||
case EIGER:
|
||||
cout << endl << "***** This is a EIGER Receiver *****" << endl << endl;
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
cout << endl << "***** This is a JUNGFRAUCTB Receiver *****" << endl << endl;
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
cout << endl << "***** This is a JUNGFRAU Receiver *****" << endl << endl;
|
||||
break;
|
||||
default:
|
||||
cout << endl << "***** Unknown Receiver *****" << endl << endl;
|
||||
return FAIL;
|
||||
@ -315,6 +321,16 @@ int UDPStandardImplementation::setDetectorType(detectorType det){ FILE_LOG(logD
|
||||
createListeningThreads(true);
|
||||
|
||||
numListeningThreads = MAX_NUM_LISTENING_THREADS;
|
||||
} else if(myDetectorType == JUNGFRAUCTB || myDetectorType == JUNGFRAU ){
|
||||
fifosize = JCTB_FIFO_SIZE;
|
||||
packetsPerFrame = JCTB_PACKETS_PER_FRAME;
|
||||
onePacketSize = JCTB_ONE_PACKET_SIZE;
|
||||
frameSize = JCTB_BUFFER_SIZE;
|
||||
bufferSize = JCTB_BUFFER_SIZE;
|
||||
maxPacketsPerFile = JFCTB_MAX_FRAMES_PER_FILE * JCTB_PACKETS_PER_FRAME;
|
||||
frameIndexMask = JCTB_FRAME_INDEX_MASK;
|
||||
frameIndexOffset = JCTB_FRAME_INDEX_OFFSET;
|
||||
packetIndexMask = JCTB_PACKET_INDEX_MASK;
|
||||
}
|
||||
latestData = new char[frameSize];
|
||||
|
||||
|
46
slsReceiverSoftware/src/dummyMain.cpp
Normal file
46
slsReceiverSoftware/src/dummyMain.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/* A simple server in the internet domain using TCP
|
||||
The port number is passed as an argument */
|
||||
|
||||
#include "sls_receiver_defs.h"
|
||||
#include "dummyUDPInterface.h"
|
||||
#include "slsReceiverTCPIPInterface.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int success;
|
||||
int tcpip_port_no;
|
||||
bool bottom = false;
|
||||
cout << "CCCCCC" << endl;
|
||||
dummyUDPInterface *udp=new dummyUDPInterface();
|
||||
slsReceiverTCPIPInterface *tcpipInterface = new slsReceiverTCPIPInterface(success, udp, tcpip_port_no, bottom);
|
||||
|
||||
|
||||
|
||||
|
||||
if(tcpipInterface->start() == slsReceiverDefs::OK){
|
||||
cout << "DONE!" << endl;
|
||||
string str;
|
||||
cin>>str;
|
||||
//wait and look for an exit keyword
|
||||
while(str.find("exit") == string::npos)
|
||||
cin>>str;
|
||||
//stop tcp server thread, stop udp socket
|
||||
tcpipInterface->stop();
|
||||
}
|
||||
|
||||
if (tcpipInterface)
|
||||
delete tcpipInterface;
|
||||
if(udp)
|
||||
delete udp;
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ using namespace std;
|
||||
|
||||
|
||||
slsReceiverTCPIPInterface::~slsReceiverTCPIPInterface() {
|
||||
closeFile(0);
|
||||
if(socket) {delete socket; socket=NULL;}
|
||||
if(receiverBase) {delete receiverBase; receiverBase=NULL;}
|
||||
closeFile(0);
|
||||
}
|
||||
|
||||
slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int &success, UDPInterface* rbase, int pn, bool bot):
|
||||
@ -652,7 +652,9 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
receiverBase->setUDPPortNo2(udpport2);
|
||||
//setup udpip
|
||||
//get ethernet interface or IP to listen to
|
||||
cout << "Ethernet interface is " << args[0] << endl;
|
||||
temp = genericSocket::ipToName(args[0]);
|
||||
cout << temp << endl;
|
||||
if(temp=="none"){
|
||||
ret = FAIL;
|
||||
strcpy(mess, "failed to get ethernet interface or IP to listen to\n");
|
||||
@ -666,10 +668,11 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
FILE_LOG(logDEBUG) << __FILE__ << "::" << __func__ << " " << eth;
|
||||
receiverBase->setEthernetInterface(eth);
|
||||
|
||||
cout << eth << endl;
|
||||
//get mac address from ethernet interface
|
||||
if (ret != FAIL)
|
||||
temp = genericSocket::nameToMac(eth);
|
||||
|
||||
|
||||
|
||||
if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){
|
||||
ret = FAIL;
|
||||
|
Reference in New Issue
Block a user