mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-16 14:57:13 +02:00
first functional commit, still some workarounds. Can start, acquire, stop, restart
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#include <Poco/Timespan.h>
|
||||
|
||||
#include "JsonBox/Value.h"
|
||||
#include "JsonBox/JsonParsingError.h"
|
||||
|
||||
//#include "logger.h"
|
||||
|
||||
@ -167,7 +168,7 @@ class RestHelper {
|
||||
string answer;
|
||||
int code = send_request(session, req, &answer);
|
||||
if(code == 0 ) {
|
||||
//FILE_LOG(logDEBUG) << __AT__ << " REQUEST: " << " ANSWER: " << answer;
|
||||
FILE_LOG(logDEBUG) << __AT__ << " REQUEST: " << " ANSWER: " << answer;
|
||||
json_value->loadFromString(answer);
|
||||
}
|
||||
delete uri;
|
||||
@ -220,7 +221,17 @@ class RestHelper {
|
||||
string answer;
|
||||
int code = send_request(session, req, &answer, request_body);
|
||||
if(code==0){
|
||||
json_value->loadFromString(answer);
|
||||
try{
|
||||
json_value->loadFromString(answer);
|
||||
}
|
||||
catch (JsonBox::JsonParsingError& e){
|
||||
try{
|
||||
json_value->loadFromString("{\"global_state\":\"" + answer + "\"}");
|
||||
}
|
||||
catch(exception &e){
|
||||
FILE_LOG(logERROR) << "Exception converting answer: " << e.what() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete uri;
|
||||
return code;
|
||||
|
Reference in New Issue
Block a user