How to acknowledge on a received opcode from respective server handler

Hi,

My BLE-Mesh client model sends an opcode to retrieve the server model state,
When server model receives the opcode, relevant handler gets triggered from where I need to acknowledge or send the server state to client.

Below handler I referred from nCS supplied "Chat" sample, wherein Chant presence is being sent.
But this is being sent to a device with an "addr", in my case I do not have an addr, as I am supposed to reply the state to the provisioning device, which is a mobile app.

int bt_mesh_chat_cli_presence_get(struct bt_mesh_chat_cli *chat,
				  uint16_t addr)
{
	struct bt_mesh_msg_ctx ctx = {
		.addr = addr,
		.app_idx = chat->model->keys[0],
		.send_ttl = BT_MESH_TTL_DEFAULT,
		.send_rel = true,
	};

	BT_MESH_MODEL_BUF_DEFINE(buf, BT_MESH_CHAT_CLI_OP_PRESENCE_GET,
				 BT_MESH_CHAT_CLI_MSG_LEN_PRESENCE_GET);
	bt_mesh_model_msg_init(&buf, BT_MESH_CHAT_CLI_OP_PRESENCE_GET);

	return bt_mesh_model_send(chat->model, &ctx, &buf, NULL, NULL);
}

Please suggest how I can reply the state to mobile app and which API I can use..?

Thanks,

  • Hi,

    in my case I do not have an addr

    What do you mean you you don't have an address?

    I am supposed to reply the state to the provisioning device, which is a mobile app.

    What mobile app are you referring to here? Are you using nRF Mesh?

    Since you are using a phone to provision, you can always set an address to the provisioner in the provisioner settings. An address is needed to send config messages or other messages than provisioning messages.

Related