nRF Connect SDK API 0.1.0
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
87 uint8_t min_int;
90};
91
92#if !defined(CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE) || defined(__DOXYGEN__)
98 struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
101};
102
108 struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
109};
110
114 uint16_t id;
117};
118
124 struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
125};
126
134 uint16_t index;
135};
136
152 void (*data)(struct bt_mesh_sensor_cli *cli,
153 struct bt_mesh_msg_ctx *ctx,
154 const struct bt_mesh_sensor_type *sensor,
155 const struct bt_mesh_sensor_value *value);
156
171 void (*sensor)(struct bt_mesh_sensor_cli *cli,
172 struct bt_mesh_msg_ctx *ctx,
173 const struct bt_mesh_sensor_info *sensor);
174
188 void (*cadence)(struct bt_mesh_sensor_cli *cli,
189 struct bt_mesh_msg_ctx *ctx,
190 const struct bt_mesh_sensor_type *sensor,
192
205 void (*settings)(struct bt_mesh_sensor_cli *cli,
206 struct bt_mesh_msg_ctx *ctx,
207 const struct bt_mesh_sensor_type *sensor,
208 const uint16_t *ids, uint32_t count);
209
223 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
224 const struct bt_mesh_sensor_type *sensor,
225 const struct bt_mesh_sensor_setting_status *setting);
226
250 void (*series_entry)(struct bt_mesh_sensor_cli *cli,
251 struct bt_mesh_msg_ctx *ctx,
252 const struct bt_mesh_sensor_type *sensor,
253 uint8_t index, uint8_t count,
254 const struct bt_mesh_sensor_series_entry *entry);
255
267 void (*unknown_type)(struct bt_mesh_sensor_cli *cli,
268 struct bt_mesh_msg_ctx *ctx, uint16_t id,
269 uint32_t opcode);
270};
271
299 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
300 const struct bt_mesh_sensor_type *sensor,
301 const struct bt_mesh_sensor_type *setting,
302 const struct bt_mesh_sensor_value *value,
304
321 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
322 const struct bt_mesh_sensor_type *sensor,
323 const struct bt_mesh_sensor_type *setting,
324 const struct bt_mesh_sensor_value *value);
325
348 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
349 const struct bt_mesh_sensor_type *sensor,
350 struct bt_mesh_sensor_value *rsp);
351
381 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
382 const struct bt_mesh_sensor_type *sensor,
383 const union bt_mesh_sensor_column_key *column,
384 struct bt_mesh_sensor_series_entry *rsp);
385
435 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
436 const struct bt_mesh_sensor_type *sensor,
437 const union bt_mesh_sensor_column_key *range_start,
438 const union bt_mesh_sensor_column_key *range_end,
439 struct bt_mesh_sensor_series_entry *rsp, uint32_t *count);
440#else /* defined(CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE) */
444 const struct bt_mesh_sensor_type *type;
446 struct sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
448 bool writable;
449};
450
456 struct sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
457};
458
460struct bt_mesh_sensor_info {
462 uint16_t id;
465};
466
468struct bt_mesh_sensor_data {
470 const struct bt_mesh_sensor_type *type;
472 struct sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX];
473};
474
490 void (*data)(struct bt_mesh_sensor_cli *cli,
491 struct bt_mesh_msg_ctx *ctx,
492 const struct bt_mesh_sensor_type *sensor,
493 const struct sensor_value *value);
494
509 void (*sensor)(struct bt_mesh_sensor_cli *cli,
510 struct bt_mesh_msg_ctx *ctx,
511 const struct bt_mesh_sensor_info *sensor);
512
526 void (*cadence)(struct bt_mesh_sensor_cli *cli,
527 struct bt_mesh_msg_ctx *ctx,
528 const struct bt_mesh_sensor_type *sensor,
530
543 void (*settings)(struct bt_mesh_sensor_cli *cli,
544 struct bt_mesh_msg_ctx *ctx,
545 const struct bt_mesh_sensor_type *sensor,
546 const uint16_t *ids, uint32_t count);
547
560 void (*setting_status)(
561 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
562 const struct bt_mesh_sensor_type *sensor,
563 const struct bt_mesh_sensor_setting_status *setting);
564
588 void (*series_entry)(struct bt_mesh_sensor_cli *cli,
589 struct bt_mesh_msg_ctx *ctx,
590 const struct bt_mesh_sensor_type *sensor,
591 uint8_t index, uint8_t count,
592 const struct bt_mesh_sensor_series_entry *entry);
593
605 void (*unknown_type)(struct bt_mesh_sensor_cli *cli,
606 struct bt_mesh_msg_ctx *ctx, uint16_t id,
607 uint32_t opcode);
608};
609
637 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
638 const struct bt_mesh_sensor_type *sensor,
639 const struct bt_mesh_sensor_type *setting,
640 const struct sensor_value *value,
642
659 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
660 const struct bt_mesh_sensor_type *sensor,
661 const struct bt_mesh_sensor_type *setting,
662 const struct sensor_value *value);
663
686 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
687 const struct bt_mesh_sensor_type *sensor,
688 struct sensor_value *rsp);
689
718 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
719 const struct bt_mesh_sensor_type *sensor,
720 const struct bt_mesh_sensor_column *column,
721 struct bt_mesh_sensor_series_entry *rsp);
722
768 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
769 const struct bt_mesh_sensor_type *sensor,
770 const struct bt_mesh_sensor_column *range,
771 struct bt_mesh_sensor_series_entry *rsp, uint32_t *count);
772#endif /* !defined(CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE) */
773
810 struct bt_mesh_msg_ctx *ctx,
811 struct bt_mesh_sensor_info *sensors,
812 uint32_t *count);
813
837 struct bt_mesh_msg_ctx *ctx,
838 const struct bt_mesh_sensor_type *sensor,
839 struct bt_mesh_sensor_descriptor *rsp);
840
864 struct bt_mesh_msg_ctx *ctx,
865 const struct bt_mesh_sensor_type *sensor,
867
894 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
895 const struct bt_mesh_sensor_type *sensor,
896 const struct bt_mesh_sensor_cadence_status *cadence,
898
916 struct bt_mesh_sensor_cli *cli, struct bt_mesh_msg_ctx *ctx,
917 const struct bt_mesh_sensor_type *sensor,
918 const struct bt_mesh_sensor_cadence_status *cadence);
919
955 struct bt_mesh_msg_ctx *ctx,
956 const struct bt_mesh_sensor_type *sensor,
957 uint16_t *ids, uint32_t *count);
958
983 struct bt_mesh_msg_ctx *ctx,
984 const struct bt_mesh_sensor_type *sensor,
985 const struct bt_mesh_sensor_type *setting,
987
1011 struct bt_mesh_msg_ctx *ctx,
1012 struct bt_mesh_sensor_data *sensors,
1013 uint32_t *count);
1014
1016extern const struct bt_mesh_model_op _bt_mesh_sensor_cli_op[];
1017extern const struct bt_mesh_model_cb _bt_mesh_sensor_cli_cb;
1020#ifdef __cplusplus
1021}
1022#endif
1023
1024#endif /* BT_MESH_SENSOR_CLI_H__ */
1025
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:267
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:250
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:188
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:205
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:222
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:171
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:152
Definition: sensor_cli.h:138
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:275
const struct bt_mesh_sensor_type * type
Definition: sensor_cli.h:122
struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX]
Definition: sensor_cli.h:124
Definition: sensor_cli.h:120
Definition: sensor.h:192
uint16_t id
Definition: sensor_cli.h:114
struct bt_mesh_sensor_descriptor descriptor
Definition: sensor_cli.h:116
Definition: sensor_cli.h:112
struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX]
Definition: sensor_cli.h:108
struct bt_mesh_sensor_column column
Definition: sensor_cli.h:106
Definition: sensor_cli.h:104
bool writable
Definition: sensor_cli.h:100
const struct bt_mesh_sensor_type * type
Definition: sensor_cli.h:96
struct bt_mesh_sensor_value value[CONFIG_BT_MESH_SENSOR_CHANNELS_MAX]
Definition: sensor_cli.h:98
Definition: sensor_cli.h:94
Definition: sensor.h:237
Definition: sensor.h:128
Definition: sensor.h:176
struct bt_mesh_sensor_value sensor_value
Definition: sensor_cli.h:133
uint16_t index
Definition: sensor_cli.h:134
Sensor column indexing value.
Definition: sensor_cli.h:132