nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
scheduler_srv.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef BT_MESH_SCHEDULER_SRV_H__
15#define BT_MESH_SCHEDULER_SRV_H__
16
17#include <zephyr/kernel.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27
35#define BT_MESH_SCHEDULER_SRV_INIT(_action_set_cb, _time_srv) \
36 { \
37 .action_set_cb = _action_set_cb, .time_srv = _time_srv, \
38 }
39
50#define BT_MESH_MODEL_SCHEDULER_SRV(_srv) \
51 BT_MESH_MODEL_SCENE_SRV(&(_srv)->scene_srv), \
52 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_SCHEDULER_SRV, \
53 _bt_mesh_scheduler_srv_op, \
54 &(_srv)->pub, \
55 BT_MESH_MODEL_USER_DATA(struct bt_mesh_scheduler_srv, \
56 _srv), \
57 &_bt_mesh_scheduler_srv_cb), \
58 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_SCHEDULER_SETUP_SRV, \
59 _bt_mesh_scheduler_setup_srv_op, \
60 NULL, \
61 BT_MESH_MODEL_USER_DATA(struct bt_mesh_scheduler_srv, \
62 _srv), \
63 &_bt_mesh_scheduler_setup_srv_cb)
64
68 struct {
69 /* Scheduled work. */
70 struct k_work_delayable delayed_work;
71 /* Calculated TAI-time for action items. */
72 struct bt_mesh_time_tai
74 /* Index of the ongoing action. */
75 uint8_t idx;
76 /* Index of the last executed action. */
77 uint8_t last_idx;
78 /* Bit field indicating active entries
79 * in the Schedule Register.
80 */
81 uint16_t active_bitmap;
82 /* The Schedule Register state is a 16-entry,
83 * zero-based, indexed array
84 */
87 };
89 const struct bt_mesh_model *model;
91 struct bt_mesh_model_pub pub;
92 /* Publication buffer */
93 struct net_buf_simple pub_buf;
94 /* Publication data */
95 uint8_t pub_data[
96 BT_MESH_MODEL_BUF_LEN(BT_MESH_SCHEDULER_OP_ACTION_STATUS,
97 BT_MESH_SCHEDULER_MSG_LEN_ACTION_STATUS)];
102
114 void (*const action_set_cb)(struct bt_mesh_scheduler_srv *srv,
115 struct bt_mesh_msg_ctx *ctx,
116 uint8_t idx,
117 struct bt_mesh_schedule_entry *entry);
118};
119
132
134extern const struct bt_mesh_model_cb _bt_mesh_scheduler_srv_cb;
135extern const struct bt_mesh_model_op _bt_mesh_scheduler_srv_op[];
136extern const struct bt_mesh_model_cb _bt_mesh_scheduler_setup_srv_cb;
137extern const struct bt_mesh_model_op _bt_mesh_scheduler_setup_srv_op[];
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* BT_MESH_SCHEDULER_SRV_H__ */
145
int bt_mesh_scheduler_srv_time_update(struct bt_mesh_scheduler_srv *srv)
Update time of the scheduled action.
#define BT_MESH_SCHEDULER_ACTION_ENTRY_COUNT
Definition: scheduler.h:24
Definition: scene_srv.h:71
Definition: scheduler.h:91
struct bt_mesh_schedule_entry sch_reg[BT_MESH_SCHEDULER_ACTION_ENTRY_COUNT]
Definition: scheduler_srv.h:85
struct bt_mesh_time_tai sched_tai[BT_MESH_SCHEDULER_ACTION_ENTRY_COUNT]
Definition: scheduler_srv.h:72
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_SCHEDULER_OP_ACTION_STATUS, BT_MESH_SCHEDULER_MSG_LEN_ACTION_STATUS)]
Definition: scheduler_srv.h:97
struct bt_mesh_model_pub pub
Definition: scheduler_srv.h:91
struct net_buf_simple pub_buf
Definition: scheduler_srv.h:93
struct bt_mesh_time_srv * time_srv
Definition: scheduler_srv.h:99
struct bt_mesh_scene_srv scene_srv
Definition: scheduler_srv.h:101
const struct bt_mesh_model * model
Definition: scheduler_srv.h:89
uint8_t idx
Definition: scheduler_srv.h:75
uint16_t active_bitmap
Definition: scheduler_srv.h:81
void(*const action_set_cb)(struct bt_mesh_scheduler_srv *srv, struct bt_mesh_msg_ctx *ctx, uint8_t idx, struct bt_mesh_schedule_entry *entry)
Scheduler action set callback.
Definition: scheduler_srv.h:114
struct k_work_delayable delayed_work
Definition: scheduler_srv.h:70
uint8_t last_idx
Definition: scheduler_srv.h:77
Definition: scheduler_srv.h:66
Definition: time_srv.h:124
Definition: time.h:39