mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
first functional commit, still some workarounds. Can start, acquire, stop, restart
This commit is contained in:
parent
f61d819599
commit
657d3e5759
@ -18,6 +18,7 @@
|
|||||||
#include <Poco/Timespan.h>
|
#include <Poco/Timespan.h>
|
||||||
|
|
||||||
#include "JsonBox/Value.h"
|
#include "JsonBox/Value.h"
|
||||||
|
#include "JsonBox/JsonParsingError.h"
|
||||||
|
|
||||||
//#include "logger.h"
|
//#include "logger.h"
|
||||||
|
|
||||||
@ -167,7 +168,7 @@ class RestHelper {
|
|||||||
string answer;
|
string answer;
|
||||||
int code = send_request(session, req, &answer);
|
int code = send_request(session, req, &answer);
|
||||||
if(code == 0 ) {
|
if(code == 0 ) {
|
||||||
//FILE_LOG(logDEBUG) << __AT__ << " REQUEST: " << " ANSWER: " << answer;
|
FILE_LOG(logDEBUG) << __AT__ << " REQUEST: " << " ANSWER: " << answer;
|
||||||
json_value->loadFromString(answer);
|
json_value->loadFromString(answer);
|
||||||
}
|
}
|
||||||
delete uri;
|
delete uri;
|
||||||
@ -220,7 +221,17 @@ class RestHelper {
|
|||||||
string answer;
|
string answer;
|
||||||
int code = send_request(session, req, &answer, request_body);
|
int code = send_request(session, req, &answer, request_body);
|
||||||
if(code==0){
|
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;
|
delete uri;
|
||||||
return code;
|
return code;
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
* @short does all the functions for a receiver, set/get parameters, start/stop etc.
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "UDPRESTImplementation.h"
|
#include "UDPRESTImplementation.h"
|
||||||
|
|
||||||
#include <stdlib.h> // exit()
|
#include <stdlib.h> // exit()
|
||||||
@ -74,7 +73,7 @@ string UDPRESTImplementation::get_rest_state(RestHelper * rest/*, string *rest_s
|
|||||||
|
|
||||||
int code = rest->get_json("v1/state", &answer);
|
int code = rest->get_json("v1/state", &answer);
|
||||||
if ( code != -1 ){
|
if ( code != -1 ){
|
||||||
|
std::cout << answer << std::endl;
|
||||||
rest_state = answer["global_state"].getString();
|
rest_state = answer["global_state"].getString();
|
||||||
std::cout << rest_state << std::endl;
|
std::cout << rest_state << std::endl;
|
||||||
}
|
}
|
||||||
@ -327,8 +326,8 @@ int UDPRESTImplementation::shutDownUDPSockets(){
|
|||||||
code = rest->post_json("v1/state/reset", &answer);
|
code = rest->post_json("v1/state/reset", &answer);
|
||||||
std::cout << code << " " << answer << std::endl;
|
std::cout << code << " " << answer << std::endl;
|
||||||
|
|
||||||
rest_state = get_rest_state(rest);
|
//rest_state = get_rest_state(rest);
|
||||||
std::cout << rest_state << std::endl;
|
//std::cout << rest_state << std::endl;
|
||||||
}
|
}
|
||||||
status = slsReceiverDefs::RUN_FINISHED;
|
status = slsReceiverDefs::RUN_FINISHED;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user