Broadcast to Zigbee Messaging Cluster

Hello.
Using the Zigbee messaging cluster, we are writing code for data exchange between ZR and ZED.
(Based on the Zigbee example light_bulb/light_switch/light_coordinator)

I want to send data to all devices within the same network that share the same PAN ID. (broadcast)
Therefore, I applied dst_addr.addr_short = 0xFFFF; in my code, but when I checked with a sniffer, no data was being sent.
(If you enter the device address in dst_addr.addr_short, it will be sent normally.)

Here's my code

< light_bulb code>

static void send_display_msg(zb_bufid_t bufid, zb_uint16_t cmd_id)
{
	LOG_INF("send_display_msg");
	zb_uint8_t messages[] = "SEND MESSAGE";
	test_disp.extended_message_control = 0x00;
	test_disp.message_len = sizeof(messages) -1 ;
	test_disp.message = messages;

	zb_addr_u dst_addr;	
	dst_addr.addr_short = 0xFFFF;

	ZB_ZCL_MESSAGING_SEND_DISPLAY_MSG(bufid, &dst_addr , ZB_APS_ADDR_MODE_16_ENDP_PRESENT, 
									ZB_ZCL_BROADCAST_ENDPOINT, DIMMABLE_LIGHT_ENDPOINT, &test_disp);
}

...

static void zcl_device_cb(zb_bufid_t bufid)
{
...
	case ZB_ZCL_MESSAGING_GET_LAST_MSG_CB_ID:
		LOG_INF("ZB_ZCL_MESSAGING_GET_LAST_MSG_CB_ID");
		zb_uint16_t cmd_id = ZB_ZCL_MESSAGING_SRV_CMD_DISPLAY_MESSAGE;
		zb_ret_t zb_err_code = zb_buf_get_out_delayed_ext(
			send_display_msg, cmd_id, 0);
		ZB_ERROR_CHECK(zb_err_code);

		break;
...
}

<light_switch code>

static void send_get_last_msg(zb_bufid_t bufid, zb_uint16_t cmd_id)
{
	LOG_INF("command: %d", cmd_id);
	zb_addr_u dst_addr;	
	dst_addr.addr_short = bulb_ctx.short_addr;
	// zb_uint16_t ZC_addr = 0xFFFF;

	ZB_ZCL_MESSAGING_SEND_GET_LAST_MSG(bufid, &dst_addr ,ZB_APS_ADDR_MODE_16_ENDP_PRESENT, bulb_ctx.endpoint, LIGHT_SWITCH_ENDPOINT);

}

...

static void button_handler(uint32_t button_state, uint32_t has_changed)
{
	zb_uint16_t cmd_id;
	zb_ret_t zb_err_code;

	/* Inform default signal handler about user input at the device. */
	user_input_indicate();

	check_factory_reset_button(button_state, has_changed);

	if (bulb_ctx.short_addr == 0xFFFF) {
		LOG_DBG("No bulb found yet.");
		return;
	}

	switch (has_changed) {
	case BUTTON_ON:
		LOG_DBG("ON - button changed");
		cmd_id = ZB_ZCL_CMD_ON_OFF_ON_ID;
		break;
	case BUTTON_OFF:
		LOG_DBG("OFF - button changed");
		cmd_id = ZB_ZCL_CMD_ON_OFF_OFF_ID;
		break;
	case BUTTON_SLEEPY:
		cmd_id = ZB_ZCL_MESSAGING_CLI_CMD_GET_LAST_MESSAGE;
		break;
	case IDENTIFY_MODE_BUTTON:
		if (IDENTIFY_MODE_BUTTON & button_state) {
			/* Button changed its state to pressed */
		} else {
			/* Button changed its state to released */
			if (was_factory_reset_done()) {
				/* The long press was for Factory Reset */
				LOG_DBG("After Factory Reset - ignore button release");
			} else   {
				/* Button released before Factory Reset */

				/* Start identification mode */
				ZB_SCHEDULE_APP_CALLBACK(start_identifying, 0);
			}
		}
		return;
	default:
		LOG_DBG("Unhandled button");
		return;
	}

	switch (button_state) {
	case BUTTON_ON:
	case BUTTON_OFF:
		LOG_DBG("Button pressed");
		buttons_ctx.state = button_state;

		/* Alarm can be scheduled only once. Next alarm only resets
		 * counting.
		 */
		k_timer_start(&buttons_ctx.alarm, BUTTON_LONG_POLL_TMO,
			      K_NO_WAIT);
		break;
	case 0:
		LOG_DBG("Button released");

		k_timer_stop(&buttons_ctx.alarm);

		if (atomic_set(&buttons_ctx.long_poll, ZB_FALSE) == ZB_FALSE) {
			/* Allocate output buffer and send on/off command. */
			if(has_changed!=BUTTON_SLEEPY)
			{
				zb_err_code = zb_buf_get_out_delayed_ext(
					light_switch_send_on_off, cmd_id, 0);
				ZB_ERROR_CHECK(zb_err_code);
			}
			else
			{
				zb_err_code = zb_buf_get_out_delayed_ext(
					send_get_last_msg, cmd_id, 0);
				ZB_ERROR_CHECK(zb_err_code);
			}
		}
		break;
	default:
		break;
	}
}

May I know where I made the error?

Related