This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Rather than reporting the status of the LED, how do I configure the Light sample to publish the ADC's readings?

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.

Parents
  • I found https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_bt_mesh_vendor_model_dev_overview.html

    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?

Reply
  • I found https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_bt_mesh_vendor_model_dev_overview.html

    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?

Children
Related