Adding ble mesh to current application

We are trying to add ble mesh functionality to our current product, but encountering an error.

We are copying code from the ..\v3.0.1\zephyr\samples\bluetooth\mesh_demo.   Currently we are just hard coding keys, but will have a way to securely set keys independent of bluetooth.   

The app seems to provision OK because in the bt_ready() callback the call to {err = bt_mesh_provision(net_key, net_idx, flags, iv_index, addr, dev_key); } returns no error.

But then in configure() call the call to {rc = bt_mesh_cfg_cli_app_key_add(net_idx, addr, net_idx, app_idx, app_key, NULL); } returns -22 (Invalid argument?)

The arguments we use are net_idx = 0, addr = 0x000F,  app_idx = 0, and the app_key is a constant 16 byte array with our network key.

It appears to us that the internal static struct bt_mesh_cfg_cli *cli; is never initialized?   When we print out the cli->model->keys_cnt it is usually a large value, like 3136.

Any ideas on how we can fix this error?

Thanks!

Parents Reply Children
No Data
Related