OVMS3-idf/components/bt/esp_ble_mesh/mesh_models/server/include/state_binding.h

103 lines
2.4 KiB
C
Raw Normal View History

/* Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
*
* Copyright (c) 2018 Vikrant More
* Additional Copyright (c) 2018 Espressif Systems (Shanghai) PTE LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _STATE_BINDING_H_
#define _STATE_BINDING_H_
ble_mesh: Miscellaneous modifications 1. Add an API to set Provisioner static oob value 2. Add an API to deinit BLE Mesh stack 3. Add an API to set Provisioner unicast address 4. Add an API to provision devices with fixed address 5. Add an API to store node composition data 6. Add an API to get node with device uuid 7. Add an API to get node with unicast address 8. Add an API to delete node with device uuid 9. Add an API to delete node with unicast address 10. Add an API for Provisioner to update local AppKey 11. Add an API for Provisioner to update local NetKey 12. Support Provisioner persistent functionality 13. Fix Provisioner entering IV Update procedure 14. Fix an issue which may cause client failing to send msg 15. Use bt_mesh.flags to indicate device role 16. Remove several useless macros 17. Callback RSSI of received mesh provisioning packets 18. Modify the Provisioner disable function 19. Change some log level from debug to info 20. Add parameters to Provisioner bind AppKey completion event 21. Fix node ignoring relay messages issue 22. Support using a specific partition for BLE Mesh 23. Fix compile warning when proxy related macros are disabled 24. Clean up BLE Mesh stack included header files 25. NULL can be input if client message needs no parameters 26. Fix compile warning when BT log is disabled 27. Initilize BLE Mesh stack local variables 28. Support using PSRAM for BLE Mesh mutex, queue and task 29. Add a menuconfig option to enable using memory from PSRAM 30. Clean up sdkconfig.defaults of BLE Mesh examples
2020-01-19 10:57:13 +00:00
#include "mesh_access.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
GENERIC_ONOFF_STATE,
GENERIC_LEVEL_STATE,
GENERIC_ONPOWERUP_STATE,
GENERIC_POWER_ACTUAL_STATE,
LIGHT_LIGHTNESS_ACTUAL_STATE,
LIGHT_LIGHTNESS_LINEAR_STATE,
LIGHT_CTL_LIGHTNESS_STATE,
LIGHT_CTL_TEMP_DELTA_UV_STATE,
LIGHT_HSL_LIGHTNESS_STATE,
LIGHT_HSL_HUE_STATE,
LIGHT_HSL_SATURATION_STATE,
LIGHT_XYL_LIGHTNESS_STATE,
LIGHT_LC_LIGHT_ONOFF_STATE,
BIND_STATE_MAX,
} bt_mesh_server_state_type_t;
typedef union {
struct {
u8_t onoff;
} gen_onoff;
struct {
s16_t level;
} gen_level;
struct {
u8_t onpowerup;
} gen_onpowerup;
struct {
u16_t power;
} gen_power_actual;
struct {
u16_t lightness;
} light_lightness_actual;
struct {
u16_t lightness;
} light_lightness_linear;
struct {
u16_t lightness;
} light_ctl_lightness;
struct {
u16_t temperature;
s16_t delta_uv;
} light_ctl_temp_delta_uv;
struct {
u16_t lightness;
} light_hsl_lightness;
struct {
u16_t hue;
} light_hsl_hue;
struct {
u16_t saturation;
} light_hsl_saturation;
struct {
u16_t lightness;
} light_xyl_lightness;
struct {
u8_t onoff;
} light_lc_light_onoff;
} bt_mesh_server_state_value_t;
u16_t bt_mesh_convert_lightness_actual_to_linear(u16_t actual);
u16_t bt_mesh_convert_lightness_linear_to_actual(u16_t linear);
s16_t bt_mesh_convert_temperature_to_gen_level(u16_t temp, u16_t min, u16_t max);
u16_t bt_mesh_covert_gen_level_to_temperature(s16_t level, u16_t min, u16_t max);
s16_t bt_mesh_convert_hue_to_level(u16_t hue);
u16_t bt_mesh_convert_level_to_hue(s16_t level);
s16_t bt_mesh_convert_saturation_to_level(u16_t saturation);
u16_t bt_mesh_convert_level_to_saturation(s16_t level);
int bt_mesh_update_binding_state(struct bt_mesh_model *model,
bt_mesh_server_state_type_t type,
bt_mesh_server_state_value_t *value);
#ifdef __cplusplus
}
#endif
#endif /* _STATE_BINDING_H_ */