Add more parameters to zigbee command using zb_buf_get_out_delayed_ext

Hi,

When sending a command using Zigbee, I understand the best method to use is by using:  

zb_buf_get_out_delayed_ext
 

So when calling light_switch_send_step, I use:

zb_err_code = zb_buf_get_out_delayed_ext(light_switch_send_step, cmd_id, 0);
Which in turn calls below function when the buffer is available. In above function it is possible to add only two parameters. Logically I would need to change more parameters when calling the function, like change the short_addr, per call, change the stepSize and transactiontime. What is the best practise to make above, or below function call more flexible?
static void light_switch_send_step(zb_bufid_t bufid, zb_uint16_t cmd_id)
{
     LOG_INF("Send step level command: %d", cmd_id);

     ZB_ZCL_LEVEL_CONTROL_SEND_STEP_REQ(bufid,
        bulb_ctx.short_addr,
        ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
        bulb_ctx.endpoint,
        LIGHT_SWITCH_ENDPOINT,
        ZB_AF_HA_PROFILE_ID,
        ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
        NULL,
        cmd_id,
        StepSize,
        DIMM_TRANSACTION_TIME);
}
Parents Reply Children
  • Hi Charlie, thank you for the response. I am not sure I understand, I read the documentation and found some code where this is used. I mainly see it being used when receiving data and getting the parameters out, for instance in the zboss_signal_handler or in a callback from ZBOSS. I don't understand how I add them when sending a message. I spend quite some time trying to understand, apologies.

    In below function, I want to forward bulbId, stepMode, stepSize etc. How should I use ZB_BUF_GET_PARAM to send more parameters along with the function 'light_switch_send_step through zb_buf_get_out_delayed?

    uint8_t Send_Step(uint8_t zb_devId, uint8_t stepMode, uint8_t stepSize){
    	   
        zb_ret_t zb_err_code;
    	zb_uint16_t cmd_id;
    	
        if (stepMode == 0) {
    		cmd_id = ZB_ZCL_LEVEL_CONTROL_STEP_MODE_UP;
    	} else {
    		cmd_id =ZB_ZCL_LEVEL_CONTROL_STEP_MODE_DOWN;
    	}
    
    	/* Allocate output buffer and send step command. */
    	zb_err_code = zb_buf_get_out_delayed_ext(light_switch_send_step, cmd_id, 0);
    	if (!zb_err_code) {
    		LOG_WRN("Buffer is full");
    	}
    }
Related