some other version

This commit is contained in:
Johannes Wendel
2019-12-05 21:46:14 +01:00
parent b49bfc65f0
commit 1591dd02ef
5 changed files with 11 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ void InputSocketHandler::run()
std::string str = event.getJsonString();
auto size = str.size();
str = std::to_string(size) + std::to_string(0x02) + str;
str = std::to_string(size) + std::string(1, 0x02) + str;
this->socket().sendBytes(str.c_str(), str.size());
}

View File

@@ -43,7 +43,7 @@ public:
{
std::unique_lock<std::mutex> lock(this->d_mutex);
this->d_condition.wait(lock, [=]
{ return !this->p_queue.empty(); });
{ return !this->p_queue.empty(); });
T rc = *this->p_queue.begin();
this->p_queue.pop();
return rc;

View File

@@ -6,6 +6,7 @@
#define FLIPPR_DRIVER_WIRINGPITESTING_H
#include <iostream>
#include <random>
#define INPUT 0
#define OUTPUT 1
@@ -23,8 +24,8 @@ void pinMode(int pin, int mode)
int digitalRead(int pin)
{
//std::cout << "Reading pin " << pin << std::endl;
return 0;
//std::cout << "Reading pin " << pin << std::endl
return rand()%2 == 0 ? 1 : 0;
}
void digitalWrite(int pin, int value)