org-arl / unet-contrib

Unet user contributions
BSD 3-Clause "New" or "Revised" License
11 stars 15 forks source link

Python gateway TxFrameNtf is broken? #5

Closed mchitre closed 6 years ago

mchitre commented 6 years ago

Try the following (using unetpy-1.3b3 and fjagepy-1.4.2b2 with a local Unet simulation such as 3-node-network.groovy):

from unetpy import *
modem = UnetGateway('localhost', 1102)
phy = modem.agentForService(Services.PHYSICAL)
print(phy << org_arl_unet_phy.TxFrameReq(to=3, data=[1,2,3,4]))
txntf = modem.receive(timeout=5000)
print(txntf)

I get the raw JSON:

{'clazz': 'org.arl.unet.phy.TxFrameNtf', 'data': {'txTime': 1248446935, 'type': 1, 'msgID': 'f8ab4819-e57d-4442-bb72-37314431a71d', 'perf': 'INFORM', 'recipient': 'PythonGW-6c698ea6-6e35-4c04-bbb6-9fff0b267df9', 'sender': 'phy', 'inReplyTo': 'a458f5cf-ee37-4783-aaec-9dd1f58652b8'}}

instead of a Python deserialized class.

prasadtiru commented 6 years ago

The above problem was fixed in the commit 8831806994b1100591ac44a1dc0caec00a3e64b6 . But these changes are not available on the unetpy-1.3b3.

Madhurimadhav commented 6 years ago

can you please provide the link for the latest version of unetpy? thanks

prasadtiru commented 6 years ago

The latest version of unetpy is released now. You can upgrade unetpy using pip install --upgrade unetpy After upgrade please verify if your installations are up to date. The versions should be unetpy-1.3b4 and fjagepy-1.4.2b3

Madhurimadhav commented 6 years ago

I upgraded. Can you share with me the syntax to print RxFrameNtf on the receiving node? print(RxFrameNtf(type=Physical.DATA,timestamp=20000)) on this code, i received this as the response RxFrameNtf:INFORM[type:DATA from:None to:None protocol:None rxTime:None txTime:20000 (0 bytes)] Where as this node has received packets from another node. Any idea why it says None ??

mchitre commented 6 years ago

@Madhurimadhav see response on Stack Overflow.