nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
silvair_enocean_srv.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 * Work based on EnOcean Proxy Server model, Copyright (c) 2020 Silvair sp. z o.o.
4 *
5 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
6 */
7
15#ifndef BT_MESH_SILVAIR_ENOCEAN_SRV_H__
16#define BT_MESH_SILVAIR_ENOCEAN_SRV_H__
17
19#include <zephyr/bluetooth/addr.h>
20#include <zephyr/sys/slist.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define BT_MESH_COMPANY_ID_SILVAIR 0x0136
27#define BT_MESH_MODEL_ID_SILVAIR_ENOCEAN_SRV 0x0001
28#define BT_MESH_SILVAIR_ENOCEAN_PROXY_BUTTONS 2
29
32extern const struct bt_mesh_model_op _bt_mesh_silvair_enocean_srv_op[];
33extern const struct bt_mesh_model_cb _bt_mesh_silvair_enocean_srv_cb;
34
35#define BT_MESH_SILVAIR_ENOCEAN_PROXY_OP BT_MESH_MODEL_OP_3(0xF4, \
36 BT_MESH_COMPANY_ID_SILVAIR)
37
38#define BT_MESH_SILVAIR_ENOCEAN_PROXY_MSG_MINLEN 1
39#define BT_MESH_SILVAIR_ENOCEAN_PROXY_MSG_MAXLEN 23
56};
57
69 bool target;
75 int32_t delta;
77 struct k_work_delayable timer;
79
81 bt_addr_le_t addr;
83 struct bt_mesh_model_pub pub;
85 struct net_buf_simple pub_buf;
87 uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(
88 BT_MESH_SILVAIR_ENOCEAN_PROXY_OP,
89 BT_MESH_SILVAIR_ENOCEAN_PROXY_MSG_MAXLEN)];
91 const struct bt_mesh_model *mod;
93 sys_snode_t entry;
94};
95
102#define BT_MESH_MODEL_SILVAIR_ENOCEAN_SRV(_srv) \
103 BT_MESH_MODEL_VND_CB(BT_MESH_COMPANY_ID_SILVAIR, \
104 BT_MESH_MODEL_ID_SILVAIR_ENOCEAN_SRV, \
105 _bt_mesh_silvair_enocean_srv_op, &(_srv)->pub, \
106 BT_MESH_MODEL_USER_DATA( \
107 struct bt_mesh_silvair_enocean_srv, _srv), \
108 &_bt_mesh_silvair_enocean_srv_cb)
109
122#define BT_MESH_MODEL_SILVAIR_ENOCEAN_BUTTON(_srv, _idx) \
123 BT_MESH_MODEL_LVL_CLI(&(_srv)->buttons[_idx].lvl), \
124 BT_MESH_MODEL_ONOFF_CLI(&(_srv)->buttons[_idx].onoff)
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* BT_MESH_SILVAIR_ENOCEAN_SRV_H__ */
131
#define BT_MESH_SILVAIR_ENOCEAN_PROXY_BUTTONS
Definition: silvair_enocean_srv.h:28
bt_mesh_silvair_enocean_state
Definition: silvair_enocean_srv.h:43
@ BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_A
Definition: silvair_enocean_srv.h:49
@ BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_B
Definition: silvair_enocean_srv.h:51
@ BT_MESH_SILVAIR_ENOCEAN_STATE_WAIT
Definition: silvair_enocean_srv.h:47
@ BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_C
Definition: silvair_enocean_srv.h:53
@ BT_MESH_SILVAIR_ENOCEAN_STATE_IDLE
Definition: silvair_enocean_srv.h:45
@ BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_D
Definition: silvair_enocean_srv.h:55
Definition: gen_lvl_cli.h:54
Definition: gen_onoff_cli.h:54
int32_t delta
Definition: silvair_enocean_srv.h:75
bool target
Definition: silvair_enocean_srv.h:69
struct bt_mesh_onoff_cli onoff
Definition: silvair_enocean_srv.h:65
struct k_work_delayable timer
Definition: silvair_enocean_srv.h:77
int tick_count
Definition: silvair_enocean_srv.h:71
enum bt_mesh_silvair_enocean_state state
Definition: silvair_enocean_srv.h:67
struct bt_mesh_lvl_cli lvl
Definition: silvair_enocean_srv.h:63
bool release_pending
Definition: silvair_enocean_srv.h:73
uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_SILVAIR_ENOCEAN_PROXY_OP, BT_MESH_SILVAIR_ENOCEAN_PROXY_MSG_MAXLEN)]
Definition: silvair_enocean_srv.h:89
struct bt_mesh_model_pub pub
Definition: silvair_enocean_srv.h:83
sys_snode_t entry
Definition: silvair_enocean_srv.h:93
struct net_buf_simple pub_buf
Definition: silvair_enocean_srv.h:85
struct bt_mesh_silvair_enocean_srv::bt_mesh_silvair_enocean_button buttons[2]
const struct bt_mesh_model * mod
Definition: silvair_enocean_srv.h:91
bt_addr_le_t addr
Definition: silvair_enocean_srv.h:81
Definition: silvair_enocean_srv.h:59