feat(ble_mesh): Bluetooth Mesh folder and file misc updates

This commit is contained in:
Liu Linyan
2023-08-25 14:28:44 +08:00
committed by wangjialiang
parent c301deb351
commit bf51fb965b
156 changed files with 437 additions and 437 deletions

View File

@@ -0,0 +1,122 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _CLIENT_COMMON_H_
#define _CLIENT_COMMON_H_
#include "mesh/access.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Client model opcode pair table */
typedef struct {
uint32_t cli_op; /* Client message opcode */
uint32_t status_op; /* Corresponding status message opcode */
} bt_mesh_client_op_pair_t;
/** Client model user data context */
typedef struct {
/** Pointer to the client model */
struct bt_mesh_model *model;
/** Size of the opcode pair table */
int op_pair_size;
/** Pointer to the opcode pair table */
const bt_mesh_client_op_pair_t *op_pair;
/**
* @brief This function is a callback function used to push the received unsolicited
* messages to the application layer.
*
* @param[in] opcode: Opcode of received status message
* @param[in] model: Model associated with the status message
* @param[in] ctx: Context information of the status message
* @param[in] buf: Buffer contains the status message value
*
* @return None
*/
void (*publish_status)(uint32_t opcode, struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf);
/** Pointer to the internal data of client model */
void *internal_data;
/** Role of the device to which the client model belongs */
uint8_t msg_role;
} bt_mesh_client_user_data_t;
/** Client model internal data context */
typedef struct {
sys_slist_t queue;
} bt_mesh_client_internal_data_t;
/** Client model sending message related context */
typedef struct {
sys_snode_t client_node;
struct bt_mesh_msg_ctx ctx; /* Message context */
uint32_t opcode; /* Message opcode */
uint32_t op_pending; /* Expected status message opcode */
int32_t timeout; /* Calculated message timeout value */
struct k_delayed_work timer; /* Time used to get response. Only for internal use. */
} bt_mesh_client_node_t;
/** Client model sending message parameters */
typedef struct {
uint32_t opcode; /* Message opcode */
struct bt_mesh_model *model; /* Pointer to the client model */
struct bt_mesh_msg_ctx ctx; /* Message context */
int32_t msg_timeout; /* Time to get corresponding response */
uint8_t msg_role; /* Role (Node/Provisioner) of the device */
const struct bt_mesh_send_cb *cb; /* User defined callback function */
void *cb_data; /* User defined callback value */
} bt_mesh_client_common_param_t;
void bt_mesh_client_model_lock(void);
void bt_mesh_client_model_unlock(void);
int bt_mesh_client_init(struct bt_mesh_model *model);
int bt_mesh_client_deinit(struct bt_mesh_model *model);
/**
* @brief Check if the msg received by client model is a publish msg or not
*
* @param model Mesh (client) Model that the message belongs to.
* @param ctx Message context, includes keys, TTL, etc.
* @param buf The message buffer
* @param need_pub Indicate if the msg sent to app layer as a publish msg
* @return 0 on success, or (negative) error code on failure.
*/
bt_mesh_client_node_t *bt_mesh_is_client_recv_publish_msg(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf, bool need_pub);
int bt_mesh_client_send_msg(bt_mesh_client_common_param_t *param,
struct net_buf_simple *msg, bool need_ack,
k_work_handler_t timer_handler);
int bt_mesh_client_free_node(bt_mesh_client_node_t *node);
int bt_mesh_client_clear_list(void *data);
/**
* @brief Set role of the client model for internal use.
*
* @param[in] model: Pointer to the client model
* @param[in] role: Role of the device
*
* @return Zero - success, otherwise - fail
*/
int bt_mesh_set_client_model_role(struct bt_mesh_model *model, uint8_t role);
#ifdef __cplusplus
}
#endif
#endif /* _CLIENT_COMMON_H_ */

View File

