nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
gen_prop_srv.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
13#ifndef BT_MESH_GEN_PROP_SRV_H__
14#define BT_MESH_GEN_PROP_SRV_H__
15
18#include <zephyr/sys/util.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24struct bt_mesh_prop_srv;
25
39#define BT_MESH_PROP_SRV_INIT(_properties, _property_count, _get, _set) \
40 { \
41 .get = _get, .set = _set, .properties = _properties, \
42 .property_count = _property_count, \
43 }
44
50#define BT_MESH_PROP_SRV_USER_INIT() {}
51
61#define BT_MESH_PROP_SRV_ADMIN_INIT(_properties, _get, _set) \
62 BT_MESH_PROP_SRV_INIT(_properties, ARRAY_SIZE(_properties), _get, _set)
63
72#define BT_MESH_PROP_SRV_MFR_INIT(_properties, _get) \
73 BT_MESH_PROP_SRV_INIT(_properties, ARRAY_SIZE(_properties), _get, NULL)
74
83#define BT_MESH_PROP_SRV_CLIENT_INIT(_properties) \
84 BT_MESH_PROP_SRV_INIT((struct bt_mesh_prop *)_properties, \
85 ARRAY_SIZE(_properties), NULL, NULL)
86
91#define BT_MESH_MODEL_PROP_SRV_USER(_srv) \
92 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_USER_PROP_SRV, \
93 _bt_mesh_prop_user_srv_op, &(_srv)->pub, \
94 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
95 _srv), \
96 &_bt_mesh_prop_srv_cb)
97
105#define BT_MESH_MODEL_PROP_SRV_ADMIN(_srv) \
106 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV, \
107 _bt_mesh_prop_admin_srv_op, &(_srv)->pub, \
108 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
109 _srv), \
110 &_bt_mesh_prop_srv_cb)
111
119#define BT_MESH_MODEL_PROP_SRV_MFR(_srv) \
120 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV, \
121 _bt_mesh_prop_mfr_srv_op, &(_srv)->pub, \
122 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
123 _srv), \
124 &_bt_mesh_prop_srv_cb)
125
133#define BT_MESH_MODEL_PROP_SRV_CLIENT(_srv) \
134 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV, \
135 _bt_mesh_prop_client_srv_op, &(_srv)->pub, \
136 BT_MESH_MODEL_USER_DATA(struct bt_mesh_prop_srv, \
137 _srv), \
138 &_bt_mesh_prop_srv_cb)
139
145};
146
154 const struct bt_mesh_model *model;
156 struct bt_mesh_model_pub pub;
157 /* Publication buffer */
158 struct net_buf_simple pub_buf;
159 /* Publication data */
160 uint8_t pub_data[BT_MESH_PROP_MSG_MAXLEN(CONFIG_BT_MESH_PROP_MAXCOUNT)];
162 uint16_t pub_id;
165
169 const uint32_t property_count;
170
195 void (*const set)(struct bt_mesh_prop_srv *srv,
196 struct bt_mesh_msg_ctx *ctx,
197 struct bt_mesh_prop_val *val);
198
212 void (*const get)(struct bt_mesh_prop_srv *srv,
213 struct bt_mesh_msg_ctx *ctx,
214 struct bt_mesh_prop_val *val);
215};
216
230 struct bt_mesh_msg_ctx *ctx);
231
248 struct bt_mesh_msg_ctx *ctx,
249 const struct bt_mesh_prop_val *val);
250
252extern const struct bt_mesh_model_cb _bt_mesh_prop_srv_cb;
253extern const struct bt_mesh_model_op _bt_mesh_prop_user_srv_op[];
254extern const struct bt_mesh_model_op _bt_mesh_prop_admin_srv_op[];
255extern const struct bt_mesh_model_op _bt_mesh_prop_mfr_srv_op[];
256extern const struct bt_mesh_model_op _bt_mesh_prop_client_srv_op[];
259#ifdef __cplusplus
260}
261#endif
262
263#endif /* BT_MESH_GEN_PROP_SRV_H__ */
264
bt_mesh_prop_srv_state
Definition: gen_prop_srv.h:141
@ BT_MESH_PROP_SRV_STATE_LIST
Definition: gen_prop_srv.h:143
@ BT_MESH_PROP_SRV_STATE_NONE
Definition: gen_prop_srv.h:142
@ BT_MESH_PROP_SRV_STATE_PROP
Definition: gen_prop_srv.h:144
int bt_mesh_prop_srv_pub_list(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx)
Publish a list of all properties on the server.
int bt_mesh_prop_srv_pub(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_prop_val *val)
Publish a property value.
const uint32_t property_count
Definition: gen_prop_srv.h:169
struct bt_mesh_prop *const properties
Definition: gen_prop_srv.h:167
const struct bt_mesh_model * model
Definition: gen_prop_srv.h:154
void(*const set)(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_prop_val *val)
Set a property value.
Definition: gen_prop_srv.h:195
void(*const get)(struct bt_mesh_prop_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_prop_val *val)
Get a property value.
Definition: gen_prop_srv.h:212
uint8_t pub_data[BT_MESH_PROP_MSG_MAXLEN(CONFIG_BT_MESH_PROP_MAXCOUNT)]
Definition: gen_prop_srv.h:160
struct net_buf_simple pub_buf
Definition: gen_prop_srv.h:158
uint16_t pub_id
Definition: gen_prop_srv.h:162
enum bt_mesh_prop_srv_state pub_state
Definition: gen_prop_srv.h:164
struct bt_mesh_model_pub pub
Definition: gen_prop_srv.h:156
Definition: gen_prop_srv.h:152
Definition: gen_prop.h:58
Definition: gen_prop.h:50