nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
enocean.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
7#ifndef BT_ENOCEAN_H__
8#define BT_ENOCEAN_H__
9
17#include <zephyr/bluetooth/bluetooth.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24#define BT_ENOCEAN_SWITCH_OA BIT(0)
26#define BT_ENOCEAN_SWITCH_IA BIT(1)
28#define BT_ENOCEAN_SWITCH_OB BIT(2)
30#define BT_ENOCEAN_SWITCH_IB BIT(3)
31
33#define BT_ENOCEAN_SWITCH_O BT_ENOCEAN_SWITCH_OB
35#define BT_ENOCEAN_SWITCH_I BT_ENOCEAN_SWITCH_IB
36
39 bool *occupancy;
40 uint16_t *light_sensor;
41 uint16_t *battery_voltage;
42 uint16_t *light_solar_cell;
43 uint8_t *energy_lvl;
44};
45
48 uint32_t seq;
49 uint8_t flags;
50 int8_t rssi;
51 bt_addr_le_t addr;
52 uint8_t key[16];
53};
54
60
80 void (*button)(struct bt_enocean_device *device,
81 enum bt_enocean_button_action action, uint8_t changed,
82 const uint8_t *opt_data, size_t opt_data_len);
83
97 void (*sensor)(struct bt_enocean_device *device,
98 const struct bt_enocean_sensor_data *data,
99 const uint8_t *opt_data, size_t opt_data_len);
100
114 void (*commissioned)(struct bt_enocean_device *device);
115
123 void (*decommissioned)(struct bt_enocean_device *device);
124
133 void (*loaded)(struct bt_enocean_device *device);
134};
135
141typedef void (*bt_enocean_foreach_cb_t)(struct bt_enocean_device *dev,
142 void *user_data);
143
149
156
164
180int bt_enocean_commission(const bt_addr_le_t *addr, const uint8_t key[16],
181 uint32_t seq);
182
193
201uint32_t bt_enocean_foreach(bt_enocean_foreach_cb_t cb, void *user_data);
202
203#ifdef __cplusplus
204}
205#endif
206
209#endif /* BT_ENOCEAN_H__ */
void bt_enocean_decommission(struct bt_enocean_device *dev)
Forget an EnOcean device.
void(* bt_enocean_foreach_cb_t)(struct bt_enocean_device *dev, void *user_data)
Visitor callback for bt_enocean_foreach.
Definition enocean.h:141
void bt_enocean_commissioning_enable(void)
Enable automatic commissioning.
void bt_enocean_init(const struct bt_enocean_callbacks *cb)
Initialize the EnOcean subsystem.
void bt_enocean_commissioning_disable(void)
Disable automatic commissioning.
bt_enocean_button_action
Definition enocean.h:56
@ BT_ENOCEAN_BUTTON_PRESS
Definition enocean.h:58
@ BT_ENOCEAN_BUTTON_RELEASE
Definition enocean.h:57
uint32_t bt_enocean_foreach(bt_enocean_foreach_cb_t cb, void *user_data)
Call the given callback for each commissioned EnOcean device.
int bt_enocean_commission(const bt_addr_le_t *addr, const uint8_t key[16], uint32_t seq)
Manually commission an EnOcean device.
void(* loaded)(struct bt_enocean_device *device)
Callback for EnOcean devices being loaded from persistent storage.
Definition enocean.h:133
void(* button)(struct bt_enocean_device *device, enum bt_enocean_button_action action, uint8_t changed, const uint8_t *opt_data, size_t opt_data_len)
Callback for EnOcean Switch button presses.
Definition enocean.h:80
void(* commissioned)(struct bt_enocean_device *device)
Callback for EnOcean commissioning.
Definition enocean.h:114
void(* decommissioned)(struct bt_enocean_device *device)
Callback for EnOcean decommissioning.
Definition enocean.h:123
void(* sensor)(struct bt_enocean_device *device, const struct bt_enocean_sensor_data *data, const uint8_t *opt_data, size_t opt_data_len)
Callback for EnOcean Sensor reports.
Definition enocean.h:97
Definition enocean.h:62
uint8_t key[16]
Definition enocean.h:52
int8_t rssi
Definition enocean.h:50
uint32_t seq
Definition enocean.h:48
bt_addr_le_t addr
Definition enocean.h:51
uint8_t flags
Definition enocean.h:49
Definition enocean.h:47
bool * occupancy
Definition enocean.h:39
uint8_t * energy_lvl
Definition enocean.h:43
uint16_t * light_solar_cell
Definition enocean.h:42
uint16_t * light_sensor
Definition enocean.h:40
uint16_t * battery_voltage
Definition enocean.h:41
Definition enocean.h:38