@@ -0,0 +1,408 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/** @file
* @brief Bluetooth Mesh Generic Client Model APIs.
*/
#ifndef _GENERIC_CLIENT_H_
#define _GENERIC_CLIENT_H_
#include "mesh/client_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Generic client model common structure */
typedef bt_mesh_client_user_data_t bt_mesh_generic_client_t;
typedef bt_mesh_client_internal_data_t generic_internal_data_t;
/* Generic Client Model Callback */
extern const struct bt_mesh_model_cb bt_mesh_generic_client_cb;
/* Generic OnOff Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_onoff_cli_op[];
/** @def BLE_MESH_MODEL_GEN_ONOFF_CLI
*
* Define a new generic onoff client model. Note that this API
* needs to be repeated for each element which the application
* wants to have a generic onoff client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_onoff_cli.
*
* @return New generic onoff client model instance.
*/
#define BLE_MESH_MODEL_GEN_ONOFF_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_ONOFF_CLI, \
bt_mesh_gen_onoff_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_onoff_client_t;
struct bt_mesh_gen_onoff_status {
bool op_en; /* Indicate whether optional parameters included */
uint8_t present_onoff; /* Present value of Generic OnOff state */
uint8_t target_onoff; /* Target value of Generic OnOff state (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_gen_onoff_set {
bool op_en; /* Indicate whether optional parameters included */
uint8_t onoff; /* Target value of Generic OnOff state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
/* Generic Level Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_level_cli_op[];
/** @def BLE_MESH_MODEL_GEN_LEVEL_CLI
*
* Define a new generic level client model. Note that this API
* needs to be repeated for each element which the application
* wants to have a generic level client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_level_cli.
*
* @return New generic level client model instance.
*/
#define BLE_MESH_MODEL_GEN_LEVEL_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_LEVEL_CLI, \
bt_mesh_gen_level_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_level_client_t;
struct bt_mesh_gen_level_status {
bool op_en; /* Indicate whether optional parameters included */
int16_t present_level; /* Present value of Generic Level state */
int16_t target_level; /* Target value of the Generic Level state (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_gen_level_set {
bool op_en; /* Indicate whether optional parameters included */
int16_t level; /* Target value of Generic Level state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_gen_delta_set {
bool op_en; /* Indicate whether optional parameters included */
int32_t delta_level; /* Delta change of Generic Level state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_gen_move_set {
bool op_en; /* Indicate whether optional parameters included */
int16_t delta_level; /* Delta Level step to calculate Move speed for Generic Level state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
/* Generic Default Transition Time Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_def_trans_time_cli_op[];
/** @def BLE_MESH_MODEL_GEN_DEF_TRANS_TIME_CLI
*
* Define a new generic default transition time client model. Note
* that this API needs to be repeated for each element that the
* application wants to have a generic default transition client
* model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_def_trans_time_cli.
*
* @return New generic default transition time client model instance.
*/
#define BLE_MESH_MODEL_GEN_DEF_TRANS_TIME_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI, \
bt_mesh_gen_def_trans_time_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_def_trans_time_client_t;
struct bt_mesh_gen_def_trans_time_set {
uint8_t trans_time; /* The value of the Generic Default Transition Time state */
};
struct bt_mesh_gen_def_trans_time_status {
uint8_t trans_time; /* The value of the Generic Default Transition Time state */
};
/* Generic Power OnOff Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_power_onoff_cli_op[];
/** @def BLE_MESH_MODEL_GEN_POWER_ONOFF_CLI
*
* Define a new generic power onoff client model. Note that this API
* needs to be repeated for each element which the application wants
* to have a generic power onoff client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_power_onoff_cli.
*
* @return New generic power onoff client model instance.
*/
#define BLE_MESH_MODEL_GEN_POWER_ONOFF_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI, \
bt_mesh_gen_power_onoff_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_power_onoff_client_t;
struct bt_mesh_gen_onpowerup_set {
uint8_t onpowerup; /* The value of the Generic OnPowerUp state */
};
struct bt_mesh_gen_onpowerup_status {
uint8_t onpowerup; /* The value of the Generic OnPowerUp state */
};
/* Generic Power Level Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_power_level_cli_op[];
/** @def BLE_MESH_MODEL_GEN_POWER_LEVEL_CLI
*
* Define a new generic power level client model. Note that this API
* needs to be repeated for each element which the application wants
* to have a generic power level client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_power_level_cli.
*
* @return New generic power level client model instance.
*/
#define BLE_MESH_MODEL_GEN_POWER_LEVEL_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI, \
bt_mesh_gen_power_level_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_power_level_client_t;
struct bt_mesh_gen_power_level_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t present_power; /* Present value of Generic Power Actual state */
uint16_t target_power; /* Target value of Generic Power Actual state (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_gen_power_last_status {
uint16_t power; /* The value of the Generic Power Last state */
};
struct bt_mesh_gen_power_default_status {
uint16_t power; /* The value of the Generic Default Last state */
};
struct bt_mesh_gen_power_range_status {
uint8_t status_code; /* Status Code for the requesting message */
uint16_t range_min; /* Value of Range Min field of Generic Power Range state */
uint16_t range_max; /* Value of Range Max field of Generic Power Range state */
};
struct bt_mesh_gen_power_level_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t power; /* Target value of Generic Power Actual state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_gen_power_default_set {
uint16_t power; /* The value of the Generic Power Default state */
};
struct bt_mesh_gen_power_range_set {
uint16_t range_min; /* Value of Range Min field of Generic Power Range state */
uint16_t range_max; /* Value of Range Max field of Generic Power Range state */
};
/* Generic Battery Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_battery_cli_op[];
/** @def BLE_MESH_MODEL_GEN_BATTERY_CLI
*
* Define a new generic battery client model. Note that this API
* needs to be repeated for each element which the application
* wants to have a generic battery client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_battery_cli.
*
* @return New generic battery client model instance.
*/
#define BLE_MESH_MODEL_GEN_BATTERY_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_BATTERY_CLI, \
bt_mesh_gen_battery_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_battery_client_t;
struct bt_mesh_gen_battery_status {
uint32_t battery_level : 8; /* Value of Generic Battery Level state */
uint32_t time_to_discharge : 24; /* Value of Generic Battery Time to Discharge state */
uint32_t time_to_charge : 24; /* Value of Generic Battery Time to Charge state */
uint32_t flags : 8; /* Value of Generic Battery Flags state */
};
/* Generic Location Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_location_cli_op[];
/** @def BLE_MESH_MODEL_GEN_LOCATION_CLI
*
* Define a new generic location client model. Note that this API
* needs to be repeated for each element which the application
* wants to have a generic location client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_location_cli.
*
* @return New generic location client model instance.
*/
#define BLE_MESH_MODEL_GEN_LOCATION_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_LOCATION_CLI, \
bt_mesh_gen_location_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_location_client_t;
struct bt_mesh_gen_loc_global_status {
int32_t global_latitude; /* Global Coordinates (Latitude) */
int32_t global_longitude; /* Global Coordinates (Longitude) */
int16_t global_altitude; /* Global Altitude */
};
struct bt_mesh_gen_loc_local_status {
int16_t local_north; /* Local Coordinates (North) */
int16_t local_east; /* Local Coordinates (East) */
int16_t local_altitude; /* Local Altitude */
uint8_t floor_number; /* Floor Number */
uint16_t uncertainty; /* Uncertainty */
};
struct bt_mesh_gen_loc_global_set {
int32_t global_latitude; /* Global Coordinates (Latitude) */
int32_t global_longitude; /* Global Coordinates (Longitude) */
int16_t global_altitude; /* Global Altitude */
};
struct bt_mesh_gen_loc_local_set {
int16_t local_north; /* Local Coordinates (North) */
int16_t local_east; /* Local Coordinates (East) */
int16_t local_altitude; /* Local Altitude */
uint8_t floor_number; /* Floor Number */
uint16_t uncertainty; /* Uncertainty */
};
/* Generic Property Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_gen_property_cli_op[];
/** @def BLE_MESH_MODEL_GEN_LOCATION_CLI
*
* Define a new generic location client model. Note that this API
* needs to be repeated for each element which the application
* wants to have a generic location client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_gen_location_cli.
*
* @return New generic location client model instance.
*/
#define BLE_MESH_MODEL_GEN_PROPERTY_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_GEN_PROP_CLI, \
bt_mesh_gen_property_cli_op, cli_pub, cli_data, &bt_mesh_generic_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_gen_property_client_t;
struct bt_mesh_gen_user_properties_status {
struct net_buf_simple *user_property_ids; /* Buffer contains a sequence of N User Property IDs */
};
struct bt_mesh_gen_user_property_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t user_property_id; /* Property ID identifying a Generic User Property */
uint8_t user_access; /* Enumeration indicating user access (optional) */
struct net_buf_simple *user_property_value; /* Raw value for the User Property (C.1) */
};
struct bt_mesh_gen_admin_properties_status {
struct net_buf_simple *admin_property_ids; /* Buffer contains a sequence of N Admin Property IDs */
};
struct bt_mesh_gen_admin_property_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
uint8_t admin_user_access; /* Enumeration indicating user access (optional) */
struct net_buf_simple *admin_property_value; /* Raw value for the Admin Property (C.1) */
};
struct bt_mesh_gen_manu_properties_status {
struct net_buf_simple *manu_property_ids; /* Buffer contains a sequence of N Manufacturer Property IDs */
};
struct bt_mesh_gen_manu_property_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
uint8_t manu_user_access; /* Enumeration indicating user access (optional) */
struct net_buf_simple *manu_property_value; /* Raw value for the Manufacturer Property (C.1) */
};
struct bt_mesh_gen_client_properties_status {
struct net_buf_simple *client_property_ids; /* Buffer contains a sequence of N Client Property IDs */
};
struct bt_mesh_gen_user_property_get {
uint16_t user_property_id; /* Property ID identifying a Generic User Property */
};
struct bt_mesh_gen_user_property_set {
uint16_t user_property_id; /* Property ID identifying a Generic User Property */
struct net_buf_simple *user_property_value; /* Raw value for the User Property */
};
struct bt_mesh_gen_admin_property_get {
uint16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
};
struct bt_mesh_gen_admin_property_set {
uint16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
uint8_t admin_user_access; /* Enumeration indicating user access */
struct net_buf_simple *admin_property_value; /* Raw value for the Admin Property */
};
struct bt_mesh_gen_manu_property_get {
uint16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
};
struct bt_mesh_gen_manu_property_set {
uint16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
uint8_t manu_user_access; /* Enumeration indicating user access */
};
struct bt_mesh_gen_client_properties_get {
uint16_t client_property_id; /* A starting Client Property ID present within an element */
};
/**
* @brief This function is called to get generic states.
*
* @param[in] common: Message common information structure
* @param[in] get: Pointer of generic get message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_generic_client_get_state(bt_mesh_client_common_param_t *common, void *get);
/**
* @brief This function is called to set generic states.
*
* @param[in] common: Message common information structure
* @param[in] set: Pointer of generic set message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_generic_client_set_state(bt_mesh_client_common_param_t *common, void *set);
#ifdef __cplusplus
}
#endif
#endif /* _GENERIC_CLIENT_H_ */

