diff --git a/lora.py b/lora.py index fed55a8..b312769 100644 --- a/lora.py +++ b/lora.py @@ -38,8 +38,6 @@ from lora_comms import make_pktbuf import multicast from util import * -domain = b'com.funkthat.lora.irrigation.shared.v0.0.1' - # Response to command will be the CMD and any arguments if needed. # The command is encoded as an unsigned byte CMD_TERMINATE = 1 # no args: terminate the sesssion, reply confirms @@ -55,11 +53,13 @@ CMD_CLEAR = 7 # arg: (): clears all future commands, but keeps current running class LORANode(object): '''Implement a LORANode initiator.''' + SHARED_DOMAIN = b'com.funkthat.lora.irrigation.shared.v0.0.1' + MAC_LEN = 8 def __init__(self, syncdatagram, shared=None): self.sd = syncdatagram - self.st = Strobe(domain, F=KeccakF(800)) + self.st = Strobe(self.SHARED_DOMAIN, F=KeccakF(800)) if shared is not None: self.st.key(shared) @@ -80,7 +80,7 @@ class LORANode(object): origstate = self.st.copy() while True: - resp = await self.sd.sendtillrecv(msg, .25) + resp = await self.sd.sendtillrecv(msg, .50) #_debprint('got:', resp) # skip empty messages @@ -601,6 +601,8 @@ class TestSequencing(unittest.IsolatedAsyncioTestCase): self.assertEqual(col, list(range(1, 7))) class TestLORANode(unittest.IsolatedAsyncioTestCase): + shared_domain = b'com.funkthat.lora.irrigation.shared.v0.0.1' + @timeout(2) async def test_lora(self): _self = self @@ -625,7 +627,7 @@ class TestLORANode(unittest.IsolatedAsyncioTestCase): return resp async def runner(self): - l = Strobe(domain, F=KeccakF(800)) + l = Strobe(TestLORANode.shared_domain, F=KeccakF(800)) l.key(shared_key)