2018年5月22日 星期二

ble MESH : how to load provision data to serial example after restart (nordic pyaci supplement)

This article is a supplement of Interactive mesh provisioning and configuration on Nordic website


the introduction of Serial example of nRF52 ble MESH SDK
only teach how to provision a node.

However, the provision data is stored in .JSON outside the chip. We have to load the provisioned nodes information into the nRF52 to act as client after nRF52 Serial restart.

The following step shows how to :

for example, if I have provisioned a node "0577"
devicekey = 0
address key = 8



then after Serial example restart,  I use interactive_pyaci.py to load the provision data :

In [1]: db = MeshDB("database/example_database.json")

In [2]: p = Provisioner(device, db)

In [3]: 2018-05-17 15:37:26,908 - INFO - COM4: Success
2018-05-17 15:37:26,911 - INFO - COM4: Success
2018-05-17 15:37:26,916 - INFO - COM4: SubnetAdd: {'subnet_handle': 0}
2018-05-17 15:37:26,919 - INFO - COM4: AppkeyAdd: {'appkey_handle': 0}
2018-05-17 15:37:26,919 - INFO - COM4: AppkeyAdd: {'appkey_handle': 1}

In [3]: device.send(cmd.AddrPublicationAdd(db.nodes[0].unicast_address))

2018-05-17 15:38:09,309 - INFO - COM4: AddrPublicationAdd: {'address_handle': 0}
In [4]: sc = SimpleOnOffClient()

In [5]: device.model_add(sc)

In [6]: sc.publish_set(0, 0)

In [7]: sc.set(True)

and this sentence:

device.send(cmd.AddrPublicationAdd(db.nodes[0].unicast_address))

is how to load data of one provisioned node into the chip 


reference:
https://devzone.nordicsemi.com/f/nordic-q-a/34254/add-delete-nodes-set-sub-net-function-in-mesh-sdk-serial-example/132390#132390

沒有留言:

張貼留言