nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
gen_ponoff_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
14#ifndef BT_MESH_GEN_PONOFF_SRV_H__
15#define BT_MESH_GEN_PONOFF_SRV_H__
16
17#include <zephyr/bluetooth/mesh.h>
18
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
28
39#define BT_MESH_PONOFF_SRV_INIT(_onoff_handlers, _dtt_change_handler, \
40 _on_power_up_change_handler) \
41 { \
42 .onoff = BT_MESH_ONOFF_SRV_INIT( \
43 &_bt_mesh_ponoff_onoff_intercept), \
44 .dtt = BT_MESH_DTT_SRV_INIT(_dtt_change_handler), \
45 .onoff_handlers = _onoff_handlers, \
46 .update = _on_power_up_change_handler, \
47 }
48
55#define BT_MESH_MODEL_PONOFF_SRV(_srv) \
56 BT_MESH_MODEL_ONOFF_SRV(&(_srv)->onoff), \
57 BT_MESH_MODEL_DTT_SRV(&(_srv)->dtt), \
58 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV, \
59 _bt_mesh_ponoff_srv_op, &(_srv)->pub, \
60 BT_MESH_MODEL_USER_DATA( \
61 struct bt_mesh_ponoff_srv, _srv), \
62 &_bt_mesh_ponoff_srv_cb), \
63 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV, \
64 _bt_mesh_ponoff_setup_srv_op, NULL, \
65 BT_MESH_MODEL_USER_DATA( \
66 struct bt_mesh_ponoff_srv, _srv), \
67 &_bt_mesh_ponoff_setup_srv_cb)
68
80 const struct bt_mesh_model *ponoff_model;
82 const struct bt_mesh_model *ponoff_setup_model;
84 struct bt_mesh_model_pub pub;
85 /* Publication buffer */
86 struct net_buf_simple pub_buf;
87 /* Publication data */
88 uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_PONOFF_OP_STATUS,
89 BT_MESH_PONOFF_MSG_LEN_STATUS)];
92
103 void (*const update)(struct bt_mesh_ponoff_srv *srv,
104 struct bt_mesh_msg_ctx *ctx,
105 enum bt_mesh_on_power_up old_on_power_up,
106 enum bt_mesh_on_power_up new_on_power_up);
107
110};
111
122 enum bt_mesh_on_power_up on_power_up);
123
142 struct bt_mesh_msg_ctx *ctx);
143
145extern const struct bt_mesh_model_cb _bt_mesh_ponoff_srv_cb;
146extern const struct bt_mesh_model_cb _bt_mesh_ponoff_setup_srv_cb;
147extern const struct bt_mesh_model_op _bt_mesh_ponoff_srv_op[];
148extern const struct bt_mesh_model_op _bt_mesh_ponoff_setup_srv_op[];
149extern const struct bt_mesh_onoff_srv_handlers _bt_mesh_ponoff_onoff_intercept;
152#ifdef __cplusplus
153}
154#endif
155
156#endif /* BT_MESH_GEN_PONOFF_SRV_H__ */
157
int bt_mesh_ponoff_srv_pub(struct bt_mesh_ponoff_srv *srv, struct bt_mesh_msg_ctx *ctx)
Publish the current OnPowerUp state.
void bt_mesh_ponoff_srv_set(struct bt_mesh_ponoff_srv *srv, enum bt_mesh_on_power_up on_power_up)
Set the OnPowerUp state of a Power OnOff server.
bt_mesh_on_power_up
Definition: gen_ponoff.h:24
Definition: gen_dtt_srv.h:54
Definition: gen_onoff_srv.h:52
Definition: gen_onoff_srv.h:92
struct bt_mesh_onoff_srv onoff
Definition: gen_ponoff_srv.h:76
const struct bt_mesh_onoff_srv_handlers *const onoff_handlers
Definition: gen_ponoff_srv.h:91
struct bt_mesh_model_pub pub
Definition: gen_ponoff_srv.h:84
struct net_buf_simple pub_buf
Definition: gen_ponoff_srv.h:86
enum bt_mesh_on_power_up on_power_up
Definition: gen_ponoff_srv.h:109
const struct bt_mesh_model * ponoff_setup_model
Definition: gen_ponoff_srv.h:82
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_PONOFF_OP_STATUS, BT_MESH_PONOFF_MSG_LEN_STATUS)]
Definition: gen_ponoff_srv.h:89
void(*const update)(struct bt_mesh_ponoff_srv *srv, struct bt_mesh_msg_ctx *ctx, enum bt_mesh_on_power_up old_on_power_up, enum bt_mesh_on_power_up new_on_power_up)
Update handler.
Definition: gen_ponoff_srv.h:103
struct bt_mesh_dtt_srv dtt
Definition: gen_ponoff_srv.h:78
const struct bt_mesh_model * ponoff_model
Definition: gen_ponoff_srv.h:80
Definition: gen_ponoff_srv.h:74