houluy / lora-mote-emulator

This is a device (mote) emulator for LoRaWAN protocol(1.0 & 1.1). Completely realized by Python 3.6
MIT License
22 stars 12 forks source link

Error while retrieving the device session #3

Open Gillani0 opened 4 years ago

Gillani0 commented 4 years ago

Hi,

I can send the Data Push join message and receive and parse its response correctly with correct mic. However, when it tries to save the session I get the following error:

ERROR - can't pickle memoryview objects

This is during self.save() operation.

Syed

houluy commented 4 years ago

Would you please show the whole error message or locate the exception position in code? I didn't encounter such an error. This may cost by a bug. I use memoryview in some process to save processing time, but when it comes to pickle (actually it shouldn't appear in pickle process), the memoryview object should be casted into bytes to be pickled.

Gillani0 commented 4 years ago

Hi following is the error trace


 - ERROR - can't pickle memoryview objects

Traceback (most recent call last):
  File "main.py", line 98, in main
    gateway.push(udp_client, phypld, mote)
  File "/lora-motes-emulator/motes/mac.py", line 304, in push
    self.parse_pullresp(pullresp[0], mote)
  File "/lora-motes-emulator/motes/mac.py", line 372, in parse_pullresp
    self.parse_txpk(txpk, mote)
  File "/lora-motes-emulator/motes/mac.py", line 416, in parse_txpk
    mote.parse_phypld(phypld)
  File "/lora-motes-emulator/motes/mac.py", line 1189, in parse_phypld
    self.parse_joinacpt(mhdr, macpld, mic)
  File "/lora-motes-emulator/motes/mac.py", line 1125, in parse_joinacpt
    self._initialize_session(optneg)
  File "/lora-motes-emulator/motes/mac.py", line 490, in _initialize_session
    self.save()
  File "/lora-motes-emulator/motes/mac.py", line 535, in save ```
houluy commented 4 years ago

The bug has been fixed.

Gillani0 commented 4 years ago

Thanks @houluy it seems to be fixed.

However, I've found other issues in your documentations and Join algorithm. Do you mind if I send a pull request? Cheers

houluy commented 4 years ago

@Gillani0 Please ~ I'm very appreciated! :)