Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configfiles/Dummy/ToolChainConfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ mon_port 5000 # remote multicast port to send monitoring messa
multicast_send_period 5000 # logging & monitoring messages will be sent as a batch once per this period
alarm_cooldown_ms 1000 # alarms with the same device and message will be limited to this rate
mon_merge_period 5000 # monitoring messages with the same device and subject will be limited to this rate
MTU 1500 # MTU of interface used for logging/monitoring

##### Tools To Add #####
Tools_File configfiles/Dummy/ToolsConfig # list of tools to run and their config files
Expand Down
1 change: 1 addition & 0 deletions configfiles/template/ToolChainConfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ mon_port 5000 # remote multicast port to send monitoring messa
multicast_send_period 5000 # logging & monitoring messages will be sent as a batch once per this period
alarm_cooldown_ms 1000 # alarms with the same device and message will be limited to this rate
mon_merge_period 5000 # monitoring messages with the same device and subject will be limited to this rate
MTU 1500 # MTU of interface used for logging/monitoring

##### Tools To Add #####
Tools_File configfiles/ToolsConfig # list of tools to run and their config files
Expand Down
37 changes: 24 additions & 13 deletions src/RemoteControl/RemoteControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "ServiceDiscovery.h"
#include "zmq.hpp"
#include <zstd.h>
#include "zstd_helpers.h"

#include <boost/uuid/uuid.hpp> // uuid class
#include <boost/uuid/uuid_generators.hpp> // generators
Expand All @@ -30,6 +32,7 @@ int main(int argc, char** argv){


zmq::context_t context(3);
ZSTD_DCtx* zstd_dctx = ZSTD_createDCtx();

//std::string address(argv[1]);
// std::stringstream tmp (argv[2]);
Expand Down Expand Up @@ -236,14 +239,17 @@ int main(int argc, char** argv){

zmq::message_t receive;
if(ServiceSend.recv(&receive)){
std::istringstream iss(static_cast<char*>(receive.data()));

std::string answer;
answer=iss.str();
if(!ZstdDecompress(zstd_dctx, (char*)receive.data(), receive.size(), answer)){
std::cerr<<"failed to decompress reply!: "<<answer<<std::endl;

} else {
Store rr;
rr.JsonParser(answer);
if(rr.Get<std::string>("msg_type")=="Command Reply") std::cout<<std::endl<<rr.Get<std::string>("msg_value")<<std::endl<<std::endl;

}

Store rr;
rr.JsonParser(answer);
if(rr.Get<std::string>("msg_type")=="Command Reply") std::cout<<std::endl<<(rr.Get<std::string>("msg_value"))<<std::endl<<std::endl;
}
else std::cout<<std::endl<<"message timed out"<<std::endl;

Expand Down Expand Up @@ -364,15 +370,18 @@ int main(int argc, char** argv){

zmq::message_t receive;
if(ServiceSend.recv(&receive)){
std::istringstream iss(static_cast<char*>(receive.data()));

std::string answer;
answer=iss.str();

Store rr;
rr.JsonParser(answer);
if(rr.Get<std::string>("msg_type")=="Command Reply") std::cout<<std::endl<<rr.Get<std::string>("msg_value")<<std::endl<<std::endl;
if(!ZstdDecompress(zstd_dctx, (char*)receive.data(), receive.size(), answer)){
std::cerr<<"failed to decompress reply!"<<std::endl;

} else {
Store rr;
rr.JsonParser(answer);
if(rr.Get<std::string>("msg_type")=="Command Reply") std::cout<<std::endl<<rr.Get<std::string>("msg_value")<<std::endl<<std::endl;

}
}

}
}

Expand All @@ -392,3 +401,5 @@ int main(int argc, char** argv){
return 0;

}


Loading
Loading