static int mod_member_list_handle()

in nimble/host/mesh/src/cfg_cli.c [461:505]


static int mod_member_list_handle(struct bt_mesh_msg_ctx *ctx,
				  struct os_mbuf *buf, bool vnd,
				  struct mod_member_list_param *param)
{
	uint16_t elem_addr, mod_id, cid;
	uint8_t status;
	int i;

	if ((vnd && buf->om_len < 7U) || (buf->om_len < 5U)) {
		BT_ERR("The message size for the application opcode is incorrect.");
		return -EMSGSIZE;
	}

	status = net_buf_simple_pull_u8(buf);
	elem_addr = net_buf_simple_pull_le16(buf);
	if (vnd) {
		cid = net_buf_simple_pull_le16(buf);
	}

	mod_id = net_buf_simple_pull_le16(buf);

	if (param->elem_addr != elem_addr || param->mod_id != mod_id ||
	    (vnd && param->cid != cid)) {
		BT_WARN("Model Member List parameters did not match");
		return -ENOENT;
	}

	if (buf->om_len % 2U) {
		BT_ERR("Model Member List invalid length");
		return -EMSGSIZE;
	}

	for (i = 0; i < *param->member_cnt && buf->om_len; i++) {
		param->members[i] = net_buf_simple_pull_le16(buf);
	}

	*param->member_cnt = i;
	if (param->status) {
		*param->status = status;
	}

	bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx);

	return 0;
}