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

Technical documentation for Python test scripts

Do you have "technical" documentation for examples executed with Python?

I need to send those packets from my host controller, which does not run python.

Something like for the 'echo' test, raw bytes: 06 02 48 65 6c 6c 6f

Below for reference your doc page from the "Sending mesh packets" test.

At the moment only option I see is decoding of the aci_cmd.py

Piotr

This tutorial shows how you can use two devices running the serial example to demonstrate a communication between them over mesh.

Table of contents


Requirements


Configuration and testing

To configure sending mesh packets:

  1. Set up a tiny mesh network by connecting two devices and starting the serial interface:
    $ python interactive_pyaci.py -d /dev/ttyACM0 /dev/ttyACM1 --no-logfile
  2. Add a network key, application key, and a local unicast address with the quick_setup() method:
    In [1]: for dev in d: dev.quick_setup()
    2017-08-02 10:01:53,154 - INFO - ttyACM0: SubnetAdd: {'subnet_handle': 0}
    2017-08-02 10:01:53,157 - INFO - ttyACM0: AppkeyAdd: {'appkey_handle': 0}
    2017-08-02 10:01:53,158 - INFO - ttyACM0: Success
    2017-08-02 10:01:53,161 - INFO - ttyACM1: SubnetAdd: {'subnet_handle': 0}
    2017-08-02 10:01:53,162 - INFO - ttyACM1: AppkeyAdd: {'appkey_handle': 0}
    2017-08-02 10:01:53,166 - INFO - ttyACM1: Success
  3. Disable the access.py module that hides the raw message events using an event filter (and is enabled by default on the device):
    In [2]: d[0].event_filter_disable()
    In [3]: d[1].event_filter_disable()
  4. Add publish addresses:
    In [4]: d[0].send(cmd.AddrPublicationAdd(d[1].local_unicast_address_start))
    2017-08-02 10:10:11,502 - INFO - ttyACM0: AddrPublicationAdd: {'address_handle': 0}
    In [5]: d[1].send(cmd.AddrPublicationAdd(d[0].local_unicast_address_start))
    2017-08-02 10:10:13,132 - INFO - ttyACM1: AddrPublicationAdd: {'address_handle': 0}
    The handles are used to reference the addresses and keys at a later point.
  5. Store the handles in variables:
    In [6]: publish_handle = 0
    In [7]: appkey_handle = 0
  6. Define some variables for the following parameters of PacketSend() API: ttl, force_segmented, transmic_size, and friendship_credentials_flag.
    In [8]: ttl = 1
    In [9]: segmented = 0
    In [10]: mic_size = 0
    In [11]: friendship_credentials_flag = 0
Parents Reply Children
No Data
Related