nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
scene_srv.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef BT_MESH_SCENE_SRV_H__
15#define BT_MESH_SCENE_SRV_H__
16
18#include <zephyr/settings/settings.h>
19#include <zephyr/toolchain.h>
20#include <zephyr/sys/slist.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#ifndef CONFIG_BT_MESH_SCENES_MAX
27#define CONFIG_BT_MESH_SCENES_MAX 0
28#endif
29
36#define BT_MESH_SCENE_ENTRY_SIG(_name) \
37 static const STRUCT_SECTION_ITERABLE( \
38 bt_mesh_scene_entry, bt_mesh_scene_entry_sig_##_name)
39
46#define BT_MESH_SCENE_ENTRY_VND(_name) \
47 static const STRUCT_SECTION_ITERABLE( \
48 bt_mesh_scene_entry, bt_mesh_scene_entry_vnd_##_name)
49
51
58#define BT_MESH_MODEL_SCENE_SRV(_srv) \
59 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_SCENE_SRV, _bt_mesh_scene_srv_op, \
60 &(_srv)->pub, \
61 BT_MESH_MODEL_USER_DATA(struct bt_mesh_scene_srv, \
62 _srv), \
63 &_bt_mesh_scene_srv_cb), \
64 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_SCENE_SETUP_SRV, \
65 _bt_mesh_scene_setup_srv_op, NULL, \
66 BT_MESH_MODEL_USER_DATA(struct bt_mesh_scene_srv, \
67 _srv), \
68 &_bt_mesh_scene_setup_srv_cb)
69
75 uint16_t count;
76
80 uint16_t next;
82 uint16_t prev;
83
85 uint8_t vndpages;
87 uint8_t sigpages;
88
90 sys_snode_t n;
91
93 struct k_work_delayable work;
95 struct bt_mesh_model_transition transition;
96
98 struct bt_mesh_tid_ctx tid;
100 const struct bt_mesh_model *model;
102 const struct bt_mesh_model *setup_mod;
104 struct bt_mesh_model_pub pub;
106 struct net_buf_simple pub_msg;
108 uint8_t buf[BT_MESH_MODEL_BUF_LEN(BT_MESH_SCENE_OP_STATUS,
109 BT_MESH_SCENE_MSG_MAXLEN_STATUS)];
111};
112
116 union {
118 uint16_t sig;
120 struct bt_mesh_mod_id_vnd vnd;
121 } id;
123 size_t maxlen;
124
137 ssize_t (*store)(const struct bt_mesh_model *model, uint8_t data[]);
138
153 void (*recall)(const struct bt_mesh_model *model, const uint8_t data[],
154 size_t len, struct bt_mesh_model_transition *transition);
155
169 void (*recall_complete)(const struct bt_mesh_model *model);
170};
171
180void bt_mesh_scene_invalidate(const struct bt_mesh_model *mod);
181
197int bt_mesh_scene_srv_set(struct bt_mesh_scene_srv *srv, uint16_t scene,
198 struct bt_mesh_model_transition *transition);
199
212 struct bt_mesh_msg_ctx *ctx);
213
223uint16_t
225
235uint16_t
237
239extern const struct bt_mesh_model_cb _bt_mesh_scene_srv_cb;
240extern const struct bt_mesh_model_op _bt_mesh_scene_srv_op[];
241extern const struct bt_mesh_model_cb _bt_mesh_scene_setup_srv_cb;
242extern const struct bt_mesh_model_op _bt_mesh_scene_setup_srv_op[];
245#ifdef __cplusplus
246}
247#endif
248
249#endif /* BT_MESH_SCENE_SRV_H__ */
250
uint16_t bt_mesh_scene_srv_current_scene_get(const struct bt_mesh_scene_srv *srv)
Get the current scene.
void bt_mesh_scene_invalidate(const struct bt_mesh_model *mod)
Notify the Scene Server that a Scene entry has changed.
#define CONFIG_BT_MESH_SCENES_MAX
Definition: scene_srv.h:27
int bt_mesh_scene_srv_pub(struct bt_mesh_scene_srv *srv, struct bt_mesh_msg_ctx *ctx)
Publish the current Scene status.
uint16_t bt_mesh_scene_srv_target_scene_get(const struct bt_mesh_scene_srv *srv)
Get the target scene.
int bt_mesh_scene_srv_set(struct bt_mesh_scene_srv *srv, uint16_t scene, struct bt_mesh_model_transition *transition)
Set the current Scene.
Definition: model_types.h:37
struct bt_mesh_mod_id_vnd vnd
Definition: scene_srv.h:120
union bt_mesh_scene_entry::@157 id
void(* recall)(const struct bt_mesh_model *model, const uint8_t data[], size_t len, struct bt_mesh_model_transition *transition)
Recall a scene based on the given scene data.
Definition: scene_srv.h:153
void(* recall_complete)(const struct bt_mesh_model *model)
Recall a scene is completed.
Definition: scene_srv.h:169
ssize_t(* store)(const struct bt_mesh_model *model, uint8_t data[])
Store the current state as a scene.
Definition: scene_srv.h:137
uint16_t sig
Definition: scene_srv.h:118
size_t maxlen
Definition: scene_srv.h:123
Definition: scene_srv.h:114
uint16_t count
Definition: scene_srv.h:75
uint16_t all[0]
Definition: scene_srv.h:73
Definition: scene_srv.h:71
Definition: model_types.h:46