From bb918be4924197e740cdbece18502d2a2ca54cb8 Mon Sep 17 00:00:00 2001 From: Jeff Moe Date: Sat, 1 Oct 2022 15:06:40 -0600 Subject: [PATCH] Send bytes --- greenctld | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/greenctld b/greenctld index 6240eff..bc8ad97 100755 --- a/greenctld +++ b/greenctld @@ -146,7 +146,7 @@ class TCPServer(object): # "\\dump_state" is sent by satnogs hamlib, need to ignore it and send okay state if cmd == '\\dump_state': - fd.send('RPRT 0\n') + fd.send(b'RPRT 0\n') return print('<-- %s' % repr(cmd)) @@ -160,7 +160,7 @@ class TCPServer(object): if cmd == 'S': self.rotor.stop() print('--> RPRT 0') - fd.send('RPRT 0\n') + fd.send(b'RPRT 0\n') return # "p", to get current position @@ -168,11 +168,11 @@ class TCPServer(object): pos = self.rotor.get_pos() if not pos: print('--> RPRT -6') - fd.send('RPRT -6\n') + fd.send(b'RPRT -6\n') else: az, el = pos print('--> %d,%d' % (az, el)) - fd.send('%.6f\n%.6f\n' % (az, el)) + fd.send(b'%.6f\n%.6f\n' % (az, el)) return # "P " to set desired position @@ -185,7 +185,7 @@ class TCPServer(object): el = int(float(el)) except: print('--> RPRT -8 (could not parse)') - fd.send('RPRT -8\n') + fd.send(b'RPRT -8\n') return if az == 360: @@ -193,22 +193,22 @@ class TCPServer(object): if az > 359: print('--> RPRT -1 (az too large)') - fd.send('RPRT -1\n') + fd.send(b'RPRT -1\n') return if el > 90: print('--> RPRT -1 (el too large)') - fd.send('RPRT -1\n') + fd.send(b'RPRT -1\n') return self.rotor.set_pos(az, el) print('--> RPRT 0') - fd.send('RPRT 0\n') + fd.send(b'RPRT 0\n') return # Nothing else is supported print('--> RPRT -4 (unknown command)') - fd.send('RPRT -4\n') + fd.send(b'RPRT -4\n') def read_client(self, fd): buf = fd.recv(1024)