nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
sensor_cli.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
13#ifndef BT_MESH_SENSOR_CLI_H__
14#define BT_MESH_SENSOR_CLI_H__
15
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24
33#define BT_MESH_SENSOR_CLI_INIT(_handlers) \
34 { \
35 .cb = _handlers, \
36 }
37
44#define BT_MESH_MODEL_SENSOR_CLI(_cli) \
45 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_SENSOR_CLI, _bt_mesh_sensor_cli_op, \
46 &(_cli)->pub, \
47 BT_MESH_MODEL_USER_DATA(struct bt_mesh_sensor_cli, \
48 _cli), \
49 &_bt_mesh_sensor_cli_cb)
50
57 const struct bt_mesh_model *model;
59 struct bt_mesh_model_pub pub;
60 /* Publication buffer */
61 struct net_buf_simple pub_buf;
62 /* Publication data */
63 uint8_t pub_data[MAX(
64 BT_MESH_MODEL_BUF_LEN(BT_MESH_SENSOR_OP_CADENCE_SET,
65 BT_MESH_SENSOR_MSG_MAXLEN_CADENCE_SET),
66 BT_MESH_MODEL_BUF_LEN(BT_MESH_SENSOR_OP_SETTING_SET,
67 BT_MESH_SENSOR_MSG_MAXLEN_SETTING_SET))];
69 struct bt_mesh_msg_ack_ctx ack_ctx;
72};
73
91
97 struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
100};
101
107 struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
108};
109
117
123 struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
124};
125
135
151 void (*data)(struct bt_mesh_sensor_cli *cli,
152 struct bt_mesh_msg_ctx *ctx,
153 const struct bt_mesh_sensor_type *sensor,
154 const struct bt_mesh_sensor_value *value);
155
170 void (*sensor)(struct bt_mesh_sensor_cli *cli,
171 struct bt_mesh_msg_ctx *ctx,
172 const struct bt_mesh_sensor_info *sensor);
173
187 void (*cadence)(struct bt_mesh_sensor_cli *cli,
188 struct bt_mesh_msg_ctx *ctx,
189 const struct bt_mesh_sensor_type *sensor,
191
204 void (*settings)(struct bt_mesh_sensor_cli *cli,
205 struct bt_mesh_msg_ctx *ctx,
206 const struct bt_mesh_sensor_type *sensor,
207 const uint16_t *ids, uint32_t count);
208
222 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
223 const struct bt_mesh_sensor_type *sensor,
224 const struct bt_mesh_sensor_setting_status *setting);
225
249 void (*series_entry)(struct bt_mesh_sensor_cli *cli,
250 struct bt_mesh_msg_ctx *ctx,
251 const struct bt_mesh_sensor_type *sensor,
252 uint8_t index, uint8_t count,
253 const struct bt_mesh_sensor_series_entry *entry);
254
266 void (*unknown_type)(struct bt_mesh_sensor_cli *cli,
267 struct bt_mesh_msg_ctx *ctx, uint16_t id,
268 uint32_t opcode);
269};
270
298 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
299 const struct bt_mesh_sensor_type *sensor,
300 const struct bt_mesh_sensor_type *setting,
301 const struct bt_mesh_sensor_value *value,
303
320 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
321 const struct bt_mesh_sensor_type *sensor,
322 const struct bt_mesh_sensor_type *setting,
323 const struct bt_mesh_sensor_value *value);
324
347 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
348 const struct bt_mesh_sensor_type *sensor,
349 struct bt_mesh_sensor_value *rsp);
350
380 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
381 const struct bt_mesh_sensor_type *sensor,
382 const union bt_mesh_sensor_column_key *column,
383 struct bt_mesh_sensor_series_entry *rsp);
384
434 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
435 const struct bt_mesh_sensor_type *sensor,
436 const union bt_mesh_sensor_column_key *range_start,
437 const union bt_mesh_sensor_column_key *range_end,
438 struct bt_mesh_sensor_series_entry *rsp, uint32_t *count);
439
476 struct bt_mesh_msg_ctx *ctx,
477 struct bt_mesh_sensor_info *sensors,
478 uint32_t *count);
479
503 struct bt_mesh_msg_ctx *ctx,
504 const struct bt_mesh_sensor_type *sensor,
505 struct bt_mesh_sensor_descriptor *rsp);
506
530 struct bt_mesh_msg_ctx *ctx,
531 const struct bt_mesh_sensor_type *sensor,
533
560 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
561 const struct bt_mesh_sensor_type *sensor,
562 const struct bt_mesh_sensor_cadence_status *cadence,
564
582 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
583 const struct bt_mesh_sensor_type *sensor,
584 const struct bt_mesh_sensor_cadence_status *cadence);
585
621 struct bt_mesh_msg_ctx *ctx,
622 const struct bt_mesh_sensor_type *sensor,
623 uint16_t *ids, uint32_t *count);
624
649 struct bt_mesh_msg_ctx *ctx,
650 const struct bt_mesh_sensor_type *sensor,
651 const struct bt_mesh_sensor_type *setting,
653
677 struct bt_mesh_msg_ctx *ctx,
678 struct bt_mesh_sensor_data *sensors,
679 uint32_t *count);
680
682extern const struct bt_mesh_model_op _bt_mesh_sensor_cli_op[];
683extern const struct bt_mesh_model_cb _bt_mesh_sensor_cli_cb;
686#ifdef __cplusplus
687}
688#endif
689
690#endif /* BT_MESH_SENSOR_CLI_H__ */
691
int bt_mesh_sensor_cli_cadence_set(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_cadence_status *cadence, struct bt_mesh_sensor_cadence_status *rsp)
Set the cadence state for the given sensor.
int bt_mesh_sensor_cli_setting_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_type *setting, struct bt_mesh_sensor_setting_status *rsp)
Get a setting value for a sensor.
int bt_mesh_sensor_cli_series_entry_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const union bt_mesh_sensor_column_key *column, struct bt_mesh_sensor_series_entry *rsp)
Read a single sensor series data entry.
int bt_mesh_sensor_cli_settings_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, uint16_t *ids, uint32_t *count)
Get the list of settings for the given sensor.
int bt_mesh_sensor_cli_cadence_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, struct bt_mesh_sensor_cadence_status *rsp)
Get the cadence state.
int bt_mesh_sensor_cli_series_entries_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const union bt_mesh_sensor_column_key *range_start, const union bt_mesh_sensor_column_key *range_end, struct bt_mesh_sensor_series_entry *rsp, uint32_t *count)
Get multiple sensor series data entries.
int bt_mesh_sensor_cli_desc_all_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_sensor_info *sensors, uint32_t *count)
Retrieve all sensor descriptors in a sensor server.
int bt_mesh_sensor_cli_setting_set_unack(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_type *setting, const struct bt_mesh_sensor_value *value)
Set a setting value for a sensor without requesting a response.
int bt_mesh_sensor_cli_desc_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, struct bt_mesh_sensor_descriptor *rsp)
Get the descriptor for the given sensor.
int bt_mesh_sensor_cli_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, struct bt_mesh_sensor_value *rsp)
Read sensor data from a sensor instance.
int bt_mesh_sensor_cli_all_get(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_sensor_data *sensors, uint32_t *count)
Read sensor data from all sensors on a server.
int bt_mesh_sensor_cli_setting_set(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_type *setting, const struct bt_mesh_sensor_value *value, struct bt_mesh_sensor_setting_status *rsp)
Set a setting value for a sensor.
int bt_mesh_sensor_cli_cadence_set_unack(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_cadence_status *cadence)
Set the cadence state for the given sensor without requesting a response.
struct bt_mesh_sensor_threshold threshold
Definition sensor_cli.h:89
uint8_t fast_period_div
Definition sensor_cli.h:81
uint8_t min_int
Definition sensor_cli.h:87
Definition sensor_cli.h:75
void(* unknown_type)(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, uint16_t id, uint32_t opcode)
Unknown type callback.
Definition sensor_cli.h:266
void(* series_entry)(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, uint8_t index, uint8_t count, const struct bt_mesh_sensor_series_entry *entry)
Series entry callback.
Definition sensor_cli.h:249
void(* cadence)(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_cadence_status *cadence)
Sensor cadence callback.
Definition sensor_cli.h:187
void(* settings)(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const uint16_t *ids, uint32_t count)
Sensor settings list callback.
Definition sensor_cli.h:204
void(* setting_status)(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_setting_status *setting)
Sensor setting status callback.
Definition sensor_cli.h:221
void(* sensor)(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_info *sensor)
Sensor description callback.
Definition sensor_cli.h:170
void(* data)(struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_sensor_type *sensor, const struct bt_mesh_sensor_value *value)
Sensor data callback.
Definition sensor_cli.h:151
Definition sensor_cli.h:137
uint8_t pub_data[MAX(BT_MESH_MODEL_BUF_LEN(BT_MESH_SENSOR_OP_CADENCE_SET, BT_MESH_SENSOR_MSG_MAXLEN_CADENCE_SET), BT_MESH_MODEL_BUF_LEN(BT_MESH_SENSOR_OP_SETTING_SET, BT_MESH_SENSOR_MSG_MAXLEN_SETTING_SET))]
Definition sensor_cli.h:67
struct bt_mesh_model_pub pub
Definition sensor_cli.h:59
const struct bt_mesh_model * model
Definition sensor_cli.h:57
const struct bt_mesh_sensor_cli_handlers * cb
Definition sensor_cli.h:71
struct net_buf_simple pub_buf
Definition sensor_cli.h:61
struct bt_mesh_msg_ack_ctx ack_ctx
Definition sensor_cli.h:69
Definition sensor_cli.h:55
Definition sensor.h:263
const struct bt_mesh_sensor_type * type
Definition sensor_cli.h:121
struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX]
Definition sensor_cli.h:123
Definition sensor_cli.h:119
Definition sensor.h:180
uint16_t id
Definition sensor_cli.h:113
struct bt_mesh_sensor_descriptor descriptor
Definition sensor_cli.h:115
Definition sensor_cli.h:111
struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX]
Definition sensor_cli.h:107
struct bt_mesh_sensor_column column
Definition sensor_cli.h:105
Definition sensor_cli.h:103
bool writable
Definition sensor_cli.h:99
const struct bt_mesh_sensor_type * type
Definition sensor_cli.h:95
struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX]
Definition sensor_cli.h:97
Definition sensor_cli.h:93
Definition sensor.h:225
Definition sensor.h:118
Definition sensor.h:164
struct bt_mesh_sensor_value sensor_value
Definition sensor_cli.h:132
uint16_t index
Definition sensor_cli.h:133
Sensor column indexing value.
Definition sensor_cli.h:131