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,

    Thanks for your explanation about publish_set function.

    So, are there any wrong settings or commands about  my code?

    I just changed element index 0 of GenericOnOffClient and Server to 1.

    Those are 3 changes as follows:

    - ACCESS_ELEMENT_COUNT (2)

    - app_onoff_init(&m_onoff_server_0, 1)

    - cc.model_app_bind(db.nodes[0].unicast_address+1, 0, mt.ModelId(0x1000))

    Any other commands are same as a nordic example ( interactive mesh provisioning and configuration ).

    I would appreciate if you could indicate the wrong points.

    Thanks,

    Kenji

Reply
  • Hi Mttrinh,

    Thanks for your explanation about publish_set function.

    So, are there any wrong settings or commands about  my code?

    I just changed element index 0 of GenericOnOffClient and Server to 1.

    Those are 3 changes as follows:

    - ACCESS_ELEMENT_COUNT (2)

    - app_onoff_init(&m_onoff_server_0, 1)

    - cc.model_app_bind(db.nodes[0].unicast_address+1, 0, mt.ModelId(0x1000))

    Any other commands are same as a nordic example ( interactive mesh provisioning and configuration ).

    I would appreciate if you could indicate the wrong points.

    Thanks,

    Kenji

Children
No Data
Related