nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
gen_lvl_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
15#ifndef BT_MESH_GEN_LVL_SRV_H__
16#define BT_MESH_GEN_LVL_SRV_H__
17
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct bt_mesh_lvl_srv;
26
33#define BT_MESH_LVL_SRV_INIT(_handlers) \
34 { \
35 .handlers = _handlers, \
36 }
37
44#define BT_MESH_MODEL_LVL_SRV(_srv) \
45 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_LEVEL_SRV, _bt_mesh_lvl_srv_op, \
46 &(_srv)->pub, \
47 BT_MESH_MODEL_USER_DATA(struct bt_mesh_lvl_srv, \
48 _srv), \
49 &_bt_mesh_lvl_srv_cb)
50
62 void (*const get)(struct bt_mesh_lvl_srv *srv,
63 struct bt_mesh_msg_ctx *ctx,
64 struct bt_mesh_lvl_status *rsp);
65
83 void (*const set)(struct bt_mesh_lvl_srv *srv,
84 struct bt_mesh_msg_ctx *ctx,
85 const struct bt_mesh_lvl_set *set,
86 struct bt_mesh_lvl_status *rsp);
87
106 void (*const delta_set)(struct bt_mesh_lvl_srv *srv,
107 struct bt_mesh_msg_ctx *ctx,
108 const struct bt_mesh_lvl_delta_set *delta_set,
109 struct bt_mesh_lvl_status *rsp);
110
133 void (*const move_set)(struct bt_mesh_lvl_srv *srv,
134 struct bt_mesh_msg_ctx *ctx,
135 const struct bt_mesh_lvl_move_set *move_set,
136 struct bt_mesh_lvl_status *rsp);
137};
138
147 const struct bt_mesh_model *model;
149 struct bt_mesh_model_pub pub;
150 /* Publication buffer */
151 struct net_buf_simple pub_buf;
152 /* Publication data */
153 uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_LVL_OP_STATUS,
154 BT_MESH_LVL_MSG_MAXLEN_STATUS)];
157};
158
172 struct bt_mesh_msg_ctx *ctx,
173 const struct bt_mesh_lvl_status *status);
174
176extern const struct bt_mesh_model_op _bt_mesh_lvl_srv_op[];
177extern const struct bt_mesh_model_cb _bt_mesh_lvl_srv_cb;
180#ifdef __cplusplus
181}
182#endif
183
184#endif /* BT_MESH_GEN_LVL_SRV_H__ */
185
int bt_mesh_lvl_srv_pub(struct bt_mesh_lvl_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_lvl_status *status)
Publish the current Level state.
Definition: gen_lvl.h:45
Definition: gen_lvl.h:65
Definition: gen_lvl.h:29
void(*const delta_set)(struct bt_mesh_lvl_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_lvl_delta_set *delta_set, struct bt_mesh_lvl_status *rsp)
Change the Level state relative to its current value.
Definition: gen_lvl_srv.h:106
void(*const get)(struct bt_mesh_lvl_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_lvl_status *rsp)
Get the current Level state.
Definition: gen_lvl_srv.h:62
void(*const set)(struct bt_mesh_lvl_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_lvl_set *set, struct bt_mesh_lvl_status *rsp)
Set the Level state.
Definition: gen_lvl_srv.h:83
void(*const move_set)(struct bt_mesh_lvl_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_lvl_move_set *move_set, struct bt_mesh_lvl_status *rsp)
Move the Level state continuously at a given rate.
Definition: gen_lvl_srv.h:133
Definition: gen_lvl_srv.h:52
struct net_buf_simple pub_buf
Definition: gen_lvl_srv.h:151
const struct bt_mesh_lvl_srv_handlers *const handlers
Definition: gen_lvl_srv.h:145
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_LVL_OP_STATUS, BT_MESH_LVL_MSG_MAXLEN_STATUS)]
Definition: gen_lvl_srv.h:154
struct bt_mesh_model_pub pub
Definition: gen_lvl_srv.h:149
struct bt_mesh_tid_ctx tid
Definition: gen_lvl_srv.h:156
const struct bt_mesh_model * model
Definition: gen_lvl_srv.h:147
Definition: gen_lvl_srv.h:143
Definition: gen_lvl.h:83
Definition: model_types.h:46