mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
ble_mesh: Add ESP BLE Mesh implementation
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _CLIENT_COMMON_H_
|
||||
#define _CLIENT_COMMON_H_
|
||||
|
||||
#include "mesh_access.h"
|
||||
|
||||
/** Client model opcode pair table */
|
||||
typedef struct {
|
||||
u32_t cli_op; /* Client message opcode */
|
||||
u32_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)(u32_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 */
|
||||
u8_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 */
|
||||
u32_t opcode; /* Message opcode */
|
||||
u32_t op_pending; /* Expected status message opcode */
|
||||
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 {
|
||||
u32_t opcode; /* Message opcode */
|
||||
struct bt_mesh_model *model; /* Pointer to the client model */
|
||||
struct bt_mesh_msg_ctx ctx; /* Message context */
|
||||
s32_t msg_timeout; /* Time to get corresponding response */
|
||||
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);
|
||||
|
||||
/**
|
||||
* @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(struct bt_mesh_model *model,
|
||||
u32_t opcode,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *msg,
|
||||
k_work_handler_t timer_handler,
|
||||
s32_t timeout, bool need_ack,
|
||||
const struct bt_mesh_send_cb *cb, void *cb_data);
|
||||
|
||||
int bt_mesh_client_free_node(bt_mesh_client_node_t *node);
|
||||
|
||||
typedef struct {
|
||||
struct bt_mesh_model *model; /* The client model structure */
|
||||
u8_t role; /* Role of the device - Node/Provisioner */
|
||||
} bt_mesh_role_param_t;
|
||||
|
||||
/**
|
||||
* @brief This function copies node_index for stack internal use.
|
||||
*
|
||||
* @param[in] common: Pointer to the bt_mesh_role_param_t structure
|
||||
*
|
||||
* @return Zero - success, otherwise - fail
|
||||
*/
|
||||
int bt_mesh_set_client_model_role(bt_mesh_role_param_t *common);
|
||||
|
||||
#endif /* _CLIENT_COMMON_H_ */
|
||||
|
@@ -0,0 +1,491 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/** @file
|
||||
* @brief Bluetooth Mesh Generic Client Model APIs.
|
||||
*/
|
||||
|
||||
#ifndef _GENERIC_CLIENT_H_
|
||||
#define _GENERIC_CLIENT_H_
|
||||
|
||||
#include "mesh_access.h"
|
||||
#include "mesh_kernel.h"
|
||||
|
||||
#include "client_common.h"
|
||||
|
||||
/* 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 OnOff Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_GEN_ONOFF_CLI, \
|
||||
gen_onoff_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u8_t present_onoff; /* Present value of Generic OnOff state */
|
||||
u8_t target_onoff; /* Target value of Generic OnOff state (optional) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_onoff_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u8_t onoff; /* Target value of Generic OnOff state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
/* Generic Level Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_GEN_LEVEL_CLI, \
|
||||
gen_level_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
s16_t present_level; /* Present value of Generic Level state */
|
||||
s16_t target_level; /* Target value of the Generic Level state (optional) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_level_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
s16_t level; /* Target value of Generic Level state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_delta_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
s32_t delta_level; /* Delta change of Generic Level state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_move_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
s16_t delta_level; /* Delta Level step to calculate Move speed for Generic Level state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
/* Generic Default Transition Time Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI, \
|
||||
gen_def_trans_time_cli_op, cli_pub, cli_data)
|
||||
|
||||
typedef bt_mesh_client_user_data_t bt_mesh_gen_def_trans_time_client_t;
|
||||
|
||||
struct bt_mesh_gen_def_trans_time_set {
|
||||
u8_t trans_time; /* The value of the Generic Default Transition Time state */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_def_trans_time_status {
|
||||
u8_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 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(BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI, \
|
||||
gen_power_onoff_cli_op, cli_pub, cli_data)
|
||||
|
||||
typedef bt_mesh_client_user_data_t bt_mesh_gen_power_onoff_client_t;
|
||||
|
||||
struct bt_mesh_gen_onpowerup_set {
|
||||
u8_t onpowerup; /* The value of the Generic OnPowerUp state */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_onpowerup_status {
|
||||
u8_t onpowerup; /* The value of the Generic OnPowerUp state */
|
||||
};
|
||||
|
||||
/* Generic Power Level Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI, \
|
||||
gen_power_level_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u16_t present_power; /* Present value of Generic Power Actual state */
|
||||
u16_t target_power; /* Target value of Generic Power Actual state (optional) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_last_status {
|
||||
u16_t power; /* The value of the Generic Power Last state */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_default_status {
|
||||
u16_t power; /* The value of the Generic Default Last state */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_range_status {
|
||||
u8_t status_code; /* Status Code for the requesting message */
|
||||
u16_t range_min; /* Value of Range Min field of Generic Power Range state */
|
||||
u16_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 */
|
||||
u16_t power; /* Target value of Generic Power Actual state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_default_set {
|
||||
u16_t power; /* The value of the Generic Power Default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_range_set {
|
||||
u16_t range_min; /* Value of Range Min field of Generic Power Range state */
|
||||
u16_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 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(BLE_MESH_MODEL_ID_GEN_BATTERY_CLI, \
|
||||
gen_battery_cli_op, cli_pub, cli_data)
|
||||
|
||||
typedef bt_mesh_client_user_data_t bt_mesh_gen_battery_client_t;
|
||||
|
||||
struct bt_mesh_gen_battery_status {
|
||||
u32_t battery_level : 8; /* Value of Generic Battery Level state */
|
||||
u32_t time_to_discharge : 24; /* Value of Generic Battery Time to Discharge state */
|
||||
u32_t time_to_charge : 24; /* Value of Generic Battery Time to Charge state */
|
||||
u32_t flags : 8; /* Value of Generic Battery Flags state */
|
||||
};
|
||||
|
||||
/* Generic Location Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_GEN_LOCATION_CLI, \
|
||||
gen_location_cli_op, cli_pub, cli_data)
|
||||
|
||||
typedef bt_mesh_client_user_data_t bt_mesh_gen_location_client_t;
|
||||
|
||||
struct bt_mesh_gen_loc_global_status {
|
||||
s32_t global_latitude; /* Global Coordinates (Latitude) */
|
||||
s32_t global_longitude; /* Global Coordinates (Longitude) */
|
||||
s16_t global_altitude; /* Global Altitude */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_loc_local_status {
|
||||
s16_t local_north; /* Local Coordinates (North) */
|
||||
s16_t local_east; /* Local Coordinates (East) */
|
||||
s16_t local_altitude; /* Local Altitude */
|
||||
u8_t floor_number; /* Floor Number */
|
||||
u16_t uncertainty; /* Uncertainty */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_loc_global_set {
|
||||
s32_t global_latitude; /* Global Coordinates (Latitude) */
|
||||
s32_t global_longitude; /* Global Coordinates (Longitude) */
|
||||
s16_t global_altitude; /* Global Altitude */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_loc_local_set {
|
||||
s16_t local_north; /* Local Coordinates (North) */
|
||||
s16_t local_east; /* Local Coordinates (East) */
|
||||
s16_t local_altitude; /* Local Altitude */
|
||||
u8_t floor_number; /* Floor Number */
|
||||
u16_t uncertainty; /* Uncertainty */
|
||||
};
|
||||
|
||||
/* Generic Property Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_GEN_PROP_CLI, \
|
||||
gen_property_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u16_t user_property_id; /* Property ID identifying a Generic User Property */
|
||||
u8_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 */
|
||||
u16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
|
||||
u8_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 */
|
||||
u16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
|
||||
u8_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 {
|
||||
u16_t user_property_id; /* Property ID identifying a Generic User Property */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_user_property_set {
|
||||
u16_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 {
|
||||
u16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_admin_property_set {
|
||||
u16_t admin_property_id; /* Property ID identifying a Generic Admin Property */
|
||||
u8_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 {
|
||||
u16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_manu_property_set {
|
||||
u16_t manu_property_id; /* Property ID identifying a Generic Manufacturer Property */
|
||||
u8_t manu_user_access; /* Enumeration indicating user access */
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_client_properties_get {
|
||||
u16_t client_property_id; /* A starting Client Property ID present within an element */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic onoff client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic onoff client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_onoff_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic level client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic level client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_level_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic default transition time
|
||||
* client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic default transition time client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_def_trans_time_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic power onoff client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic power onoff client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_pwr_onoff_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic power level client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic power level client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_pwr_level_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic battery client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic battery client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_battery_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic location client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic location client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_location_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize generic property client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to generic property client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_gen_property_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of generic status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_generic_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of generic status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_generic_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
|
||||
|
||||
#endif /* _GENERIC_CLIENT_H_ */
|
@@ -0,0 +1,492 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/** @file
|
||||
* @brief Bluetooth Mesh Lighting Client Model APIs.
|
||||
*/
|
||||
|
||||
#ifndef _LIGHTING_CLIENT_H_
|
||||
#define _LIGHTING_CLIENT_H_
|
||||
|
||||
#include "mesh_access.h"
|
||||
#include "mesh_kernel.h"
|
||||
|
||||
#include "client_common.h"
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Light Lightness Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI, \
|
||||
light_lightness_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u16_t present_lightness; /* Present value of light lightness actual state */
|
||||
u16_t target_lightness; /* Target value of light lightness actual state (optional) */
|
||||
u8_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 */
|
||||
u16_t present_lightness; /* Present value of light lightness linear state */
|
||||
u16_t target_lightness; /* Target value of light lightness linear state (optional) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_last_status {
|
||||
u16_t lightness; /* The value of the Light Lightness Last state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_default_status {
|
||||
u16_t lightness; /* The value of the Light Lightness default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_range_status {
|
||||
u8_t status_code; /* Status Code for the requesting message */
|
||||
u16_t range_min; /* Value of range min field of light lightness range state */
|
||||
u16_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 */
|
||||
u16_t lightness; /* Target value of light lightness actual state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_linear_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t lightness; /* Target value of light lightness linear state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_default_set {
|
||||
u16_t lightness; /* The value of the Light Lightness Default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_range_set {
|
||||
u16_t range_min; /* Value of range min field of light lightness range state */
|
||||
u16_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 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(BLE_MESH_MODEL_ID_LIGHT_CTL_CLI, \
|
||||
light_ctl_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u16_t present_ctl_lightness; /* Present value of light ctl lightness state */
|
||||
u16_t present_ctl_temperature; /* Present value of light ctl temperature state */
|
||||
u16_t target_ctl_lightness; /* Target value of light ctl lightness state (optional) */
|
||||
u16_t target_ctl_temperature; /* Target value of light ctl temperature state (C.1) */
|
||||
u8_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 */
|
||||
u16_t present_ctl_temperature; /* Present value of light ctl temperature state */
|
||||
u16_t present_ctl_delta_uv; /* Present value of light ctl delta UV state */
|
||||
u16_t target_ctl_temperature; /* Target value of light ctl temperature state (optional) */
|
||||
u16_t target_ctl_delta_uv; /* Target value of light ctl delta UV state (C.1) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_temperature_range_status {
|
||||
u8_t status_code; /* Status code for the requesting message */
|
||||
u16_t range_min; /* Value of temperature range min field of light ctl temperature range state */
|
||||
u16_t range_max; /* Value of temperature range max field of light ctl temperature range state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_default_status {
|
||||
u16_t lightness; /* Value of light lightness default state */
|
||||
u16_t temperature; /* Value of light temperature default state */
|
||||
s16_t delta_uv; /* Value of light delta UV default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t ctl_lightness; /* Target value of light ctl lightness state */
|
||||
u16_t ctl_temperature; /* Target value of light ctl temperature state */
|
||||
s16_t ctl_delta_uv; /* Target value of light ctl delta UV state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_temperature_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t ctl_temperature; /* Target value of light ctl temperature state */
|
||||
s16_t ctl_delta_uv; /* Target value of light ctl delta UV state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_temperature_range_set {
|
||||
u16_t range_min; /* Value of temperature range min field of light ctl temperature range state */
|
||||
u16_t range_max; /* Value of temperature range max field of light ctl temperature range state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_default_set {
|
||||
u16_t lightness; /* Value of light lightness default state */
|
||||
u16_t temperature; /* Value of light temperature default state */
|
||||
s16_t delta_uv; /* Value of light delta UV default state */
|
||||
};
|
||||
|
||||
/* Light HSL Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_LIGHT_HSL_CLI, \
|
||||
light_hsl_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u16_t hsl_lightness; /* Present value of light hsl lightness state */
|
||||
u16_t hsl_hue; /* Present value of light hsl hue state */
|
||||
u16_t hsl_saturation; /* Present value of light hsl saturation state */
|
||||
u8_t remain_time; /* Time to complete state transition (optional) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_target_status {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t hsl_lightness_target; /* Target value of light hsl lightness state */
|
||||
u16_t hsl_hue_target; /* Target value of light hsl hue state */
|
||||
u16_t hsl_saturation_target; /* Target value of light hsl saturation state */
|
||||
u8_t remain_time; /* Time to complete state transition (optional) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_hue_status {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t present_hue; /* Present value of light hsl hue state */
|
||||
u16_t target_hue; /* Target value of light hsl hue state (optional) */
|
||||
u8_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 */
|
||||
u16_t present_saturation; /* Present value of light hsl saturation state */
|
||||
u16_t target_saturation; /* Target value of light hsl saturation state (optional) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_default_status {
|
||||
u16_t lightness; /* Value of light lightness default state */
|
||||
u16_t hue; /* Value of light hue default state */
|
||||
u16_t saturation; /* Value of light saturation default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_range_status {
|
||||
u8_t status_code; /* Status code for the requesting message */
|
||||
u16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */
|
||||
u16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */
|
||||
u16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */
|
||||
u16_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 */
|
||||
u16_t hsl_lightness; /* Target value of light hsl lightness state */
|
||||
u16_t hsl_hue; /* Target value of light hsl hue state */
|
||||
u16_t hsl_saturation; /* Target value of light hsl saturation state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_hue_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t hue; /* Target value of light hsl hue state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_saturation_set {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t saturation; /* Target value of light hsl hue state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_default_set {
|
||||
u16_t lightness; /* Value of light lightness default state */
|
||||
u16_t hue; /* Value of light hue default state */
|
||||
u16_t saturation; /* Value of light saturation default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_range_set {
|
||||
u16_t hue_range_min; /* Value of hue range min field of light hsl hue range state */
|
||||
u16_t hue_range_max; /* Value of hue range max field of light hsl hue range state */
|
||||
u16_t saturation_range_min; /* Value of saturation range min field of light hsl saturation range state */
|
||||
u16_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 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(BLE_MESH_MODEL_ID_LIGHT_XYL_CLI, \
|
||||
light_xyl_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u16_t xyl_lightness; /* The present value of the Light xyL Lightness state */
|
||||
u16_t xyl_x; /* The present value of the Light xyL x state */
|
||||
u16_t xyl_y; /* The present value of the Light xyL y state */
|
||||
u8_t remain_time; /* Time to complete state transition (optional) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_target_status {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t target_xyl_lightness; /* The target value of the Light xyL Lightness state */
|
||||
u16_t target_xyl_x; /* The target value of the Light xyL x state */
|
||||
u16_t target_xyl_y; /* The target value of the Light xyL y state */
|
||||
u8_t remain_time; /* Time to complete state transition (optional) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_default_status {
|
||||
u16_t lightness; /* The value of the Light Lightness Default state */
|
||||
u16_t xyl_x; /* The value of the Light xyL x Default state */
|
||||
u16_t xyl_y; /* The value of the Light xyL y Default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_range_status {
|
||||
u8_t status_code; /* Status Code for the requesting message */
|
||||
u16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */
|
||||
u16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */
|
||||
u16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */
|
||||
u16_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 */
|
||||
u16_t xyl_lightness; /* The target value of the Light xyL Lightness state */
|
||||
u16_t xyl_x; /* The target value of the Light xyL x state */
|
||||
u16_t xyl_y; /* The target value of the Light xyL y state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_default_set {
|
||||
u16_t lightness; /* The value of the Light Lightness Default state */
|
||||
u16_t xyl_x; /* The value of the Light xyL x Default state */
|
||||
u16_t xyl_y; /* The value of the Light xyL y Default state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_range_set {
|
||||
u16_t xyl_x_range_min; /* The value of the xyL x Range Min field of the Light xyL x Range state */
|
||||
u16_t xyl_x_range_max; /* The value of the xyL x Range Max field of the Light xyL x Range state */
|
||||
u16_t xyl_y_range_min; /* The value of the xyL y Range Min field of the Light xyL y Range state */
|
||||
u16_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 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(BLE_MESH_MODEL_ID_LIGHT_LC_CLI, \
|
||||
light_lc_cli_op, cli_pub, cli_data)
|
||||
|
||||
typedef bt_mesh_client_user_data_t bt_mesh_light_lc_client_t;
|
||||
|
||||
struct bt_mesh_light_lc_mode_status {
|
||||
u8_t mode; /* The present value of the Light LC Mode state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_om_status {
|
||||
u8_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 */
|
||||
u8_t present_light_onoff; /* The present value of the Light LC Light OnOff state */
|
||||
u8_t target_light_onoff; /* The target value of the Light LC Light OnOff state (Optional) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_property_status {
|
||||
u16_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 {
|
||||
u8_t mode; /* The target value of the Light LC Mode state */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_om_set {
|
||||
u8_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 */
|
||||
u8_t light_onoff; /* The target value of the Light LC Light OnOff state */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_property_get {
|
||||
u16_t light_lc_property_id; /* Property ID identifying a Light LC Property */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_property_set {
|
||||
u16_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 initialize light lightness client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to light lightness client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_light_lightness_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize light ctl client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to light ctl client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_light_ctl_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize light hsl client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to light hsl client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_light_hsl_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize light xyl client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to light xyl client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_light_xyl_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize light lc client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to light lc client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_light_lc_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of light status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_light_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of light status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_light_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
|
||||
|
||||
#endif /* _LIGHTING_CLIENT_H_ */
|
@@ -0,0 +1,167 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/** @file
|
||||
* @brief Bluetooth Mesh Sensor Client Model APIs.
|
||||
*/
|
||||
|
||||
#ifndef _SENSOR_CLIENT_H_
|
||||
#define _SENSOR_CLIENT_H_
|
||||
|
||||
#include "mesh_access.h"
|
||||
#include "mesh_kernel.h"
|
||||
|
||||
#include "client_common.h"
|
||||
|
||||
/* Sensor Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_SENSOR_CLI, \
|
||||
sensor_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 {
|
||||
u16_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 {
|
||||
u16_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 */
|
||||
u16_t sensor_property_id; /* Property ID identifying a sensor */
|
||||
u16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
|
||||
u8_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 {
|
||||
u16_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 {
|
||||
u16_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 */
|
||||
u16_t property_id; /* Property ID for the sensor (optional) */
|
||||
};
|
||||
|
||||
struct bt_mesh_sensor_cadence_get {
|
||||
u16_t property_id; /* Property ID for the sensor */
|
||||
};
|
||||
|
||||
struct bt_mesh_sensor_cadence_set {
|
||||
u16_t property_id; /* Property ID for the sensor */
|
||||
u8_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 */
|
||||
u8_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 {
|
||||
u16_t sensor_property_id; /* Property ID for the sensor */
|
||||
};
|
||||
|
||||
struct bt_mesh_sensor_setting_get {
|
||||
u16_t sensor_property_id; /* Property ID identifying a sensor */
|
||||
u16_t sensor_setting_property_id; /* Setting ID identifying a setting within a sensor */
|
||||
};
|
||||
|
||||
struct bt_mesh_sensor_setting_set {
|
||||
u16_t sensor_property_id; /* Property ID identifying a sensor */
|
||||
u16_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 */
|
||||
u16_t property_id; /* Property ID for the sensor (optional) */
|
||||
};
|
||||
|
||||
struct bt_mesh_sensor_column_get {
|
||||
u16_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 */
|
||||
u16_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 initialize sensor client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to sensor client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_sensor_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of sensor status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_sensor_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of sensor status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_sensor_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
|
||||
|
||||
#endif /* _SENSOR_CLIENT_H_ */
|
@@ -0,0 +1,257 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/** @file
|
||||
* @brief Bluetooth Mesh Time and Scene Client Model APIs.
|
||||
*/
|
||||
|
||||
#ifndef _TIME_SCENE_CLIENT_H_
|
||||
#define _TIME_SCENE_CLIENT_H_
|
||||
|
||||
#include "mesh_access.h"
|
||||
#include "mesh_kernel.h"
|
||||
|
||||
#include "client_common.h"
|
||||
|
||||
/* 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 Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_TIME_CLI, \
|
||||
time_cli_op, cli_pub, cli_data)
|
||||
|
||||
typedef bt_mesh_client_user_data_t bt_mesh_time_client_t;
|
||||
|
||||
struct bt_mesh_time_status {
|
||||
u8_t tai_seconds[5]; /* The current TAI time in seconds */
|
||||
u8_t sub_second; /* The sub-second time in units of 1/256 second */
|
||||
u8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */
|
||||
u16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */
|
||||
u16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */
|
||||
u8_t time_zone_offset; /* The local time zone offset in 15-minute increments */
|
||||
};
|
||||
|
||||
struct bt_mesh_time_zone_status {
|
||||
u8_t time_zone_offset_curr; /* Current local time zone offset */
|
||||
u8_t time_zone_offset_new; /* Upcoming local time zone offset */
|
||||
u8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */
|
||||
};
|
||||
|
||||
struct bt_mesh_tai_utc_delta_status {
|
||||
u16_t tai_utc_delta_curr : 15; /* Current difference between TAI and UTC in seconds */
|
||||
u16_t padding_1 : 1; /* Always 0b0. Other values are Prohibited. */
|
||||
u16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */
|
||||
u16_t padding_2 : 1; /* Always 0b0. Other values are Prohibited. */
|
||||
u8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */
|
||||
};
|
||||
|
||||
struct bt_mesh_time_role_status {
|
||||
u8_t time_role; /* The Time Role for the element */
|
||||
};
|
||||
|
||||
struct bt_mesh_time_set {
|
||||
u8_t tai_seconds[5]; /* The current TAI time in seconds */
|
||||
u8_t sub_second; /* The sub-second time in units of 1/256 second */
|
||||
u8_t uncertainty; /* The estimated uncertainty in 10-millisecond steps */
|
||||
u16_t time_authority : 1; /* 0 = No Time Authority, 1 = Time Authority */
|
||||
u16_t tai_utc_delta : 15; /* Current difference between TAI and UTC in seconds */
|
||||
u8_t time_zone_offset; /* The local time zone offset in 15-minute increments */
|
||||
};
|
||||
|
||||
struct bt_mesh_time_zone_set {
|
||||
u8_t time_zone_offset_new; /* Upcoming local time zone offset */
|
||||
u8_t tai_zone_change[5]; /* TAI Seconds time of the upcoming Time Zone Offset change */
|
||||
};
|
||||
|
||||
struct bt_mesh_tai_utc_delta_set {
|
||||
u16_t tai_utc_delta_new : 15; /* Upcoming difference between TAI and UTC in seconds */
|
||||
u16_t padding : 1; /* Always 0b0. Other values are Prohibited. */
|
||||
u8_t tai_delta_change[5]; /* TAI Seconds time of the upcoming TAI-UTC Delta change */
|
||||
};
|
||||
|
||||
struct bt_mesh_time_role_set {
|
||||
u8_t time_role; /* The Time Role for the element */
|
||||
};
|
||||
|
||||
/* Scene Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_SCENE_CLI, \
|
||||
scene_cli_op, cli_pub, cli_data)
|
||||
|
||||
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 */
|
||||
u8_t status_code; /* Status code for the last operation */
|
||||
u16_t current_scene; /* Scene Number of a current scene */
|
||||
u16_t target_scene; /* Scene Number of a target scene (optional) */
|
||||
u8_t remain_time; /* Time to complete state transition (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_scene_register_status {
|
||||
u8_t status_code; /* Status code for the previous operation */
|
||||
u16_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 {
|
||||
u16_t scene_number; /* The number of the scene to be stored */
|
||||
};
|
||||
|
||||
struct bt_mesh_scene_recall {
|
||||
bool op_en; /* Indicate whether optional parameters included */
|
||||
u16_t scene_number; /* The number of the scene to be recalled */
|
||||
u8_t tid; /* Transaction Identifier */
|
||||
u8_t trans_time; /* Time to complete state transition (optional) */
|
||||
u8_t delay; /* Indicate message execution delay (C.1) */
|
||||
};
|
||||
|
||||
struct bt_mesh_scene_delete {
|
||||
u16_t scene_number; /* The number of the scene to be deleted */
|
||||
};
|
||||
|
||||
/* Scheduler Client Model Context */
|
||||
extern const struct bt_mesh_model_op 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(BLE_MESH_MODEL_ID_SCHEDULER_CLI, \
|
||||
scheduler_cli_op, cli_pub, cli_data)
|
||||
|
||||
typedef bt_mesh_client_user_data_t bt_mesh_scheduler_client_t;
|
||||
|
||||
struct bt_mesh_scheduler_status {
|
||||
u16_t schedules; /* Bit field indicating defined Actions in the Schedule Register */
|
||||
};
|
||||
|
||||
struct bt_mesh_scheduler_act_status {
|
||||
u64_t index : 4; /* Enumerates (selects) a Schedule Register entry */
|
||||
u64_t year : 7; /* Scheduled year for the action */
|
||||
u64_t month : 12; /* Scheduled month for the action */
|
||||
u64_t day : 5; /* Scheduled day of the month for the action */
|
||||
u64_t hour : 5; /* Scheduled hour for the action */
|
||||
u64_t minute : 6; /* Scheduled minute for the action */
|
||||
u64_t second : 6; /* Scheduled second for the action */
|
||||
u64_t day_of_week : 7; /* Schedule days of the week for the action */
|
||||
u64_t action : 4; /* Action to be performed at the scheduled time */
|
||||
u64_t trans_time : 8; /* Transition time for this action */
|
||||
u16_t scene_number; /* Transition time for this action */
|
||||
};
|
||||
|
||||
struct bt_mesh_scheduler_act_get {
|
||||
u8_t index; /* Index of the Schedule Register entry to get */
|
||||
};
|
||||
|
||||
struct bt_mesh_scheduler_act_set {
|
||||
u64_t index : 4; /* Index of the Schedule Register entry to set */
|
||||
u64_t year : 7; /* Scheduled year for the action */
|
||||
u64_t month : 12; /* Scheduled month for the action */
|
||||
u64_t day : 5; /* Scheduled day of the month for the action */
|
||||
u64_t hour : 5; /* Scheduled hour for the action */
|
||||
u64_t minute : 6; /* Scheduled minute for the action */
|
||||
u64_t second : 6; /* Scheduled second for the action */
|
||||
u64_t day_of_week : 7; /* Schedule days of the week for the action */
|
||||
u64_t action : 4; /* Action to be performed at the scheduled time */
|
||||
u64_t trans_time : 8; /* Transition time for this action */
|
||||
u16_t scene_number; /* Transition time for this action */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize time client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to time client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_time_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize scene client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to scene client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_scene_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @brief This function is called to initialize scheduler client model user_data.
|
||||
*
|
||||
* @param[in] model: Pointer to scheduler client model
|
||||
* @param[in] primary: Whether belongs to primary element
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_scheduler_cli_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of time scene status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_time_scene_client_get_state(bt_mesh_client_common_param_t *common, void *get, void *status);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param[out] status: Pointer of time scene status message value
|
||||
*
|
||||
* @return Zero-success, other-fail
|
||||
*/
|
||||
int bt_mesh_time_scene_client_set_state(bt_mesh_client_common_param_t *common, void *set, void *status);
|
||||
|
||||
#endif /* _TIME_SCENE_CLIENT_H_ */
|
Reference in New Issue
Block a user