Search code examples
unetstack

Simple way to send fake RxFrameNtf on API port


Can I send fake RxFrameNtfs/DatagramNtfs to an app that is connected to the API from a webshell?
I.e. in the modems websh I wish create an ntf:

dgntf = new org.arl.unet.DatagramNtf(from:2,to:1,data:new String("hello"), priority:org.arl.unet.Priority.NORMAL, protocol:0, ttl:2)

And I want to send this to an app connected to the modem with a Python Unetsocket. Essentially what I'm looking for is a simple way to test the Python side that I can use on both a single simulated modem and a physical modem.


Solution

  • To add on, if you're doing this on a modem and wanted to send from the modem's shell, it's quite simple:

    send new org.arl.unet.DatagramNtf(
      recipient: topic(agent("uwlink")),   // to make it appear as if it came from uwlink
      from: 2,
      to: 1,
      data: new String("hello"),
      priority: org.arl.unet.Priority.NORMAL,
      protocol: 0,
      ttl: 2
    )