mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-01-08 17:49:57 +01:00
fixing getline
This commit is contained in:
parent
fa87ee505e
commit
e8f6f63b67
|
|
@ -44,10 +44,13 @@ class AprsIs:
|
|||
self.socket.sendall(bytearray(f"{line}\r\n", encoding='utf8'))
|
||||
|
||||
def get_line(self):
|
||||
line = self._get_line()
|
||||
if line.startswith("#"):
|
||||
return None
|
||||
yield line
|
||||
line_list = list(self._get_line())
|
||||
new_list = []
|
||||
if line_list:
|
||||
for line in line_list:
|
||||
if not line.startswith("#"):
|
||||
new_list.append(line)
|
||||
return new_list
|
||||
|
||||
def _get_line(self):
|
||||
if self.socket:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from testlib.esp_dut import ESP
|
||||
from testlib.aprs_con import APRSIS
|
||||
from testlib.aprs_con import APRSIS, AprsIs
|
||||
|
||||
|
||||
def test_basic_port(ESP):
|
||||
|
|
@ -27,3 +27,16 @@ def test_erase(ESP):
|
|||
|
||||
def test_aprs_login(APRSIS):
|
||||
pass
|
||||
|
||||
|
||||
def test_aprs_msg(APRSIS):
|
||||
aprs = AprsIs("OE5BPA-2", passwd="22948",
|
||||
host="localhost", port=10152)
|
||||
aprs.connect()
|
||||
aprs.send_line("OE5BPA-2>APLG01:=4819.82NL01418.68E&Testing")
|
||||
for i in range(2):
|
||||
line = APRSIS.get_line()
|
||||
for l in line:
|
||||
if l == "OE5BPA-2>APLG01,TCPIP*,qAC,OE5BPA:=4819.82NL01418.68E&Testing":
|
||||
return
|
||||
raise
|
||||
|
|
|
|||
Loading…
Reference in a new issue