This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Interactive Pyaci - Sending mesh packets - Error

I'm trying to follow the guide Sending mesh packets in the Interactive PyACI section on the nordic infocenter. 

I've installed the required prerequisites using pip. 

Here are the commands I'm issuing to get to the the error:

python interactive_pyaci.py -d COM7 COM8 --no-logfile

for dev in d: dev.quick_setup()

d[0].event_filter_disable()
d[1].event_filter_disable()

d[0].send(cmd.AddrPublicationAdd(d[1].local_unicast_adress_start))
d[1].send(cmd.AddrPublicationAdd(d[0].local_unicast_adress_start))

publish_handle = 0
appkey_handle = 0

d[0].send(cmd.PacketSend(appkey_handle, d[0].local_unicast_adress_start, publish_handle, 1, 0, "Hello World"))

Once I run: d[0].send(cmd.PacketSend(appkey_handle, d[0].local_unicast_adress_start, publish_handle, 1, 0, "Hello World"))

I get the following error:

TypeError: __init__() missing 1 required positional argument: 'data'

In [10]: missing 1 required positional argument: 'data'
  File "<ipython-input-10-d084ceded5ba>", line 1
    missing 1 required positional argument: 'data'
            ^
SyntaxError: invalid syntax

I've replicated this problem on both Windows and Mac.

pip version: 10.0.1
python version: 3.6.5

Any insights or help would be appreciated.

Parents Reply Children
  • Hello Drew,

    Seems the document is out of date, there's one more parameter in the "cmd.PacketSend()" 

    In [8]: d[0].send(cmd.PacketSend?
    Init signature: cmd.PacketSend(appkey_handle, src_addr, dst_addr_handle, ttl, force_segmented, transmic_size, data) 
    Docstring:
    Send a mesh packet
    
    Parameters
    ----------
        appkey_handle : uint16_t
            Appkey or devkey handle to use for packet sending. Subnetwork will be picked
            automatically.
        src_addr : uint16_t
            Raw unicast address to use as source address. Must be in the range of local unicast
            addresses.
        dst_addr_handle : uint16_t
            Handle of destination address to use in packet.
        ttl : uint8_t
            Time To Live value to use in packet.
        force_segmented : uint8_t
            Whether or not to force use of segmented message type for the transmission.
        transmic_size : uint8_t
            Transport MIC size used enum. SMALL=0, LARGE=1, DEFAULT=2. LARGE may only be used with
            segmented packets.
        data : uint8_t[245]
            Payload of the packet.

    As we can see, before the "data", we should also enter the "transmic_size".

    And in here, we can use "default" which is equal to "2", so the total command will be:

    d[0].send(cmd.PacketSend(appkey_handle, d[0].local_unicast_adress_start, publish_handle, 1, 0, 2, "Hello World"))

    Hope the upon information can do help Slight smile

Related