nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
gen_loc_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_LOC_SRV_H__
16#define BT_MESH_GEN_LOC_SRV_H__
17
19#include <zephyr/sys/util.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct bt_mesh_loc_srv;
26
33#define BT_MESH_LOC_SRV_INIT(_handlers) \
34 { \
35 .handlers = _handlers, \
36 }
37
44#define BT_MESH_MODEL_LOC_SRV(_srv) \
45 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_LOCATION_SRV, \
46 _bt_mesh_loc_srv_op, &(_srv)->pub, \
47 BT_MESH_MODEL_USER_DATA(struct bt_mesh_loc_srv, \
48 _srv), \
49 &_bt_mesh_loc_srv_cb), \
50 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_LOCATION_SETUPSRV, \
51 _bt_mesh_loc_setup_srv_op, NULL, \
52 BT_MESH_MODEL_USER_DATA(struct bt_mesh_loc_srv, _srv), \
53 &_bt_mesh_loc_setup_srv_cb)
54
66 void (*const global_get)(struct bt_mesh_loc_srv *srv,
67 struct bt_mesh_msg_ctx *ctx,
68 struct bt_mesh_loc_global *rsp);
69
82 void (*const global_set)(struct bt_mesh_loc_srv *srv,
83 struct bt_mesh_msg_ctx *ctx,
84 struct bt_mesh_loc_global *loc);
85
95 void (*const local_get)(struct bt_mesh_loc_srv *srv,
96 struct bt_mesh_msg_ctx *ctx,
97 struct bt_mesh_loc_local *rsp);
98
111 void (*const local_set)(struct bt_mesh_loc_srv *srv,
112 struct bt_mesh_msg_ctx *ctx,
113 struct bt_mesh_loc_local *loc);
114};
115
122 const struct bt_mesh_model *model;
124 struct bt_mesh_model_pub pub;
125 /* Publication buffer */
126 struct net_buf_simple pub_buf;
127 /* Publication data */
128 uint8_t pub_data[MAX(
129 BT_MESH_MODEL_BUF_LEN(BT_MESH_LOC_OP_LOCAL_STATUS,
130 BT_MESH_LOC_MSG_LEN_LOCAL_STATUS),
131 BT_MESH_MODEL_BUF_LEN(BT_MESH_LOC_OP_GLOBAL_STATUS,
132 BT_MESH_LOC_MSG_LEN_GLOBAL_STATUS))];
133
135 struct {
141 uint8_t was_last_local: 1;
145};
146
169 struct bt_mesh_msg_ctx *ctx,
170 const struct bt_mesh_loc_global *global);
171
194 struct bt_mesh_msg_ctx *ctx,
195 const struct bt_mesh_loc_local *local);
196
198extern const struct bt_mesh_model_op _bt_mesh_loc_srv_op[];
199extern const struct bt_mesh_model_op _bt_mesh_loc_setup_srv_op[];
200extern const struct bt_mesh_model_cb _bt_mesh_loc_srv_cb;
201extern const struct bt_mesh_model_cb _bt_mesh_loc_setup_srv_cb;
204#ifdef __cplusplus
205}
206#endif
207
208#endif /* BT_MESH_GEN_LOC_SRV_H__ */
209
int bt_mesh_loc_srv_local_pub(struct bt_mesh_loc_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_loc_local *local)
Publish the Local Location state.
int bt_mesh_loc_srv_global_pub(struct bt_mesh_loc_srv *srv, struct bt_mesh_msg_ctx *ctx, const struct bt_mesh_loc_global *global)
Publish the Global Location state.
Definition: gen_loc.h:54
Definition: gen_loc.h:67
void(*const global_get)(struct bt_mesh_loc_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_loc_global *rsp)
Get the Global Location state.
Definition: gen_loc_srv.h:66
void(*const local_set)(struct bt_mesh_loc_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_loc_local *loc)
Set the Local Location state.
Definition: gen_loc_srv.h:111
void(*const global_set)(struct bt_mesh_loc_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_loc_global *loc)
Set the Global Location state.
Definition: gen_loc_srv.h:82
void(*const local_get)(struct bt_mesh_loc_srv *srv, struct bt_mesh_msg_ctx *ctx, struct bt_mesh_loc_local *rsp)
Get the Local Location state.
Definition: gen_loc_srv.h:95
Definition: gen_loc_srv.h:56
uint8_t is_local_available
Definition: gen_loc_srv.h:139
uint8_t is_global_available
Definition: gen_loc_srv.h:137
uint8_t pub_data[MAX(BT_MESH_MODEL_BUF_LEN(BT_MESH_LOC_OP_LOCAL_STATUS, BT_MESH_LOC_MSG_LEN_LOCAL_STATUS), BT_MESH_MODEL_BUF_LEN(BT_MESH_LOC_OP_GLOBAL_STATUS, BT_MESH_LOC_MSG_LEN_GLOBAL_STATUS))]
Definition: gen_loc_srv.h:132
struct net_buf_simple pub_buf
Definition: gen_loc_srv.h:126
const struct bt_mesh_loc_srv_handlers *const handlers
Definition: gen_loc_srv.h:144
const struct bt_mesh_model * model
Definition: gen_loc_srv.h:122
struct bt_mesh_loc_srv::@147 pub_state
uint8_t was_last_local
Definition: gen_loc_srv.h:141
struct bt_mesh_model_pub pub
Definition: gen_loc_srv.h:124
Definition: gen_loc_srv.h:120