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