nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
dm_cli.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef BT_MESH_DM_CLI_H__
15#define BT_MESH_DM_CLI_H__
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
22#include <zephyr/bluetooth/addr.h>
23#include <zephyr/sys/slist.h>
24#include <zephyr/bluetooth/mesh/access.h>
25#include "dm_common.h"
26#include <dm.h>
27
28struct bt_mesh_dm_cli;
29
33 uint8_t status;
35 uint8_t entry_cnt;
38};
39
43 uint8_t status;
50};
51
59 uint16_t addr;
62};
63
74 void (*const cfg_status_handler)(struct bt_mesh_dm_cli *cli,
75 struct bt_mesh_msg_ctx *ctx,
76 const struct bt_mesh_dm_cli_cfg_status *status);
77
86 void (*const result_handler)(struct bt_mesh_dm_cli *cli,
87 struct bt_mesh_msg_ctx *ctx,
88 const struct bt_mesh_dm_cli_results *results);
89};
90
94 const struct bt_mesh_dm_cli_handlers *const handlers;
96 uint8_t tid;
98 const struct bt_mesh_model *model;
100 struct bt_mesh_msg_ack_ctx ack_ctx;
102 struct bt_mesh_model_pub pub;
104 struct net_buf_simple pub_buf;
106 uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_DM_START_OP,
107 BT_MESH_DM_START_MSG_LEN_MAX)];
111 uint8_t entry_cnt;
112};
113
124#define BT_MESH_MODEL_DM_CLI_INIT(_mem, _cnt, _handlers) \
125 { \
126 .res_arr = _mem, \
127 .entry_cnt = _cnt, \
128 .handlers = _handlers, \
129 }
130
137#define BT_MESH_MODEL_DM_CLI(_cli) \
138 BT_MESH_MODEL_VND_CB(BT_MESH_VENDOR_COMPANY_ID, BT_MESH_MODEL_ID_DM_CLI, \
139 _bt_mesh_dm_cli_op, &(_cli)->pub, \
140 BT_MESH_MODEL_USER_DATA(struct bt_mesh_dm_cli, _cli), \
141 &_bt_mesh_dm_cli_cb)
142
164 struct bt_mesh_msg_ctx *ctx,
165 const struct bt_mesh_dm_cfg *set,
166 struct bt_mesh_dm_cli_cfg_status *rsp);
167
189int bt_mesh_dm_cli_measurement_start(struct bt_mesh_dm_cli *cli, struct bt_mesh_msg_ctx *ctx,
190 const struct bt_mesh_dm_cli_start *start,
191 struct bt_mesh_dm_cli_results *rsp);
192
213int bt_mesh_dm_cli_results_get(struct bt_mesh_dm_cli *cli, struct bt_mesh_msg_ctx *ctx,
214 uint8_t entry_cnt, struct bt_mesh_dm_cli_results *rsp);
215
217extern const struct bt_mesh_model_op _bt_mesh_dm_cli_op[];
218extern const struct bt_mesh_model_cb _bt_mesh_dm_cli_cb;
221#ifdef __cplusplus
222}
223#endif
224
225#endif /* BT_MESH_DM_CLI_H__ */
226
int bt_mesh_dm_cli_measurement_start(struct bt_mesh_dm_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_dm_cli_start *start, struct bt_mesh_dm_cli_results *rsp)
Start a distance measurement on a Distance Measurement server.
int bt_mesh_dm_cli_results_get(struct bt_mesh_dm_cli *cli, struct bt_mesh_msg_ctx *ctx, uint8_t entry_cnt, struct bt_mesh_dm_cli_results *rsp)
Get measurement results from a Distance Measurement server.
int bt_mesh_dm_cli_config(struct bt_mesh_dm_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_dm_cfg *set, struct bt_mesh_dm_cli_cfg_status *rsp)
Set or get the config state in the Distance Measurement server.
dm_ranging_mode
Ranging mode definition.
Definition: dm.h:40
Definition: dm_common.h:59
uint8_t result_entry_cnt
Definition: dm_cli.h:47
uint8_t status
Definition: dm_cli.h:43
struct bt_mesh_dm_cfg def
Definition: dm_cli.h:49
bool is_in_progress
Definition: dm_cli.h:45
Definition: dm_cli.h:41
void(*const result_handler)(struct bt_mesh_dm_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_dm_cli_results *results)
Result status message handler.
Definition: dm_cli.h:86
void(*const cfg_status_handler)(struct bt_mesh_dm_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_dm_cli_cfg_status *status)
Config status message handler.
Definition: dm_cli.h:74
Definition: dm_cli.h:65
uint8_t entry_cnt
Definition: dm_cli.h:35
struct bt_mesh_dm_res_entry * res
Definition: dm_cli.h:37
uint8_t status
Definition: dm_cli.h:33
Definition: dm_cli.h:31
struct bt_mesh_dm_cfg * cfg
Definition: dm_cli.h:61
bool reuse_transaction
Definition: dm_cli.h:55
enum dm_ranging_mode mode
Definition: dm_cli.h:57
uint16_t addr
Definition: dm_cli.h:59
Definition: dm_cli.h:53
struct bt_mesh_msg_ack_ctx ack_ctx
Definition: dm_cli.h:100
const struct bt_mesh_dm_cli_handlers *const handlers
Definition: dm_cli.h:94
struct net_buf_simple pub_buf
Definition: dm_cli.h:104
uint8_t tid
Definition: dm_cli.h:96
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_DM_START_OP, BT_MESH_DM_START_MSG_LEN_MAX)]
Definition: dm_cli.h:107
const struct bt_mesh_model * model
Definition: dm_cli.h:98
struct bt_mesh_dm_res_entry * res_arr
Definition: dm_cli.h:109
struct bt_mesh_model_pub pub
Definition: dm_cli.h:102
uint8_t entry_cnt
Definition: dm_cli.h:111
Definition: dm_cli.h:92
Definition: dm_common.h:29