def write(self, channel, data): if self.opened: with self.lock: msg = { TYPE: channel.replace('\n', ''), DATA: data.replace('\n', '') } self.socket.sendall(dictToJson(msg).encode() + NEWLINE)
def write(self, channel, data): if self.opened: with self.lock: msg = { TYPE: channel.replace("\n", ""), DATA: data.replace("\n", "") } self.serial.write(dictToJson(msg).encode() + NEWLINE)
def write(self, channel, data): msg = {"type": channel, "data": data} self.socket.sendall(dictToJson(msg).encode() + NEWLINE) return self
def exit(self): self.go = False msg = {'stop': True} self.client.send(dictToJson(msg).encode())
def write(self, channel, data): msg = {'type': channel, 'data': data} self.client.send(dictToJson(msg).encode())
def write(self, channel, data): msg = {'type': channel, 'data': data} self.socket.sendall(dictToJson(msg).encode() + NEWLINE)
def write(self, channel, data): if self.canWrite: self.canWrite = False msg = {'type': channel, 'data': data} self.client.sendall(dictToJson(msg).encode() + NEWLINE)