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

Questions about Interactive pyaci

Hi,

I'm testing an interactive pyaci example in Mesh SDK v2.2.0 with two nRF52DK boards.

Interactive mesh provisioning and configuration example worked fine so I modified the element index of GenericOnOffServer to 1 in light switch sever (not proxy server).

That is,

#define ACCESS_ELEMENT_COUNT (2)  // line 93 in nrf_mesh_config_app.h

app_onoff_init(&m_onoff_server_0, 1));    // line 108 in main.c

and then, test it again as follows on interacitve ipython.

> db = MeshDB("database/example_database.json")
> p = Provisioner(device, db)
> p.scan_start()
# found a device

> p.scan_stop()
> p.provision(name="Light bulb")
# DevkeyAdd: {'devkey_handle': 8}
# AddrPublicationAdd: {'address_handle': 0}

> cc = ConfigurationClient(db)
> device.model_add(cc)
> cc.publish_set(8, 0)
> cc.composition_data_get()
# received composition data
  "pid": "0000",
  "vid": "0000",
  "cid": "0059",
  "elements": [
    {
      "location": "0000",
      "models": [
        {
          "modelId": "0000"
        },
        {
          "modelId": "0002"
        }
      ],
      "index": 0
    },
    {
      "location": "0000",
      "models": [
        {
          "modelId": "1000"
        }
      ],
      "index": 1
    }
  ],
  "crpl": 40,
  "features": {
    "proxy": 2,
    "relay": 0,
    "low_power": 2,
    "friend": 2
  }
  
cc.appkey_add(0)
cc.model_app_bind(db.nodes[0].unicast_address+1, 0, mt.ModelId(0x1000))
gc = GenericOnOffClient()
device.model_add(gc)
gc.publish_set(0, 0)
gc.set(True)

Unfortunatelly,  LED doesn't blink.

I can understand calling publish_set(8,0) on ConfigurationClient object... devkey_handle is 8, address_handle is 0.

But I still can't understand about publish_set(0,0) on GenericOnOffClient object.

Does the first argument 0 mean application key that is bound to 0x1000 model id?

and second argument 0 mean address_handle same as setting on ConfigurationClient?

Are there any wrong settings? or do I have to call any other commands?

Thanks,

Kenji

Parents
  • Hi,

    The parameter for the publish_set function is key_handle and address_handle. The key_handle parameter can be either application or device key handle. Note that these are handles and not the actual values. Handles are obtained elsewhere.

  • Hi Mttrinh,

    OK, please let me know if your dev team find the cause and the solution.

    Thanks.

    One more question,  after calling provision() function, we can see devkey and appkey via stdout/stderr message

    on ipython like:

    # DevkeyAdd: {'devkey_handle': 8}
    # AddrPublicationAdd: {'address_handle': 0}

    Do you have any functions to get those keys directly?

    I'd like to make my own class by python not using ipython (not interactively)

    I mean that I'd like to remove IPython.embed() in interactive_pyaci.py and then

    call provision and some configuration functions directly from my own class.

    Thanks again,

    Kenji

Reply
  • Hi Mttrinh,

    OK, please let me know if your dev team find the cause and the solution.

    Thanks.

    One more question,  after calling provision() function, we can see devkey and appkey via stdout/stderr message

    on ipython like:

    # DevkeyAdd: {'devkey_handle': 8}
    # AddrPublicationAdd: {'address_handle': 0}

    Do you have any functions to get those keys directly?

    I'd like to make my own class by python not using ipython (not interactively)

    I mean that I'd like to remove IPython.embed() in interactive_pyaci.py and then

    call provision and some configuration functions directly from my own class.

    Thanks again,

    Kenji

Children
Related