nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
gen_battery_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_BATTERY_SRV_H__
16#define BT_MESH_GEN_BATTERY_SRV_H__
17
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
25
32#define BT_MESH_BATTERY_SRV_INIT(_get_handler) \
33 { \
34 .get = _get_handler, \
35 }
36
43#define BT_MESH_MODEL_BATTERY_SRV(_srv) \
44 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_BATTERY_SRV, \
45 _bt_mesh_battery_srv_op, &(_srv)->pub, \
46 BT_MESH_MODEL_USER_DATA(struct bt_mesh_battery_srv, \
47 _srv), \
48 &_bt_mesh_battery_srv_cb)
49
56 const struct bt_mesh_model *model;
58 struct bt_mesh_model_pub pub;
59 /* Publication buffer */
60 struct net_buf_simple pub_buf;
61 /* Publication data */
62 uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_BATTERY_OP_STATUS,
63 BT_MESH_BATTERY_MSG_LEN_STATUS)];
64
76 void (*const get)(struct bt_mesh_battery_srv *srv,
77 struct bt_mesh_msg_ctx *ctx,
78 struct bt_mesh_battery_status *rsp);
79};
80
100 struct bt_mesh_msg_ctx *ctx,
101 const struct bt_mesh_battery_status *status);
102
104extern const struct bt_mesh_model_op _bt_mesh_battery_srv_op[];
105extern const struct bt_mesh_model_cb _bt_mesh_battery_srv_cb;
108#ifdef __cplusplus
109}
110#endif
111
112#endif /* BT_MESH_GEN_BATTERY_SRV_H__ */
113
int bt_mesh_battery_srv_pub(struct bt_mesh_battery_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_battery_status *status)
Publish the Generic Battery Server model status.
struct net_buf_simple pub_buf
Definition: gen_battery_srv.h:60
const struct bt_mesh_model * model
Definition: gen_battery_srv.h:56
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_BATTERY_OP_STATUS, BT_MESH_BATTERY_MSG_LEN_STATUS)]
Definition: gen_battery_srv.h:63
void(*const get)(struct bt_mesh_battery_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_battery_status *rsp)
Get the Battery state.
Definition: gen_battery_srv.h:76
struct bt_mesh_model_pub pub
Definition: gen_battery_srv.h:58
Definition: gen_battery_srv.h:54
Definition: gen_battery.h:79