Skip to content

Commit

Permalink
Merge branch 'testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
hfedcba committed Sep 18, 2018
2 parents 3321afd + ebfcaf9 commit 2896657
Show file tree
Hide file tree
Showing 9 changed files with 444 additions and 350 deletions.
10 changes: 7 additions & 3 deletions basic-logic/and/MyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ bool MyNode::doAnd()
try
{
std::lock_guard<std::mutex> inputGuard(_inputMutex);
for(uint32_t i = 0; i < _inputs.size(); i++)
for(auto& input : _inputs)
{
if(!_inputs[i]->booleanValue) return false;
if(!input->booleanValue) return false;
}
return true;
}
Expand All @@ -104,7 +104,11 @@ void MyNode::input(const Flows::PNodeInfo info, uint32_t index, const Flows::PVa
try
{
if(index >= _inputs.size()) return;
Flows::PVariable& input = message->structValue->at("payload");

Flows::PVariable myMessage = std::make_shared<Flows::Variable>();
*myMessage = *message;

Flows::PVariable& input = myMessage->structValue->at("payload");
if(input->type != Flows::VariableType::tBoolean)
{
input->booleanValue = (bool)*input;
Expand Down
1 change: 0 additions & 1 deletion basic-logic/fallingedge/MyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void MyNode::input(Flows::PNodeInfo info, uint32_t index, Flows::PVariable messa
output(0, message);
}
_lastInput = *input;

}
catch(const std::exception& ex)
{
Expand Down
5 changes: 4 additions & 1 deletion basic-logic/not/MyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ void MyNode::input(const Flows::PNodeInfo info, uint32_t index, const Flows::PVa
{
try
{
Flows::PVariable& input = message->structValue->at("payload");
Flows::PVariable myMessage = std::make_shared<Flows::Variable>();
*myMessage = *message;

Flows::PVariable& input = myMessage->structValue->at("payload");
if(input->type != Flows::VariableType::tBoolean)
{
input->booleanValue = (bool)*input;
Expand Down
6 changes: 5 additions & 1 deletion basic-logic/or/MyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ void MyNode::input(const Flows::PNodeInfo info, uint32_t index, const Flows::PVa
try
{
if(index >= _inputs.size()) return;
Flows::PVariable& input = message->structValue->at("payload");

Flows::PVariable myMessage = std::make_shared<Flows::Variable>();
*myMessage = *message;

Flows::PVariable& input = myMessage->structValue->at("payload");
if(input->type != Flows::VariableType::tBoolean)
{
input->booleanValue = (bool)*input;
Expand Down
3 changes: 2 additions & 1 deletion http/http-request/MyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,14 @@ void MyNode::input(const Flows::PNodeInfo info, uint32_t index, const Flows::PVa
{
std::string postRequest = "POST " + _path + " HTTP/1.1\r\nUser-Agent: Homegear\r\nHost: " + _hostname + ":" + std::to_string(_port) + "\r\n" + _basicAuth + "Connection: Close\r\nContent-Length: " + std::to_string(content.size()) + "\r\n\r\n";
postRequest.insert(postRequest.end(), content.begin(), content.end());
_httpClient->sendRequest(postRequest, result);
}
else if(_method == "PATCH")
{
std::string patchRequest = "PATCH " + _path + " HTTP/1.1\r\nUser-Agent: Homegear\r\nHost: " + _hostname + ":" + std::to_string(_port) + "\r\n" + _basicAuth + "Connection: Close\r\nContent-Length: " + std::to_string(content.size()) + "\r\n\r\n";
patchRequest.insert(patchRequest.end(), content.begin(), content.end());
_httpClient->sendRequest(patchRequest, result);
}
_httpClient->get(_path, result);


Flows::PVariable message = std::make_shared<Flows::Variable>(Flows::VariableType::tStruct);
Expand Down
Loading

0 comments on commit 2896657

Please sign in to comment.