I see on the forums that this is done through access_model_publish, but I cannot find where that is called in the Light sample.
Hi Jala,
Could you let me know which exact example you are working on ?
You are correct that you can call access_model_publish() to send the data to a node. But you need to define your own model instead of using the light switch model for example. (In the light switch example the data is sent inside status_send() function)
We have created some proprietary models that you can have a look inside \models\vendor.
Hi Hung,
I am working on the server one referred to here https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/mesh/light/README.html#bluetooth-mesh-light.
I've went through the forums and it seems most use the client node (light switch sample) to send, is this not possible on a server node?
I'll have a look at those models and post my findings, thanks.
Hi Jala,
Sorry I was thinking that you were asking about mesh example in nRF5 SDK not nRF Connect SDK (access_model_publish() is a function in nRF5 SDK)
In light example the publication of the sever model is sent in
I've added
#define YOUR_COMPANY_ID 0xFFFF
#define YOUR_MODEL_ID 0x2323
static struct bt_mesh_elem elements[] = {
#if DT_NODE_EXISTS(DT_ALIAS(led0))
BT_MESH_ELEM(
1, BT_MESH_MODEL_LIST(
BT_MESH_MODEL_CFG_SRV,
BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub),
BT_MESH_MODEL_ONOFF_SRV(&led_ctx[0].srv)),
BT_MESH_MODEL_NONE),
#endif
#if DT_NODE_EXISTS(DT_ALIAS(led1))
BT_MESH_ELEM(
2, BT_MESH_MODEL_LIST(BT_MESH_MODEL_ONOFF_SRV(&led_ctx[1].srv)),
BT_MESH_MODEL_NONE),
#endif
#if DT_NODE_EXISTS(DT_ALIAS(led2))
BT_MESH_ELEM(
3, BT_MESH_MODEL_LIST(BT_MESH_MODEL_ONOFF_SRV(&led_ctx[2].srv)),
BT_MESH_MODEL_NONE),
#endif
#if DT_NODE_EXISTS(DT_ALIAS(led3))
BT_MESH_ELEM(
4, BT_MESH_MODEL_LIST(BT_MESH_MODEL_ONOFF_SRV(&led_ctx[3].srv)),
BT_MESH_MODEL_NONE),
#endif
BT_MESH_ELEM(
5,
BT_MESH_MODEL_NONE,
BT_MESH_MODEL_LIST(BT_MESH_MODEL_VND_CB(YOUR_COMPANY_ID,
YOUR_MODEL_ID,
_opcode_list,
NULL,
NULL,
NULL))
),
};
Is it okay to reuse the generic onoff opcodes (0x82) and, if I understand this correctly, send back ADC values through the opcode handler?