Пример #1
0
	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)
Пример #2
0
 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)
Пример #3
0
 def write(self, channel, data):
     msg = {"type": channel, "data": data}
     self.socket.sendall(dictToJson(msg).encode() + NEWLINE)
     return self
Пример #4
0
 def exit(self):
     self.go = False
     msg = {'stop': True}
     self.client.send(dictToJson(msg).encode())
Пример #5
0
 def write(self, channel, data):
     msg = {'type': channel, 'data': data}
     self.client.send(dictToJson(msg).encode())
Пример #6
0
	def write(self, channel, data):
		msg = {'type': channel, 'data': data}
		self.socket.sendall(dictToJson(msg).encode() + NEWLINE)
Пример #7
0
	def write(self, channel, data):
		if self.canWrite:
			self.canWrite = False
			msg = {'type': channel, 'data': data}
			self.client.sendall(dictToJson(msg).encode() + NEWLINE)