python cl working now for inputs

This commit is contained in:
Johannes Wendel
2019-12-06 00:28:33 +01:00
parent 1591dd02ef
commit f1ae41b243
2 changed files with 7 additions and 8 deletions

View File

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

View File

@@ -46,11 +46,12 @@ class Networking:
self.get("/displays" + display + "/write_score/" + str(score))
def getInputEvent(self):
header = bytearray()
header = list()
while b'\x02' not in header:
bla = self.input_socket.recv(1)
header.append(bla)
s = ""
for x in header:
s += x.decode('utf8')
length = int(str(header[:-1]))
return self.input_socket.recv(length)
return s