a version of receiver for gemma with bottom

This commit is contained in:
Maliakal Dhanya 2014-12-02 10:12:00 +01:00
parent 6787c2e1e0
commit 52d3140a3a
3 changed files with 29 additions and 6 deletions

View File

@ -47,7 +47,7 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
*/
virtual ~UDPStandardImplementation();
void configure(map<string, string> config_map);
/**
* delete and free member parameters

View File

@ -91,6 +91,22 @@ UDPStandardImplementation::UDPStandardImplementation()
}
void UDPStandardImplementation::configure(map<string, string> config_map){
FILE_LOG(logWARNING) << __AT__ << " called";
map<string, string>::const_iterator pos;
pos = config_map.find("mode");
if (pos != config_map.end() ){
int b;
if(!sscanf(pos->second.c_str(), "%d", &b)){
cout << "Warning: Could not parse mode. Assuming top mode." << endl;
b = 0;
}
bottom = b!= 0;
cout << "bottom:"<< bottom << endl;
}
};
void UDPStandardImplementation::initializeMembers(){
myDetectorType = GENERIC;
maxPacketsPerFile = 0;
@ -945,12 +961,12 @@ int UDPStandardImplementation::createUDPSockets(){
port[1] = server_port[1];
/** eiger specific */
/*
if(bottom){
port[0] = server_port[1];
port[1] = server_port[0];
}
*/
//if eth is mistaken with ip address
if (strchr(eth,'.')!=NULL)
strcpy(eth,"");

View File

@ -65,6 +65,13 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
switch(c){
case 'm':
int b;
sscanf(optarg, "%d", &b);
bottom = b != 0;
configuration_map["mode"] = optarg;
break;
case 'f':
fname = optarg;
//cout << long_options[option_index].name << " " << optarg << endl;
@ -86,7 +93,7 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
string help_message = """\nSLS Receiver Server\n\n""";
help_message += """usage: slsReceiver --config config_fname [--rx_tcpport port]\n\n""";
help_message += """\t--config:\t configuration filename for SLS Detector receiver\n""";
help_message += """\t--mode:\t ???\n""";
help_message += """\t--mode:\t 1 for bottom and 0 for top\n""";
help_message += """\t--rx_tcpport:\t TCP Communication Port with the client. Default: 1954.\n\n""";
help_message += """\t--rest_hostname:\t Receiver hostname:port. It applies only to REST receivers, and indicates the hostname of the REST backend. Default: localhost:8081.\n\n""";
@ -120,10 +127,10 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
}
if (success==OK){
FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl;
FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << " with mode " << bottom << endl;
udp_interface = UDPInterface::create(udp_interface_type);
udp_interface->configure(configuration_map);
tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no);
tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no, bottom);
//tcp ip interface
}
}