nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
gen_onoff_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_ONOFF_SRV_H__
16#define BT_MESH_GEN_ONOFF_SRV_H__
17
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
26
33#define BT_MESH_ONOFF_SRV_INIT(_handlers) \
34 { \
35 .handlers = _handlers, \
36 }
37
44#define BT_MESH_MODEL_ONOFF_SRV(_srv) \
45 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_ONOFF_SRV, \
46 _bt_mesh_onoff_srv_op, &(_srv)->pub, \
47 BT_MESH_MODEL_USER_DATA(struct bt_mesh_onoff_srv, \
48 _srv), \
49 &_bt_mesh_onoff_srv_cb)
50
69 void (*const set)(struct bt_mesh_onoff_srv *srv,
70 struct bt_mesh_msg_ctx *ctx,
71 const struct bt_mesh_onoff_set *set,
72 struct bt_mesh_onoff_status *rsp);
73
83 void (*const get)(struct bt_mesh_onoff_srv *srv,
84 struct bt_mesh_msg_ctx *ctx,
85 struct bt_mesh_onoff_status *rsp);
86};
87
98 const struct bt_mesh_model *model;
100 struct bt_mesh_model_pub pub;
101 /* Publication buffer */
102 struct net_buf_simple pub_buf;
103 /* Publication data */
104 uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(
105 BT_MESH_ONOFF_OP_STATUS, BT_MESH_ONOFF_MSG_MAXLEN_STATUS)];
107 atomic_t flags;
108};
109
129 struct bt_mesh_msg_ctx *ctx,
130 const struct bt_mesh_onoff_status *status);
131
133extern const struct bt_mesh_model_op _bt_mesh_onoff_srv_op[];
134extern const struct bt_mesh_model_cb _bt_mesh_onoff_srv_cb;
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* BT_MESH_GEN_ONOFF_SRV_H__ */
142
int bt_mesh_onoff_srv_pub(struct bt_mesh_onoff_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_onoff_status *status)
Publish the Generic OnOff Server model status.
Definition: gen_onoff.h:24
void(*const get)(struct bt_mesh_onoff_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_onoff_status *rsp)
Get the OnOff state.
Definition: gen_onoff_srv.h:83
void(*const set)(struct bt_mesh_onoff_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_onoff_set *set, struct bt_mesh_onoff_status *rsp)
Set the OnOff state.
Definition: gen_onoff_srv.h:69
Definition: gen_onoff_srv.h:52
const struct bt_mesh_model * model
Definition: gen_onoff_srv.h:98
atomic_t flags
Definition: gen_onoff_srv.h:107
struct net_buf_simple pub_buf
Definition: gen_onoff_srv.h:102
struct bt_mesh_model_pub pub
Definition: gen_onoff_srv.h:100
const struct bt_mesh_onoff_srv_handlers * handlers
Definition: gen_onoff_srv.h:96
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_ONOFF_OP_STATUS, BT_MESH_ONOFF_MSG_MAXLEN_STATUS)]
Definition: gen_onoff_srv.h:105
struct bt_mesh_tid_ctx prev_transaction
Definition: gen_onoff_srv.h:94
Definition: gen_onoff_srv.h:92
Definition: gen_onoff.h:40
Definition: model_types.h:46