View File

@@ -0,0 +1,440 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/** @file
* @brief Bluetooth Mesh Lighting Client Model APIs.
*/
#ifndef _LIGHTING_CLIENT_H_
#define _LIGHTING_CLIENT_H_
#include "mesh/client_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Light client model common structure */
typedef bt_mesh_client_user_data_t bt_mesh_light_client_t;
typedef bt_mesh_client_internal_data_t light_internal_data_t;
/* Lighting Client Model Callback */
extern const struct bt_mesh_model_cb bt_mesh_lighting_client_cb;
/* Light Lightness Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_light_lightness_cli_op[];
/** @def BLE_MESH_MODEL_LIGHT_LIGHTNESS_CLI
*
* Define a new light lightness client model. Note that this API
* needs to be repeated for each element which the application
* wants to have a light lightness client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_light_lightness_cli.
*
* @return New light lightness client model instance.
*/
#define BLE_MESH_MODEL_LIGHT_LIGHTNESS_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI, \
bt_mesh_light_lightness_cli_op, cli_pub, cli_data, &bt_mesh_lighting_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_light_lightness_client_t;
struct bt_mesh_light_lightness_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t present_lightness; /* Present value of light lightness actual state */
uint16_t target_lightness; /* Target value of light lightness actual state (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_light_lightness_linear_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t present_lightness; /* Present value of light lightness linear state */
uint16_t target_lightness; /* Target value of light lightness linear state (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_light_lightness_last_status {
uint16_t lightness; /* The value of the Light Lightness Last state */
};
struct bt_mesh_light_lightness_default_status {
uint16_t lightness; /* The value of the Light Lightness default state */
};
struct bt_mesh_light_lightness_range_status {
uint8_t status_code; /* Status Code for the requesting message */
uint16_t range_min; /* Value of range min field of light lightness range state */
uint16_t range_max; /* Value of range max field of light lightness range state */
};
struct bt_mesh_light_lightness_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t lightness; /* Target value of light lightness actual state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_lightness_linear_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t lightness; /* Target value of light lightness linear state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_lightness_default_set {
uint16_t lightness; /* The value of the Light Lightness Default state */
};
struct bt_mesh_light_lightness_range_set {
uint16_t range_min; /* Value of range min field of light lightness range state */
uint16_t range_max; /* Value of range max field of light lightness range state */
};
/* Light CTL Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_light_ctl_cli_op[];
/** @def BLE_MESH_MODEL_LIGHT_CTL_CLI
*
* Define a new light CTL client model. Note that this API needs
* to be repeated for each element which the application wants to
* have a light CTL client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_light_ctl_cli.
*
* @return New light CTL client model instance.
*/
#define BLE_MESH_MODEL_LIGHT_CTL_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_LIGHT_CTL_CLI, \
bt_mesh_light_ctl_cli_op, cli_pub, cli_data, &bt_mesh_lighting_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_light_ctl_client_t;
struct bt_mesh_light_ctl_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t present_ctl_lightness; /* Present value of light ctl lightness state */
uint16_t present_ctl_temperature; /* Present value of light ctl temperature state */
uint16_t target_ctl_lightness; /* Target value of light ctl lightness state (optional) */
uint16_t target_ctl_temperature; /* Target value of light ctl temperature state (C.1) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_light_ctl_temperature_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t present_ctl_temperature; /* Present value of light ctl temperature state */
uint16_t present_ctl_delta_uv; /* Present value of light ctl delta UV state */
uint16_t target_ctl_temperature; /* Target value of light ctl temperature state (optional) */
uint16_t target_ctl_delta_uv; /* Target value of light ctl delta UV state (C.1) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_light_ctl_temperature_range_status {
uint8_t status_code; /* Status code for the requesting message */
uint16_t range_min; /* Value of temperature range min field of light ctl temperature range state */
uint16_t range_max; /* Value of temperature range max field of light ctl temperature range state */
};
struct bt_mesh_light_ctl_default_status {
uint16_t lightness; /* Value of light lightness default state */
uint16_t temperature; /* Value of light temperature default state */
int16_t delta_uv; /* Value of light delta UV default state */
};
struct bt_mesh_light_ctl_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t ctl_lightness; /* Target value of light ctl lightness state */
uint16_t ctl_temperature; /* Target value of light ctl temperature state */
int16_t ctl_delta_uv; /* Target value of light ctl delta UV state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_ctl_temperature_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t ctl_temperature; /* Target value of light ctl temperature state */
int16_t ctl_delta_uv; /* Target value of light ctl delta UV state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_ctl_temperature_range_set {
uint16_t range_min; /* Value of temperature range min field of light ctl temperature range state */
uint16_t range_max; /* Value of temperature range max field of light ctl temperature range state */
};
struct bt_mesh_light_ctl_default_set {
uint16_t lightness; /* Value of light lightness default state */
uint16_t temperature; /* Value of light temperature default state */
int16_t delta_uv; /* Value of light delta UV default state */
};
/* Light HSL Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_light_hsl_cli_op[];
/** @def BLE_MESH_MODEL_LIGHT_HSL_CLI
*
* Define a new light HSL client model. Note that this API needs
* to be repeated for each element which the application wants to
* have a light HSL client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_light_hsl_cli.
*
* @return New light HSL client model instance.
*/
#define BLE_MESH_MODEL_LIGHT_HSL_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_LIGHT_HSL_CLI, \
bt_mesh_light_hsl_cli_op, cli_pub, cli_data, &bt_mesh_lighting_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_light_hsl_client_t;
struct bt_mesh_light_hsl_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t hsl_lightness; /* Present value of light hsl lightness state */
uint16_t hsl_hue; /* Present value of light hsl hue state */
uint16_t hsl_saturation; /* Present value of light hsl saturation state */
uint8_t remain_time; /* Time to complete state transition (optional) */
};
struct bt_mesh_light_hsl_target_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t hsl_lightness_target; /* Target value of light hsl lightness state */
uint16_t hsl_hue_target; /* Target value of light hsl hue state */
uint16_t hsl_saturation_target; /* Target value of light hsl saturation state */
uint8_t remain_time; /* Time to complete state transition (optional) */
};
struct bt_mesh_light_hsl_hue_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t present_hue; /* Present value of light hsl hue state */
uint16_t target_hue; /* Target value of light hsl hue state (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_light_hsl_saturation_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t present_saturation; /* Present value of light hsl saturation state */
uint16_t target_saturation; /* Target value of light hsl saturation state (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_light_hsl_default_status {
uint16_t lightness; /* Value of light lightness default state */
uint16_t hue; /* Value of light hue default state */
uint16_t saturation; /* Value of light saturation default state */
};
struct bt_mesh_light_hsl_range_status {
uint8_t status_code; /* Status code for the requesting message */
uint16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */
uint16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */
uint16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */
uint16_t saturation_range_max; /* Value of saturation range max field of light hsl saturation range state */
};
struct bt_mesh_light_hsl_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t hsl_lightness; /* Target value of light hsl lightness state */
uint16_t hsl_hue; /* Target value of light hsl hue state */
uint16_t hsl_saturation; /* Target value of light hsl saturation state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_hsl_hue_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t hue; /* Target value of light hsl hue state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_hsl_saturation_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t saturation; /* Target value of light hsl hue state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_hsl_default_set {
uint16_t lightness; /* Value of light lightness default state */
uint16_t hue; /* Value of light hue default state */
uint16_t saturation; /* Value of light saturation default state */
};
struct bt_mesh_light_hsl_range_set {
uint16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */
uint16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */
uint16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */
uint16_t saturation_range_max; /* Value of saturation range max field of light hsl saturation range state */
};
/* Light xyL Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_light_xyl_cli_op[];
/** @def BLE_MESH_MODEL_LIGHT_XYL_CLI
*
* Define a new light xyL client model. Note that this API needs
* to be repeated for each element which the application wants
* to have a light xyL client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_light_xyl_cli.
*
* @return New light xyL client model instance.
*/
#define BLE_MESH_MODEL_LIGHT_XYL_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_LIGHT_XYL_CLI, \
bt_mesh_light_xyl_cli_op, cli_pub, cli_data, &bt_mesh_lighting_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_light_xyl_client_t;
struct bt_mesh_light_xyl_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t xyl_lightness; /* The present value of the Light xyL Lightness state */
uint16_t xyl_x; /* The present value of the Light xyL x state */
uint16_t xyl_y; /* The present value of the Light xyL y state */
uint8_t remain_time; /* Time to complete state transition (optional) */
};
struct bt_mesh_light_xyl_target_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t target_xyl_lightness; /* The target value of the Light xyL Lightness state */
uint16_t target_xyl_x; /* The target value of the Light xyL x state */
uint16_t target_xyl_y; /* The target value of the Light xyL y state */
uint8_t remain_time; /* Time to complete state transition (optional) */
};
struct bt_mesh_light_xyl_default_status {
uint16_t lightness; /* The value of the Light Lightness Default state */
uint16_t xyl_x; /* The value of the Light xyL x Default state */
uint16_t xyl_y; /* The value of the Light xyL y Default state */
};
struct bt_mesh_light_xyl_range_status {
uint8_t status_code; /* Status Code for the requesting message */
uint16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */
uint16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */
uint16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */
uint16_t xyl_y_range_max; /* The value of the xyL y Range Max field of the Light xyL y Range state */
};
struct bt_mesh_light_xyl_set {
bool op_en; /* Indicate whether optional parameters included */
uint16_t xyl_lightness; /* The target value of the Light xyL Lightness state */
uint16_t xyl_x; /* The target value of the Light xyL x state */
uint16_t xyl_y; /* The target value of the Light xyL y state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_xyl_default_set {
uint16_t lightness; /* The value of the Light Lightness Default state */
uint16_t xyl_x; /* The value of the Light xyL x Default state */
uint16_t xyl_y; /* The value of the Light xyL y Default state */
};
struct bt_mesh_light_xyl_range_set {
uint16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */
uint16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */
uint16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */
uint16_t xyl_y_range_max; /* The value of the xyL y Range Max field of the Light xyL y Range state */
};
/* Light LC Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_light_lc_cli_op[];
/** @def BLE_MESH_MODEL_LIGHT_LC_CLI
*
* Define a new light lc client model. Note that this API needs
* to be repeated for each element which the application wants
* to have a light lc client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_light_lc_cli.
*
* @return New light lc client model instance.
*/
#define BLE_MESH_MODEL_LIGHT_LC_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_LIGHT_LC_CLI, \
bt_mesh_light_lc_cli_op, cli_pub, cli_data, &bt_mesh_lighting_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_light_lc_client_t;
struct bt_mesh_light_lc_mode_status {
uint8_t mode; /* The present value of the Light LC Mode state */
};
struct bt_mesh_light_lc_om_status {
uint8_t mode; /* The present value of the Light LC Occupancy Mode state */
};
struct bt_mesh_light_lc_light_onoff_status {
bool op_en; /* Indicate whether optional parameters included */
uint8_t present_light_onoff; /* The present value of the Light LC Light OnOff state */
uint8_t target_light_onoff; /* The target value of the Light LC Light OnOff state (Optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_light_lc_property_status {
uint16_t light_lc_property_id; /* Property ID identifying a Light LC Property */
struct net_buf_simple *light_lc_property_value; /* Raw value for the Light LC Property */
};
struct bt_mesh_light_lc_mode_set {
uint8_t mode; /* The target value of the Light LC Mode state */
};
struct bt_mesh_light_lc_om_set {
uint8_t mode; /* The target value of the Light LC Occupancy Mode state */
};
struct bt_mesh_light_lc_light_onoff_set {
bool op_en; /* Indicate whether optional parameters included */
uint8_t light_onoff; /* The target value of the Light LC Light OnOff state */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_light_lc_property_get {
uint16_t light_lc_property_id; /* Property ID identifying a Light LC Property */
};
struct bt_mesh_light_lc_property_set {
uint16_t light_lc_property_id; /* Property ID identifying a Light LC Property */
struct net_buf_simple *light_lc_property_value; /* Raw value for the Light LC Property */
};
/**
* @brief This function is called to get light states.
*
* @param[in] common: Message common information structure
* @param[in] get: Pointer of light get message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_light_client_get_state(bt_mesh_client_common_param_t *common, void *get);
/**
* @brief This function is called to set light states.
*
* @param[in] common: Message common information structure
* @param[in] set: Pointer of light set message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_light_client_set_state(bt_mesh_client_common_param_t *common, void *set);
#ifdef __cplusplus
}
#endif
#endif /* _LIGHTING_CLIENT_H_ */

View File

@@ -0,0 +1,155 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/** @file
* @brief Bluetooth Mesh Sensor Client Model APIs.
*/
#ifndef _SENSOR_CLIENT_H_
#define _SENSOR_CLIENT_H_
#include "mesh/client_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Sensor Client Model Callback */
extern const struct bt_mesh_model_cb bt_mesh_sensor_client_cb;
/* Sensor Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_sensor_cli_op[];
/** @def BLE_MESH_MODEL_SENSOR_CLI
*
* Define a new sensor client model. Note that this API needs to
* be repeated for each element which the application wants to
* have a sensor client model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_sensor_cli.
*
* @return New sensor client model instance.
*/
#define BLE_MESH_MODEL_SENSOR_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_SENSOR_CLI, \
bt_mesh_sensor_cli_op, cli_pub, cli_data, &bt_mesh_sensor_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_sensor_client_t;
typedef bt_mesh_client_internal_data_t sensor_internal_data_t;
struct bt_mesh_sensor_descriptor_status {
struct net_buf_simple *descriptor; /* Sequence of 8-octet sensor descriptors (optional) */
};
struct bt_mesh_sensor_cadence_status {
uint16_t property_id; /* Property for the sensor */
struct net_buf_simple *sensor_cadence_value; /* Value of sensor cadence state */
};
struct bt_mesh_sensor_settings_status {
uint16_t sensor_property_id; /* Property ID identifying a sensor */
struct net_buf_simple *sensor_setting_property_ids; /* A sequence of N sensor setting property IDs (optional) */
};
struct bt_mesh_sensor_setting_status {
bool op_en; /* Indicate whether optional parameters included */
uint16_t sensor_property_id; /* Property ID identifying a sensor */
uint16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
uint8_t sensor_setting_access; /* Read/Write access rights for the setting (optional) */
struct net_buf_simple *sensor_setting_raw; /* Raw value for the setting */
};
struct bt_mesh_sensor_status {
struct net_buf_simple *marshalled_sensor_data; /* Value of sensor data state (optional) */
};
struct bt_mesh_sensor_column_status {
uint16_t property_id; /* Property identifying a sensor and the Y axis */
struct net_buf_simple *sensor_column_value; /* Left values of sensor column status */
};
struct bt_mesh_sensor_series_status {
uint16_t property_id; /* Property identifying a sensor and the Y axis */
struct net_buf_simple *sensor_series_value; /* Left values of sensor series status */
};
struct bt_mesh_sensor_descriptor_get {
bool op_en; /* Indicate whether optional parameters included */
uint16_t property_id; /* Property ID for the sensor (optional) */
};
struct bt_mesh_sensor_cadence_get {
uint16_t property_id; /* Property ID for the sensor */
};
struct bt_mesh_sensor_cadence_set {
uint16_t property_id; /* Property ID for the sensor */
uint8_t fast_cadence_period_divisor : 7, /* Divisor for the publish period */
status_trigger_type : 1; /* The unit and format of the Status Trigger Delta fields */
struct net_buf_simple *status_trigger_delta_down; /* Delta down value that triggers a status message */
struct net_buf_simple *status_trigger_delta_up; /* Delta up value that triggers a status message */
uint8_t status_min_interval; /* Minimum interval between two consecutive Status messages */
struct net_buf_simple *fast_cadence_low; /* Low value for the fast cadence range */
struct net_buf_simple *fast_cadence_high; /* Fast value for the fast cadence range */
};
struct bt_mesh_sensor_settings_get {
uint16_t sensor_property_id; /* Property ID for the sensor */
};
struct bt_mesh_sensor_setting_get {
uint16_t sensor_property_id; /* Property ID identifying a sensor */
uint16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
};
struct bt_mesh_sensor_setting_set {
uint16_t sensor_property_id; /* Property ID identifying a sensor */
uint16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
struct net_buf_simple *sensor_setting_raw; /* Raw value for the setting */
};
struct bt_mesh_sensor_get {
bool op_en; /* Indicate whether optional parameters included */
uint16_t property_id; /* Property ID for the sensor (optional) */
};
struct bt_mesh_sensor_column_get {
uint16_t property_id; /* Property identifying a sensor */
struct net_buf_simple *raw_value_x; /* Raw value identifying a column */
};
struct bt_mesh_sensor_series_get {
bool op_en; /* Indicate whether optional parameters included */
uint16_t property_id; /* Property identifying a sensor */
struct net_buf_simple *raw_value_x1; /* Raw value identifying a starting column (optional) */
struct net_buf_simple *raw_value_x2; /* Raw value identifying a ending column (C.1) */
};
/**
* @brief This function is called to get sensor states.
*
* @param[in] common: Message common information structure
* @param[in] get: Pointer of sensor get message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_sensor_client_get_state(bt_mesh_client_common_param_t *common, void *get);
/**
* @brief This function is called to set sensor states.
*
* @param[in] common: Message common information structure
* @param[in] set: Pointer of sensor set message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_sensor_client_set_state(bt_mesh_client_common_param_t *common, void *set);
#ifdef __cplusplus
}
#endif
#endif /* _SENSOR_CLIENT_H_ */

View File

@@ -0,0 +1,225 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/** @file
* @brief Bluetooth Mesh Time and Scene Client Model APIs.
*/
#ifndef _TIME_SCENE_CLIENT_H_
#define _TIME_SCENE_CLIENT_H_
#include "mesh/client_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Time scene client model common structure */
typedef bt_mesh_client_user_data_t bt_mesh_time_scene_client_t;
typedef bt_mesh_client_internal_data_t time_scene_internal_data_t;
/* Time Scene Client Model Callback */
extern const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb;
/* Time Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_time_cli_op[];
/** @def BLE_MESH_MODEL_TIME_CLI
*
* Define a new time client model. Note that this API needs to
* be repeated for each element which the application wants to
* have a time model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_time_cli.
*
* @return New time client model instance.
*/
#define BLE_MESH_MODEL_TIME_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_TIME_CLI, \
bt_mesh_time_cli_op, cli_pub, cli_data, &bt_mesh_time_scene_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_time_client_t;
struct bt_mesh_time_status {
uint8_t tai_seconds[5]; /* The current TAI time in seconds */
uint8_t sub_second; /* The sub-second time in units of 1/256 second */
uint8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */
uint16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */
uint16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */
uint8_t time_zone_offset; /* The local time zone offset in 15-minute increments */
};
struct bt_mesh_time_zone_status {
uint8_t time_zone_offset_curr; /* Current local time zone offset */
uint8_t time_zone_offset_new; /* Upcoming local time zone offset */
uint8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */
};
struct bt_mesh_tai_utc_delta_status {
uint16_t tai_utc_delta_curr : 15; /* Current difference between TAI and UTC in seconds */
uint16_t padding_1 : 1; /* Always 0b0. Other values are Prohibited. */
uint16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */
uint16_t padding_2 : 1; /* Always 0b0. Other values are Prohibited. */
uint8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */
};
struct bt_mesh_time_role_status {
uint8_t time_role; /* The Time Role for the element */
};
struct bt_mesh_time_set {
uint8_t tai_seconds[5]; /* The current TAI time in seconds */
uint8_t sub_second; /* The sub-second time in units of 1/256 second */
uint8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */
uint16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */
uint16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */
uint8_t time_zone_offset; /* The local time zone offset in 15-minute increments */
};
struct bt_mesh_time_zone_set {
uint8_t time_zone_offset_new; /* Upcoming local time zone offset */
uint8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */
};
struct bt_mesh_tai_utc_delta_set {
uint16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */
uint16_t padding : 1; /* Always 0b0. Other values are Prohibited. */
uint8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */
};
struct bt_mesh_time_role_set {
uint8_t time_role; /* The Time Role for the element */
};
/* Scene Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_scene_cli_op[];
/** @def BLE_MESH_MODEL_SCENE_CLI
*
* Define a new scene client model. Note that this API needs to
* be repeated for each element which the application wants to
* have a scene model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_scene_cli.
*
* @return New scene client model instance.
*/
#define BLE_MESH_MODEL_SCENE_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_SCENE_CLI, \
bt_mesh_scene_cli_op, cli_pub, cli_data, &bt_mesh_time_scene_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_scene_client_t;
struct bt_mesh_scene_status {
bool op_en; /* Indicate whether optional parameters included */
uint8_t status_code; /* Status code for the last operation */
uint16_t current_scene; /* Scene Number of a current scene */
uint16_t target_scene; /* Scene Number of a target scene (optional) */
uint8_t remain_time; /* Time to complete state transition (C.1) */
};
struct bt_mesh_scene_register_status {
uint8_t status_code; /* Status code for the previous operation */
uint16_t current_scene; /* Scene Number of a current scene */
struct net_buf_simple *scenes; /* A list of scenes stored within an element */
};
struct bt_mesh_scene_store {
uint16_t scene_number; /* The number of the scene to be stored */
};
struct bt_mesh_scene_recall {
bool op_en; /* Indicate whether optional parameters included */
uint16_t scene_number; /* The number of the scene to be recalled */
uint8_t tid; /* Transaction Identifier */
uint8_t trans_time; /* Time to complete state transition (optional) */
uint8_t delay; /* Indicate message execution delay (C.1) */
};
struct bt_mesh_scene_delete {
uint16_t scene_number; /* The number of the scene to be deleted */
};
/* Scheduler Client Model Context */
extern const struct bt_mesh_model_op bt_mesh_scheduler_cli_op[];
/** @def BLE_MESH_MODEL_SCHEDULER_CLI
*
* Define a new scheduler client model. Note that this API needs to
* be repeated for each element which the application wants to
* have a scheduler model on.
* @param cli_pub Pointer to a unique struct bt_mesh_model_pub.
* @param cli_data Pointer to a unique struct bt_mesh_scheduler_cli.
*
* @return New scheduler client model instance.
*/
#define BLE_MESH_MODEL_SCHEDULER_CLI(cli_pub, cli_data) \
BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_SCHEDULER_CLI, \
bt_mesh_scheduler_cli_op, cli_pub, cli_data, &bt_mesh_time_scene_client_cb)
typedef bt_mesh_client_user_data_t bt_mesh_scheduler_client_t;
struct bt_mesh_scheduler_status {
uint16_t schedules; /* Bit field indicating defined Actions in the Schedule Register */
};
struct bt_mesh_scheduler_act_status {
uint64_t index : 4; /* Enumerates (selects) a Schedule Register entry */
uint64_t year : 7; /* Scheduled year for the action */
uint64_t month : 12; /* Scheduled month for the action */
uint64_t day : 5; /* Scheduled day of the month for the action */
uint64_t hour : 5; /* Scheduled hour for the action */
uint64_t minute : 6; /* Scheduled minute for the action */
uint64_t second : 6; /* Scheduled second for the action */
uint64_t day_of_week : 7; /* Schedule days of the week for the action */
uint64_t action : 4; /* Action to be performed at the scheduled time */
uint64_t trans_time : 8; /* Transition time for this action */
uint16_t scene_number; /* Transition time for this action */
};
struct bt_mesh_scheduler_act_get {
uint8_t index; /* Index of the Schedule Register entry to get */
};
struct bt_mesh_scheduler_act_set {
uint64_t index : 4; /* Index of the Schedule Register entry to set */
uint64_t year : 7; /* Scheduled year for the action */
uint64_t month : 12; /* Scheduled month for the action */
uint64_t day : 5; /* Scheduled day of the month for the action */
uint64_t hour : 5; /* Scheduled hour for the action */
uint64_t minute : 6; /* Scheduled minute for the action */
uint64_t second : 6; /* Scheduled second for the action */
uint64_t day_of_week : 7; /* Schedule days of the week for the action */
uint64_t action : 4; /* Action to be performed at the scheduled time */
uint64_t trans_time : 8; /* Transition time for this action */
uint16_t scene_number; /* Transition time for this action */
};
/**
* @brief This function is called to get scene states.
*
* @param[in] common: Message common information structure
* @param[in] get: Pointer of time scene get message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_time_scene_client_get_state(bt_mesh_client_common_param_t *common, void *get);
/**
* @brief This function is called to set scene states.
*
* @param[in] common: Message common information structure
* @param[in] set: Pointer of time scene set message value
*
* @return Zero-success, other-fail
*/
int bt_mesh_time_scene_client_set_state(bt_mesh_client_common_param_t *common, void *set);
#ifdef __cplusplus
}
#endif
#endif /* _TIME_SCENE_CLIENT_H_ */