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.
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?
Hi Jala,
Glad that you found the documentation.
No, you can't use the Generic OnOff Opcode to send your own data. You would need to follow what we described in the documentation: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_bt_mesh_vendor_model_dev_overview.html#defining-opcodes-for-the-messages
If you haven't register your own company ID to Bluetooth SIG, you can use Nordic Company ID (0x0059). The first number (0x01 for example) is up to you to choose. Note that there is a chance that other company also use Nordic Company ID and same opcode (0x01 for example). So it may conflict if you are in the same network.
Can I use any of the Generic OpCodes for my vendor model? This other qca4020 board is limited in documentation and support so its hard to find how to customize the op code I'm sending other than what is given (which are the Generic ones).
Hi Jala,
If you only want to do some testing between your device and the QCA4020, then it's not a problem to use the Generic OpCodes.
But if you want to do Bluetooth qualification for your product for the market you must register your own company ID and use that instead.