mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
solved bad_alloc
This commit is contained in:
parent
2f82469531
commit
9e78bae614
@ -87,7 +87,9 @@ int UDPRESTImplementation::get_rest_state(RestHelper * rest, string *rest_state)
|
||||
};
|
||||
|
||||
void UDPRESTImplementation::initialize_REST(){
|
||||
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
FILE_LOG(logDEBUG) << __AT__ << " REST status is initialized: " << isInitialized;
|
||||
|
||||
if (rest_hostname.empty()) {
|
||||
FILE_LOG(logDEBUG) << __AT__ <<"can't initialize with empty string or NULL for detectorHostname";
|
||||
@ -104,7 +106,9 @@ void UDPRESTImplementation::initialize_REST(){
|
||||
try{
|
||||
rest->init(rest_hostname, rest_port);
|
||||
code = get_rest_state(rest, &answer);
|
||||
std::cout << "AAAAAAAa " << answer << std::endl;
|
||||
|
||||
|
||||
if (code != 0){
|
||||
throw answer;
|
||||
}
|
||||
@ -133,11 +137,19 @@ void UDPRESTImplementation::initialize_REST(){
|
||||
ss >> test;
|
||||
|
||||
|
||||
test = "{\"path\":\"" + string( getFilePath() ) + "\"}";
|
||||
code = rest->post_json("state/initialize", &answer, test);
|
||||
FILE_LOG(logDEBUG) << __AT__ << "state/configure got " << code;
|
||||
code = rest->get_json("state", &answer);
|
||||
FILE_LOG(logDEBUG) << __AT__ << "state got " << code << " " << answer << "\n";
|
||||
FILE_LOG(logDEBUG) << __AT__ << " state got " << code << " " << answer << "\n";
|
||||
if (answer != "INITIALIZED"){
|
||||
test = "{\"path\":\"" + string( getFilePath() ) + "\"}";
|
||||
code = rest->post_json("state/initialize", &answer, test);
|
||||
}
|
||||
else{
|
||||
test = "{\"path\":\"" + string( getFilePath() ) + "\"}";
|
||||
code = rest->post_json("state/configure", &answer, test);
|
||||
}
|
||||
FILE_LOG(logDEBUG) << __AT__ << " state/configure got " << code;
|
||||
code = rest->get_json("state", &answer);
|
||||
FILE_LOG(logDEBUG) << __AT__ << " state got " << code << " " << answer << "\n";
|
||||
|
||||
|
||||
/*
|
||||
@ -1169,10 +1181,8 @@ int UDPRESTImplementation::startReceiver(char message[]){
|
||||
initialize_REST();
|
||||
FILE_LOG(logDEBUG) << __FILE__ << "::" << __func__ << " initialized";
|
||||
|
||||
// #ifdef VERBOSE
|
||||
cout << "Starting Receiver" << endl;
|
||||
//#endif
|
||||
|
||||
|
||||
std::string answer;
|
||||
int code;
|
||||
//char *intStr = itoa(a);
|
||||
@ -1184,17 +1194,21 @@ int UDPRESTImplementation::startReceiver(char message[]){
|
||||
stringstream ss2;
|
||||
ss2 << getNumberOfFrames();
|
||||
string str_n = ss2.str();
|
||||
|
||||
|
||||
cout << "Starting Receiver" << endl;
|
||||
|
||||
std::string request_body = "{\"settings\": {\"bit_depth\": " + str_dr + ", \"nimages\": " + str_n + "}}";
|
||||
//std::string request_body = "{\"settings\": {\"nimages\":1, \"scanid\":999, \"bit_depth\":16}}";
|
||||
FILE_LOG(logDEBUG) << __FILE__ << "::" << " sending this configuration body: " << request_body;
|
||||
code = rest->post_json("state/configure", &answer, request_body);
|
||||
code = rest->get_json("state", &answer);
|
||||
//code = rest->get_json("state", &answer);
|
||||
//FILE_LOG(logDEBUG) << __FILE__ << "::" << " got: " << answer;
|
||||
|
||||
code = rest->post_json("state/open", &answer);
|
||||
code = rest->get_json("state", &answer);
|
||||
//code = rest->post_json("state/open", &answer);
|
||||
//code = rest->get_json("state", &answer);
|
||||
|
||||
status = slsReceiverDefs::RUNNING;
|
||||
status = RUNNING;
|
||||
|
||||
//reset listening thread variables
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user